Commit graph

3123 commits

Author SHA1 Message Date
Anna Shaleva
0948d53244 examples: add documentation
And provide the wallet for examples `my_wallet.json` with the owner
address inside.
2021-03-23 16:46:15 +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
Anna Shaleva
ee76db9ff2 rpc: refactor (*Client).AddNetworkFee errors handling
core.ErrVerificationFailed is not very informative. Also removing it
from RPC client allows to get rid of `core` dependency in the `client`
package, which is needed for the next commit.
2021-03-22 13:28:22 +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
83cb5ff07b roles: add missing NeoFSAlphabet role 2021-03-19 16:18:45 +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
Roman Khimov
c1b2a79cfe netmode: use proper testnet magic number
Preview5 network used 'N3P5' as its magic, but the official testnet magic is
still 'NEOt', that's the way it's defined in neo-node, so use that.
2021-03-19 16:18:45 +03:00
Anna Shaleva
2c68bfcfc6 consensus: remove nonce from PrepareRequest 2021-03-18 21:32:43 +03:00
Anna Shaleva
4809cdf0b0 consensus: fix panic during verifyBlock
Issue: panic during mixed 4-nodes consensus setup:
```
2021-03-18T12:01:50.715Z	INFO	skip change view	{"nc": 0, "nf": 3}
2021-03-18T12:01:52.786Z	INFO	received ChangeView	{"validator": 0, "reason": "Timeout", "new view": 1}
2021-03-18T12:01:53.602Z	INFO	received ChangeView	{"validator": 2, "reason": "Timeout", "new view": 1}
2021-03-18T12:01:56.736Z	INFO	received ChangeView	{"validator": 1, "reason": "Timeout", "new view": 1}
2021-03-18T12:01:56.736Z	INFO	changing dbft view	{"height": 3, "view": 1, "index": 3, "role": "Backup"}
2021-03-18T12:02:01.758Z	INFO	received PrepareRequest	{"validator": 2, "tx": 0}
panic: interface conversion: block.Block is nil, not *consensus.neoBlock

goroutine 315 [running]:
github.com/nspcc-dev/neo-go/pkg/consensus.(*service).verifyBlock(0xc000419540, 0x0, 0x0, 0x4)
	github.com/nspcc-dev/neo-go/pkg/consensus/consensus.go:427 +0x1306
github.com/nspcc-dev/dbft.(*DBFT).createAndCheckBlock(0xc0001f8840, 0x13f0002)
	github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:373 +0x27e
github.com/nspcc-dev/dbft.(*DBFT).onPrepareRequest(0xc0001f8840, 0x13f4378, 0xc0003b8500)
	github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:329 +0xdf1
github.com/nspcc-dev/dbft.(*DBFT).OnReceive(0xc0001f8840, 0x13f4378, 0xc0003b8500)
	github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:247 +0xe25
github.com/nspcc-dev/neo-go/pkg/consensus.(*service).eventLoop(0xc000419540)
	github.com/nspcc-dev/neo-go/pkg/consensus/consensus.go:297 +0x79d
created by github.com/nspcc-dev/neo-go/pkg/consensus.(*service).Start
	github.com/nspcc-dev/neo-go/pkg/consensus/consensus.go:249 +0xa5
```

So (*service).verifyBlock is unable to work with nil block.
2021-03-18 18:20:33 +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
c773f117be
Merge pull request #1838 from nspcc-dev/extend-rpc-client
Extend RPC client
2021-03-17 11:10:09 +03:00
Roman Khimov
2fa80f0bb6
Merge pull request #1837 from nspcc-dev/fix-some-call-flags
Fix some call flags
2021-03-17 11:09:57 +03:00
Roman Khimov
cb1583e317
Merge pull request #1830 from nspcc-dev/fix/neofs
Use filters with NeoFS responses
2021-03-17 10:25:46 +03:00
Roman Khimov
7990fa1b61 client: add gasperblock getter
It's an important chain parameter.
2021-03-16 23:04:41 +03:00
Roman Khimov
87d4939093 client: add NNS price getter 2021-03-16 22:59:04 +03:00
Roman Khimov
f308a9995d client: add GetOraclePrice for oracle price 2021-03-16 22:55:17 +03:00
Roman Khimov
42674e46ac client: add GetStoragePrice for native policy contract 2021-03-16 22:50:14 +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
38103dcc7a consensus: check transactions count during PrepareRequest verification 2021-03-15 16:58:37 +03:00
Anna Shaleva
23a3514cc0 consensus: store ProtocolConfiguration in consensus config 2021-03-15 16:58:27 +03:00
Anna Shaleva
9377751e65 config: add NativeUpdateHistory 2021-03-15 12:35:14 +03:00
Evgeniy Stratonikov
e8b95ebf3e oracle/neofs: change result types
1. `GetHash` returnes '0x'-prefixed little-endian hex-string.
2. `GetPayload` and `GetRange` assume result is UTF-8.
2021-03-15 10:54:08 +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
Evgeniy Stratonikov
540c6c13a9 oracle/neofs: allow to use filters on NeoFS responses 2021-03-12 14:15:40 +03:00
Roman Khimov
7730aef0ec payload: adapt notary payloads to new hashing too 2021-03-12 14:14:22 +03:00
Roman Khimov
9d500b86fc context: s/hex/data/ for JSON
See neo-project/neo#2394.
2021-03-12 13:10:24 +03:00
Anna Shaleva
85a8644517 core: add nativenames.IsValid 2021-03-12 13:05:37 +03:00
Roman Khimov
dc980b5847 sc/context: add network magic into the context
See neo-project/neo#2393, we need this to be able to sign multisig
transactions.
2021-03-12 12:59:14 +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
3e9bd0be72 smartcontract: use base64 encoding for verifiable items
See neo-project/neo#1199.
2021-03-11 19:55:20 +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