Commit graph

3108 commits

Author SHA1 Message Date
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
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
0c04b403b4
Merge pull request #1794 from nspcc-dev/fix/json
stackitem: escape control characters in `ToJSON()`
2021-03-02 13:37:27 +03:00
Evgeniy Stratonikov
e5fbf04529 stackitem: escape control characters in ToJSON()
Decoding uses `json.Decoder` which handles everything for us.
2021-03-02 10:47:02 +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
Roman Khimov
dbc86b4ecc
Merge pull request #1789 from nspcc-dev/vm/pow
vm: implement POW and SQRT opcodes
2021-03-01 17:08:44 +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
53327bf475 vm/testdata: update C# json tests 2021-03-01 16:58:53 +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
7577bbef22 compiler: copy locals slice during inline
Consider function call `f(1, g(2, 3))` when
both `f` and `g` are inlined. If `f` contains some locals,
inlining `g` will replace them with it's another locals map,
because slices in Go reuse storage on `append`.
Thus scope needs to be copied.
2021-03-01 11:48:42 +03:00
Evgeniy Stratonikov
b66b853285 compiler: drop stack after inline
Some control-flow statements drop stack items, for example
`return` when it is used inside of `range` loop.
For inlined calls this `return` should drop only portion of stack
which belongs to inlined call.
2021-03-01 11:48:42 +03:00
Roman Khimov
50e330a9c8
Merge pull request #1773 from nspcc-dev/detailed-rpc-error
rpc: detalize `submit*` RPC validation error
2021-02-26 17:03:18 +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
Anna Shaleva
2fbbadeb56 rpc: detalize submit* RPC validation error
These changes do not break the compatibility with the C# node response.

It is useful for the end-user to be aware of the failed validation reason.
Also, the `cause` will be displayed at the running node log.
2021-02-25 19:18:57 +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
Roman Khimov
549596bc1f
Merge pull request #1774 from nspcc-dev/fix/compiler
Allow to use inlined functions during global var init
2021-02-25 16:16:21 +03:00
Roman Khimov
7cf22d00dd
Merge pull request #1769 from nspcc-dev/ci-dockerhub
github: setup github workflow to publish to DockerHub
2021-02-25 15:22:20 +03:00
Evgeniy Stratonikov
0a4ff9d3e4 compiler: allow to use inlined functions to init globals 2021-02-25 15:12:16 +03:00
Evgeniy Stratonikov
ac91de80e7 interop: fix Base58Decode interop 2021-02-25 15:11:52 +03:00
Anna Shaleva
81ea4bbfcf core: update oracle test
It is failing from time to time.
2021-02-25 11:20:28 +03:00
Roman Khimov
46fbd940fe
Merge pull request #1720 from nspcc-dev/compiler/syscall
Refactor syscall handing
2021-02-24 19:31:52 +03:00
Evgeniy Stratonikov
df5314f286 compiler: refactor syscall handling
Close #941.
2021-02-24 12:51:15 +03:00
Evgeniy Stratonikov
f7b9861c11 compiler: count locals for vararg inline functions 2021-02-24 12:45:47 +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
Roman Khimov
61e04f04de
Merge pull request #1763 from nspcc-dev/multisig-interop
core: add System.Contract.CreateMultisigAccount
2021-02-19 18:15:33 +03:00
Anna Shaleva
c82b11eebe compiler: add CreateMultisigAccount interop 2021-02-19 17:34:23 +03:00
Anna Shaleva
5a37201319 core: add System.Contract.CreateMultisigAccount interop 2021-02-19 17:31:50 +03:00
Evgeniy Stratonikov
b38443fe20 smartcontract: add checks for onNEP*Payable methods
When they are present in contract, we want them
to have correct signature.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
d89f055697 smartcontract: add checks for parameter names
It can be annoying to use parameter names as specified by standard,
so a separate `CheckABI` is supported.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
9d4ccf0fcc smartcontract: add test for Optional methods
They should be checked only if name + parameter count matches.
This is how methods are identified in NEO.
2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
ae30e30321 native: add NEP-11 check for name service 2021-02-19 17:06:07 +03:00
Evgeniy Stratonikov
eb26a61078 smartcontract: remove IsNEP17() 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
Anna Shaleva
488e75a246 cli: add filebytes parameter type 2021-02-19 10:52:45 +03:00
Roman Khimov
fe918e28f2
Merge pull request #1757 from nspcc-dev/logs
network: add logs for different RelayTx errors
2021-02-18 13:13:25 +03:00
Anna Shaleva
94430ef3ca network: refactor RelayTx error handling
We don't need to wrap different core errors in server. Also it would be
good to provede more error info to the user.
2021-02-18 12:40:40 +03:00