Commit graph

1691 commits

Author SHA1 Message Date
Roman Khimov
21e05f5779
Merge pull request #2055 from nspcc-dev/fix-gas-limits
Tune fixed GAS limits
2021-07-16 16:53:06 +03:00
Evgeniy Stratonikov
8077f9232d interop: implement System.Runtime.GetRandom
Our murmur3 implementation is architecture independent and optimized in
assembly.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 16:00:01 +03:00
Evgeniy Stratonikov
fdb54f2dc3 core/test: get rid of empty tx scripts
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Evgeniy Stratonikov
3a4e0caeb8 core/block: add Nonce field to header
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Evgeniy Stratonikov
2cd5b63f0b policy: fix max exec fee
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-14 10:27:09 +03:00
Evgeniy Stratonikov
451b02122a *: increase GAS for verification
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-14 10:27:09 +03:00
Roman Khimov
2b7abd20e7
Merge pull request #2057 from nspcc-dev/optimize-storage-find
Optimize `storageFind`
2021-07-13 12:51:10 +03:00
Roman Khimov
83a557f0eb
Merge pull request #2042 from nspcc-dev/oracle-not-supported
Check oracle response Content-Type header
2021-07-13 11:31:37 +03:00
Evgeniy Stratonikov
eb7bd7b99b core: optimize storageFind
Because `Map` stores elements in arbitrary order, addition of new
element takes linear time (`Index` iterates over all keys). Thus our
`storageFind` is actually quadratic in time. Optimize this by creating
map from sorted slice.

```
name           old time/op    new time/op    delta
StorageFind-8     157µs ± 2%     112µs ± 1%  -28.60%  (p=0.000 n=10+10)

name           old alloc/op   new alloc/op   delta
StorageFind-8    69.4kB ± 0%    60.5kB ± 0%  -12.90%  (p=0.000 n=9+10)

name           old allocs/op  new allocs/op  delta
StorageFind-8     2.21k ± 0%     2.00k ± 0%   -9.37%  (p=0.000 n=10+7)
```

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:22:17 +03:00
Evgeniy Stratonikov
b8b272c8c4 core/test: add benchmark for storageFind
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:20:45 +03:00
Evgeniy Stratonikov
0d5ede0bff core/test: use testing.TB in constructors
This allows to use chain in benchmarks.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:20:45 +03:00
Evgeniy Stratonikov
9f377cde12 storage: convert key once in MemoryStore.seek
There is no need in additional allocations.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 14:14:32 +03:00
Evgeniy Stratonikov
8e9302f40b oracle: check response Content-Type
If not specified everything is allowed.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-12 13:13:48 +03:00
Roman Khimov
bc5a1b7bcd
Merge pull request #2043 from nspcc-dev/runtime-getnetwork
interop/runtime: add `System.Runtime.GetNetwork`, fix #2038
2021-07-12 10:46:41 +03:00
Roman Khimov
1853d0c713 core: don't copy config in ApplyPolicyToTxSet
Makes no sense, GetConfig() is for external users.
2021-07-09 13:01:42 +03:00
Evgeniy Stratonikov
96a42cd011 interop: add System.Runtime.GetNetwork, fix #2038
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-08 17:02:37 +03:00
Roman Khimov
7bc7457fbe
Merge pull request #2050 from nspcc-dev/fix-network-test-race
Fix some test failures
2021-07-08 14:50:50 +03:00
Roman Khimov
bd400dfe20 native: copy contract on update
It can be a pointer to cached data:

