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
5bba9c158a
Merge pull request #1502 from nspcc-dev/cli/fix_network_args
...
cli: fixed removed network arguments
2020-10-21 18:14:22 +03:00
Anna Shaleva
795823ee3b
cli: fixed removed network arguments
...
Should be done in 590be7a58d
. I removed
network flags from RPC, but we still need them for server-related
cli commands.
2020-10-21 17:41:23 +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
Roman Khimov
138d310c85
Merge pull request #1485 from nspcc-dev/fix-get-for-boltdb
...
storage: fix Get for BoltDB, fix #1482
2020-10-13 19:20:39 +03:00
Anna Shaleva
fde0546e28
examples: add _deploy usage examples
...
Close #1466
2020-10-13 19:14:44 +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
Anna Shaleva
659fb89beb
cli: warn about bad VM state during invokefunction
2020-10-13 19:14:36 +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
Roman Khimov
737306aacf
Merge pull request #1478 from nspcc-dev/neo3/get_storage_items_fix
...
core: copy storage item key in simple.GetStorageItems
2020-10-10 13:02:42 +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
Roman Khimov
93df89da8f
Merge pull request #1477 from nspcc-dev/fix/native
...
native: provide `name` method for all contracts
2020-10-09 15:35:52 +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