Commit graph

3152 commits

Author SHA1 Message Date
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
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
b780a64b4d emit: allow to emit big.Int 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
Anna Shaleva
078870fceb compiler: fix contract.IsStandard syscall test 2021-03-10 19:24:19 +03:00
Evgeniy Stratonikov
100f2db3fb native: implement CryptoLib contract 2021-03-10 19:24:19 +03:00
Roman Khimov
19a23a36e4
Merge pull request #1807 from nspcc-dev/feature/walletsign
cli: allow to sign dumped transaction by several non-multisig signers
2021-03-10 14:13:20 +03:00
Roman Khimov
9b0d4e0968
Merge pull request #1792 from nspcc-dev/fix/consensusdata
Remove `ConsensusData` from `Block`
2021-03-10 14:12:38 +03:00
Roman Khimov
9ca59e6312
Merge pull request #1811 from nspcc-dev/feature/pubdump
Allow to dump public keys in CLI
2021-03-10 13:50: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
Evgeniy Stratonikov
7160675ac1 compiler/interop: improve conversion to bytes interops
Allow to convert to both `Buffer` and `ByteString`
and explicitly mention VM types. Rename `ToByteArray` to `ToBytes`
to avoid ambiguity.
2021-03-10 13:38:44 +03:00
Roman Khimov
731adf8448
Merge pull request #1484 from nspcc-dev/oracle/neofs
Integrate NeoFS into oracle module
2021-03-09 17:30:15 +03:00
Evgeniy Stratonikov
106c27782e cli/wallet: allow to cosign with a contract
Contracts have empty verification script and their hash is
calculated differently.
2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
b9136dbfc0 smartcontract: use hash in GetWitness()
All necessary info must already be in context.
2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
20d2386414 smartcontract: use script instead of address in context 2021-03-09 15:45:02 +03:00
Evgeniy Stratonikov
ded6a70335 vm: add ParseSignatureContract() 2021-03-09 15:43:57 +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
Evgenii Stratonikov
22b4edd58e oracle: support NeoFS 2021-03-09 14:24:57 +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
7a176727ca smartcontract: add GetMajorityNodeCount() 2021-03-09 13:46:44 +03:00
Evgeniy Stratonikov
717be43a5d oracle: split broadcaster into parts
1. Generic parallel sending part can be reused by state service.
2. Specific oracle marshaling is implemented on top of (1).
2021-03-09 13:46:44 +03:00
Evgeniy Stratonikov
55009153a9 vm/emit: emit Boolean values correctly
We should convert both `true` and `false` values.
2021-03-09 13:34:22 +03:00
Evgeniy Stratonikov
3e54b46ffb rpc/tests: fix verification contract 2021-03-09 13:34:22 +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
5a3fa47b95 encoding: panic on nil slice
After `state.StorageItem` became a slice of bytes
we no longer panic on accessing `si.Value`. This helps
to ensure that nothing was broken. Providing `nil` to `FromBytes`
is probably an error anyway.
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
7c62df1253 compiler: add tests for syscall handling 2021-03-05 10:17:35 +03:00
Evgeniy Stratonikov
dcbfe856cd compiler/interop: fix contract.GetCallFlags 2021-03-05 10:17:35 +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
Roman Khimov
924de3e090
Merge pull request #1796 from nspcc-dev/compiler/pow
Add syscalls for POW and SQRT opcodes
2021-03-04 16:56:15 +03:00
Evgeniy Stratonikov
8f8c7d2839 compiler: fix import alias handling 2021-03-04 14:41:20 +03:00
Evgeniy Stratonikov
d66ce43239 compiler/interop: replace int64 with int 2021-03-04 13:20:43 +03:00
Evgeniy Stratonikov
1138143a50 compiler/interop: add flag type for PutEx 2021-03-04 13:13:12 +03:00
Evgeniy Stratonikov
1e2944f492 compiler/interop: return proper type from contract.GetCallFlags 2021-03-04 13:09:03 +03:00
Evgeniy Stratonikov
0b54870bfe compiler: add missing math routines
Add interops for ABS, SIGN, MIN, MAX, WITHIN opcodes
2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
56fe6574c9 compiler: simplify convert.To* processing
With inlining there is no need for special logic in compiler.
2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
e754ca62db compiler: do not emit CONVERT for syscall results
When we encounter type assertion CONVERT is emitted.
This isn't needed for SYSCALL (or opcode) results
because value already has needed type.
Problems can arise when result is converted to invalid type
but `neogointernal` package shouldn't be used directly anyway.
2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
5f4385d3fa compiler: implement syscalls for POW and SQRT opcodes 2021-03-04 13:05:33 +03:00
Evgeniy Stratonikov
578bbabd1d compiler: allow to emit opcodes directly 2021-03-04 13:03:05 +03:00
Evgeniy Stratonikov
0a789af10d core: fix parameter count for CreateMultisigAccount 2021-03-04 12:55:31 +03:00
Roman Khimov
58ea4607d0
Merge pull request #1805 from nspcc-dev/interop/convertcontext-fix
interop: fix ConvertContextToReadOnly interop
2021-03-04 12:31:36 +03:00
Roman Khimov
dedcab2d63
Merge pull request #1804 from nspcc-dev/interop/createmultisigaccount-fix
interop: fix CreateMultisigAccount interop
2021-03-04 12:31:28 +03:00
Anna Shaleva
0c464083ed interop: fix ConvertContextToReadOnly interop
The same bug as in #1804.
2021-03-04 11:51:32 +03:00
Anna Shaleva
52e4d69c82 interop: fix CreateMultisigAccount interop
Introduced in #1720.
2021-03-04 11:39:49 +03:00
Anna Shaleva
6c0faa4ea3 rpc: provide cosigners accounts to CreateTxFromScript
We need to define network fee for each of cosigners, and the only way to
do it is to access the cosigner's script.
2021-03-04 10:37:35 +03:00
Anna Shaleva
b1b9a8cf66 rpc: refactor CreateTxFromScript signature
Make cosigners non-variadic.
2021-03-03 13:42:15 +03:00
Evgeniy Stratonikov
798ae6c63c consensus/test: add missing t.Cleanup() 2021-03-03 13:14:25 +03:00