2021-07-07T20:05:24.8508647Z ==================
2021-07-07T20:05:24.8509294Z WARNING: DATA RACE
2021-07-07T20:05:24.8510243Z Write at 0x00c000142cc8 by goroutine 51:
2021-07-07T20:05:24.8511350Z   github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).Update()
2021-07-07T20:05:24.8529622Z       /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:335 +0x70a
2021-07-07T20:05:24.8531266Z   github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).updateWithData()
2021-07-07T20:05:24.8532544Z       /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:316 +0x1e9
2021-07-07T20:05:24.8533726Z   github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).update()
2021-07-07T20:05:24.8534928Z       /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:303 +0x111
2021-07-07T20:05:24.8536123Z   github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).update-fm()
2021-07-07T20:05:24.8537389Z       /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:302 +0x34
2021-07-07T20:05:24.8538462Z   github.com/nspcc-dev/neo-go/pkg/core/native.Call()
2021-07-07T20:05:24.8539565Z       /home/runner/work/neo-go/neo-go/pkg/core/native/interop.go:54 +0x90c
2021-07-07T20:05:24.8540751Z   github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler()
2021-07-07T20:05:24.8542177Z       /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:262 +0x216
2021-07-07T20:05:24.8543328Z   github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler-fm()
2021-07-07T20:05:24.8544586Z       /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:250 +0x53
2021-07-07T20:05:24.8545648Z   github.com/nspcc-dev/neo-go/pkg/vm.(*VM).execute()
2021-07-07T20:05:24.8546635Z       /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:1312 +0xb2d5
2021-07-07T20:05:24.8547632Z   github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Step()
2021-07-07T20:05:24.8548640Z       /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:416 +0x1f2
2021-07-07T20:05:24.8549836Z   github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Run()
2021-07-07T20:05:24.8550852Z       /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:393 +0x195
2021-07-07T20:05:24.8551989Z   github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).runScriptInVM()
2021-07-07T20:05:24.8553174Z       /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:1326 +0x7eb
2021-07-07T20:05:24.8554345Z   github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).invokeFunction()
2021-07-07T20:05:24.8555560Z       /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:1219 +0x50c
2021-07-07T20:05:24.8556616Z   github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleIn()
2021-07-07T20:05:24.8557823Z       /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:345 +0xecb
2021-07-07T20:05:24.8558987Z   github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleRequest()
2021-07-07T20:05:24.8560356Z       /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:315 +0x364
2021-07-07T20:05:24.8561599Z   github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleHTTPRequest()
2021-07-07T20:05:24.8562976Z       /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:309 +0xf9b
2021-07-07T20:05:24.8564208Z   github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleHTTPRequest-fm()
2021-07-07T20:05:24.8565523Z       /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:257 +0x64
2021-07-07T20:05:24.8566348Z   net/http.HandlerFunc.ServeHTTP()
2021-07-07T20:05:24.8567290Z       /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2042 +0x51
2021-07-07T20:05:24.8568185Z   net/http.serverHandler.ServeHTTP()
2021-07-07T20:05:24.8569130Z       /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2843 +0xca
2021-07-07T20:05:24.8569861Z   net/http.(*conn).serve()
2021-07-07T20:05:24.8570634Z       /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:1925 +0x84c
2021-07-07T20:05:24.8571139Z
2021-07-07T20:05:24.8571639Z Previous read at 0x00c000142cc8 by goroutine 41:
2021-07-07T20:05:24.8572892Z   github.com/nspcc-dev/neo-go/pkg/core/interop/contract.callExFromNative()
2021-07-07T20:05:24.8574265Z       /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:101 +0x2d4
2021-07-07T20:05:24.8575581Z   github.com/nspcc-dev/neo-go/pkg/core/interop/contract.callInternal()
2021-07-07T20:05:24.8576951Z       /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:85 +0x1f5
2021-07-07T20:05:24.8578094Z   github.com/nspcc-dev/neo-go/pkg/core/interop/contract.Call()
2021-07-07T20:05:24.8579306Z       /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:69 +0x804
2021-07-07T20:05:24.8580514Z   github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler()
2021-07-07T20:05:24.8581755Z       /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:262 +0x216
2021-07-07T20:05:24.8582907Z   github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler-fm()
2021-07-07T20:05:24.8584300Z       /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:250 +0x53
2021-07-07T20:05:24.8585422Z   github.com/nspcc-dev/neo-go/pkg/vm.(*VM).execute()
2021-07-07T20:05:24.8586403Z       /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:1312 +0xb2d5
2021-07-07T20:05:24.8590451Z   github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Step()
2021-07-07T20:05:24.8591549Z       /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:416 +0x1f2
2021-07-07T20:05:24.8592466Z   github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Run()
2021-07-07T20:05:24.8593550Z       /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:393 +0x195
2021-07-07T20:05:24.8594531Z   github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).storeBlock()
2021-07-07T20:05:24.8595708Z       /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:717 +0x1694
2021-07-07T20:05:24.8596793Z   github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).AddBlock()
2021-07-07T20:05:24.8598142Z       /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:579 +0x544
2021-07-07T20:05:24.8599419Z   github.com/nspcc-dev/neo-go/pkg/consensus.(*service).processBlock()
2021-07-07T20:05:24.8601093Z       /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:521 +0x141
2021-07-07T20:05:24.8602485Z   github.com/nspcc-dev/neo-go/pkg/consensus.(*service).processBlock-fm()
2021-07-07T20:05:24.8603809Z       /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:517 +0x55
2021-07-07T20:05:24.8604910Z   github.com/nspcc-dev/dbft.(*DBFT).checkCommit()
2021-07-07T20:05:24.8606098Z       /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/check.go:73 +0xd8a
2021-07-07T20:05:24.8607235Z   github.com/nspcc-dev/dbft.(*DBFT).checkPrepare()
2021-07-07T20:05:24.8608551Z       /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/check.go:36 +0x677
2021-07-07T20:05:24.8609681Z   github.com/nspcc-dev/dbft.(*DBFT).sendPrepareRequest()
2021-07-07T20:05:24.8611016Z       /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/send.go:42 +0x47c
2021-07-07T20:05:24.8612107Z   github.com/nspcc-dev/dbft.(*DBFT).OnTimeout()
2021-07-07T20:05:24.8613257Z       /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:188 +0x68c
2021-07-07T20:05:24.8614499Z   github.com/nspcc-dev/neo-go/pkg/consensus.(*service).eventLoop()
2021-07-07T20:05:24.8615712Z       /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:274 +0x17ed
2021-07-07T20:05:24.8616284Z
2021-07-07T20:05:24.8616757Z Goroutine 51 (running) created at:
2021-07-07T20:05:24.8617367Z   net/http.(*Server).Serve()
2021-07-07T20:05:24.8618159Z       /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2969 +0x5d3
2021-07-07T20:05:24.8619253Z   github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).Start.func2()
2021-07-07T20:05:24.8620437Z       /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:224 +0x85
2021-07-07T20:05:24.8620936Z
2021-07-07T20:05:24.8621405Z Goroutine 41 (running) created at:
2021-07-07T20:05:24.8622393Z   github.com/nspcc-dev/neo-go/pkg/consensus.(*service).Start()
2021-07-07T20:05:24.8623562Z       /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:250 +0x17c
2021-07-07T20:05:24.8624682Z   github.com/nspcc-dev/neo-go/pkg/network.(*Server).tryStartServices()
2021-07-07T20:05:24.8626078Z       /home/runner/work/neo-go/neo-go/pkg/network/server.go:445 +0x2e1
2021-07-07T20:05:24.8627226Z   github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start()
2021-07-07T20:05:24.8628333Z       /home/runner/work/neo-go/neo-go/pkg/network/server.go:268 +0x2af
2021-07-07T20:05:24.8628973Z ==================
2021-07-08 10:40:54 +03:00
Roman Khimov
ea9dde257c
Merge pull request #2047 from nspcc-dev/fix-state
Don't create an extension node for the last branch child
2021-07-08 10:20:59 +03:00
Evgeniy Stratonikov
a33e422b79 mpt: do not create an Extension for the last child of a Branch
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-07 15:49:53 +03:00
Evgeniy Stratonikov
25428d53f1 mpt: strip branch node in a simple implementation
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-07 15:47:07 +03:00
Roman Khimov
0cd9cd0c80 state/result: save/return real JSONization errors
Don't hide/obfuscate real problems.
2021-07-07 00:42:36 +03:00
Roman Khimov
e62a766058 state: move nil check down to stackitem JSON processing
We want to return real errors, not some generic thing for any kind of thing
happening.
2021-07-07 00:38:19 +03:00
Roman Khimov
0de949b575 stackitem: remove Item/StackItem from function names
They're useless in a package named 'stackitem', make this package a bit more
user-friendly.
2021-07-06 19:56:23 +03:00
Evgeniy Stratonikov
9691eee10c mpt: strip branch if 1 child is left
If the child left is a hash node, we should retrieve it from store.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-05 11:04:20 +03:00
Evgeniy Stratonikov
d2e8254848 native: fix typo in comments
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-05 11:04:19 +03:00
Evgeniy Stratonikov
a7722f0fa5 native: save balance value in storage for failed transfers
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-05 11:03:42 +03:00
Roman Khimov
e3323faf69
Merge pull request #2032 from nspcc-dev/optimize-restore
native: cache GAS per vote values
2021-07-01 15:17:37 +03:00
Evgeniy Stratonikov
0591366f85 native: cache GAS per vote values
`storage.Seek()` is rather expensive and we need only last updated value
of gas per block in `PostPersist()`.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-01 10:34:04 +03:00
Anna Shaleva
9673a04009 core: allow to add several headers with StateRootInHeader on
Problem: with StateRootInHeader setting on only one header of height N+1
can be added to the chain of height N, because we need local stateroot
to verify headers (which is calculated for the last stored block N).
Thus, adding chunk of headers starting from the current chain's heigh
is impossible and (*Blockchain).AddHeaders doesn't have much sense.

