Evgeniy Stratonikov
a737d473fb
native: use ToPreallocatedBytes
where possible
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
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
Evgeniy Stratonikov
0a789af10d
core: fix parameter count for CreateMultisigAccount
2021-03-04 12:55:31 +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
10cc19b33c
Merge pull request #1791 from nspcc-dev/drop-go-1-13
...
*: drop go 1.13
2021-03-01 17:20:26 +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
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
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
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
Anna Shaleva
81ea4bbfcf
core: update oracle test
...
It is failing from time to time.
2021-02-25 11:20:28 +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
Anna Shaleva
5a37201319
core: add System.Contract.CreateMultisigAccount interop
2021-02-19 17:31:50 +03:00
Evgeniy Stratonikov
ae30e30321
native: add NEP-11 check for name service
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
Roman Khimov
608df7fb21
Merge pull request #1747 from nspcc-dev/default-notary-config
...
notary: usability improvements
2021-02-17 14:21:47 +03:00
Roman Khimov
69458a9945
Merge pull request #1751 from nspcc-dev/microfixes
...
core: microfixes
2021-02-17 14:20:01 +03:00
Anna Shaleva
0cd02e2de8
core: update protocols regexps
2021-02-17 13:51:08 +03:00
Anna Shaleva
15d90925b8
core: refactor (*NameService).checkName method
...
It does not require native contract.
2021-02-17 13:29:18 +03:00
Anna Shaleva
a4d84ee3b0
core: enable test, disabled in ac52765
2021-02-17 13:19:26 +03:00
Anna Shaleva
1e108f20a7
core: remove description from NFT state
2021-02-17 13:19:26 +03:00
Anna Shaleva
a6d4a266b9
core: check transaction's scripts length during decoding
2021-02-17 13:19:23 +03:00
Evgeniy Stratonikov
0cb6ec7345
mpt: allow to remove non-existent keys in batch
...
This bug was here before batch were intoduced.
`Delete` is allowed to be called on missing keys with
HALT result, MPT needs to take this into account.
2021-02-17 12:37:44 +03:00
Anna Shaleva
bcb82b457d
config: move notary module config to ApplicationConfiguration
2021-02-16 13:58:25 +03:00
Anna Shaleva
46dfd36a1f
core: fix native designateAsRole method
...
It shouldn't return anything.
2021-02-15 18:13:00 +03:00
Anna Shaleva
664a2a88eb
core: allow call in verification
2021-02-15 15:03:32 +03:00
Anna Shaleva
4893faa374
core: remove NEP17BalanceState if balance is null [addTokens]
...
Affects states.
2021-02-12 23:48:30 +03:00
Anna Shaleva
0f1473897b
core: temp manifest.Extra marshalling fix
...
Manifest.Extra still serialized as JSON message with undefined order
of items, so it affects contract states dumps.
2021-02-12 23:48:30 +03:00
Anna Shaleva
e1384cb795
core: fix native NameService methods return types
...
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
49b1b4bb27
core: fix native Neo parameter name
...
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
99f58d9cd5
core: fix native Ladger parameter type
...
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
7021c76042
core: fix native Management's parameters names
...
Affects dumps.
2021-02-12 18:58:31 +03:00
Anna Shaleva
a237e34c1f
rpc: add test for submitNotaryRequest
2021-02-11 17:15:59 +03:00
Anna Shaleva
2bb8537151
core: use declared constant for Notary's verification price
...
This constant is used from the outside, it should be synced with the
real verification price.
2021-02-11 17:11:36 +03:00
Anna Shaleva
9bd2cae08e
core: refactor (*Notary).verify
...
There could be only one Notary signer.
2021-02-11 17:11:36 +03:00
Anna Shaleva
8444f3d816
network: refactor notary service's PostBlock
...
There was a deadlock while trying to finalize transaction during
PostBlock:
1) (*Notary).PostBlock is called under the blockchain lock
2) (*Notary).onTransaction is called inside the PostBlock
3) (*Notary).onTransaction needs to RLock the blockchain to add
completed transaction to the memory pool (and the blockchain is Lock'ed
by this moment)
The problem is fixed by using notifications subsistem, because it's not
required to call (*Notary).PostBlock under the blockchain lock.
2021-02-11 17:11:36 +03:00
Evgeniy Stratonikov
560aff6155
compiler: adjust init/_deploy method offsets during optimization
...
Because `_initialize` and `_deploy` methods encompass multiple
Go functions, their offsets are stored differently and need
special treatment.
2021-02-11 15:59:02 +03:00
Evgeniy Stratonikov
02ca3d3dfd
interop: reuse state.Native
in ContractMD
2021-02-11 12:32:10 +03:00
Evgeniy Stratonikov
6ca7b4b966
interop: rename ContractID
to ID
...
Helps further refactoring, see next commit.
2021-02-11 12:27:43 +03:00
Evgeniy Stratonikov
f0d8652bcd
rpc: implement getnativecontracts
RPC
2021-02-11 12:27:43 +03:00
Evgeniy Stratonikov
e1d2a5b5b7
state: split ContractBase and UpdateCounter
...
Latter doesn't make sense for native contracts.
2021-02-11 12:24:09 +03:00
Roman Khimov
29b1581ea8
Merge pull request #1723 from nspcc-dev/fix/rpcnumber
...
Marshal fees and GAS as integers.
2021-02-11 00:35:46 +03:00
Roman Khimov
7c419cebdc
Merge pull request #1729 from nspcc-dev/manifest-and-script-checks
...
Manifest and script checks
2021-02-10 20:58:52 +03:00
Roman Khimov
dd05cae506
core: check all transaction scripts
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
158f0d9d9c
native/vm: add script check for deployed contracts
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
62ef5a8dc7
native: enforce contract manifest UTF-8 validity
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
e9ea89b4e3
manifest: add group signature length check
...
Refs. #1699 .
2021-02-09 22:31:24 +03:00
Evgeniy Stratonikov
b0fbd897ad
Revert "rpc: marshal fees and GAS as Fixed8 decimal"
...
This reverts commit a79b12b4d4
.
2021-02-09 11:16:52 +03:00
Evgeniy Stratonikov
468dc5aad6
core/tests: fix NameService test
...
We should look for the timestamp of the block with `register`.
2021-02-08 17:56:10 +03:00
Roman Khimov
1a4958b1d5
manifest: add ABI validity check
...
Some methods must be defined in a valid ABI. Refs. neo-project/neo#2263 .
2021-02-08 13:27:39 +03:00
Evgeniy Stratonikov
2f6345f2d9
compiler: add Hash compatibility test
2021-02-08 13:09:41 +03:00
Roman Khimov
5ba074b4cf
manifest: return an error from IsValid
...
Be more specific.
2021-02-08 12:04:57 +03:00
Roman Khimov
e4b5b59663
Merge pull request #1704 from nspcc-dev/binary_manifest
...
core: serialise manifest as stackitem
2021-02-05 23:58:07 +03:00
Roman Khimov
aad2b3adad
Merge pull request #1712 from nspcc-dev/nep17-nep11-onpayments
...
NEP17/NEP11 onPayments
2021-02-05 21:04:35 +03:00
Roman Khimov
cd9b34416e
native: call onNEP11Transfer for NEP-11 transfers
...
See neo-project/neo#2287 .
2021-02-05 20:48:45 +03:00
Anna Shaleva
a2715404d0
core: serialise manifest as stackitem
2021-02-05 19:10:15 +03:00
Anna Shaleva
840104461b
config: update testnet netmode to preview5 magic
2021-02-05 18:57:54 +03:00
Roman Khimov
a442e1530d
native: rename onPayment into onNEP17Payment
...
Follow neo-project/neo#2287 .
2021-02-05 16:09:51 +03:00
Roman Khimov
cdfc7fc8fa
Merge pull request #1703 from nspcc-dev/initials_for_natives
...
core: store native contracts' initial values in the DB
2021-02-05 15:32:05 +03:00
Evgeniy Stratonikov
d7f68d3650
native: fix getCommittee
name
...
`C` was in russian.
2021-02-05 13:34:05 +03:00
Anna Shaleva
2b06601646
core: change Oracle request ID endianness
2021-02-05 11:37:12 +03:00
Anna Shaleva
12f7111ca8
core: mark blocked accounts with empty byte array
2021-02-05 11:37:12 +03:00
Anna Shaleva
6a4e312eac
core: move GetPrice from core
to interop
...
We have additional logic for getting BaseExecFee policy value. This
logic should be moved to interop context instead of being in Policer,
because Policer is just an interface over Policy contract.
After moving this logic to interop context, we need to use it to define
BaseExecFee instead of (Policer).BaseExecFee. Thus, moving
(*Blockchain).GetPrice to (*Context).GetPrice is necessary.
2021-02-05 11:36:32 +03:00
Anna Shaleva
260bcd373c
core: store initial native values into DAO
2021-02-05 10:43:17 +03:00
Roman Khimov
ed3cef81cc
core: allow to read states for non-contract verifications
...
C# does it this way now:
callFlags = !witness.VerificationScript.IsStandardContract() ? CallFlags.ReadStates : CallFlags.None
So non-standard scripts _always_ have access to state and standards ones just
don't care (their code is known and it doesn't touch state).
2021-02-04 13:12:11 +03:00
Roman Khimov
ac527650eb
native: add Ledger contract, fix #1696
...
But don't change the way we process/store transactions and blocks. Effectively
it's just an interface for smart contracts that replaces old syscalls.
Transaction definition is moved temporarily to runtime package and Block
definition is removed (till we solve #1691 properly).
2021-02-04 13:12:11 +03:00
Roman Khimov
641896b2fb
Merge pull request #1658 from nspcc-dev/signature_collection/module
...
core, network: add Notary module
2021-02-02 22:24:14 +03:00
Anna Shaleva
df26ca1c7f
core: add Notary module test
2021-02-02 22:01:32 +03:00
Anna Shaleva
bfbd096fed
core: introduce mempool notifications
2021-02-02 22:01:32 +03:00
Anna Shaleva
19fa0daaa6
core, network: add Notary module
2021-02-02 22:01:20 +03:00
Roman Khimov
f7cb00b82d
Merge pull request #1678 from nspcc-dev/nameservice
...
Implement NameService
2021-02-01 22:52:59 +03:00
Evgeniy Stratonikov
e4ff8326b5
native: add NameService
2021-02-01 21:40:21 +03:00
Evgeniy Stratonikov
ec6317d643
core: allow to sign with arbitrary signer
...
Related #1677 .
2021-02-01 10:16:16 +03:00
Evgeniy Stratonikov
c8a07be58d
native: sort methods in manifest
2021-01-29 12:19:08 +03:00
Evgeniy Stratonikov
2336415f42
naitve: disallow contract name modification
2021-01-29 12:19:08 +03:00
Evgeniy Stratonikov
c1cc7e6f9d
native: add additional parameters to deploy
...
1. Management contract has 2 overloads of `deploy` method.
2. Normal contracts should have `_deploy` with 2 parameters.
2021-01-29 12:19:08 +03:00
Evgeniy Stratonikov
849385a533
native: allow to overload native methods
2021-01-29 12:19:08 +03:00
Roman Khimov
818d5988f5
Merge pull request #1695 from nspcc-dev/committeechecks
...
native: unify committee checks
2021-01-29 11:58:33 +03:00
Evgeniy Stratonikov
690b787fe3
native: unify committee checks
...
Fail execution if tx is not signed by committee.
2021-01-29 10:50:17 +03:00
Evgeniy Stratonikov
9592f3e052
network: implement pool for Extensible
payloads
2021-01-28 17:09:06 +03:00
Evgeniy Stratonikov
153678160e
native: use majority hash only for oracles
2021-01-28 17:09:06 +03:00
Evgeniy Stratonikov
db4e7558e0
native: cache all roles in Designate
2021-01-28 17:09:05 +03:00
Evgeniy Stratonikov
c420014cb5
oracle: implement filters
2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
e4528e59dc
oracle: reprocess request on fail
2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
aa852aaaac
oracle: submit responses concurrently
2021-01-28 13:00:59 +03:00
Evgenii Stratonikov
43e4d3af88
oracle: integrate module in core and RPC
...
1. Initialization is performed via `Blockchain` methods.
2. Native Oracle contract updates list of oracle nodes
and in-fly requests in `PostPersist`.
3. RPC uses Oracle module directly.
2021-01-28 13:00:58 +03:00
Evgenii Stratonikov
7e16bea126
network: implement Oracle module
2021-01-28 12:43:20 +03:00
Evgeniy Stratonikov
c146540ce8
core: fix native contract verification
2021-01-28 12:35:02 +03:00
Evgeniy Stratonikov
dd1e2cefe4
core,cli: disallow verify methods with non-bool returns
2021-01-27 12:51:47 +03:00
Evgeniy Stratonikov
73f888f02e
core: allow to overload contract methods
...
Multiple methods with different parameter count can co-exist.
2021-01-27 12:51:07 +03:00
Roman Khimov
3d79c7644e
Merge pull request #1687 from nspcc-dev/fix-transaction-fee-marshalling
...
Fix transaction fee marshalling
2021-01-23 15:11:14 +03:00
Roman Khimov
120ae4841f
transactions: fix JSON unmarshalling of fees
...
Fixed8 is already marshalled as a string and stripping quotes from it just
leads to interpreting it as a float with all regular float problems (like
test transaction failing with `txid doesn't match transaction hash`).
2021-01-22 18:22:09 +03:00
Roman Khimov
054ca27e9c
state: use checksums and names to calculate contract hashes
...
It allows to deploy the same NEF using one sender and get different contract
hashes. See neo-project/neo#2240 .
2021-01-22 12:22:48 +03:00
Roman Khimov
6b9b37f170
native: don't call CreateNativeContractHash() in oracle contract
...
Move oracleScript from global context to Oracle itself. We have the hash
already computed by NewContractMD, there is no need to repeat this
calculation.
2021-01-22 11:28:13 +03:00
Roman Khimov
6bc2512767
Merge pull request #1684 from nspcc-dev/candidate-registration-price
...
native: make registering as a candidate cost more
2021-01-22 10:04:53 +03:00
Evgeniy Stratonikov
49de8161ef
core: implement LoadToken handler
2021-01-22 09:04:37 +03:00
Roman Khimov
476cbbebdc
native: make registering as a candidate cost more
...
Follow neo-project/neo#2252 .
2021-01-21 23:02:59 +03:00
Evgeniy Stratonikov
c6894f3f55
native: check for committee in setters
2021-01-21 15:20:34 +03:00
Evgeniy Stratonikov
24d9a31476
testchain: support signing tx by committee
2021-01-21 14:51:15 +03:00
Evgeniy Stratonikov
719dceff77
nef: merge Compiler and Version fields
2021-01-19 11:19:28 +03:00
Evgeniy Stratonikov
52843fc1bf
nef: add Tokens field
2021-01-19 11:19:24 +03:00
Evgeniy Stratonikov
324107b31e
vm: implement POPITEM opcode
2021-01-19 09:46:01 +03:00
Roman Khimov
6ecc6f0422
native: call native contracts by ID instead of name
...
Fix #1666 .
2021-01-18 00:38:23 +03:00
Roman Khimov
f39ede9869
opcode: add CALLT opcode, move ABORT/ASSERT
...
Refs. #1644 . Hash compatibility test temporarily disabled, to be enabled when
it's up to date with current C# master.
2021-01-18 00:14:52 +03:00
Roman Khimov
db122de197
storage: fix linter warnings
...
pkg/core/interop/storage/find.go:19:6: exported type Iterator should have comment or be unexported
pkg/core/interop/storage/find.go:25:1: exported function NewIterator should have comment or be unexported
pkg/core/interop/storage/find.go:33:1: exported method Iterator.Next should have comment or be unexported
pkg/core/interop/storage/find.go:35:3: should replace s.index += 1 with s.index++
pkg/core/interop/storage/find.go:40:1: exported method Iterator.Value should have comment or be unexported
2021-01-15 21:12:10 +03:00
Evgeniy Stratonikov
9b1a7021ba
core: add PickN flags to Storage.Find
...
Allow to pick items by index from serialized struct or array.
2021-01-15 21:12:10 +03:00
Evgeniy Stratonikov
44af99fd07
core: add Deserialize flag to Storage.Find
...
Allow to deserialize values being iterated over.
2021-01-15 21:12:10 +03:00
Evgeniy Stratonikov
7fc0c04dba
core: add flags to Storage.Find
...
It can be iterated over keys, values or both.
Prefix can be stripped.
2021-01-15 21:12:08 +03:00
Evgeniy Stratonikov
2130e17f0c
core,vm: remove System.Enumerator.*
interops
...
Map iterator now returns key-value pair, while array/byte-array
iterators work like old enumerators.
Follow neo-project/neo#2190 .
2021-01-15 21:11:32 +03:00
Evgeniy Stratonikov
d04b000748
vm: remove iterator/enumerator Concat API
...
Follow neo-project/neo#2170 .
2021-01-15 21:08:59 +03:00
Roman Khimov
e36e71ffbd
Merge pull request #1647 from nspcc-dev/contractcall
...
Update `System.Contract.Call`
2021-01-15 21:02:01 +03:00
Anna Shaleva
09f0f03775
core: fix mempool.Add
...
Unlucky transaction could also have OracleResponce attribute.
2021-01-15 16:43:21 +03:00
Evgenii Stratonikov
1c0c331e25
core: update System.Contract.Call
syscall
...
1. Remove `System.Contract.CallEx`.
2. Extend number of parameters.
3. Add return value count to `VM.Context`.
2021-01-14 18:23:36 +03:00
Evgenii Stratonikov
86b0e76bf0
core: remove callback interops
...
Follow neo-project/neo#2168 .
2021-01-14 17:53:46 +03:00
Evgenii Stratonikov
dbe81f9b80
smartcontract: move flags to a separate package
2021-01-14 17:52:09 +03:00
Roman Khimov
36b5751262
Merge pull request #1665 from nspcc-dev/nefstate
...
Store NEF in contract state
2021-01-14 10:14:38 +03:00
Evgeniy Stratonikov
0b26b46234
state: store NEF instead of script for contract
...
NEFs for native contracts are set statically, thus
field values are taken from the reference implementation.
2021-01-13 15:34:10 +03:00
Roman Khimov
f912ee60df
Merge pull request #1660 from nspcc-dev/initialize-role-management-before-oracles
...
native: swap oracle and role management init
2021-01-13 13:03:27 +03:00
Evgenii Stratonikov
fb88d4f3a0
mpt: support put in batches
2021-01-13 12:25:27 +03:00
Roman Khimov
524bf9aaa0
native: swap oracle and role management init
...
Role management doesn't need oracles, but oracles do need role management. See
neo-project/neo#2187 .
2021-01-12 21:27:42 +03:00
Roman Khimov
ca86b78536
Merge pull request #1622 from nspcc-dev/nativenames
...
native: update contract names
2021-01-12 20:59:10 +03:00
Roman Khimov
4fa1476c03
native: use Hash160 method parameters where appropriate
...
Partially reverts 33386065bc
, see
neo-project/neo#2183 .
2021-01-12 18:08:12 +03:00
Evgenii Stratonikov
33b926586a
native: update contract names
...
Follow https://github.com/neo-project/neo/pull/2152 .
2021-01-12 17:58:05 +03:00
Roman Khimov
a0c4deb20f
Merge pull request #1630 from nspcc-dev/oracle_response
...
core: add ProtocolNotSupported oracle response code
2020-12-30 17:29:48 +03:00
Roman Khimov
811f38eaed
*: gofmt -s
2020-12-28 17:23:30 +03:00
Roman Khimov
197b98f40b
Merge pull request #1640 from nspcc-dev/fix/mpt
...
Hotfixes for testnet
2020-12-26 09:04:18 +03:00
Evgenii Stratonikov
c2f70a179b
Revert "mpt: do not allocate new buffer when updating dirty node"
...
This reverts commit 168ba7960c
.
It seems, there are some problems with it:
`2020-12-25T18:13:07.476+0300 WARN blockQueue: failed adding block into the blockchain {"error": "error while trying to apply MPT changes: unexpected EOF", "blockHeight": 9729, "nextIndex": 9730}`
2020-12-25 18:42:47 +03:00
Anna Shaleva
c13382e27d
core: fix (*NEO).getCandidates
...
Don't need to pay attention to key prefix while sorting.
2020-12-25 17:03:05 +03:00
Evgenii Stratonikov
30423f3306
mpt: update MPT after the block processing
2020-12-25 14:40:23 +03:00
Evgenii Stratonikov
168ba7960c
mpt: do not allocate new buffer when updating dirty node
...
Running time becomes faster under high load while staying the same in
the average case.
Memory allocation done in `Trie` goes down by about ~10% (even more,
actually).
2020-12-25 11:33:49 +03:00
Anna Shaleva
bc3f8a3b48
core: fix (*NEO).computeCommitteeMembers
...
In (*NEO).computeCommitteeMembers we return standbyCommittee in case
if there's not enought candidates. But there can be standby committee
members among candidates, so we need to fill in known votes.
2020-12-24 12:47:42 +03:00
Anna Shaleva
33386065bc
core: adjust parameters of native methods
...
This commit is mostly about Hash160 -> ByteArray for native contracts'
methods. Manifest is included into states, so we need to be compatible.
2020-12-23 11:18:44 +03:00
Anna Shaleva
e40f3610ed
core: store MinimumDeploymentFee as uint32
2020-12-22 16:09:16 +03:00
Roman Khimov
df6cb11017
Merge pull request #1631 from nspcc-dev/fix/appexec
...
vm: allow to serialize interop items
2020-12-22 13:20:30 +03:00
Roman Khimov
dee97d8542
Merge pull request #1524 from nspcc-dev/rpc/invoke_verify
...
rpc: add `invokecontractverify` RPC-method
2020-12-21 10:36:54 +03:00
Anna Shaleva
b1324db847
core: add notifications to ManagmentContract
2020-12-18 16:52:51 +03:00
Anna Shaleva
d34353aec2
core: add MinimumDeploymentFee
2020-12-18 16:48:05 +03:00
Anna Shaleva
a65544aab1
core: fix Managment destroy price
...
Too expensive.
2020-12-18 16:46:09 +03:00
Evgenii Stratonikov
3397f2c9be
native: cache contract in Management contract
2020-12-18 13:11:17 +03:00
Evgenii Stratonikov
8c22d27acc
state: allow to encode AppExecResult with recursive items
...
1. Encode them to a special type, decode to `nil`.
2. `Interop` can be encoded in JSON, this info should also be preserved.
2020-12-18 13:04:31 +03:00
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
Anna Shaleva
da5eb67e85
rpc: implement invokecontractverify
RPC method
2020-12-15 15:53:36 +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