Anna Shaleva
e0d76d873e
core: add ProtocolNotSupported oracle response code
2020-12-18 13:01:45 +03:00
Anna Shaleva
31b06907c9
core: restrict allowed Oracle callbacks
2020-12-17 11:41:28 +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
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
Anna Shaleva
f3279bd9f3
core: add missing RequiredFlags to System.Contract.Native*Persist
2020-12-15 16:21:00 +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
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
7ba1b16854
state: drop unused UTXO remnant
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
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
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
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
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
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
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
Evgenii Stratonikov
e903e40085
core: call from native contracts synchronously
...
Follow neo-project/neo#2130 .
2020-12-10 16:43:46 +03:00
Roman Khimov
02457d9f77
Merge pull request #1597 from nspcc-dev/fix/safemethods
...
manifest: add `Safe` flag to method descriptor
2020-12-09 16:32:19 +03:00
Evgenii Stratonikov
e4c3339c91
util: move Fixed8
to encoding/fixedn package
2020-12-09 11:18:18 +03:00
Evgenii Stratonikov
b7e86fa6a3
manifest: add Safe
flag to method descriptor
...
`interop.Contex.AddMethod` sets `Safe` flag for native
contracts. This allows not to forget to change manifest
when changing call flags.
Also fixed invalid `Safe` flags for `Notary` and `Designate` contracts.
2020-12-08 13:27:43 +03:00
Anna Shaleva
74a143cee3
core: allow to change deposit's till
for owner only
2020-12-08 10:39:20 +03:00
Evgenii Stratonikov
cd5219086a
wallet: export NewAccountFromPrivateKey()
...
Don't perform back-and-forth conversion, don't handle error
which never occur.
2020-12-04 12:45:53 +03:00
Evgenii Stratonikov
6e749f4977
core: add tests for crypto interops
...
Also move related test from `core/`.
2020-12-03 14:14:35 +03:00
Evgenii Stratonikov
5bd8ca9597
core/tests: extend test suite
2020-12-03 14:02:58 +03:00
Evgenii Stratonikov
dcc58b7c44
core: validate manifest before incrementing ID in Contract.Create
...
Also add more tests.
2020-12-02 15:54:03 +03:00
Evgenii Stratonikov
b203c23515
core: cover enumerator/iterator interops
2020-12-02 15:54:03 +03:00
Evgenii Stratonikov
d136569ac8
core: move System.Binary.*
interops to binary/
package
...
Also extend test suite.
2020-12-02 15:54:03 +03:00
Evgenii Stratonikov
2eb256014e
core: move System.Runtime.*
interops to runtime/
package
...
Also extend test suite.
2020-12-02 15:54:03 +03:00
Roman Khimov
9211cb636c
Merge pull request #1555 from nspcc-dev/constant-contract-hashes
...
Constant contract hashes
2020-12-01 14:12:26 +03:00
Evgenii Stratonikov
1db27c004e
native: do not fail on missing request in Oracle.PostPersist()
2020-12-01 12:29:18 +03:00
Evgenii Stratonikov
cba117352c
mempool: correctly handle tx with oracle response
...
If tx with the same oracle response ID is already in mempool,
replace it if network fee of added transaction is higher and
return error otherwise.
2020-12-01 12:29:18 +03:00
Evgenii Stratonikov
3085710e9b
native: call onPayment
only during transfer
...
OnPayment method should be called during GAS distribution
and NEO transfer.
2020-11-30 13:05:44 +03:00
Roman Khimov
d93aa745bb
contract: avoid going to the DB for entry scripts
...
This optimizes out DB access for non-deployed contracts under the assumption
that deployed ones are always loaded via `LoadScriptWithHash` (and if they're
not --- it's a bug anyway with the new hashing model) which actually is a very
popular case (every entry script does that).
2020-11-27 21:47:08 +03:00
Roman Khimov
49f6b33eae
core: fix contract-based verification script hash
...
When using contract-based verification it's important to load contract's hash
along with the script, otherwise it won't be valid.
Simplify things along the way.
2020-11-27 21:47:08 +03:00
Roman Khimov
1cf1fe5d74
*: introduce stable contract hashes
...
Follow neo-project/neo#2044 .
2020-11-27 21:47:08 +03:00
Roman Khimov
7044e9be40
Merge pull request #1549 from nspcc-dev/core/fix_committee_update
...
core: update committee every [committee length] blocks
2020-11-27 11:04:40 +03:00