Anna Shaleva
afdfa9ce62
rpc: add submitnotaryrequest
RPC call
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
Anna Shaleva
5d6fdda664
network: fix P2PNotaryRequest payload broadcaster
2021-02-11 17:11:36 +03:00
Anna Shaleva
5c2ea2d5bb
network: refactor P2PNotaryRequest decoding
...
We need to provide magic for both main and fallback transactions during
decoding, because transactions hashes depend on it.
2021-02-11 17:11:33 +03:00
Anna Shaleva
c14e34cdb5
network: add RelayP2PNotaryRequest method
2021-02-11 16:56:24 +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
4f1bea0bcb
rpc/client: implement GetNativeContracts
2021-02-11 12:37:03 +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
a6e25cffde
bitfield: add basic bit field package
...
Strange as it is but I wasn't able to find any good bit field
implementation. Most of them are limited to 64 bits, some allow for wider
values (like https://github.com/emef/bitfield ) but even they're not that
efficient (using bytes instead of wider types). This this minimalistic thing.
2021-02-09 22:31:26 +03:00
Roman Khimov
b892db9976
vm: add instruction correctness check
...
See neo-project/neo-vm#392 .
2021-02-09 22:31:26 +03:00
Roman Khimov
a3abdbd7f0
manifest: add duplicate events/methods checks to ABI
...
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
dc3967ae7b
manifest: add manifest validity checks
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
284476c070
manifest: add Permission and Permissions validity checks
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
15ed905757
manifest: add validity checks for Parameter
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
f0c3066ef6
manifest: add method validity check
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
f3c761e4c2
manifest: move Parameter into a file of its own
2021-02-09 22:31:26 +03:00
Roman Khimov
0b2e9312af
manifest: add event validity check
...
Refs. #1699 .
2021-02-09 22:31:26 +03:00
Roman Khimov
f78e3fb290
manifest: move Event into a file of its own
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
Roman Khimov
296c7a10fc
manifest: move Group code into a file of its own
2021-02-09 22:31:22 +03:00
Evgeniy Stratonikov
18911caa3a
Revert "rpc: marshal GAS in getunclaimedgas
as decimal"
...
This reverts commit df801a8539
.
2021-02-09 11:37:25 +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
18b7584cb4
compiler/interop: add Manifest to Contract struct
2021-02-08 13:13:11 +03:00
Evgeniy Stratonikov
6cf40749a9
compiler: add tests for native wrappers
2021-02-08 13:13:10 +03:00
Evgeniy Stratonikov
73a75cc27a
compiler: do not convert interop types on assertion
2021-02-08 13:11:39 +03:00
Evgeniy Stratonikov
2f6345f2d9
compiler: add Hash compatibility test
2021-02-08 13:09:41 +03:00
Evgeniy Stratonikov
69c011b3e7
compiler: implement Ledger contract wrapper
2021-02-08 13:09:41 +03:00
Evgeniy Stratonikov
7bee28b81e
compiler: implement Management contract wrapper
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
211fe307ee
manifest: move ABI code into file of its own
...
Make it a little more convenient to work with it.
2021-02-08 11:55:16 +03:00
Evgeniy Stratonikov
9988f4ed1c
compiler: implement Notary contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
2f26490e59
compiler: implement RoleManagement contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
77fcfeccff
compiler: implement Policy contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
3c237e2a29
compiler: implement NameService contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
779fba3001
compiler: implement Oracle contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
34a6eef8ce
compiler: implement GAS contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
6e866b622a
compiler: implement NEO contract wrapper
2021-02-08 11:44:39 +03:00
Evgeniy Stratonikov
e5d8c1c985
compiler: allow conversion to types from external packages
2021-02-08 11:02:45 +03:00
Roman Khimov
60dfffc574
manifest: remove no longer used Serializable interface
...
It was used when manifests were saved into JSON.
2021-02-08 10:52:53 +03:00
Roman Khimov
1f98289f5d
Merge pull request #1717 from nspcc-dev/rpc-base64
...
RPC base64 changes
2021-02-08 10:42:26 +03:00
Roman Khimov
e0c7a3b77c
rpc: add getblockheadercount call
...
See neo-project/neo-modules#504 .
2021-02-07 23:18:09 +03:00
Roman Khimov
272bb03e3b
rpc: use base64 for getstorage in/out
...
See neo-project/neo#484 .
2021-02-07 22:07:30 +03:00
Roman Khimov
66471de9d2
Merge pull request #1716 from nspcc-dev/zero-headers-error
...
payload: treat zero-length headers as error
2021-02-06 14:32:38 +03:00
Roman Khimov
eecd71abeb
payload: treat zero-length headers as error
...
See neo-project/neo#2259 .
2021-02-06 00:06:01 +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
d138ed731c
Merge pull request #1709 from nspcc-dev/network-fixes-for-preview5
...
Network fixes for preview5
2021-02-05 16:22:00 +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
Roman Khimov
a87b8578b2
network: stub "StateService" payloads out for now
...
And stop dropping connections if we're to receive them. Proper handling is
subject of #1701 , but we need at least some connection-level stability for
now.
2021-02-05 14:59:41 +03:00
Roman Khimov
686f983ccf
network: prevent disconnects during initial sync
...
Node receiving extensible payload from the future is confused and drops
connection. Note that this can still happen if the node is to loose its
synchrony.
Calling `IsInSync()` is quite expensive, so we stop doing that once synchrony
is reached (hence bool flag).
2021-02-05 14:54:43 +03:00
Roman Khimov
b1977ea4e3
Merge pull request #1708 from nspcc-dev/native/fixname
...
native: fix `getCommittee` name
2021-02-05 14:02:28 +03:00
Evgeniy Stratonikov
d7f68d3650
native: fix getCommittee
name
...
`C` was in russian.
2021-02-05 13:34:05 +03:00
Anna Shaleva
b0563ad0d7
services: fix Oracle responces mutex
...
Solves the following problem:
=== RUN TestOracleFull
logger.go:130: 2021-02-04T09:25:16.305Z INFO P2PNotaryRequestPayloadPool size is not set or wrong, setting default value {"P2PNotaryRequestPayloadPoolSize": 1000}
logger.go:130: 2021-02-04T09:25:16.306Z INFO no storage version found! creating genesis block
logger.go:130: 2021-02-04T09:25:27.687Z DEBUG done processing headers {"headerIndex": 1, "blockHeight": 0, "took": "2.413398ms"}
logger.go:130: 2021-02-04T09:25:27.696Z DEBUG done processing headers {"headerIndex": 2, "blockHeight": 1, "took": "1.138196ms"}
logger.go:130: 2021-02-04T09:25:28.680Z INFO blockchain persist completed {"persistedBlocks": 2, "persistedKeys": 173, "headerHeight": 2, "blockHeight": 2, "took": "166.793µs"}
fatal error: sync: Unlock of unlocked RWMutex
goroutine 6157 [running]:
runtime.throw(0x115dfdb, 0x20)
/usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc000297ca0 sp=0xc000297c70 pc=0x44f432
sync.throw(0x115dfdb, 0x20)
/usr/local/go/src/runtime/panic.go:1102 +0x35 fp=0xc000297cc0 sp=0xc000297ca0 pc=0x44f3b5
sync.(*RWMutex).Unlock(0xc000135300)
/usr/local/go/src/sync/rwmutex.go:129 +0xf3 fp=0xc000297d00 sp=0xc000297cc0 pc=0x4a1ac3
github.com/nspcc-dev/neo-go/pkg/services/oracle.(*Oracle).Run(0xc000135180)
/go/src/github.com/nspcc-dev/neo-go/pkg/services/oracle/oracle.go:189 +0x82b fp=0xc000297fd8 sp=0xc000297d00 pc=0xe13b0b
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000297fe0 sp=0xc000297fd8 pc=0x4834d1
created by github.com/nspcc-dev/neo-go/pkg/core.TestOracleFull
/go/src/github.com/nspcc-dev/neo-go/pkg/core/oracle_test.go:276 +0x3f1
2021-02-05 11:37:12 +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
43bfc909eb
consensus: flush previous proposal on new block
...
Reusing proposals from previous blocks doesn't make sense. And reduce some
code duplication along the way.
2021-02-04 18:54:01 +03:00
Roman Khimov
8c0a7225e5
consensus: only use previous proposal if it has something in it
...
It might just be uninitialized it doesn't really make sense using zero-length
previous proposal anyway.
2021-02-04 18:48:09 +03:00
Roman Khimov
f081e63674
consensus: fix extensible message category name
...
Fix this in 2+2 setup:
2021-02-04T13:50:23.923Z WARN peer disconnected {"addr": "172.30.0.5:20334", "reason": "handling CMDExtensible message: invalid category", "peerCount": 3}
2021-02-04T13:50:26.968Z WARN peer disconnected {"addr": "172.30.0.2:42586", "reason": "handling CMDExtensible message: invalid category", "peerCount": 2}
2021-02-04 16:55:46 +03:00
Roman Khimov
6fd5f4e86d
payload: extensible payload hashes are network-dependent
...
Of course they are. Fixes
2021-02-04T13:39:02.351Z WARN peer disconnected {"addr": "172.29.0.4:20333", "reason": "handling CMDExtensible message: signature check failed: invalid signature", "peerCount": 3}
2021-02-04T13:39:02.352Z WARN peer disconnected {"addr": "172.29.0.3:20334", "reason": "handling CMDExtensible message: signature check failed: invalid signature", "peerCount": 2}
in 2+2 setting.
2021-02-04 16:50:51 +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
4ad9c7929b
internals: move testchain from network to internals
...
It'll be useful for tests outside of the network pkg.
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
Roman Khimov
d822e8dc21
vm: add test for neo-project/neo-vm#393
2021-02-01 16:39:54 +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
25d734cbad
oracle: process requests concurrently
2021-01-28 13:00:59 +03:00