Commit graph

3626 commits

Author SHA1 Message Date
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
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
Roman Khimov
e97cd9c032 core: fail TestCreateBasicChain when saving the chain
When regenerating RPC server test chain I usually need metadata this test
outputs and the easiest way to get it is make it fail.
2020-12-14 15:23:49 +03:00
Roman Khimov
9a78f1da19 rpc/client: get policy contract hash in Init()
Drop hardcoded value.
2020-12-14 15:23:49 +03:00
Roman Khimov
ab12eee346 native: move contract deployment to management contract
See neo-project/neo#2119.
2020-12-14 15:23:46 +03:00
Roman Khimov
ad3547783d native: drop Neo.Native.Deploy, move contract init to management contract
The contract is almost a stub at the moment, though it does deploy other
contracts.
2020-12-14 13:33:41 +03:00
Roman Khimov
090bee8624 native: change OnPersist/PostPersist handling
Every contract now has these and they're always invoked. See
neo-project/neo#1913 and neo-project/neo#2119.
2020-12-13 21:36:06 +03:00
Roman Khimov
fc361213a7
Merge pull request #1608 from nspcc-dev/core/callflags
core: adjust call flags
2020-12-11 19:23:15 +03:00
Anna Shaleva
2290b91b83 core: fix verification call flag
Previous commit sets AllowCall flag as required for Neo.Native.Call, but
invocation script was loaded with ReadStates flag => native contracts
verification failed.

Other contracts can also make use of AllowCall call flag.
2020-12-11 17:45:12 +03:00
Roman Khimov
742c15cf0b
Merge pull request #1609 from nspcc-dev/fix/json
stackitem: fix JSON encoding
2020-12-11 14:07:21 +03:00
Roman Khimov
1d529dc5b6
Merge pull request #1607 from nspcc-dev/compiler/safe
Set `Safe` flag in emitted manifest
2020-12-11 14:03:55 +03:00
Evgenii Stratonikov
18b331d765 stackitem: fix JSON encoding
Encode both `Buffer` and `ByteString` to UTF-8 bytes.
Follow https://github.com/neo-project/neo/pull/1715 .
2020-12-11 13:30:47 +03:00
Anna Shaleva
53e45d793b core: adjust call flags 2020-12-11 11:38:14 +03:00
Anna Shaleva
fadbae8997 core: rename call flags
Also new States flag is added and ReadOnly flag is adjusted.
2020-12-11 10:34:01 +03:00
Evgenii Stratonikov
4dc5877674 compiler: remove unused code and simplify error handling
After cbf26f3 some errors can't occur.
2020-12-10 18:56:08 +03:00
Roman Khimov
3bbf7642ea
Merge pull request #1582 from nspcc-dev/signature_collection/notary_request_payload
network: add notary request payload
2020-12-10 18:51:09 +03:00
Anna Shaleva
0b5cf78468 network: add notary request payload 2020-12-10 18:17:31 +03:00
Anna Shaleva
501c0c93c6 core: take into account NotaryAssisted attributes during verification
It's a bug, we have to reserve proper amount of GAS from verification
gas limit for NotaryAssisted attributes.
2020-12-10 18:17:31 +03:00
Anna Shaleva
6d357c3793 core: return a special error from verifyHashAgainstScript
It will help us to distinguish proper `false` verification result from
various verification errors.
2020-12-10 18:17:31 +03:00
Anna Shaleva
2ab0e6c399 core: check stack length before returning false verification result
We must be sure that stack has no other items before returning `false`
verification result. It is an error in both cases, but by preserving the
order we know exactly that it was correct `false` on stack.
2020-12-10 18:17:31 +03:00
Evgenii Stratonikov
ec1ff42872 manifest: add Safe flag for NEP-17 methods 2020-12-10 18:04:49 +03:00
Evgenii Stratonikov
2341ae0c53 compiler: specify safe methods in config 2020-12-10 18:00:43 +03:00
Roman Khimov
f0dba26d43
Merge pull request #1600 from nspcc-dev/nativesync
core: call from native contracts synchronously
2020-12-10 17:52:10 +03:00
Evgenii Stratonikov
d7194e4da5 compiler: do not check for main package in ConvertToManifest 2020-12-10 17:45:23 +03:00
Evgenii Stratonikov
9fd8577dd9 compiler: use Options in ConvertToManifest() 2020-12-10 17:43:25 +03:00
Roman Khimov
03d32ecd61
Merge pull request #1606 from nspcc-dev/fix/test
go.mod: update testify version
2020-12-10 17:11:52 +03:00
Evgenii Stratonikov
80c3c374fd go.mod: update testify version 2020-12-10 17:01:39 +03:00
Evgenii Stratonikov
e63191d31f core: hangle CallingScriptHash correctly
When using native contracts, script hash of second-to-top context
on invocation stack does not always correspond to a real calling
contract.
2020-12-10 16:52:36 +03:00