Roman Khimov
8a55bd528d
Merge pull request #1977 from nspcc-dev/interop-base58check
...
native/std: add base58Check* methods
2021-05-25 17:57:23 +03:00
Evgeniy Stratonikov
192771a58a
native/std: add base58Check* methods, close #1974
2021-05-25 17:32:19 +03:00
Evgeniy Stratonikov
c8ddc790d9
rpc/request: handle bool parameters correctly
2021-05-25 11:24:28 +03:00
Evgeniy Stratonikov
60a3e0d778
compiler: count auxiliary locals introduced by inlining
...
During initialization of globals no function scope is present thus
locals number is not saved anywere. Save it in `codegen` directly.
2021-05-19 11:50:07 +03:00
Evgeniy Stratonikov
87a69b13f1
compiler/test: add test for inlining with local alias
...
INITSLOT count should be 1 more than for the same test with global.
2021-05-19 11:50:07 +03:00
Evgeniy Stratonikov
b693d54282
compiler: count local variables on the go
...
Create local variables as they are needed and remove `INITSLOT`
if there were no locals. This helps to eliminate a whole class
of bugs when calculated and real amount mismatched.
2021-05-19 11:50:07 +03:00
Evgeniy Stratonikov
bfa2bafb04
compiler: optimize jumps in tests
...
Jump target shortening affects manifest, so we better be sure.
2021-05-19 09:54:10 +03:00
Evgeniy Stratonikov
2aaaf30db7
compiler: remove finallyProcessIndex
from funcScope
2021-05-19 09:54:10 +03:00
Roman Khimov
e0779f2d6e
Merge pull request #1965 from nspcc-dev/native/remove_nns
...
native: remove NNS contract
2021-05-17 22:51:58 +03:00
Anna Shaleva
2d20b0fa23
core: remove nnsrecords package from native
...
Use nns from examples instead.
2021-05-17 22:24:56 +03:00
Anna Shaleva
c9099fa555
core: remove native nonfungible token
2021-05-17 22:22:07 +03:00
Anna Shaleva
99b37efc31
core: remove native NNS
2021-05-17 22:22:07 +03:00
Anna Shaleva
4c4361b2c6
native: move\remove native NNS tests
...
Record types test is moved to non-native NNS tests and adjusted
according to the non-native implementation behavior.
NEP11-compliance test is removed (non-native NNS is checked against
NEP11 standard during examples compilation test).
Domain name test is removed (we already have the same non-native
NNS tests).
2021-05-17 22:22:03 +03:00
Anna Shaleva
bfda758221
core: replace native NNS with non-native NNS in core tests
2021-05-17 22:12:38 +03:00
Anna Shaleva
7180b2ce06
rpc: use non-native NNS instead of native NNS in testchain
2021-05-17 22:08:15 +03:00
Anna Shaleva
4f1c50373f
core: detalize errors during contract.LoadToken and contract.Call
2021-05-17 22:08:15 +03:00
Anna Shaleva
6eee868b4a
interop: remove native NNS API wrappers
2021-05-17 22:08:15 +03:00
Evgeniy Stratonikov
33e1e61343
config: make MaxValidUntilBlockIncrement
configurable
2021-05-17 13:43:03 +03:00
Evgeniy Stratonikov
ea49c6b637
wallet: rename isdefault
to isDefault
...
Follow neo-project/neo#2451 .
2021-05-14 10:31:31 +03:00
Roman Khimov
4131e208e5
jsonpath: drop unnecessary assignment, fix lint fail
...
pkg/services/oracle/jsonpath/jsonpath.go:354:8 ineffassign ineffectual assignment to val
2021-05-13 17:26:38 +03:00
Roman Khimov
f2f9ec1a05
Merge pull request #1916 from nspcc-dev/fix/oraclefilter
...
oracle: make JSONPath compatible with C# implementation
2021-05-13 15:34:52 +03:00
Evgeniy Stratonikov
28a0d68c05
jsonpath: allow empty paths
2021-05-13 11:53:49 +03:00
Evgeniy Stratonikov
5fc81c787b
jsonpath: use ordered map json unmarshaler
2021-05-13 11:53:49 +03:00
Evgeniy Stratonikov
6890688b8f
oracle: add max nesting depth to JSONPath filter
2021-05-13 11:53:49 +03:00
Evgeniy Stratonikov
1c30d8c395
oracle: make JSONPath compatible with C# implementation
...
C# node uses simplified implementation which is easy to port.
2021-05-13 11:53:28 +03:00
Roman Khimov
834743ec88
Merge pull request #1958 from nspcc-dev/linter
...
Linter improvements
2021-05-13 10:52:58 +03:00
Roman Khimov
9d2712573f
*: enable godot linter and fix all its warnings
...
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Roman Khimov
d4a2f4d8b9
hash: suppress staticcheck warning
2021-05-12 22:52:32 +03:00
Roman Khimov
4e651eaf83
compiler: simplify increments as suggested by golint
2021-05-12 22:52:07 +03:00
Roman Khimov
c4e084b0d8
*: fix whitespace errors
...
leading/trailing newlines
2021-05-12 22:51:41 +03:00
Roman Khimov
b1710bebaa
native: fix errcheck errors in nns contract
2021-05-12 21:49:42 +03:00
Roman Khimov
a44376903a
rpc: fix errcheck warnings in websocket code
2021-05-12 21:48:38 +03:00
Roman Khimov
e9cefc4bfc
*: fix all errcheck warnings in testing code
2021-05-12 21:45:12 +03:00
Roman Khimov
4caff35e73
consensus: fix error checking in decoders
...
Spotted by errcheck.
2021-05-12 20:14:52 +03:00
Roman Khimov
99108c620f
network: fix errcheck warning
2021-05-12 20:14:35 +03:00
Roman Khimov
601841ef35
*: drop unused structure fields
...
Found by structcheck:
`good` is unused (structcheck)
and alike.
2021-05-12 19:41:23 +03:00
Roman Khimov
4cd3da99b4
core: fix ineffassign warning in test code
...
ineffectual assignment to err (ineffassign)
2021-05-12 19:37:14 +03:00
Roman Khimov
78bf172108
network: drop some not really useful test code
...
SA4010: this result of append is never used, except maybe in other appends (staticcheck)
2021-05-12 19:29:45 +03:00
Roman Khimov
b5ff87c2bd
native: fix minimum deployment fee setting
...
SA4003: no value of type uint32 is less than 0 (staticcheck)
But it's more involved than that, we should allow any positive big.Int here.
2021-05-12 19:27:02 +03:00
Roman Khimov
d15cacc1ba
rpc/client: fix broken test code
...
SA1024: cutset contains duplicate characters (staticcheck)
2021-05-12 19:15:21 +03:00
Roman Khimov
b8ba923874
standard: improve testing code
...
staticcheck: SA4021: x = append(y) is equivalent to x = y
2021-05-12 19:12:09 +03:00
Roman Khimov
333f778aa6
*: drop empty branches
...
Fix this warning from staticcheck: SA9003: empty branch
2021-05-12 19:10:31 +03:00
Roman Khimov
92dbb3c4b9
*: fix all unused
warnings
...
From golangci-lint.
2021-05-12 18:53:12 +03:00
Roman Khimov
de5e61588d
vm: simplify some test code
...
gosimple: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix`
2021-05-12 18:44:35 +03:00
Roman Khimov
7af67d2a3c
vm/cli: simplify buffer-related code
...
gosimple: S1030: should use buf.String() instead of string(buf.Bytes())
2021-05-12 18:42:50 +03:00
Roman Khimov
bd48454c72
mempool: simpilfy boolean comparisons in test code
...
gosimple: S1008: should use 'return t == tx2' instead of 'if t == tx2 { return true }; return false'
2021-05-12 18:40:41 +03:00
Roman Khimov
cf59bd878d
native: simplify escaping in regexp.MustCompile()
...
gosimple: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice
2021-05-12 18:38:24 +03:00
Roman Khimov
0178594850
*: simpilfy make() invocations
...
gosimple: S1019: should use make([]byte, 64) instead
2021-05-12 18:36:45 +03:00
Roman Khimov
07cdbb815c
*: drop unnecessary fmt.Sprintf uses
...
gosimple: S1039: unnecessary use of fmt.Sprintf
2021-05-12 18:29:39 +03:00
Roman Khimov
ad8ffee0ab
*: remove redundant return
statements
...
Found by gosimple via golangci-lint.
2021-05-12 18:24:16 +03:00
Roman Khimov
8322607fd2
rpc/server: silence deadcode warning
2021-05-12 18:22:18 +03:00
Roman Khimov
73ecbbb7c6
compiler: remove unused testPrintHash from test code
2021-05-12 18:18:49 +03:00
Roman Khimov
cfc067dd24
*: remove dead code
...
Found by deadcode via golangci-lint.
2021-05-12 18:13:14 +03:00
Roman Khimov
fbcb08c5f0
Merge pull request #1957 from nspcc-dev/compiler/static
...
Emit debug info for static variables
2021-05-12 18:12:58 +03:00
Roman Khimov
75a55d910e
Merge pull request #1956 from nspcc-dev/interop/checksig-rename
...
core: rename Neo.Crypto.[CheckSig CheckMultisig] interops
2021-05-12 17:06:39 +03:00
Evgeniy Stratonikov
7b638d5489
compiler: emit debug variable info for _deploy()
2021-05-12 16:04:11 +03:00
Evgeniy Stratonikov
b72f6be9e9
compiler: emit debug variable info for init()
2021-05-12 16:04:06 +03:00
Evgeniy Stratonikov
7afca7f8e5
compiler: add support for static-variables
in debug info
2021-05-12 15:05:39 +03:00
Evgeniy Stratonikov
e8ba386e58
compiler: remove offset comparison from debug test
...
We shouldn't test for them anyway plus the error is more
specific now.
2021-05-12 15:04:46 +03:00
Anna Shaleva
f824789116
core: remove neointerops-related files
...
And move their content to systeminterops-related files.
2021-05-12 13:30:04 +03:00
Anna Shaleva
4b933f88a7
core: simplify interop functions
...
We now have the only interop table (system interops).
2021-05-12 13:30:01 +03:00
Roman Khimov
fec214055f
Merge pull request #1948 from nspcc-dev/extensible-dos
...
Prevent network DoS attack using Extensible payloads
2021-05-12 10:58:51 +03:00
Evgeniy Stratonikov
275a5c9daa
network: limit message number from the same sender
2021-05-12 10:52:11 +03:00
Anna Shaleva
6d59689d9c
core: rename Neo.Crypto.CheckMultisig interop
2021-05-11 18:38:14 +03:00
Anna Shaleva
366e79b9b8
core: rename Neo.Crypto.CheckSig interop
2021-05-11 18:37:55 +03:00
Anna Shaleva
af16c3e009
wallet: add test to regenerate testwallet_NEO3.json
2021-05-11 18:36:30 +03:00
Anna Shaleva
5071173dfd
wallet: add test to regenerate CLI testwallet
2021-05-11 18:36:30 +03:00
Anna Shaleva
5017f2d2e6
wallet: add test to regenerate examples wallet
2021-05-11 18:36:30 +03:00
Anna Shaleva
68d0249c50
wallet: refactor regenerate test
...
Move common code to a separate function.
2021-05-11 18:36:30 +03:00
Anna Shaleva
14189c50aa
wallet: add test to regenerate Oracle testwallets
2021-05-11 18:36:30 +03:00
Anna Shaleva
56a616f21c
wallet: add test to regenerate Notary testwallets
2021-05-11 18:36:30 +03:00
Roman Khimov
3a21d8f44f
Merge pull request #1947 from nspcc-dev/iterator-remove
...
interop: remove `System.Iterator.Create`
2021-05-11 18:29:17 +03:00
Evgeniy Stratonikov
35cdf0447c
extpool/test: remove debug print
2021-05-11 12:16:24 +03:00
Evgeniy Stratonikov
fbf7d9edce
core: drop oracles from extensible whitelist
2021-05-11 12:16:24 +03:00
Evgeniy Stratonikov
23a4e25436
interop: remove System.Iterator.Create
, fix #1935
...
There are now only storage iterators. Related #1933 .
2021-05-11 12:13:30 +03:00
Evgeniy Stratonikov
40d1dd0e0d
native/std: add stringSplit
method
2021-05-11 12:11:38 +03:00
Evgeniy Stratonikov
dadfe2b9ab
native/std: add memorySearch
method
2021-05-11 12:11:38 +03:00
Evgeniy Stratonikov
978f4dfbc5
native/std: add memoryCompare
method
2021-05-11 12:11:38 +03:00
Evgeniy Stratonikov
82a6c3266c
native/std: limit input size for some methods
...
Also fix prices accordingly.
2021-05-11 12:11:38 +03:00
Evgeniy Stratonikov
e4b34833da
native/std: add overloads for itoa
and atoi
2021-05-11 12:11:38 +03:00
Roman Khimov
a4b54b2e8a
Merge pull request #1954 from nspcc-dev/fix-testnet-tests
...
netmode: fix testnet magic
2021-05-11 10:08:36 +03:00
Roman Khimov
3402a3ec30
oracle: send user-agent header with our requests, fix #1923
2021-05-07 16:40:45 +03:00
Roman Khimov
02eb40376e
netmode: fix testnet magic
...
Somehow missed this in 134c7acff1
.
2021-05-07 16:40:08 +03:00
Roman Khimov
39571745cb
stateroot: fix incompleteRoot leak
...
Drop old incomplete roots from the map.
2021-05-07 14:31:20 +03:00
Roman Khimov
3d49f7d99a
stateroot: only send stateroot message once per validators count
...
Actually fix #1922 .
2021-05-07 14:31:20 +03:00
Roman Khimov
4a45abe3e0
stateroot: make vote/root extensibles live less
...
These are arbitrary numbers, but that's what C# node uses. maxRetries could be
set lower because we have exponential backoff anyway, but this works too.
2021-05-07 14:31:20 +03:00
Roman Khimov
7c902669bf
stateroot: implement exponential vote resends
2021-05-07 14:31:20 +03:00
Roman Khimov
d5c7a40db9
stateroot: try finalizing stateroot when adding our signature
...
And don't add/resend it multiple times.
1. We can be in a setup with one SV only and no AddSignature() called at all.
2. AddSignature() might add M-1 signatures and our signature should be the
last one to complete MPTRoot, but we'll never do that.
2021-05-06 23:29:43 +03:00
Roman Khimov
847927af74
stateroot: s/onValidatedRoot/relayExtensible/
...
Makes more sense because it's not just roots that we're relaying.
2021-05-06 22:32:13 +03:00
Roman Khimov
222b4dc920
stateroot: simplify account locking, deduplicate code
2021-05-06 22:17:09 +03:00
Roman Khimov
fc800dcbc1
stateroot: protect incomplete root manipulations in signAndSend
...
We're modifying it here, so there can be a race between this method and
AddSignature().
2021-05-06 21:53:34 +03:00
Roman Khimov
ba5273999f
Merge pull request #1950 from nspcc-dev/nep11/data
...
*: add `data` to NEP11 Transfer
2021-05-06 10:39:56 +03:00
Anna Shaleva
d0c64347ab
*: add data
to NEP11 Transfer
2021-05-05 19:44:29 +03:00
Anna Shaleva
efe9bee1ff
smartcontract: refactor manifest.FromStackItem test
...
We need a good case to ensure that error cases constructed well.
2021-05-05 18:54:42 +03:00
Anna Shaleva
50fc9bf766
smartcontract: use permission descriptors for manifest's trusts
2021-05-05 17:40:10 +03:00
Evgeniy Stratonikov
bb039ef035
manifest: add features
field
2021-05-04 13:10:46 +03:00
Roman Khimov
3acdbbd603
Merge pull request #1918 from nspcc-dev/cli/nep11
...
cli: support NEP11-related commands
2021-04-30 17:10:29 +03:00
Anna Shaleva
e27c894338
rpc: add NEP11 commands which return iterator
...
These are Tokens (optional), TokensOf and OwnerOf (divisible).
2021-04-30 16:23:06 +03:00
Anna Shaleva
9eeebf481c
rpc: allow to marshal Iterators for invoke* results
2021-04-30 16:23:06 +03:00
Anna Shaleva
35ba3d97e6
rpc: export createNEP11TransferTx
...
It'll be used from cli package.
2021-04-30 16:23:06 +03:00
Anna Shaleva
c3264c065d
rpc: check token standard in nepTokenInfo
2021-04-30 16:23:04 +03:00
Anna Shaleva
40ae78cb88
wallet: add Standard
field to Token
...
We need to distinguish NEP11 and NEP17 tokens preesnted in the wallet.
2021-04-30 15:58:27 +03:00
Roman Khimov
8bfb6d7e37
Merge pull request #1942 from nspcc-dev/server/announced_port
...
network: add ability to specify port for P2P version exchange
2021-04-30 14:42:25 +03:00
Anna Shaleva
28b78d1a6c
smartcontract: remove NEP10 standard name
...
It's unused.
2021-04-30 11:38:11 +03:00
Anna Shaleva
bc3a3d103e
rpc: fix (*Client)TransferNEP11D
...
Four args should be specified: from, to, amount and tokenID.
2021-04-30 11:38:11 +03:00
Anna Shaleva
2fb083bd37
rpc: add NEP11TokenInfo method
2021-04-30 11:38:11 +03:00
Anna Shaleva
09bb162de0
network: add ability to specify port for P2P version exchange
2021-04-30 11:27:55 +03:00
Evgeniy Stratonikov
ac601601c1
native: add refuel
method to GAS contract
2021-04-29 18:26:34 +03:00
Evgeniy Stratonikov
0114f9a912
interop: add System.Runtime.BurnGas
2021-04-29 18:23:33 +03:00
Roman Khimov
5924123927
Merge pull request #1939 from nspcc-dev/vm-arith-null
...
Allow NULL items for LT/LE/GT/GE instructions
2021-04-29 17:55:13 +03:00
Roman Khimov
62810bb510
Merge pull request #1941 from nspcc-dev/storage-find-prefix
...
interop: strip full prefix in `System.Storage.Find`
2021-04-29 17:55:00 +03:00
Evgeniy Stratonikov
ffaae0f773
interop: strip full prefix in System.Storage.Find
2021-04-29 17:29:26 +03:00
Roman Khimov
a34a5c1887
Merge pull request #1938 from nspcc-dev/designate-events
...
native: emit `Designation` event on role update
2021-04-29 16:40:32 +03:00
Evgeniy Stratonikov
8fa4a576f4
vm: allow Null arguments for LT,LE,GT,GE opcodes
2021-04-29 16:10:51 +03:00
Evgeniy Stratonikov
dc393642a2
opcode: fix GTE, LTE string representations
2021-04-29 16:08:48 +03:00
Evgeniy Stratonikov
8c3998593e
native: emit Designation
event on role update
2021-04-29 14:12:48 +03:00
Roman Khimov
438eb0c43a
rpc: rename magic to network in JSON
...
Follow neo-modules/neo-core changes. We don't rename structure fields though
to stay compatible with current code (and we do have netmode.Magic to justify
that also).
2021-04-28 23:41:31 +03:00
Evgeniy Stratonikov
da360be5b1
rpc/request: allow to provide bool parameters, fix #1919
2021-04-28 16:44:19 +03:00
Anna Shaleva
0632e15f06
core: add NEP11 to nonfungible supported standards list
2021-04-26 17:56:02 +03:00
Anna Shaleva
127d0ad2ba
rpc: allow to provide cosigners for NEP11-transfer-related commands
2021-04-23 10:45:11 +03:00
Anna Shaleva
49c35dec20
rpc: allow to provide cosigners for NEP17-transfer-related commands
2021-04-23 10:29:40 +03:00
Anna Shaleva
1d6ba389c9
rpc: split SignAndPushInvocationTx in two parts
...
There are several places where constructed transaction need to be
signed and sent. Thus, we definitely need a separate method for signing
and sending constructed transaction to avoid code duplication.
2021-04-23 10:27:47 +03:00
Roman Khimov
8407ae057c
Merge pull request #1912 from nspcc-dev/cli/invoke_with_contract_signer
...
rpc: properly construct cosigners' witnesses in SignAndPushInvocationTx
2021-04-21 19:13:16 +03:00
Anna Shaleva
48ae1cc486
rpc: refactor SignAndPushInvocationTx
...
We have a set of accounts provided via `cosigners` argument, so we
should fill all transaction witnesses in (not only sender's witness).
If we can't properly construct witnesses for all of the signers then an
error should be returned.
2021-04-21 18:52:32 +03:00
Anna Shaleva
f7c65f2b55
core: fix Condition never satisfied
test error
...
This test is failing from time to time.
2021-04-21 11:19:12 +03:00
Anna Shaleva
eaf45d243b
wallet: allow to sign with encrypted contract-based accounts
2021-04-20 14:53:51 +03:00
Roman Khimov
881ed3065e
Merge pull request #1909 from nspcc-dev/cli/default-cosigner-scope
...
cli, rpc: use CalledByEntry as a default cosigner's scope
2021-04-19 14:43:31 +03:00
Anna Shaleva
8f4257639e
rpc: use CalledByEntry as default cosigner's scope
2021-04-19 12:06:13 +03:00
Anna Shaleva
ae36523a61
rpc, internal: fix CodeQL int conversions warnings
...
```
Incorrect conversion of an integer with architecture-dependent bit
size from to a lower bit size type int32 without an upper bound
check.
```
2021-04-19 11:30:28 +03:00
Anna Shaleva
28b74cb647
smartcontract: add ExpandParameterToEmitable method
...
It'll help to convert Parameter to a atandard type which then can be
emitted ass an array item.
2021-04-16 17:30:25 +03:00
Anna Shaleva
f7dcb7ae29
vm: allow emit.Array handle uint256
2021-04-16 16:20:30 +03:00
Anna Shaleva
1d3a297a6b
rpc: add Data field to NEP17 TransferTarget
...
It's a part of transfer, thus it should be passed along with the other
transfer parameters.
2021-04-16 13:54:23 +03:00
Roman Khimov
508ad51a86
core: ignore non-numeric "amounts" in Transfer events
...
Refs. #1900 .
2021-04-12 15:09:37 +03:00
Roman Khimov
13619a0e77
rpc/server: improve submitblock and submitnotaryrequest also
2021-04-10 22:47:24 +03:00
Roman Khimov
274f2c0408
rpc/server: be more specific in some sendrawtransaction error cases
...
Refs. #1894 .
2021-04-10 00:31:42 +03:00
Roman Khimov
973ed8c1f6
rpc/server: fix ineffassign warning
2021-04-08 15:52:57 +03:00
Roman Khimov
d3ea720afb
result: gofmt -s
2021-04-08 15:49:14 +03:00
Roman Khimov
46d866965d
Merge pull request #1889 from nspcc-dev/tune-logging
...
Tune logging
2021-04-07 20:58:52 +03:00
Roman Khimov
1785a333d2
core: tune "blockchain persist completed" message
...
It's misleading, we're writing it on disk-level persistence, it's not the same
as block "persistence" in C#, so we better write it clear.
2021-04-07 18:14:30 +03:00
Roman Khimov
453012ff16
runtime: tune runtime.Log messages
...
Add transaction hash, print contract hash in LE (as all user-facing functions
do) and don't double-quote the message, zap already does quoting of its own.
2021-04-07 18:14:30 +03:00
Roman Khimov
e2121ff583
core: fix key clashes in Storage.Find
...
Fixes #1873 . NewByteArray() doesn't copy the slice, so we need to do it
ourselves.
2021-04-07 14:52:50 +03:00
Roman Khimov
9b15ab48ad
core: restore MPT collapsing logic
...
Fix #1867 , revert part of bf20db09e0
.
2021-04-07 11:14:18 +03:00
Roman Khimov
555693d8b8
oracle: add MinimumResponseGas to interop
...
It's important for users of oracle contract.
2021-04-06 22:50:42 +03:00
Roman Khimov
ed358b4c4c
native: expose MinimumResponseGas, add specific error for it
2021-04-06 22:50:42 +03:00
Roman Khimov
090d68f8fa
oracle: add response codes to interop defintions
...
Client should be aware of them.
2021-04-06 22:50:42 +03:00
Roman Khimov
bba22cb736
transaction: marshal oracle response codes as strings
...
C# node does it this way.
2021-04-06 22:50:42 +03:00
Roman Khimov
607cdcf13d
oracle: improve oracle interop documentation
2021-04-06 22:50:42 +03:00
Roman Khimov
7a1c1638e4
oracle: specify neofs timeout as timeout, set default if 0
...
There has to be some sane default and we'd like configuration to be consistent
with other timeout values.
2021-04-06 17:08:04 +03:00
Roman Khimov
f69fd34220
oracle: add logging, refactor request processing a bit
...
And return more appropriate errors in some cases.
2021-04-06 17:02:32 +03:00
Roman Khimov
d2f7f00997
oracle: change neofs URI scheme
...
Strip '//', see neo-project/neo-modules#518 .
2021-04-06 16:56:19 +03:00
Roman Khimov
bd9a303e29
oracle: URI host validation is only relevant for https
...
NeoFS doesn't have hosts.
2021-04-06 16:53:32 +03:00
Roman Khimov
29b79db998
oracle: we only work with https, forget http
2021-04-06 16:53:18 +03:00
Roman Khimov
7e9f8e03c2
compiler: add a test for inlined selector statements
...
Selector here is either a struct field access or global package
variable/constant. While technically none of these require an additional
local, inlining actually uses one, so add a test for it.
2021-04-06 10:54:37 +03:00
Roman Khimov
21a7f3d760
compiler: keep traversing after c.countLocalsCall()
...
Some arguments can be inlined functions themselves thus requiring additional
attention. Otherwise we can get less local variables than really used by
STLOCs (and subsequent program crash).
2021-04-05 22:58:07 +03:00
Roman Khimov
84b240cc9a
services/consensus: add some logging on start
2021-04-02 13:13:26 +03:00
Roman Khimov
99b71bbbd1
network: move service starts to tryStartServices
...
All of them only make sense on a fully synchronized node, doing anything
during the initial sync is just a waste of time.
2021-04-02 13:12:06 +03:00
Roman Khimov
690a1db589
network: replace consensusStarted/canHandleExtens with syncReached flag
...
They're essentially the same.
2021-04-02 12:55:56 +03:00
Roman Khimov
a954821b98
consensus: make Shutdown a no-op if not started
...
It makes client code a bit simpler, we can just issue a Shutdown() request
without thinking much about it (but only once of course).
2021-04-02 12:50:46 +03:00
Roman Khimov
a01636a1b0
stateroot: set networking callback in a more straightforward way
2021-04-02 12:12:36 +03:00
Roman Khimov
4d0cbebb5a
stateroot: make it shutdown properly, not locking up whole system
2021-04-02 11:38:49 +03:00
Roman Khimov
863b9550e6
rpcbroadcaster: don't mess with the URL from the config
...
It can be http://, it can be https://, it's not up to rpcbroadcaster to change
it in any way.
2021-04-02 11:13:38 +03:00
Anna Shaleva
58ab3b5ad1
core: get native nep17 balance from contract storage
...
Not from DAO's items with storage.STNEP17Balances prefix, because
changes are reflected there only after notifications processing. And
this happens only after the transaction script is executed, but there
might be cases when we need to get the balance that was updated
earlier during the same transaction processing.
Affects storage dumps.
2021-04-01 18:37:44 +03:00
Roman Khimov
2c8f8bf3ec
Merge pull request #1871 from nspcc-dev/mpt/serialisation-fix
...
mpt: refactor serialisation
2021-04-01 11:01:38 +03:00
Anna Shaleva
8c358aa556
mpt: change MaxKeyLength for LeafNode
2021-04-01 10:20:16 +03:00
Anna Shaleva
7f038bd465
mpt: split HashNode in two types
...
First type is non-empty HashNode, and the second one is an Empty node.
2021-04-01 10:19:57 +03:00
Anna Shaleva
b9927c39ee
mpt: refactor nodes serialisation
...
It should be serialised with type in case if it's a children node.
The type can be either HashT or EmptyT.
2021-04-01 10:19:57 +03:00
Anna Shaleva
6e836d325e
mpt: increase max leaf value length
2021-04-01 10:17:08 +03:00
Anna Shaleva
f0c222b385
core: move StorageItem-related constants to storage
pkg
...
Need this to avoid import cycle problem.
2021-04-01 10:17:08 +03:00
Anna Shaleva
ec19a087bb
core: remove StorageFlag remnant
2021-04-01 10:17:08 +03:00
Anna Shaleva
7dc9f0bde2
mpt: swap Leaf and Node types
2021-04-01 10:17:08 +03:00
Anna Shaleva
1ba7338b07
rpc: fix mpt-related responses serialisation
...
MPT structures should be serialized in base64.
2021-04-01 10:17:03 +03:00
Anna Shaleva
f57187e611
vm: throw unhandled exception with message instead of panic
...
The result is the same HALT state, but the exception message is the real
one got from user. Changes ported from C#:
1. Throw exception: 59b8ac73d2/src/neo-vm/ExecutionEngine.cs (L1448)
2. Prettify message: https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/VMUnhandledException.cs#L28
The result is that instead of
```
2021-03-31T17:02:54.508+0300 WARN contract invocation failed {"tx": "2aefeb705f3a609df8767d9b45e036b9dd1eb77407e5732375981915668889b8", "block": 30640, "error": "error encountered at instruction 970 (THROW): runtime error: invalid memory address or nil pointer dereference"}
```
we'll get
```
2021-03-31T17:33:56.299+0300 WARN contract invocation failed {"tx": "2aefeb705f3a609df8767d9b45e036b9dd1eb77407e5732375981915668889b8", "block": 30640, "error": "error encountered at instruction 970 (THROW): unhandled exception: No authorization."}
```
in the node logs.
2021-03-31 19:37:52 +03:00
Anna Shaleva
93530fa8fa
core: pop all args from stack before validation checks in Notify
...
We should match the C# behaviour.
2021-03-31 19:01:05 +03:00
Anna Shaleva
793f27084b
vm: specify syscall ID when panicing on syscall invocation
...
It's convinient to know the failing syscall without dumping
smartcontract instructions.
2021-03-31 19:00:59 +03:00
Anna Shaleva
b7194ec608
core: put candidate account to the storage during (*NEO).vote
...
C# node uses Snapshot.GetAndChange to get it from storage, so it's the
same problem as with voting account. Affects dumps.
2021-03-29 17:06:37 +03:00
Anna Shaleva
c63528db44
core: put voiting account to the storage during (*NEO).vote
...
After getting account from the storage there are a lot of checks which
may fail. But C# node uses Snapshot.GetAndChange, so the account state
should be put in the storage even in case of vote failure. Affects
dumps.
2021-03-29 17:04:20 +03:00
Anna Shaleva
3d8d927178
core: check candidate is registered at the start of voiting
...
C# node returns an error if the candidate is not registered. We have this
check inside the ModifyAccountVotes, but (*NEO).vote doesn't panics and
just return bool on stack, so we should match exactly the C#'s
algorithm.
2021-03-29 17:04:15 +03:00
Roman Khimov
5b4f6d255f
Merge pull request #1857 from nspcc-dev/rpc/nep11
...
rpc: add NEP11 and NNS interfaces to RPC Client
2021-03-27 18:27:29 +03:00
Roman Khimov
afb4c1e5e2
Merge pull request #1858 from nspcc-dev/rpc/calculatenetworkfee
...
rpc: add `calculatenetworkfee` RPC method
2021-03-27 15:08:42 +03:00
Roman Khimov
3b4dde05c3
stateroot: handle ErrStateMismatch internally
...
It's a local problem and returning error from here leads to peer disconnect
that isn't solving anything.
2021-03-27 00:33:11 +03:00
Roman Khimov
216513e14f
stateroot: reject validated root if it doesn't match local one
...
Prevent
2021-03-27T00:05:23.382+0300 WARN blockQueue: failed adding block into the blockchain {"error": "error while trying to apply MPT changes: key not found", "blockHeight": 12757, "nextIndex": 12758}
after node restart (node reads "local" root hash that it doesn't have).
2021-03-27 00:33:11 +03:00
Roman Khimov
d143696328
stateroot: try to fix MPT caching/updating
...
It was completely ruined by bf20db09e0
. MPT was
updating bc.dao directly which shouldn't ever happen, it must write into the
same cache and then Persist these KVs as usual.
2021-03-27 00:33:11 +03:00
Roman Khimov
56fd375c6d
core: move stateroot check into header check
...
As it's a part of the header.
2021-03-27 00:33:11 +03:00
Roman Khimov
1fdd406234
stateroot: drop unused function
2021-03-27 00:33:11 +03:00
Roman Khimov
042aef452d
stateroot: Extensible messages must have proper category
2021-03-27 00:33:11 +03:00
Anna Shaleva
ffc2ad3cc3
rpc: check RPC client is initialised where appropriate
...
We don't need magic to create tx anymore, but we need it to sign tx.
2021-03-26 20:51:17 +03:00
Anna Shaleva
626ec8a82b
rpc: add resolve
and isAvailable
NNS API to RPC client
2021-03-26 20:48:07 +03:00
Anna Shaleva
f955589370
rpc: add NEP11 API support to the RPC client
2021-03-26 20:48:01 +03:00
Anna Shaleva
2bb3ff2aff
vm: return more detailed error from emit.Array
2021-03-26 20:44:32 +03:00
Anna Shaleva
ad9ede455e
rpc: add NNS-connected transactions to the test chain
...
It is needed for RPC client integration tests.
2021-03-26 20:44:32 +03:00
Anna Shaleva
a2a9d7ff05
core: move NNS record types to a separate package
...
We need this to avoid `native` dependency in RPC client.
2021-03-26 20:44:32 +03:00
Anna Shaleva
347f7ed576
rpc: move all top*FromStack
client functions to a separate file
...
Some of them are shared between multiple RPC client APIs, so let's keep
them in a separate place for better maintainability.
2021-03-26 20:44:32 +03:00
Anna Shaleva
30e7d9a8b0
rpc: remove duplicated code from CreateNEP17MultiTransferTx
2021-03-26 20:44:32 +03:00
Anna Shaleva
bcc5c055de
rpc: allow to calculatenetworkfee
for verify
with args
...
We can load invocation script for those contract-based witnesses which
requires arguments for `verify` methods.
2021-03-26 19:16:00 +03:00
Anna Shaleva
252e03bc34
rpc: add CalculateNetworkFee RPC method
2021-03-26 19:14:46 +03:00
Anna Shaleva
d2a81daf57
rpc: refactor TestCalculateNetworkFee
...
We need to ensure that we don't add extra network fee during
calculation.
2021-03-26 19:12:43 +03:00
Roman Khimov
6989769f2c
rpc/server: fix getversion reply for staterootinheader extension
...
Proper network should have it set to `true` and client should know about it.
2021-03-26 18:38:46 +03:00
Roman Khimov
546faf5e70
Merge pull request #1859 from nspcc-dev/rework-signing-fix-stateroots
...
Rework signing, fix stateroots
2021-03-26 14:04:23 +03:00
Roman Khimov
5569512ce9
stateroot: fix missing verification script
...
Stateroot payload must have it.
2021-03-26 13:45:18 +03:00
Roman Khimov
5f7ec6e784
state: fix MPTRoot JSONization
...
Match C# implementation. It's easier to do this by changing the structure
itself.
2021-03-26 13:45:18 +03:00