Solution: verify header.PrevStateRoot only for header N+1. Rest of the
headers should be added without PrevStateRoot verification.
2021-06-30 11:56:05 +03:00
Anna Shaleva
d49294b046 core: fix the way candidates are sorted
(*NEO).GetCandidates along with getCandidatesCall use candidates sorted
by serialized ECPoint bytes.

(*NEO).computeCommitteeMembers use candidates sorted by votes, and then
by deserialized ECPoint, i.e. using default ECPoint comparator.
2021-06-16 17:35:04 +03:00
Anna Shaleva
50296975e2 crypto: allow to provide non-default scrypt parameters 2021-06-11 15:22:28 +03:00
Anna Shaleva
6ff64153db core: check stored native states against autogenerated ones on start 2021-06-10 22:16:05 +03:00
Anna Shaleva
be902afe9e core: do not allow NEP17 roundtrip in case of insufficient funds
NEP17 roundtrip is prohibited if from account doesn't have enough funds.

This commit fixes states diff in block 92057 where account
NfuwpaQ1A2xaeVbxWe8FRtaRgaMa8yF3YM initiates two NEO roundtrips with
amount exceeding the account's balance:

block 92057: value mismatch for key +////xTbYWBH3r5qhRKZAPFPHabKfb2vhQ==: QQMhAkwBIQOZZwEA vs QQMhAkwBIQN/ZwEA
block 92057: value mismatch for key +v///ws=: kqlddcitCg== vs tphddcitCg==
block 92057: value mismatch for key +v///xTbYWBH3r5qhRKZAPFPHabKfb2vhQ==: QQEhBUWyDu0W vs QQEhBWmhDu0W

