Commit graph

2864 commits

Author SHA1 Message Date
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