Commit graph

2611 commits

Author SHA1 Message Date
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
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
4de233b339 emit: allow to emit nested arrays 2020-11-24 11:23:44 +03:00
Evgenii Stratonikov
c849176be7 manifest: include contract Name 2020-11-24 11:23:44 +03:00
Evgenii Stratonikov
8e60a65b55 rpc: implement verifyproof RPC
Test getproof and verifyproof together.
2020-11-20 18:06:22 +03:00
Evgenii Stratonikov
e38e8aa48a rpc: implement getproof RPC 2020-11-20 18:06:22 +03:00
Evgenii Stratonikov
6b42e9306a rpc/server: implement getstateheight RPC 2020-11-20 18:06:21 +03:00
Evgenii Stratonikov
4de22247d5 rpc/server: implement getstateroot RPC 2020-11-20 17:16:33 +03:00
Evgenii Stratonikov
1869d6d460 core: allow to use state root in header 2020-11-20 17:16:32 +03:00
Evgenii Stratonikov
3025b42c65 consensus: assume non-nil message in decodeData
`nil` message is occuring only in tests to check that
no unnecessary decoding is done on errors.
2020-11-20 17:14:19 +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
Roman Khimov
4640ba2758
Merge pull request #1551 from nspcc-dev/core/adjust_runtime_notify
core: adjust System.Runtime.Notify interop
2020-11-18 21:40:54 +03:00
Anna Shaleva
ec8ebc292c core: restrict notification size for System.Runtime.Notify 2020-11-17 16:27:51 +03:00
Anna Shaleva
8e29a200c0 rpc: adjust NEP5 transfers amount JSON marshalling
This committ fixes the difference between Go and C# nodes:

Go:
```
{
   "jsonrpc" : "2.0",
   "result" : {
      "received" : [
         {
            "blockindex" : 65,
            "txhash" : "0x394f851cf167d664c0dbcf98e2e64f2da23022fd7943dcb914492529de20a945",
            "transfernotifyindex" : 0,
            "timestamp" : 1605535020126,
            "transferaddress" : "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
            "amount" : "29999999",
            "assethash" : "0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc"
         }
      ],
      "address" : "NULwe3UAHckN2fzNdcVg31tDiaYtMDwANt",
      "sent" : []
   },
   "id" : 1
}
```

C#:
```
{
   "id" : 1,
   "result" : {
      "address" : "NULwe3UAHckN2fzNdcVg31tDiaYtMDwANt",
      "sent" : [],
      "received" : [
	 {
	    "transferaddress" : "NUVPACMnKFhpuHjsRjhUvXz1XhqfGZYVtY",
	    "timestamp" : 1605535020126,
	    "txhash" : "0x394f851cf167d664c0dbcf98e2e64f2da23022fd7943dcb914492529de20a945",
	    "blockindex" : 65,
	    "transfernotifyindex" : 0,
	    "amount" : "2999999900000000",
	    "assethash" : "0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc"
	 }
      ]
   },
   "jsonrpc" : "2.0"
}
```
2020-11-17 15:50:19 +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
Roman Khimov
112fa5b92d smartcontract: drop unused ContractDetails
That's a remnant from 2.0.
2020-11-13 21:00:54 +03:00
Evgenii Stratonikov
adf403666f native: decode storage item in Seek 2020-11-13 17:33:00 +03:00
Anna Shaleva
31cf71fb62 rpc: use default Uint160 marshaller for result.NEP5Balance.Asset
To match C# behaviour we should marshal asset hash with `0x` prefix.
2020-11-13 12:28:31 +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
Roman Khimov
543871fb2c
Merge pull request #1541 from nspcc-dev/core/fix_nef_getversion
smartcontract: fix nef.GetVersion
2020-11-12 17:56:12 +03:00
Anna Shaleva
251a660b85 smartcontract: ignore case in trigger.FromString 2020-11-12 17:49:28 +03:00
Anna Shaleva
d6992cb5c4 core: marshal block hash for AppExecResult [NotificationsSubsystem] 2020-11-12 17:43:20 +03:00
Anna Shaleva
0b15ca8bd0 rpc: add trigger parameter to getapplicationlog 2020-11-12 17:43:11 +03:00