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
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
Roman Khimov
b92ea2a48a
manifest/compiler: drop hashes from ABI and debug info
...
See neo-project/neo-devpack-dotnet#391 and neo-project/neo#2044 .
2020-11-26 18:30:49 +03:00
Roman Khimov
586dedecad
Merge pull request #1567 from nspcc-dev/tests/stillrelevant
...
core: add tests for `Blockchain.isTxStillRelevant()`
2020-11-26 17:28:21 +03:00
Evgenii Stratonikov
9f26d7b249
core: add tests for Blockchain.isTxStillRelevant()
2020-11-26 16:04:43 +03:00
Roman Khimov
f8957f10d7
Merge pull request #1566 from nspcc-dev/contractjson
...
rpc: marshal fees and GAS as Fixed8 decimal
2020-11-26 15:12:35 +03:00
Evgenii Stratonikov
a79b12b4d4
rpc: marshal fees and GAS as Fixed8 decimal
2020-11-26 15:04:30 +03:00
Evgenii Stratonikov
3a986d8635
core: add test for RemoveUntraceableBlocks
setting
2020-11-26 12:33:34 +03:00
Roman Khimov
882c214646
Merge pull request #1561 from nspcc-dev/removeold
...
core: remove old blocks and transactions
2020-11-25 19:14:32 +03:00
Anna Shaleva
9faa63453c
core: refactore some tests
...
They have a lot of common code.
2020-11-25 18:37:29 +03:00
Anna Shaleva
17842dabd6
core: implement native Notary contract
2020-11-25 18:37:29 +03:00
Anna Shaleva
c013522296
core: remove native contracts' name
method
...
We have `name` in contract manifest.
2020-11-25 18:37:29 +03:00
Anna Shaleva
0f68528095
core: add callback to VM context
2020-11-25 18:37:29 +03:00
Anna Shaleva
c9acc43023
core: invoke contract verification script with AllowStates flag
...
We should call contract's `verify` with AllowStates flag.
2020-11-25 18:37:29 +03:00
Anna Shaleva
eca27055b8
core: fix NEP17 Transfer event
...
`Transfer` event declaration was placed at the wrong part of
`newNEP17Native`, that's why it had incorrect parameters.
Fixed.
2020-11-25 18:37:29 +03:00
Anna Shaleva
2fee69f26f
core: add missing onPersist and postPersist methods to natives
...
Although not every contract is persisted (see
https://github.com/neo-project/neo/blob/master/src/neo/Ledger/Blockchain.cs#L94 )
we have to add `onPersist` and `postPersist` methods to every
native contract in order to display them in manifest for users and
follow C# behaviour. In C# there are `onPersist` and `postPersist`
methods in base native contract class, see
https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/NativeContract.cs#L141
and
https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/NativeContract.cs#L148
2020-11-25 18:37:29 +03:00
Anna Shaleva
97069a05d5
core: fix locking in storeBlock
2020-11-25 18:37:29 +03:00
Anna Shaleva
52cf328296
core: add NotaryAssisted transaction attribute
2020-11-25 18:37:29 +03:00
Anna Shaleva
fc9f0034c9
core: adjust verifyTxAttributes
for HighPriority attributes
...
The fact that they have hight priority does not mean that cheks for other
attributes should be skipped.
2020-11-25 18:37:29 +03:00
Anna Shaleva
8cdf2d3464
core: unify verifyTxAttributes
errors
...
We already have pretty ErrInvalidAttribute error, so I think that all
other `verifyTxAttributes` errors should be wrappers around ErrInvalidAttr.
2020-11-25 18:37:29 +03:00
Anna Shaleva
31aa66a4a4
core: check the length of NotValidBefore attr while decoding
...
DecodeBinary throws panic otherwise.
2020-11-25 18:37:29 +03:00
Anna Shaleva
8548786444
core: do not rewrite binreader error for bad Conflicts attr
...
We should keep the original BinReader error untouched in case if
it is exists.
2020-11-25 18:37:24 +03:00
Evgenii Stratonikov
28b4d4e2f8
core: remove old blocks and transactions
...
Remove blocks with `height <= current height - MaxTraceableBlocks`
together with transactions.
2020-11-25 16:38:20 +03:00
Evgenii Stratonikov
54b177cf40
dao: store blocks/txransactions by big-endian hash
...
There is no need for additional allocations.
2020-11-25 14:03:43 +03:00
Anna Shaleva
b00eb51c55
core: add P2PNotary designated role
2020-11-24 18:47:09 +03:00
Evgenii Stratonikov
67f26859a8
scripts: implement script for creating dumps
...
This is useful for creating dumps providing various load
to benchmark restore or check compatibility with C# nodes.
Related #1472 .
2020-11-24 16:47:33 +03:00
Evgenii Stratonikov
6f7284906a
blockchainer: allow to dump/restore chain
2020-11-24 16:43:11 +03:00
Evgenii Stratonikov
966b50f2ae
core: save StateRootInHeader in genesis block
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
7d91a3a89e
pkg: move internal/ package to the root directory
...
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
31eca342eb
*: replace all NEP5 occurences to NEP17
2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
b97dfae8d8
native: replace NEP-5 with NEP-17
2020-11-24 13:08:23 +03:00
Evgenii Stratonikov
a5914f89fa
core: allow to provide block in GetTestVM()
...
Sometimes amount of GAS consumed depends on block height.
2020-11-24 12:17:29 +03:00
Evgenii Stratonikov
42ae226f9e
native: use proper stack for result
...
When native method calls other contract result should be put
on the stack of current context. With oracles this problem wasn't
noticed because of void return type.
2020-11-24 12:17:28 +03:00
Evgenii Stratonikov
c849176be7
manifest: include contract Name
2020-11-24 11:23:44 +03:00
Evgenii Stratonikov
e38e8aa48a
rpc: implement getproof RPC
2020-11-20 18:06:22 +03:00
Evgenii Stratonikov
1869d6d460
core: allow to use state root in header
2020-11-20 17:16:32 +03:00
Evgenii Stratonikov
85f927d892
mpt: implement reference counting
...
Also postpone MPT initialization until `storeBlock`
because we need to read-and-check or save info about refcounting
depending on starting height.
2020-11-20 16:50:30 +03:00
Evgenii Stratonikov
1c559634aa
mpt: fill cached fields when getting node from store
...
Node which has been got from store shouldn't be flushed again.
2020-11-19 12:25:43 +03:00
Evgenii Stratonikov
fd9ff4102a
mpt: export func for decoding node with type
...
`NodeObject` can contain auxilliary fields and shouldn't be used from outside.
2020-11-19 12:25:43 +03:00
Roman Khimov
2f824c590a
Merge pull request #1556 from nspcc-dev/allow-null-oracle-filters
...
Allow null oracle filters
2020-11-19 10:30:22 +03:00
Roman Khimov
eef921b8e0
native: allow NULL filter in oracle requests
...
Follow neo-project/neo#2067
2020-11-18 23:59:13 +03:00
Anna Shaleva
ec8ebc292c
core: restrict notification size for System.Runtime.Notify
2020-11-17 16:27:51 +03:00
Anna Shaleva
933bb4ca75
core: update committee every [committee length] blocks
...
Was changed in https://github.com/neo-project/neo/pull/1848 . Affects
storage dumps.
2020-11-17 11:22:32 +03:00
Anna Shaleva
054e60c0cf
core: remove NodeList from Oracle storage
...
The reference implementation does not store NodeList. This commit fixes
state difference for genesis block.
2020-11-16 19:09:34 +03:00
Roman Khimov
88cee80a58
Merge pull request #1543 from nspcc-dev/compatibility-fixes
...
rpc, cli: tiny compatibility fixes
2020-11-16 15:53:42 +03:00
Anna Shaleva
083879838c
rpc: adjust getrawtransaction
and gettransactionheight
RPC call
...
We should return verbose transaction in case if it is in the mempool
from `getrawtransaction`. We also shouldn't return height from
`gettransactionheight` in case if transaction is in the mempool.
2020-11-16 13:25:42 +03:00
Roman Khimov
3cb945f022
manifest: simplify marshaling
2020-11-13 21:46:26 +03:00
Roman Khimov
286d9185f4
smartcontract: remove contract features
...
We're featureless now, all contracts have access to storage and payable status
is to be determined via new NEP. Follow neo-project/neo#2060 .
2020-11-13 21:26:23 +03:00
Evgenii Stratonikov
adf403666f
native: decode storage item in Seek
2020-11-13 17:33:00 +03:00
Roman Khimov
0f827ee6ba
Merge pull request #1531 from nspcc-dev/core/applicationlog_with_multiple_triggers
...
core, rpc: store multiple execution results for single hash
2020-11-12 19:05:22 +03:00
Anna Shaleva
d6992cb5c4
core: marshal block hash for AppExecResult [NotificationsSubsystem]
2020-11-12 17:43:20 +03:00
Anna Shaleva
7ca93e76ac
core, rpc: allow to store several AppExecResult for a single hash
...
It is required for we have several executions per block.
2020-11-12 16:24:39 +03:00
Roman Khimov
9142906abe
Merge pull request #1539 from nspcc-dev/core/fix_mempool_test
...
core: fix failing mempool test
2020-11-12 15:48:28 +03:00
Roman Khimov
11a224057b
Merge pull request #1536 from nspcc-dev/feature/retransmit3
...
network: retransmit stale transactions (master)
2020-11-12 15:47:00 +03:00
Anna Shaleva
a84e4c1e89
core: make some checks in TestMempoolAddRemoveConflicts non-critical
...
It will help to investigate test failures.
2020-11-12 15:14:32 +03:00
Anna Shaleva
54e6bcad12
core: fix failing mempool test
...
There might be a case when identical nonces are generated for tx6, tx7 or
tx8 (they are not in mempool, so each of them pass mempool-presence
check). In this case test fails due to the lack of hashes into mp.conflicts
map (two of tx6, tx7 or tx8 have identical hashes) with the following
error:
```
=== RUN TestMempoolAddRemoveConflicts
--- FAIL: TestMempoolAddRemoveConflicts (0.00s)
mem_pool_test.go:376:
Error Trace: mem_pool_test.go:376
Error: Not equal:
expected: 4
actual : 3
Test: TestMempoolAddRemoveConflicts
```
Fixed by maling the nonce non-random.
2020-11-12 15:05:01 +03:00
Anna Shaleva
b51eb7f5ef
core: update opcodes prices
...
Changes ported from https://github.com/neo-project/neo/pull/2020 .
2020-11-12 14:20:26 +03:00
Evgenii Stratonikov
3e5b84348d
network: retransmit stale transactions
2020-11-12 13:51:44 +03:00