Roman Khimov
286d9185f4
smartcontract: remove contract features
...
We're featureless now, all contracts have access to storage and payable status
is to be determined via new NEP. Follow neo-project/neo#2060 .
2020-11-13 21:26:23 +03:00
Roman Khimov
112fa5b92d
smartcontract: drop unused ContractDetails
...
That's a remnant from 2.0.
2020-11-13 21:00:54 +03:00
Evgenii Stratonikov
adf403666f
native: decode storage item in Seek
2020-11-13 17:33:00 +03:00
Anna Shaleva
31cf71fb62
rpc: use default Uint160 marshaller for result.NEP5Balance.Asset
...
To match C# behaviour we should marshal asset hash with `0x` prefix.
2020-11-13 12:28:31 +03:00
Roman Khimov
0f827ee6ba
Merge pull request #1531 from nspcc-dev/core/applicationlog_with_multiple_triggers
...
core, rpc: store multiple execution results for single hash
2020-11-12 19:05:22 +03:00
Roman Khimov
543871fb2c
Merge pull request #1541 from nspcc-dev/core/fix_nef_getversion
...
smartcontract: fix nef.GetVersion
2020-11-12 17:56:12 +03:00
Anna Shaleva
251a660b85
smartcontract: ignore case in trigger.FromString
2020-11-12 17:49:28 +03:00
Anna Shaleva
d6992cb5c4
core: marshal block hash for AppExecResult [NotificationsSubsystem]
2020-11-12 17:43:20 +03:00
Anna Shaleva
0b15ca8bd0
rpc: add trigger parameter to getapplicationlog
2020-11-12 17:43:11 +03:00
Anna Shaleva
9c3d8cd398
smartcontract: fix nef.GetVersion
...
It should be able to parse versions like `1.1.1-rc.1`.
Close #1540 .
2020-11-12 17:08:54 +03:00
Anna Shaleva
7ca93e76ac
core, rpc: allow to store several AppExecResult for a single hash
...
It is required for we have several executions per block.
2020-11-12 16:24:39 +03:00
Roman Khimov
2712ef6e5a
Merge pull request #1537 from nspcc-dev/rpc/unify_base64
...
rpc: use base64 for `submitblock` and `sendrawtransaction`
2020-11-12 15:49:39 +03:00
Roman Khimov
9142906abe
Merge pull request #1539 from nspcc-dev/core/fix_mempool_test
...
core: fix failing mempool test
2020-11-12 15:48:28 +03:00
Roman Khimov
11a224057b
Merge pull request #1536 from nspcc-dev/feature/retransmit3
...
network: retransmit stale transactions (master)
2020-11-12 15:47:00 +03:00
Anna Shaleva
20f8fe5699
rpc: use base64 for submitblock
and sendrawtransaction
...
Changes ported from https://github.com/neo-project/neo-modules/pull/394 .
2020-11-12 15:21:35 +03:00
Anna Shaleva
a84e4c1e89
core: make some checks in TestMempoolAddRemoveConflicts non-critical
...
It will help to investigate test failures.
2020-11-12 15:14:32 +03:00
Anna Shaleva
54e6bcad12
core: fix failing mempool test
...
There might be a case when identical nonces are generated for tx6, tx7 or
tx8 (they are not in mempool, so each of them pass mempool-presence
check). In this case test fails due to the lack of hashes into mp.conflicts
map (two of tx6, tx7 or tx8 have identical hashes) with the following
error:
```
=== RUN TestMempoolAddRemoveConflicts
--- FAIL: TestMempoolAddRemoveConflicts (0.00s)
mem_pool_test.go:376:
Error Trace: mem_pool_test.go:376
Error: Not equal:
expected: 4
actual : 3
Test: TestMempoolAddRemoveConflicts
```
Fixed by maling the nonce non-random.
2020-11-12 15:05:01 +03:00
Anna Shaleva
b51eb7f5ef
core: update opcodes prices
...
Changes ported from https://github.com/neo-project/neo/pull/2020 .
2020-11-12 14:20:26 +03:00
Evgenii Stratonikov
3e5b84348d
network: retransmit stale transactions
2020-11-12 13:51:44 +03:00
Anna Shaleva
01296bda5f
core: remove policy default values initialisation
2020-11-10 18:05:40 +03:00
Roman Khimov
62d6f3ba22
Merge pull request #1530 from nspcc-dev/syscall/atoi
...
core: implement `System.Binary.Atoi/Itoa` syscalls
2020-11-10 16:39:02 +03:00
Evgenii Stratonikov
d193e16662
compiler: support System.Binary.Atoi/Itoa
syscalls
2020-11-10 16:15:10 +03:00
Evgenii Stratonikov
e4bf531e3e
core: implement System.Binary.Atoi/Itoa
syscalls
...
They follow C# conversion rules, but differ from our `bigint` module
conversions:
1. String must be big-endian.
2. Sign extension is 4-bit in size (single hex character)
and not 8-byte.
2020-11-10 16:15:10 +03:00
Evgenii Stratonikov
54992ad4f3
core: provide account in calculate claimable
...
`getunclaimedgas` RPC should return all GAS available to claim.
2020-11-10 16:08:21 +03:00
Evgenii Stratonikov
860c146260
native: increase committee GAS bounty
...
Follow neo-project/neo#2049 .
2020-11-10 15:30:31 +03:00
Evgenii Stratonikov
af583c14ea
native: add GAS rewards for voters
...
Close #1348 .
2020-11-10 15:30:30 +03:00
Evgenii Stratonikov
a3c7130ab2
native: cache committee together with votes
2020-11-10 15:23:06 +03:00
Roman Khimov
ede2b05f29
Merge pull request #1529 from nspcc-dev/fix/nextconsensus
...
consensus: update NextConsensus only when committee is recalculated
2020-11-10 10:24:35 +03:00
Evgenii Stratonikov
c30d891aa9
consensus: update NextConsensus only when committee is recalculated
2020-11-09 17:35:32 +03:00
Roman Khimov
a1ce3d2db2
transaction: add new oracle response codes
...
Follow neo-project/neo#2037 .
2020-11-09 16:54:09 +03:00
Roman Khimov
a9dddf893a
Merge pull request #1525 from nspcc-dev/rpc/base64
...
rpc: return bse64 bytes from `getblock`, `getblockheader`, `getrawtx`
2020-11-09 10:48:28 +03:00
Anna Shaleva
6bb81d9b51
rpc: return bse64 bytes from getblock
, getblockheader
, getrawtx
...
Close #1522
2020-11-09 10:29:33 +03:00
Roman Khimov
58f384a323
Merge pull request #1526 from nspcc-dev/improve-worst-case-reverseitems
...
vm: improve REVERSEITEMS for 1M Buffer
2020-11-07 23:18:34 +03:00
Roman Khimov
bf9ecc2bd3
vm: improve REVERSEITEMS for 1M Buffer
...
Before:
BenchmarkOpcodes/REVERSEITEMS/buffer/1M-8 1680 758747 ns/op
After:
BenchmarkOpcodes/REVERSEITEMS/buffer/1M-8 2649 442720 ns/op
2020-11-06 23:31:26 +03:00
Roman Khimov
536f488f0c
Merge pull request #1514 from nspcc-dev/rpc/batch_requests
...
rpc: allow batch JSON-RPC requests
2020-11-06 17:27:23 +03:00
Anna Shaleva
6ee919747f
rpc: allow batch JSON-RPC requests
...
Close #1509
2020-11-06 17:06:20 +03:00
Roman Khimov
bdd073aad7
Merge pull request #1520 from nspcc-dev/tune-some-limits
...
Tune some limits
2020-11-06 15:35:44 +03:00
Roman Khimov
0ee377792e
Merge pull request #1519 from nspcc-dev/designate-role-history
...
native: implement designate contract history retention
2020-11-06 15:35:18 +03:00
Roman Khimov
47421f23f4
native: add events to oracle contract
...
Follow neo-project/neo#2036 .
2020-11-06 13:49:07 +03:00
Roman Khimov
9e781bff47
native: implement designate contract history retention
...
Follow neo-project/neo#2007 . Fix getDesignatedByRole price along the way.
2020-11-06 13:46:40 +03:00
Roman Khimov
b233158c9f
transaction: lower MaxValidUntilBlockIncrement
...
Follow neo-project/neo#2042 .
2020-11-06 13:41:46 +03:00
Roman Khimov
b327308df8
core/config: move MaxTraceableBlocks to configuration file
...
Follow neo-project/neo#2042 , use 2102400 setting for mainnet/testnet and
200000 for private networks.
2020-11-06 13:41:46 +03:00
Roman Khimov
39a38dc5f5
transaction: raise max oracle response size
...
Follow neo-project/neo#1984 .
2020-11-06 13:41:46 +03:00
Roman Khimov
679846c1a1
Merge pull request #1426 from nspcc-dev/rpc/getcontractstate_by_id_or_name
...
rpc: allow to `getcontractstate` by id or name
2020-11-05 13:17:42 +03:00
Roman Khimov
d7502debba
core: adjust storage update fees
...
Follow neo-project/neo#2033 .
2020-11-03 22:50:40 +03:00
Anna Shaleva
b8a88f9378
rpc: allow to use address, id or name instead of scripthash [Client]
...
... for getcontractstate RPC client method.
2020-11-03 17:58:24 +03:00
Anna Shaleva
d3daaafbe4
rpc: allow to get contract scripthash from address, id or name [Server]
...
... for `invokefunction` RPC method.
2020-11-03 17:25:46 +03:00
Anna Shaleva
15a939b1da
rpc: allow to getcontractstate
by address, id or name
...
close #1423
2020-11-03 17:23:49 +03:00
Roman Khimov
eaa260474f
trigger/core: split System trigger into OnPerist and PostPersist
...
Follow neo-project/neo#2022 .
2020-10-29 19:17:07 +03:00
Roman Khimov
044786b995
core: use Application trigger in CalculateClaimable()
...
It doesn't need a System one.
2020-10-29 19:17:07 +03:00
Roman Khimov
2522271161
vm: use Application trigger by default
...
Don't mess with System, it's too powerful to be the default.
2020-10-29 19:17:07 +03:00
Roman Khimov
2924ecd453
core: use ic.SpawnVM() in tests, not vm.New()
...
vm.New() sets some arbitrary trigger while interop context always sets
something appropriate according to its state.
2020-10-29 19:17:07 +03:00
Roman Khimov
d4da811d12
Merge pull request #1507 from nspcc-dev/conflicts_attr
...
core: implement Conflicts transaction attribute
2020-10-29 16:54:58 +03:00
Anna Shaleva
ec63d5c456
core: add conflicts attribute
...
Close #1491
2020-10-29 10:57:31 +03:00
Roman Khimov
0eb4ad8564
Merge pull request #1508 from nspcc-dev/core/check_witness_tests
...
core: add CheckWitness tests
2020-10-27 15:56:35 +03:00
Roman Khimov
c4a4a84515
native: lower voting fee
...
Follow neo-project/neo#2010 .
2020-10-26 22:12:56 +03:00
Anna Shaleva
5a15e6b54c
core: add tests for CheckWitness
...
Close #1366
2020-10-26 20:30:45 +03:00
Anna Shaleva
204d7f1c6a
core: refactor runtime.CheckWitness interop
...
Removed unreachable code, see
8fed383523
runtime.CheckHashedWitness can only be used for transaction
verification, the other two options from reference implementation (block
and consensus payload) have separate methods for verification.
2020-10-26 20:26:21 +03:00
Roman Khimov
eca1221d22
Merge pull request #1504 from nspcc-dev/core/native_serialisation
...
core: native serialisation
2020-10-23 18:38:35 +03:00
Anna Shaleva
f259a614de
core: add transaction.HasSigner method
2020-10-23 16:32:26 +03:00
Anna Shaleva
0232bbcb0c
core: refactor GASRecord handling
...
We should store each GAS record as
{
Key: ContractID + RecordsPrefix + RecordID,
Value: RecordValue,
}
So don't use state.GASRecord for storing anymore. However, it's still
useful to cache GasRecord values by using state.GASRecords, because we
have to keep GASIndexPairs sorted by indexes.
2020-10-23 12:49:12 +03:00
Anna Shaleva
0da01fde7f
core: refactor blocked accounts logic
2020-10-23 11:42:30 +03:00
Roman Khimov
1956f2c079
Merge pull request #1496 from nspcc-dev/signatures-collection
...
core: implement NotValidBefore and Reserved tx attributes
2020-10-23 11:26:49 +03:00
Anna Shaleva
7947e99a1e
core: add transaction.GetAttributes
2020-10-23 11:05:03 +03:00
Anna Shaleva
95630b72e8
core: verify transaction attributes before adding it into mempool
...
Attributes check should be done before adding transaction to
the pool, otherwise there might be a case when transaction with invalid
attributes is in the pool.
2020-10-23 11:05:03 +03:00
Anna Shaleva
a6579a05ac
core: refactor transaction.Attribute unmarshalling
2020-10-23 11:05:03 +03:00
Anna Shaleva
09b8b8de73
core: reserve attributes range for experimantal purposes
2020-10-23 11:04:59 +03:00
Anna Shaleva
368ff820b3
core: add NotValidBefore transaction attribute
...
Close #1490
2020-10-23 11:02:46 +03:00
Anna Shaleva
6685f8eba9
core: restrict the maximum number of requests per URL
2020-10-22 11:32:02 +03:00
Anna Shaleva
7c232e2ddc
core: add max nodes count restriction to designate contract
2020-10-22 11:32:02 +03:00
Roman Khimov
8be7cd4bff
Merge pull request #1489 from nspcc-dev/rpc/invoke_with_base64
...
rpc, cli: use base64 script encoding for Invoke* calls; add Magic to `getversion` RPC call
2020-10-19 16:17:06 +03:00
Roman Khimov
62be070737
Merge pull request #1499 from nspcc-dev/rpc/notifications_subscriptions_fix
...
rpc: fix Matches and marshalling for notification events
2020-10-19 16:15:39 +03:00
Anna Shaleva
590be7a58d
rpc, cli: remove Network from RPC client and cli
2020-10-19 16:11:11 +03:00
Roman Khimov
4da3111767
Merge pull request #1497 from nspcc-dev/compiler/slice
...
compiler: refactor void calls processing
2020-10-19 13:59:27 +03:00
Anna Shaleva
64d1946fbb
rpc: fix Matches and marshalling for notification events
...
Close #1494 . Marshalling went wrong due to the incorrect pointers usage.
Reproduced and fixed.
2020-10-19 13:44:20 +03:00
Anna Shaleva
474d2dfb65
rpc: add Magic to Version
2020-10-19 11:51:27 +03:00
Anna Shaleva
c50f3db6ad
rpc, cli: encode script in base64 for Invoke*
2020-10-19 11:51:27 +03:00
Evgenii Stratonikov
01ccaefe2f
compiler: refactor void calls processing
...
Call result is not used only if it occurs inside a `ExprStmt`.
Otherwise (`IfStmt`, `BinExpr`...) it is used.
Fix #1495 .
2020-10-19 10:43:47 +03:00
Roman Khimov
d58c50fb77
Merge pull request #1418 from nspcc-dev/rpc/invoke_with_sender
...
rpc: add tx to invoke* results, support hex for uint160 params
2020-10-17 17:54:12 +03:00
Anna Shaleva
ceb7ea9737
rpc: allow both base58 and hex for Uint160 RPC server parameters
...
`getunclaimedgas` RPC-call allows to use both base58 and hex
representations for uint160.
2020-10-17 00:42:45 +03:00
Anna Shaleva
19a2e3bb91
rpc: add transaction field to InvokeResult
2020-10-17 00:42:39 +03:00
Roman Khimov
6849499f56
Merge pull request #1493 from nspcc-dev/vm-opcode-bench
...
vm: add opcode benchmark
2020-10-16 11:02:04 +03:00
Roman Khimov
07770ea4a5
Merge pull request #1492 from nspcc-dev/minor-vm-fixes
...
Minor VM fixes
2020-10-15 18:10:41 +03:00
Roman Khimov
0709e20fbb
vm: add opcode benchmark
...
For future optimizations and price adjustments.
2020-10-15 16:27:36 +03:00
Roman Khimov
27a01c7759
vm: optimize stack traversal on exception handling
...
Before:
BenchmarkOpcodes/THROW/0/1-8 10000 506 ns/op
BenchmarkOpcodes/THROW/0/16-8 10000 524 ns/op
BenchmarkOpcodes/THROW/255/0-8 10000 49363 ns/op
BenchmarkOpcodes/THROW/1023/0-8 10000 1628480 ns/op
After:
BenchmarkOpcodes/THROW/0/1-8 10000 575 ns/op
BenchmarkOpcodes/THROW/0/16-8 10000 516 ns/op
BenchmarkOpcodes/THROW/255/0-8 10000 8290 ns/op
BenchmarkOpcodes/THROW/1023/0-8 10000 34605 ns/op
2020-10-15 16:20:34 +03:00
Roman Khimov
3d8434a50c
vm: fix invocation stack checks
...
It should be done on every new context push.
2020-10-15 16:20:34 +03:00
Roman Khimov
fe0ec91636
vm: optimize reversing items on the stack
...
Before:
BenchmarkOpcodes/REVERSE3/null-8 10000 335 ns/op
BenchmarkOpcodes/REVERSE3/integer-8 10000 355 ns/op
BenchmarkOpcodes/REVERSE3/big_bytes-8 10000 344 ns/op
BenchmarkOpcodes/REVERSE4/null-8 10000 353 ns/op
BenchmarkOpcodes/REVERSE4/integer-8 10000 336 ns/op
BenchmarkOpcodes/REVERSE4/big_bytes-8 10000 324 ns/op
BenchmarkOpcodes/REVERSEN/5/null-8 10000 350 ns/op
BenchmarkOpcodes/REVERSEN/5/integer-8 10000 358 ns/op
BenchmarkOpcodes/REVERSEN/5/big_bytes-8 10000 351 ns/op
BenchmarkOpcodes/REVERSEN/1024/null-8 10000 982413 ns/op
BenchmarkOpcodes/REVERSEN/1024/integer-8 10000 994926 ns/op
BenchmarkOpcodes/REVERSEN/1024/big_bytes-8 10000 992951 ns/op
After:
BenchmarkOpcodes/REVERSE3/null-8 10000 241 ns/op
BenchmarkOpcodes/REVERSE3/integer-8 10000 255 ns/op
BenchmarkOpcodes/REVERSE3/big_bytes-8 10000 249 ns/op
BenchmarkOpcodes/REVERSE4/null-8 10000 249 ns/op
BenchmarkOpcodes/REVERSE4/integer-8 10000 267 ns/op
BenchmarkOpcodes/REVERSE4/big_bytes-8 10000 292 ns/op
BenchmarkOpcodes/REVERSEN/5/null-8 10000 337 ns/op
BenchmarkOpcodes/REVERSEN/5/integer-8 10000 327 ns/op
BenchmarkOpcodes/REVERSEN/5/big_bytes-8 10000 293 ns/op
BenchmarkOpcodes/REVERSEN/1024/null-8 10000 5414 ns/op
BenchmarkOpcodes/REVERSEN/1024/integer-8 10000 5487 ns/op
BenchmarkOpcodes/REVERSEN/1024/big_bytes-8 10000 5609 ns/op
2020-10-15 16:19:59 +03:00
Roman Khimov
e9a8e957f8
Merge pull request #1488 from nspcc-dev/fix/compiler
...
compiler: fix manifest method offset
2020-10-14 15:12:57 +03:00
Evgenii Stratonikov
1f2d76a1c2
compiler: fix manifest method offset
...
While optimizing jumps, old offsets should be compared
with the method offset before optimization, not with
the constantly changing value.
2020-10-14 15:04:33 +03:00
Roman Khimov
99e0e346c6
Merge pull request #1476 from nspcc-dev/fix/verify
...
core: allow to invoke `verify` of native contracts
2020-10-14 12:49:01 +03:00
Roman Khimov
7808ab2dde
Merge pull request #1479 from nspcc-dev/examples/deploy
...
examples: add _deploy usage examples
2020-10-14 12:32:21 +03:00
Evgenii Stratonikov
aee02ff2e3
core: allow to invoke verify
of native contracts
2020-10-14 11:44:27 +03:00
Roman Khimov
e5048b771e
Merge pull request #1486 from nspcc-dev/fix-empty-discovery-pool
...
Fix empty discovery pool
2020-10-13 19:23:25 +03:00
Anna Shaleva
f8d5c40928
compiler: do not DROP return value with type assertion
...
The same problem as with IF. Example:
```
func foo() interface{} {
...
}
func Main() int{} {
return foo().(int) <--- panic here
}
```
2020-10-13 19:14:44 +03:00
Anna Shaleva
dbce3c9a19
compiler: do not DROP unary expression value inside IF stmt
...
We dropped values from such calls because they where marked as unused
(consequently, were followed by DROP instructions). Example:
if !foo() { <--- panic here
...
}
This commit prevents the following runtime error during script execution:
```
"error encountered at instruction ** (NOT): runtime error: invalid memory address or nil pointer dereference"
```
2020-10-13 19:14:44 +03:00
Anna Shaleva
fe1f0a7245
core: introduce CheckReturnState constants
...
At the moment we should have 3 possible options to check return state
during vm context unloading:
* no check
* ensure the stack is empty
* ensure the stack is not empty
It is necessary to distinguish them because new _deploy method shouldn't
left anything on stack. Example: if we use _deploy method before some
ordinary contract method which returns one value. Without these changes
the contract invocation will fail due to 2 elements on stack left after
invocation (the first `null` element is from _deploy, the second element
is return-value from the ordinary contract method).
2020-10-13 19:14:44 +03:00
Roman Khimov
0f39da19d0
storage: fix Get for BoltDB, fix #1482
2020-10-13 19:05:11 +03:00
Roman Khimov
38a22b44b2
network: try connecting to seeds indefinitely, use them with 0 pool
...
If the node is to start with seeds unavailable it will try connecting to each
of them three times, blacklist them and then sit forever waiting for
something. It's not a good behavior, it should always try connecting to seeds
if nothing else works.
2020-10-13 19:02:10 +03:00
Roman Khimov
8028e08abc
network: an address should either be good or bad, but not both
2020-10-13 19:01:45 +03:00
Roman Khimov
c72ecd1be4
Merge pull request #1480 from nspcc-dev/fix-reverification-of-stale-txes
...
core: drop stale transactions from the mempool
2020-10-12 15:54:28 +03:00
Roman Khimov
a154481860
core: drop stale transactions from the mempool
...
They're no longer valid if `ValidUntilBlock == curheight`.
2020-10-12 14:58:40 +03:00
Anna Shaleva
097ef2a731
core: copy storage item key in simple.GetStorageItems
...
Related to #1468 , ported from #1475 .
We should copy the key to avoid bytes substitution. Otherwise there's a
chance that at the end of dao.Store.Seek(...) execution some keys won't
be the same as the original keys found inside saveToMap function because
storage.Seek can guarantee that provided key and value are only valid
until the next `f` call.
2020-10-10 12:37:46 +03:00
Evgenii Stratonikov
42ff4a8fc7
native: provide name
method for all contracts
2020-10-09 15:06:28 +03:00
Roman Khimov
eb9b1cae36
Merge pull request #1474 from nspcc-dev/core/fixes
...
Some small improvements
2020-10-09 10:03:52 +03:00
Roman Khimov
6025c13a6d
Merge pull request #1471 from nspcc-dev/rpc-server-logging-improvement
...
server: don't always Sprintf params for logger
2020-10-08 16:45:30 +03:00
Roman Khimov
c8ba155d47
server: don't always Sprintf params for logger
...
Add Stringer to Params, if we're not printing Debug messages (which usually is
the case), it won't be called at all. Micro-optimization.
2020-10-08 16:37:28 +03:00
Roman Khimov
124ce9d247
Merge pull request #1455 from nspcc-dev/get_invocation_counter
...
core: remove error from runtime.GetInvocationCounter
2020-10-08 16:34:40 +03:00
Anna Shaleva
cbf89fbb19
vm: add Call method which increments invocation counter
2020-10-08 16:25:45 +03:00
Roman Khimov
8c2fd91c5c
Merge pull request #1462 from nspcc-dev/rpc/exceptions
...
rpc, core: add FaultException to AppExecResult and Invoke* results
2020-10-08 16:20:38 +03:00
Anna Shaleva
0f71088246
core: add FaultException to AppExecResult
2020-10-08 16:12:19 +03:00
Anna Shaleva
9a493dd2a0
rpc: add FaultException to result.Invoke
...
Close #1440
2020-10-08 16:12:14 +03:00
Roman Khimov
70e9e329cd
Merge pull request #1463 from nspcc-dev/core/blocked_accounts_cache
...
core: add cache to Policy blocked accounts
2020-10-08 14:35:19 +03:00
Evgenii Stratonikov
44abaa8ef3
smartcontract: implement GetDefaultHonestNodeCount
...
We may use this in other parts of code.
2020-10-08 13:48:14 +03:00
Evgenii Stratonikov
037cecf1ac
native: move OracleRequest to state package
...
It is used by multiple modules outside native
and produces unneeded dependencies.
2020-10-08 13:48:14 +03:00
Anna Shaleva
9fe2b04db9
core: add cache to Policy blocked accounts
...
Close #1441
2020-10-08 13:47:21 +03:00
Roman Khimov
a44cb99df6
payload: add a check for zero-length address list
...
Which is also present in C# code. Thanks, @AnnaShaleva.
2020-10-08 13:26:18 +03:00
Anna Shaleva
6ce00fde82
vm, core: move invocation counter from InteropContext to VM
2020-10-08 11:33:26 +03:00
Anna Shaleva
45bfce60a5
core: remove error from runtime.GetInvocationCounter
...
close #1444
2020-10-08 11:32:00 +03:00
Roman Khimov
5abec520c7
payload: limit the number of possible addresses
2020-10-07 23:29:20 +03:00
Roman Khimov
0120a8f239
stackitem: limit buffer/bytearray reads upon deserialization
...
This is not the way it's done in C#, but that's the most sensible approach to
me.
2020-10-07 23:08:20 +03:00
Roman Khimov
64e9775707
vm/stackitem: limit reads for bigint values
...
They can't exceed 33 bytes.
2020-10-07 23:07:10 +03:00
Roman Khimov
f45c032eff
nef: limit the number of bytes to be read during decode
2020-10-07 18:30:44 +03:00
Roman Khimov
63c7469dfd
manifest: limit its size when decoding
2020-10-07 18:29:19 +03:00
Roman Khimov
f318e573d4
payload: limit the user agent field in version payload
...
Protocol limit.
2020-10-07 18:27:24 +03:00
Roman Khimov
705941a800
transaction: add script length limit
...
As it is implemented in C# code.
2020-10-07 18:23:10 +03:00
Roman Khimov
d029f5c0d8
transaction: fix witness script length limits
...
See neo-project/neo#1958 .
2020-10-07 18:05:23 +03:00
Evgenii Stratonikov
96bca91e4b
vm: handle very big int creation properly
...
Determine size as in reference implementation instead of
`big.Int.BitLen()`
Close #1437 .
2020-10-07 11:50:42 +03:00
Evgenii Stratonikov
17922038dc
native: add GetOracleInvokeScript()
2020-10-07 10:04:19 +03:00
Evgenii Stratonikov
0a596e1df2
keys: don't panic if signature has invalid size
2020-10-07 10:04:19 +03:00
Evgenii Stratonikov
9733a6f394
core: move CalculateNetworkFee
to a separate package
2020-10-07 10:04:19 +03:00
Roman Khimov
d6a1a22afa
Merge pull request #1452 from nspcc-dev/contract/deploy
...
Support `_deploy` method
2020-10-06 19:54:14 +03:00
Evgenii Stratonikov
c4a8770215
compiler: support _deploy
method
2020-10-06 19:12:35 +03:00
Evgenii Stratonikov
6701e8cda0
compiler: allow to use local variables in init()
...
Because body of multiple `init()` functions constitute single
method in contract, we initialize slot with maximum amount of
locals encounterered in any of `init()` functions and clear them
before emitting body of each instance of `init()`.
2020-10-06 19:08:32 +03:00
Evgenii Stratonikov
2d9ef9219a
core: call _deploy method during create/update
2020-10-06 18:03:25 +03:00
Evgenii Stratonikov
b71f9e296c
core/tests: refactor contract creation a bit
...
Make it easier to add new methods.
2020-10-06 18:03:25 +03:00
Evgenii Stratonikov
b2a3a0851e
emit: accept multiple opcodes in Opcode()
2020-10-06 18:03:25 +03:00
Roman Khimov
2de146125c
Merge pull request #1460 from nspcc-dev/contract/update
...
core: allow Null in `System.Contract.Update`
2020-10-06 16:54:21 +03:00
Evgenii Stratonikov
0b76f875c7
core: allow Null in System.Contract.Update
...
Null means absense of script or manifest, empty
byte-slice is an error.
Related #1459 .
2020-10-06 10:34:45 +03:00
Roman Khimov
2ea29924c4
Merge pull request #1454 from nspcc-dev/core/policy_checks
...
core: add validation to policy methods
2020-10-05 19:09:59 +03:00
Anna Shaleva
6cff35c927
network: restrict flags size in MerkleBlockPayload
2020-10-05 18:08:37 +03:00
Anna Shaleva
560e470484
core: add validation to native Policy methods
...
close #1442
2020-10-05 18:08:37 +03:00
Anna Shaleva
e1e586f18b
core: restrict the muximum number of contents per block
2020-10-05 18:08:33 +03:00
Anna Shaleva
d27775acc5
rpc: remove json names from result.Invoke struct
...
We use invokeAux to marshal result.Invoke to JSON.
2020-10-05 16:00:15 +03:00
Roman Khimov
0e82d4cbd1
Merge pull request #1458 from nspcc-dev/fix/storageput
...
core: calculate gas for `System.Storage.Put` correctly
2020-10-05 14:26:17 +03:00
Evgenii Stratonikov
833bbb1d35
core: calculate gas for System.Storage.Put
correctly
...
If `Put` creates new key, its length should contribute
to a GAS cost of the syscall.
2020-10-05 13:03:44 +03:00
Anna Shaleva
c79d440c21
network: fix MerkleBlockPayload serialisation
2020-10-02 19:25:57 +03:00
Roman Khimov
8e146d19b3
Merge pull request #1447 from nspcc-dev/core/fix_neo_cache
...
core: fix cache for (NEO).nextValidators and (NEO).committee
2020-10-02 17:09:43 +03:00
Anna Shaleva
eccf639803
core: add InitializeCache method to NEO native contracts
...
There might be a case when cached contract values store nil (e.g.
after restoring chain from dump). We should always initialize cached
values irrespective to the (NEO).Initialize method.
This commit fixes a bug introduced in 83e94d3
when 4-nodes privnet is failing after restoring from dump:
```
$ docker logs neo_go_node_one
=> Try to restore blocks before running node
2020-09-30T11:55:49.122Z INFO no storage version found! creating genesis block
2020-09-30T11:55:49.124Z INFO service hasn't started since it's disabled {"service": "Pprof"}
2020-09-30T11:55:49.124Z INFO service hasn't started since it's disabled {"service": "Prometheus"}
2020-09-30T11:55:49.124Z INFO skipped genesis block {"hash": "3792eaa22c196399a114666fd491c4b9ac52491d9abb1f633a8036a8ac81e4db"}
2020-09-30T11:55:49.141Z INFO shutting down service {"service": "Pprof", "endpoint": ":30001"}
2020-09-30T11:55:49.141Z INFO shutting down service {"service": "Prometheus", "endpoint": ":40001"}
2020-09-30T11:55:49.141Z INFO blockchain persist completed {"persistedBlocks": 3, "persistedKeys": 146, "headerHeight": 3, "blockHeight": 3, "took": "324.27µs"}
2020-09-30T11:55:49.150Z INFO restoring blockchain {"version": "0.1.0"}
2020-09-30T11:55:49.150Z INFO service hasn't started since it's disabled {"service": "Prometheus"}
2020-09-30T11:55:49.151Z INFO service hasn't started since it's disabled {"service": "Pprof"}
2020-09-30T11:55:49.443Z INFO starting rpc-server {"endpoint": ":30333"}
2020-09-30T11:55:49.443Z INFO node started {"blockHeight": 3, "headerHeight": 3}
_ ____________ __________
/ | / / ____/ __ \ / ____/ __ \
/ |/ / __/ / / / /_____/ / __/ / / /
/ /| / /___/ /_/ /_____/ /_/ / /_/ /
/_/ |_/_____/\____/ \____/\____/
/NEO-GO:/
2020-09-30T11:55:49.444Z INFO new peer connected {"addr": "172.23.0.5:39638", "peerCount": 1}
2020-09-30T11:55:49.444Z INFO new peer connected {"addr": "172.23.0.5:20333", "peerCount": 2}
2020-09-30T11:55:49.444Z WARN peer disconnected {"addr": "172.23.0.5:20333", "reason": "identical node id", "peerCount": 1}
2020-09-30T11:55:49.445Z WARN peer disconnected {"addr": "172.23.0.5:39638", "reason": "identical node id", "peerCount": 0}
2020-09-30T11:55:49.445Z INFO new peer connected {"addr": "172.23.0.3:20335", "peerCount": 1}
2020-09-30T11:55:49.445Z INFO new peer connected {"addr": "172.23.0.2:20334", "peerCount": 2}
2020-09-30T11:55:49.445Z INFO started protocol {"addr": "172.23.0.3:20335", "userAgent": "/NEO-GO:/", "startHeight": 3, "id": 1339919829}
2020-09-30T11:55:49.445Z INFO new peer connected {"addr": "172.23.0.4:20336", "peerCount": 3}
2020-09-30T11:55:49.445Z INFO started protocol {"addr": "172.23.0.4:20336", "userAgent": "/NEO-GO:/", "startHeight": 3, "id": 4036722359}
2020-09-30T11:55:49.445Z INFO node reached synchronized state, starting consensus
2020-09-30T11:55:49.445Z INFO started protocol {"addr": "172.23.0.2:20334", "userAgent": "/NEO-GO:/", "startHeight": 3, "id": 1557367037}
panic: runtime error: integer divide by zero
goroutine 132 [running]:
github.com/nspcc-dev/dbft.(*Context).GetPrimaryIndex(...)
github.com/nspcc-dev/dbft@v0.0.0-20200925163137-8f3b9ab3b720/context.go:83
github.com/nspcc-dev/dbft.(*Context).reset(0xc0000e0780, 0x0)
github.com/nspcc-dev/dbft@v0.0.0-20200925163137-8f3b9ab3b720/context.go:208 +0x64b
github.com/nspcc-dev/dbft.(*DBFT).InitializeConsensus(0xc0000e0780, 0x964800)
github.com/nspcc-dev/dbft@v0.0.0-20200925163137-8f3b9ab3b720/dbft.go:87 +0x51
github.com/nspcc-dev/dbft.(*DBFT).Start(0xc0000e0780)
github.com/nspcc-dev/dbft@v0.0.0-20200925163137-8f3b9ab3b720/dbft.go:81 +0x4b
github.com/nspcc-dev/neo-go/pkg/consensus.(*service).Start(0xc0001a2160)
github.com/nspcc-dev/neo-go/pkg/consensus/consensus.go:206 +0x56
github.com/nspcc-dev/neo-go/pkg/network.(*Server).tryStartConsensus(0xc0000ec500)
github.com/nspcc-dev/neo-go/pkg/network/server.go:311 +0xda
github.com/nspcc-dev/neo-go/pkg/network.(*Server).handleMessage(0xc0000ec500, 0x104d800, 0xc000222090, 0xc0000a6f10, 0x0, 0x0)
github.com/nspcc-dev/neo-go/pkg/network/server.go:781 +0xa7a
github.com/nspcc-dev/neo-go/pkg/network.(*TCPPeer).handleConn(0xc000222090)
github.com/nspcc-dev/neo-go/pkg/network/tcp_peer.go:162 +0x2e7
created by github.com/nspcc-dev/neo-go/pkg/network.(*TCPTransport).Dial
github.com/nspcc-dev/neo-go/pkg/network/tcp_transport.go:40 +0x1ac
```
2020-10-02 17:03:06 +03:00
Roman Khimov
15e459feea
core: fix designate test
...
Merge conflict between #1450 and #1451 .
2020-10-02 16:23:48 +03:00
Roman Khimov
b5d138b150
Merge pull request #1451 from nspcc-dev/native/designative
...
native: implement Designate contract
2020-10-02 16:09:33 +03:00