C#'s applog (contains False and False on stack for both transfers):
```
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "gasconsumed" : "11955500",
            "exception" : null,
            "stack" : [
               {
                  "value" : false,
                  "type" : "Boolean"
               },
               {
                  "value" : false,
                  "type" : "Boolean"
               }
            ],
            "vmstate" : "HALT",
            "trigger" : "Application",
            "notifications" : []
         }
      ],
      "txid" : "0x8e73a7e9a566a514813907272ad65fc965002c3b098eacc5bdda529af19d7688"
   }
}
```

Go's applog (both transfers succeeded and GAS minted):
```
{
   "result" : {
      "executions" : [
         {
            "gasconsumed" : "11955500",
            "trigger" : "Application",
            "stack" : [
               {
                  "type" : "Boolean",
                  "value" : true
               },
               {
                  "type" : "Boolean",
                  "value" : true
               }
            ],
            "vmstate" : "HALT",
            "notifications" : [
               {
                  "eventname" : "Transfer",
                  "contract" : "0xd2a4cff31913016155e38e474a2c06d08be276cf",
                  "state" : {
                     "value" : [
                        {
                           "type" : "Any"
                        },
                        {
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
                           "type" : "ByteString"
                        },
                        {
                           "value" : "4316",
                           "type" : "Integer"
                        }
                     ],
                     "type" : "Array"
                  }
               },
               {
                  "state" : {
                     "type" : "Array",
                     "value" : [
                        {
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
                           "type" : "ByteString"
                        },
                        {
                           "type" : "ByteString",
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U="
                        },
                        {
                           "type" : "Integer",
                           "value" : "1111111111"
                        }
                     ]
                  },
                  "contract" : "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
                  "eventname" : "Transfer"
               },
               {
                  "contract" : "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
                  "state" : {
                     "type" : "Array",
                     "value" : [
                        {
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
                           "type" : "ByteString"
                        },
                        {
                           "type" : "ByteString",
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U="
                        },
                        {
                           "type" : "Integer",
                           "value" : "1111111"
                        }
                     ]
                  },
                  "eventname" : "Transfer"
               }
            ]
         }
      ],
      "txid" : "0x8e73a7e9a566a514813907272ad65fc965002c3b098eacc5bdda529af19d7688"
   },
   "id" : 1,
   "jsonrpc" : "2.0"
}
```
2021-06-09 13:36:50 +03:00
Anna Shaleva
20e0a0d746 core: add price for CALLT instruction 2021-06-07 19:17:22 +03:00
Evgeniy Stratonikov
f3d02b9fef mpt/tests: add compatibility tests 2021-06-04 11:09:17 +03:00
Evgeniy Stratonikov
e833d333fe mpt: disallow empty keys
This is not a problem in practice, as all keys are prefixed
by a contract ID. However in theory it can lead to a different
state root after new portion of changes thus this fix.
2021-06-04 11:09:17 +03:00
Evgeniy Stratonikov
5b1f6207de mpt: reduce max key length
The constant used is actually a nibbled-path restriction.
Clarify this and make them private.
2021-06-04 11:09:17 +03:00
Anna Shaleva
b8e96ac82b core: move mempool.Event to a separate package
And write a marshaller for EventType, it'll be reused by the Notification
subsystem.
2021-06-01 12:24:28 +03:00
Anna Shaleva
999fba81cd core: export (*NEOBalanceState).FromStackItem 2021-05-31 11:18:54 +03:00
Roman Khimov
b858be63b4
Merge pull request #1969 from nspcc-dev/examples/nns-fix
examples: fix IPv6 bounds check
2021-05-28 14:29:54 +03:00
Anna Shaleva
2a9ce03376 examples: fix IPv6 bounds check 2021-05-28 11:31:09 +03:00
Evgeniy Stratonikov
233996eec0 native/neo: add getAccountState method, close #1975 2021-05-27 10:59:38 +03:00
Evgeniy Stratonikov
192771a58a native/std: add base58Check* methods, close #1974 2021-05-25 17:32:19 +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
Evgeniy Stratonikov
33e1e61343 config: make MaxValidUntilBlockIncrement configurable 2021-05-17 13:43:03 +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
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
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
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
e9cefc4bfc *: fix all errcheck warnings in testing code 2021-05-12 21:45:12 +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
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
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
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
cfc067dd24 *: remove dead code
Found by deadcode via golangci-lint.
2021-05-12 18:13:14 +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
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
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
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
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
3402a3ec30 oracle: send user-agent header with our requests, fix #1923 2021-05-07 16:40:45 +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
Anna Shaleva
d0c64347ab *: add data to NEP11 Transfer 2021-05-05 19:44:29 +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
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
Anna Shaleva
0632e15f06 core: add NEP11 to nonfungible supported standards list 2021-04-26 17:56:02 +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
Roman Khimov
508ad51a86 core: ignore non-numeric "amounts" in Transfer events
Refs. #1900.
2021-04-12 15:09:37 +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
ed358b4c4c native: expose MinimumResponseGas, add specific error for it 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
29b79db998 oracle: we only work with https, forget http 2021-04-06 16:53:18 +03:00
Roman Khimov
a01636a1b0 stateroot: set networking callback in a more straightforward way 2021-04-02 12:12:36 +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
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
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
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
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
252e03bc34 rpc: add CalculateNetworkFee RPC method 2021-03-26 19:14:46 +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
Roman Khimov
b3f9cd1541 dao: drop network from DAO
Not used any more.
2021-03-26 13:45:18 +03:00
Roman Khimov
c789431402 payload: drop Network from P2PNotaryRequest
It's not needed now.
2021-03-26 13:45:18 +03:00
Roman Khimov
8c110a6147 state: drop Network from MPTRoot structure
It's only needed to verify/sign.
2021-03-26 13:45:18 +03:00
Roman Khimov
95c279325a block: drop Network from the Header
It's not network-tied any more, network is only needed to
sign/verify. Unfortunately we still have to keep network in consensus data
structures because of dbft library interface.
2021-03-26 13:45:18 +03:00
Roman Khimov
d314f82db3 transaction: drop Network from Transaction
We only need it when signing/verifying.
2021-03-26 13:45:18 +03:00
Roman Khimov
df12adaa9e crypto: remove crypto.Verifiable interface
We can now verify any hash.Hashable thing.
2021-03-26 13:45:18 +03:00
Roman Khimov
0248e2c0d2 state: add network to MPTRoot, change hashing
Fix RC1 incompatibility.
2021-03-25 22:37:30 +03:00
Anna Shaleva
1e649bc9a0 core: move NotaryVerificationPrice to a separate package
It is needed to avoid `native` dependency in RPC client.
2021-03-23 13:56:39 +03:00
Anna Shaleva
681bd89cc7 core: move native node roles to a separate pkg
We need this to avoid `native` dependency in the RPC client.
2021-03-23 13:56:34 +03:00
Roman Khimov
28da00f057
Merge pull request #1852 from nspcc-dev/tests/fix-rubles-contract
rpc: refactor Rubl test contract
2021-03-22 15:55:51 +03:00
Anna Shaleva
6b36590181 core: ensure all transactions are HALT while creating test chain 2021-03-22 15:35:22 +03:00
Anna Shaleva
0a5072a1da core: allow to compile test contracts with yaml config
And refactored Rubl test contract (it should support NEP-17 and
onNEP17Payment).
2021-03-22 15:32:26 +03:00
Roman Khimov
20144e6137 *: fix some misspellings spotted by GoReportCard 2021-03-22 12:13:08 +03:00
Anna Shaleva
96e198de97 core: fix Management.GetContract 2021-03-19 20:44:21 +03:00
Roman Khimov
57d4990fe6
Merge pull request #1850 from nspcc-dev/fex-storage-price
core: fix storage.Put price
2021-03-19 19:10:22 +03:00
Anna Shaleva
7118eae467 core: remove useless code from putWithContext 2021-03-19 18:57:29 +03:00
Anna Shaleva
5b18f5974f core: fix storage.Delete price 2021-03-19 18:57:00 +03:00
Anna Shaleva
0bca63b907 core: fix storage.Put price 2021-03-19 18:41:33 +03:00
Roman Khimov
b56e028733 *: add more package-specific documentation
For the most important packages at least.
2021-03-19 16:18:45 +03:00
Anna Shaleva
e5cdecfa9f core: fix transaction hashes 2021-03-18 17:57:54 +03:00
Roman Khimov
42465dd002
Merge pull request #1825 from nspcc-dev/fix-invokecontractverify
rpc: refactor invokecontractverify
2021-03-17 18:08:23 +03:00
Roman Khimov
0de72f1dc9 core: fix call flags for Native(On|Post)Persist
See neo-project/neo#2339.
2021-03-16 22:49:14 +03:00
Roman Khimov
d1251b8daf core: don't limit on/postPersist methods
They read/write/call/notify, so they need everything.
2021-03-16 22:48:32 +03:00
Roman Khimov
304b9ad3d4 contract: disable notifications for safe methods
See neo-project/neo#2339.
2021-03-16 22:47:49 +03:00
Roman Khimov
025330f132
Merge pull request #1832 from nspcc-dev/consensus/microfixes
consensus: add MaxBlockSize and MaxBlockSysFee settings
2021-03-16 18:11:33 +03:00
Anna Shaleva
0d9266d407 core: remove System.Contract.IsStandard 2021-03-16 16:59:23 +03:00
Roman Khimov
a18fbc7bb1
Merge pull request #1827 from nspcc-dev/native/update_history
config: add NativeUpdateHistory
2021-03-16 12:47:22 +03:00
Anna Shaleva
20b70ee9fe config: add MaxBlockSystemFee setting 2021-03-16 12:09:11 +03:00
Anna Shaleva
8f06bf21d7 config: add MaxBlockSize setting 2021-03-16 12:08:47 +03:00
Anna Shaleva
9377751e65 config: add NativeUpdateHistory 2021-03-15 12:35:14 +03:00
Anna Shaleva
edfca68a17 rpc: refactor invokecontractverify
In `(c *Client) AddNetworkFee` we define network fee for contract
witness verification via `invokecontractverify` RPC call, and that's the
initial purpose of this RPC method. But it was not implemented
correctly. It used `System.Contract.Call` instead of beheiving like
`initVerificationVM`.

