Commit graph

3652 commits

Author SHA1 Message Date
Anna Shaleva
be0609cc7a rpc: fix getapplicationlog RPC handler
Fixes the following panic:
```
2020/12/22 18:16:09 http: panic serving 127.0.0.1:50228: runtime error: invalid memory address or nil pointer dereference
goroutine 4043 [running]:
net/http.(*conn).serve.func1(0xc00094c960)
	net/http/server.go:1772 +0x139
panic(0xcd9b40, 0x16a94e0)
	runtime/panic.go:973 +0x396
github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).getApplicationLog(0xc000094ea0, 0xc000472d20, 0x2, 0x4, 0xc0000be228, 0xc0007ad601, 0x28)
	github.com/nspcc-dev/neo-go/pkg/rpc/server/server.go:542 +0xac
github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleIn(0xc000094ea0, 0xc000089770, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	github.com/nspcc-dev/neo-go/pkg/rpc/server/server.go:326 +0x981
github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleRequest(0xc000094ea0, 0xc001bccba0, 0x0, 0x0, 0x0)
	github.com/nspcc-dev/neo-go/pkg/rpc/server/server.go:296 +0x26a
github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleHTTPRequest(0xc000094ea0, 0x1071f40, 0xc000b089a0, 0xc00053c200)
	github.com/nspcc-dev/neo-go/pkg/rpc/server/server.go:290 +0x91b
net/http.HandlerFunc.ServeHTTP(0xc0004e61b0, 0x1071f40, 0xc000b089a0, 0xc00053c200)
	net/http/server.go:2012 +0x44
net/http.serverHandler.ServeHTTP(0xc0000d2ee0, 0x1071f40, 0xc000b089a0, 0xc00053c200)
	net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc00094c960, 0x10749c0, 0xc0006ae980)
	net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
	net/http/server.go:2933 +0x35c

```
2020-12-23 11:18:44 +03:00
Anna Shaleva
33386065bc core: adjust parameters of native methods
This commit is mostly about Hash160 -> ByteArray for native contracts'
methods. Manifest is included into states, so we need to be compatible.
2020-12-23 11:18:44 +03:00
Anna Shaleva
e40f3610ed core: store MinimumDeploymentFee as uint32 2020-12-22 16:09:16 +03:00
Roman Khimov
df6cb11017
Merge pull request #1631 from nspcc-dev/fix/appexec
vm: allow to serialize interop items
2020-12-22 13:20:30 +03:00
Roman Khimov
fb48bc3f91
Merge pull request #1635 from nspcc-dev/max_gas_invoke
config: update MaxGasInvoke
2020-12-22 13:09:24 +03:00
Anna Shaleva
2c58f274d0 config: update MaxGasInvoke 2020-12-22 12:25:34 +03:00
Roman Khimov
19d7267773
Merge pull request #1633 from nspcc-dev/payload_test
consensus: update binary payload tests
2020-12-21 13:36:26 +03:00
Roman Khimov
aab175f471
Merge pull request #1634 from nspcc-dev/dbft
go.mod: update dbft version
2020-12-21 13:36:05 +03:00
Evgenii Stratonikov
d6ec1290c5 go.mod: update dbft version
Close #1632.
2020-12-21 13:20:23 +03:00
Anna Shaleva
766f66c5ca consensus: update binary payload tests 2020-12-21 12:51:07 +03:00
Roman Khimov
dee97d8542
Merge pull request #1524 from nspcc-dev/rpc/invoke_verify
rpc: add `invokecontractverify` RPC-method
2020-12-21 10:36:54 +03:00
Roman Khimov
0ce948332d
Merge pull request #1624 from nspcc-dev/core/managment_fix
core: managment contract updates
2020-12-20 00:21:42 +03:00
Roman Khimov
a697ff40f6
Merge pull request #1628 from nspcc-dev/cli/hash
cli: allow to calculate contract hash before deployment
2020-12-18 18:18:28 +03:00
Anna Shaleva
b1324db847 core: add notifications to ManagmentContract 2020-12-18 16:52:51 +03:00
Anna Shaleva
d34353aec2 core: add MinimumDeploymentFee 2020-12-18 16:48:05 +03:00
Anna Shaleva
a65544aab1 core: fix Managment destroy price
Too expensive.
2020-12-18 16:46:09 +03:00
Roman Khimov
203f8adc9d
Merge pull request #1618 from nspcc-dev/contractcache
native: cache contract in Management contract
2020-12-18 14:59:42 +03:00
Evgenii Stratonikov
3397f2c9be native: cache contract in Management contract 2020-12-18 13:11:17 +03:00
Evgenii Stratonikov
8c22d27acc state: allow to encode AppExecResult with recursive items
1. Encode them to a special type, decode to `nil`.
2. `Interop` can be encoded in JSON, this info should also be preserved.
2020-12-18 13:04:31 +03:00
Evgenii Stratonikov
c49eb86a2e cli: allow to calculate contract hash before deployment 2020-12-17 15:44:42 +03:00
Roman Khimov
c13d6ecc55
Merge pull request #1625 from nspcc-dev/fix_oracle
core: restrict allowed Oracle callbacks
2020-12-17 13:21:58 +03:00
Anna Shaleva
31b06907c9 core: restrict allowed Oracle callbacks 2020-12-17 11:41:28 +03:00
Roman Khimov
f2365e2392
Merge pull request #1620 from nspcc-dev/fix/consensus
consensus: validate timestamp in `verifyBlock()`
2020-12-16 19:13:15 +03:00
Evgenii Stratonikov
75eb2b05d8 go.mod: update dbft version 2020-12-16 17:45:14 +03:00
Evgenii Stratonikov
c5f9f6a3fd consensus: validate timestamp in `verifyBlock()
Not doing this can possibly lead to the same node being validator
again and again.
2020-12-16 17:41:44 +03:00
Roman Khimov
4dcd06ef44
Merge pull request #1615 from nspcc-dev/opcodes
core: redefine opcode prices
2020-12-16 16:54:19 +03:00
Roman Khimov
ecdf95d5d6
Merge pull request #1621 from nspcc-dev/core/mempool_fix
core: fix bug with mempool.verifiedMap
2020-12-16 14:11:28 +03:00
Anna Shaleva
93a5c37696 core: fix bug with mempool.verifiedMap
Transaction is added to verifiedMap before OOM check, so we may have a
case when OOM occurs during tx1 pooling, but mp.containsKey(tx1)
returns `true` after this. Fixed.
2020-12-16 14:08:05 +03:00
Evgenii Stratonikov
65d147c890 core/test: simplify tests for policy contract
Most of the methods are just get/set with some boundaries.
This simplifies writing tests for new methods.
Also add missing test regarding cache behaviour for current methods
when value is set and read in the same block.
2020-12-16 13:55:40 +03:00
Evgenii Stratonikov
62da365302 native: allow to modify StoragePrice in the policy contract 2020-12-16 13:55:40 +03:00
Evgenii Stratonikov
4946556830 native: allow to modify ExecFeeFactor in the policy contract 2020-12-16 13:55:40 +03:00
Evgenii Stratonikov
1840c1c80d core: redefine opcode prices
Prices are defined in as a coefficients to `BaseExecFee` which
is defined by Policy contract (TBD later).
Native method prices are defined without need to multiply.
2020-12-16 13:55:39 +03:00
Roman Khimov
44b4c92992
Merge pull request #1619 from nspcc-dev/core/persist_fix
core: add missing RequiredFlags to System.Contract.Native*Persist
2020-12-15 18:26:05 +03:00
Anna Shaleva
f3279bd9f3 core: add missing RequiredFlags to System.Contract.Native*Persist 2020-12-15 16:21:00 +03:00
Anna Shaleva
da5eb67e85 rpc: implement invokecontractverify RPC method 2020-12-15 15:53:36 +03:00
Roman Khimov
7c2257803f
Merge pull request #1616 from nspcc-dev/fix/nativehash
native: fix contract hashes
2020-12-15 13:18:47 +03:00
Evgenii Stratonikov
dda4ba8d4d native: add compatibility test for hashes 2020-12-15 12:58:04 +03:00
Evgenii Stratonikov
1ffa1f9ade native: fix contract hashes 2020-12-15 12:58:04 +03:00
Roman Khimov
42be00b5bc
Merge pull request #1617 from nspcc-dev/fix/transfer
native: fix `NEP17.Transfer` cost
2020-12-15 12:22:54 +03:00
Evgenii Stratonikov
5310c7f3ce native: fix NEP17.Transfer cost
It was increased with the introducion of `postTransfer`.
2020-12-15 12:04:10 +03:00
Roman Khimov
f009e531de
Merge pull request #1610 from nspcc-dev/management-contract
Management contract and other recent changes
2020-12-14 18:16:23 +03:00
Roman Khimov
7ba1b16854 state: drop unused UTXO remnant 2020-12-14 15:24:15 +03:00
Roman Khimov
2e0fe370cf nef: lower MaxScriptLength
Follow neo-project/neo#2119 changes.
2020-12-14 15:24:15 +03:00
Roman Khimov
cb5ecaefe7 native: drop OnPersistEnd
Now that PostPersist is being run for every native contract we can do our
dirty caching tricks right there instead of OnPersistEnd.
2020-12-14 15:24:15 +03:00
Roman Khimov
938be298f0 core: don't allow calls in verification context
Follow neo-project/neo#2144. System.Contract.CallNative already has "None"
flag, so tests work fine.
2020-12-14 15:24:15 +03:00
Roman Khimov
cf8cf93e7a native: change contract names, move them to separate package
Follow neo-project/neo#2138 and make RPC client's GetNativeContractHash
case-sensitive.
2020-12-14 15:24:15 +03:00
Roman Khimov
aff1469482 native: uppercase token symbols
Follow neo-project/neo#2136.
2020-12-14 15:24:15 +03:00
Roman Khimov
e3dfb5d165 cli/wallet: swap name/address checks for token identification
Address identification must have a priority, another token can have this
address in its name, but when there is a hash specified we should take the one
with proper hash.
2020-12-14 15:24:15 +03:00
Roman Khimov
8e2df8902c cli/wallet: don't mangle token symbol in output
It's important to show it as is because it identifies token.
2020-12-14 15:24:15 +03:00
Roman Khimov
1e9253f1f0 interop: rename Neo.Native.Call to System.Contract.CallNative 2020-12-14 15:24:13 +03:00