Commit graph

2798 commits

Author SHA1 Message Date
Evgenii Stratonikov
bb706aa55b vm: implement CALLT opcode 2021-01-21 19:30:04 +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
0bbdee2ce1 nef: add Reserved bytes 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
7fb40e104a io: allow to restrict string size 2021-01-19 11:16:23 +03:00
Roman Khimov
376c22adee
Merge pull request #1670 from nspcc-dev/vm/popitem
Add POPITEM opcode
2021-01-19 09:51:53 +03:00
Evgeniy Stratonikov
f0fe03117a compiler: optimize struct copy a bit
POPITEM is cheaper than PUSH + PICKITEM.
2021-01-19 09:46:01 +03:00
Evgeniy Stratonikov
324107b31e vm: implement POPITEM opcode 2021-01-19 09:46:01 +03:00
Roman Khimov
163d90c866 network: don't register addresses before version handshake
1) It duplicates registration in `version` message handler and no valid
   connection can work without version exchange.
2) On public networks we have seed nodes defined by names, so we register
   connections to them using these names, but then if connection is dropped we
   delist them by IP:PORT combinations which can lead to zero PeerCount() with
   all seeds still being registered as connected in the discovery subsystem
   and thus no reconnection attempts being made.
2021-01-18 21:10:06 +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
Evgeniy Stratonikov
11191c0a08 nef: support JSON serialization 2021-01-13 15:26:35 +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
Evgenii Stratonikov
1d4d93b3eb vmcli: use manifest for method execution 2021-01-11 10:45:42 +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
Anna Shaleva
be3692136e vm: adjust default VM interops prices
It might be not so important, because we use them only for VM-CLI, but
let's keep them equal to the standard interops prices.
2020-12-29 11:11:56 +03:00
Roman Khimov
a8bb040558 *: fix ineffassign goreportcard warnings 2020-12-28 17:31:50 +03:00
Roman Khimov
459ad521ab *: fix misspellings spotted by goreportcard 2020-12-28 17:27:04 +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
Roman Khimov
756785acd3
Merge pull request #1638 from nspcc-dev/fix/mpt
mpt: do not allocate new buffer when updating dirty node
2020-12-25 14:52:09 +03:00
Evgenii Stratonikov
30423f3306 mpt: update MPT after the block processing 2020-12-25 14:40:23 +03:00
Evgenii Stratonikov
84a3474fc5 network: set timeout on write
Fix a bug occuring under high load when node
hangs during this write.
2020-12-25 14:36:53 +03:00
Evgenii Stratonikov
5bd6c1e5cc network: fix a bug in discovery with a peer connected twice
It could be the case that checks are performed simultaneosly and
peers connections goes down from 2 to 0. We must take such case into
account and register address as good in discovery.
2020-12-25 14:36:53 +03:00
Evgenii Stratonikov
2cb536a6a1 network: provide NullPayload where necessary 2020-12-25 14:36:53 +03:00
Evgenii Stratonikov
0a5049658f network: support non-blocking broadcast
Right now a single slow peer can slow down whole network.
Do broadcast in 2 parts:
1. Perform non-blocking send to all peers if possible.
2. Perform blocking sends until message is sent to 2/3 of good peers.
2020-12-25 14:36:52 +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