During real contract witness verification the whole contract's script is
loaded into VM, and then we jump to the `verify` method. Thus, to define
exact contract verification price, we should act like this (and not just
perform `System.Contract.Call` of `verify` method).

Tests are added.

This bug is the reason of adding extra GAS (c.notary.extraVerifyFee) to
pre-calculated value in
https://github.com/nspcc-dev/neofs-node/pull/404/files#diff-639db437ca2578db46c9e8cbf18f9aa01f8ca5aee30e0fa7e70ba0354822d7b3R237
2021-03-12 18:59:20 +03:00
Anna Shaleva
1261dd5306 core: refactor initVerificationVM
It needs only VM and function to get contract state. Also exposed this
method and extended Blockchainer. These changes are needed for the
next commit.
2021-03-12 18:55:27 +03:00
Roman Khimov
f7d74190f5
Merge pull request #1829 from nspcc-dev/change-hashing-scheme
Change hashing scheme
2021-03-12 15:20:23 +03:00
Anna Shaleva
85a8644517 core: add nativenames.IsValid 2021-03-12 13:05:37 +03:00
Roman Khimov
6326094264 native: change getCommittee/getNextBlockValidators price
See neo-project/neo#2392, neo-project/neo#2391.
2021-03-12 11:32:27 +03:00
Roman Khimov
4462a6a6b7 change block/tx/extensible signing process, fix #1741
Sign [magic, hash], see neo-project/neo#2314.
2021-03-12 11:27:50 +03:00
Roman Khimov
096f48caf0
Merge pull request #1820 from nspcc-dev/fix/nativetypes
native: use proper types in manifest
2021-03-11 17:02:34 +03:00
Evgeniy Stratonikov
de04411488 core/fee: alter opcode prices
Follow neo-project/neo#2384.
2021-03-11 15:44:09 +03:00
Evgeniy Stratonikov
1cb25d3190 native: use proper types in manifest 2021-03-11 11:48:38 +03:00
Evgeniy Stratonikov
9cb38a4b1b native: support StorageFee 2021-03-11 10:12:30 +03:00
Evgeniy Stratonikov
256cd09228 native: allow to set oracle request price 2021-03-11 10:12:30 +03:00
Evgeniy Stratonikov
27fc28bd69 native: allow to set candidate register price 2021-03-11 10:12:30 +03:00
Evgeniy Stratonikov
d9e62de454 native: fix prefixGASPerBlock doc comment 2021-03-11 10:12:30 +03:00
Evgeniy Stratonikov
3278d23852 native: rename Price to CPUFee
Method price is now multiplied by `BaseExecFee`.
2021-03-11 10:12:30 +03:00
Anna Shaleva
9015e50847 core: refactor Neo.Crypto.CheckMultisigWithECDsaSecpr1
Rename it to Neo.Crypto.CheckMultisig and remove `message` parameter.
2021-03-10 21:46:05 +03:00
Anna Shaleva
7126637f73 core: remove Neo.Crypto.CheckMultisigWithECDsaSecp256k1
Koblitz RIP.
2021-03-10 21:46:05 +03:00
Anna Shaleva
cdaca7be3e core: use Neo.Crypto.CheckSig for standard signature verification 2021-03-10 21:45:58 +03:00
Anna Shaleva
4e6c1092b8 core: add Neo.Crypto.CheckSig interop 2021-03-10 19:24:19 +03:00
Anna Shaleva
14ade42101 core: remove System.Binary.[Serialize, Deserialize] syscalls
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
5c9c168ee5 core: remove System.Binary.[Base64*, Base58*] syscalls
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
4d2ad4b9e2 core: remove System.Json.[Serialize, Deserialize] interops
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
f65485b735 core: remove System.Binary.Itoa and System.Binary.Atoi syscalls
And move their tests to native StdLib.
2021-03-10 19:24:19 +03:00
Anna Shaleva
2b90d4455f native: implement StdLib contract 2021-03-10 19:24:19 +03:00
Evgeniy Stratonikov
100f2db3fb native: implement CryptoLib contract 2021-03-10 19:24:19 +03:00
Evgeniy Stratonikov
ac95510402 core: do not return block if only header is present 2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
f83b376181 block: replace Base with Header 2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
4df8a2ad36 block: remove MaxContentsPerBlock 2021-03-10 13:38:44 +03:00
Evgeniy Stratonikov
2f490a3403 block: remove ConsensusData field 2021-03-10 13:38:44 +03:00
Roman Khimov
e66d36900c
Merge pull request #1701 from nspcc-dev/statemsg
Update state-root handling
2021-03-09 15:16:44 +03:00
Evgeniy Stratonikov
2f3abf95a2 stateroot: broadcast state on new blocks 2021-03-09 13:51:11 +03:00
Evgeniy Stratonikov
3c65ed1507 stateroot: allow to sign new roots 2021-03-09 13:51:11 +03:00
Evgeniy Stratonikov
ac227a80fe stateroot: use RoleStateValidator for verification 2021-03-09 13:51:10 +03:00
Evgeniy Stratonikov
bf20db09e0 stateroot: move state-root related logic to core/stateroot 2021-03-09 13:48:29 +03:00
Evgeniy Stratonikov
d06718e1cb core/tests: print hash of the genesis block 2021-03-09 13:34:22 +03:00
Evgeniy Stratonikov
a737d473fb native: use ToPreallocatedBytes where possible 2021-03-09 12:11:26 +03:00
Evgeniy Stratonikov
e551432b30 dao: serialize state.StorageItem as raw bytes 2021-03-09 12:11:26 +03:00
Evgeniy Stratonikov
55698d0426 dao: use raw state.StorageItem instead of pointer
It is now a slice, there is no need for additional indirection.
2021-03-09 12:11:25 +03:00
Evgeniy Stratonikov
fd4174ad31 core/state: remove IsConst from StorageItem 2021-03-09 11:59:08 +03:00
Evgeniy Stratonikov
4195603257 native: add NeoFSAlphabet node role 2021-03-05 13:13:31 +03:00
Evgeniy Stratonikov
47ef3b41fa core: fix System.Storage.Find parameter count 2021-03-05 10:17:35 +03:00
Evgeniy Stratonikov
ffd85dd51d native/policy: remove MaxBlockSize and MaxBlockSystemFee 2021-03-04 16:59:19 +03:00
Evgeniy Stratonikov
7b8533b67c native/policy: move MaxTransactionsPerBlock to config 2021-03-04 16:59:19 +03:00
Evgeniy Stratonikov
0a789af10d core: fix parameter count for CreateMultisigAccount 2021-03-04 12:55:31 +03:00
Roman Khimov
e6d3a60431
Merge pull request #1782 from nspcc-dev/optimize/nep17
dao: do not look up new NEP17 batch
2021-03-02 15:28:42 +03:00
Roman Khimov
c9212f29e6
Merge pull request #1744 from nspcc-dev/fix/nativecall
Update `CallNative` to post-preview5
2021-03-02 15:28:00 +03:00
Roman Khimov
10cc19b33c
Merge pull request #1791 from nspcc-dev/drop-go-1-13
*: drop go 1.13
2021-03-01 17:20:26 +03:00
Anna Shaleva
ffb2d78bbd core: update Notary test
Let's allow to wait a bit more. Hardware resources of the Github
workflow tests aren't so fluent.
2021-03-01 17:08:00 +03:00
Anna Shaleva
2c81fc8b8e *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
Evgeniy Stratonikov
d255c4a517 vm: implement SQRT opcode 2021-03-01 16:58:53 +03:00
Evgeniy Stratonikov
6496782736 vm: implement POW opcode 2021-03-01 16:58:53 +03:00
Evgeniy Stratonikov
d5cb95e685 dao: do not look up new NEP17 batch
It will fail anyway.
2021-02-26 14:08:51 +03:00
Evgeniy Stratonikov
61ce4a7f79 core: set native script and hash in SetOracle 2021-02-26 10:59:09 +03:00
Evgeniy Stratonikov
f9f1fe03b2 core: refactor native call
1. `System.Contract.CallNative` expects version on stack.
2. Actual method is determined based on current
   instruction pointer.
