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
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
705d04eda6
Merge pull request #1469 from nspcc-dev/fix-protocol-limits
...
Fix protocol limits
2020-10-08 13:39:25 +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
7ddce97f11
Merge pull request #1461 from nspcc-dev/cli/multisig
...
cli: allow to send multisig deploy/invoke tx
2020-10-07 23:34:52 +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
Roman Khimov
273b803f52
Merge pull request #1464 from nspcc-dev/vm/bigint
...
vm: handle very big int creation properly
2020-10-07 15:09:25 +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
897c9198f8
cli: allow to send multisig deploy/invoke tx
...
It allows to invoke native contracts as committee
from CLI in privnet, e.g. to set new oracle nodes.
Also don't require `out` flag in `multisig sign`
if tx is to be pushed.
2020-10-07 11:48:06 +03:00
Roman Khimov
0dcf42ac24
Merge pull request #1467 from nspcc-dev/core/fixes
...
Some fixes for core, crypto
2020-10-07 10:17:23 +03:00
Evgenii Stratonikov
17922038dc
native: add GetOracleInvokeScript()
2020-10-07 10:04:19 +03:00
Evgenii Stratonikov
d50a14359a
cli/wallet: save tx only if --out
was provided
...
Also don't print tx hash twice.
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
945e9410e4
cli: add test for testinvokefunction
...
Check that contract can be properly deployed
and invoked.
2020-10-06 19:12:38 +03:00