3. Native hashes don't longer depend on NEF checksum.
2021-02-26 10:59:09 +03:00
Roman Khimov
f264996f74
Merge pull request #1777 from nspcc-dev/fix/vote
core: fix native method call flags
2021-02-25 18:55:10 +03:00
Evgeniy Stratonikov
663afbe4df core: check call flags in LoadToken
Follow neo-project/neo#2292.
2021-02-25 18:14:52 +03:00
Evgeniy Stratonikov
4db5ef05f8 core: fix call flags for System.Contract.Call
Follow neo-project/neo#2292.
2021-02-25 18:12:38 +03:00
Evgeniy Stratonikov
cbda20aca3 core: fix native method call flags
Replace `WriteStates` with `States`.

Follow neo-project/neo#2339.
Close #1775.
Related #1725.
2021-02-25 18:07:33 +03:00
Anna Shaleva
81ea4bbfcf core: update oracle test
It is failing from time to time.
2021-02-25 11:20:28 +03:00
Anna Shaleva
988dfcc7fe services: update Notary transaction size after completion
Close #1766
2021-02-24 12:38:32 +03:00
Roman Khimov
abee3b5b05
Merge pull request #1722 from nspcc-dev/fix/nep11
smartcontract: add NEP-11 standard check
2021-02-22 22:27:09 +03:00
Anna Shaleva
5a37201319 core: add System.Contract.CreateMultisigAccount interop 2021-02-19 17:31:50 +03:00
Evgeniy Stratonikov
ae30e30321 native: add NEP-11 check for name service 2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
9c0bbd0bfd smartcontract: add NEP-11 standard check
The only method missing is name, because it is
provided in manifest.
2021-02-19 17:06:07 +03:00
Roman Khimov
608df7fb21
Merge pull request #1747 from nspcc-dev/default-notary-config
notary: usability improvements
2021-02-17 14:21:47 +03:00
Roman Khimov
69458a9945
Merge pull request #1751 from nspcc-dev/microfixes
core: microfixes
2021-02-17 14:20:01 +03:00
Anna Shaleva
0cd02e2de8 core: update protocols regexps 2021-02-17 13:51:08 +03:00
Anna Shaleva
15d90925b8 core: refactor (*NameService).checkName method
It does not require native contract.
2021-02-17 13:29:18 +03:00
Anna Shaleva
a4d84ee3b0 core: enable test, disabled in ac52765 2021-02-17 13:19:26 +03:00
Anna Shaleva
1e108f20a7 core: remove description from NFT state 2021-02-17 13:19:26 +03:00
Anna Shaleva
a6d4a266b9 core: check transaction's scripts length during decoding 2021-02-17 13:19:23 +03:00
Evgeniy Stratonikov
0cb6ec7345 mpt: allow to remove non-existent keys in batch
This bug was here before batch were intoduced.
`Delete` is allowed to be called on missing keys with
HALT result, MPT needs to take this into account.
2021-02-17 12:37:44 +03:00
Anna Shaleva
bcb82b457d config: move notary module config to ApplicationConfiguration 2021-02-16 13:58:25 +03:00
Anna Shaleva
46dfd36a1f core: fix native designateAsRole method
It shouldn't return anything.
2021-02-15 18:13:00 +03:00
Anna Shaleva
664a2a88eb core: allow call in verification 2021-02-15 15:03:32 +03:00
Anna Shaleva
4893faa374 core: remove NEP17BalanceState if balance is null [addTokens]
Affects states.
2021-02-12 23:48:30 +03:00
Anna Shaleva
0f1473897b core: temp manifest.Extra marshalling fix
Manifest.Extra still serialized as JSON message with undefined  order
of items, so it affects contract states dumps.
2021-02-12 23:48:30 +03:00
Anna Shaleva
e1384cb795 core: fix native NameService methods return types
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
49b1b4bb27 core: fix native Neo parameter name
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
99f58d9cd5 core: fix native Ladger parameter type
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
7021c76042 core: fix native Management's parameters names
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
a237e34c1f rpc: add test for submitNotaryRequest 2021-02-11 17:15:59 +03:00
Anna Shaleva
2bb8537151 core: use declared constant for Notary's verification price
This constant is used from the outside, it should be synced with the
real verification price.
2021-02-11 17:11:36 +03:00
Anna Shaleva
9bd2cae08e core: refactor (*Notary).verify
There could be only one Notary signer.
2021-02-11 17:11:36 +03:00
Anna Shaleva
8444f3d816 network: refactor notary service's PostBlock
There was a deadlock while trying to finalize transaction during
PostBlock:
	1) (*Notary).PostBlock is called under the blockchain lock
	2) (*Notary).onTransaction is called inside the PostBlock
	3) (*Notary).onTransaction needs to RLock the blockchain to add
completed transaction to the memory pool (and the blockchain is Lock'ed
by this moment)

The problem is fixed by using notifications subsistem, because it's not
required to call (*Notary).PostBlock under the blockchain lock.
2021-02-11 17:11:36 +03:00
Evgeniy Stratonikov
560aff6155 compiler: adjust init/_deploy method offsets during optimization
Because `_initialize` and `_deploy` methods encompass multiple
Go functions, their offsets are stored differently and need
special treatment.
2021-02-11 15:59:02 +03:00
Evgeniy Stratonikov
02ca3d3dfd interop: reuse state.Native in ContractMD 2021-02-11 12:32:10 +03:00
Evgeniy Stratonikov
6ca7b4b966 interop: rename ContractID to ID
Helps further refactoring, see next commit.
2021-02-11 12:27:43 +03:00
Evgeniy Stratonikov
f0d8652bcd rpc: implement getnativecontracts RPC 2021-02-11 12:27:43 +03:00
Evgeniy Stratonikov
e1d2a5b5b7 state: split ContractBase and UpdateCounter
Latter doesn't make sense for native contracts.
2021-02-11 12:24:09 +03:00
Roman Khimov
29b1581ea8
Merge pull request #1723 from nspcc-dev/fix/rpcnumber
Marshal fees and GAS as integers.
2021-02-11 00:35:46 +03:00
Roman Khimov
7c419cebdc
Merge pull request #1729 from nspcc-dev/manifest-and-script-checks
Manifest and script checks
2021-02-10 20:58:52 +03:00
Roman Khimov
dd05cae506 core: check all transaction scripts
Refs. #1699.
2021-02-09 22:31:26 +03:00
Roman Khimov
158f0d9d9c native/vm: add script check for deployed contracts
Refs. #1699.
2021-02-09 22:31:26 +03:00
Roman Khimov
62ef5a8dc7 native: enforce contract manifest UTF-8 validity
Refs. #1699.
2021-02-09 22:31:26 +03:00
Roman Khimov
e9ea89b4e3 manifest: add group signature length check
Refs. #1699.
2021-02-09 22:31:24 +03:00