Anna Shaleva
d1ec01c45e
util: implement Serializable interface over Uint160
2020-05-04 11:49:14 +03:00
Anna Shaleva
08f5708edb
core: remove Script attribute type
2020-05-04 11:49:14 +03:00
Roman Khimov
40e153030d
Merge pull request #919 from nspcc-dev/feature/arith
...
vm: reorder arithmetic and bitwise opcodes
2020-04-30 20:18:19 +03:00
Evgenii Stratonikov
905f5f3047
*: go mod tidy
2020-04-30 19:29:52 +03:00
Evgenii Stratonikov
c8328981ec
vm: refactor tests
...
Most of the tests follow the same logic:
push items on stack -> execute program -> check single result.
This commit reuses this function in most of the tests.
2020-04-30 19:29:52 +03:00
Evgenii Stratonikov
9081211f12
vm: implement NOTEQUAL opcode
2020-04-30 18:00:15 +03:00
Evgenii Stratonikov
70f0c656b0
vm: check Integer size on creation
2020-04-30 18:00:15 +03:00
Evgenii Stratonikov
a64a0f2681
vm: reorder arithmetic opcodes
2020-04-30 18:00:15 +03:00
Roman Khimov
fda943b5cf
Merge pull request #917 from nspcc-dev/feature/crypto
...
vm: remove crypto-related opcodes
2020-04-29 21:52:30 +03:00
Evgenii Stratonikov
519b31a704
vm: remove crypto-related opcodes
...
All cryptography has moved to interops in NEO3.
There is no SHA256 interop RN, but it is to appear later.
Closes #777 .
2020-04-29 19:16:38 +03:00
Roman Khimov
c1aa96d614
Merge pull request #911 from nspcc-dev/feature/convert
...
vm: implement CONVERT opcode
2020-04-28 18:08:36 +03:00
Evgenii Stratonikov
4b064e18aa
emit: converto to Boolean in Bool()
2020-04-28 17:36:58 +03:00
Evgenii Stratonikov
2fd63387c0
compiler: support CONVERT interops
...
When result is needed to have certain type, we should have ability
to convert it, with the help of CONVERT opcode.
2020-04-28 16:44:06 +03:00
Evgenii Stratonikov
bfcb1a409f
compiler: extend possible returned values
...
All integer values (int32, uint64...) should be able to be returned.
2020-04-28 16:44:06 +03:00
Evgenii Stratonikov
7e98a2ffa0
vm: implements CONVERT opcode
2020-04-28 16:38:52 +03:00
Evgenii Stratonikov
be38798785
vm: move Bool method to the StackItem interface
2020-04-28 15:13:41 +03:00
Roman Khimov
ec2218698f
Merge pull request #898 from nspcc-dev/neo3/block_format
...
core: change block format to neo3
2020-04-27 18:10:44 +03:00
Anna Shaleva
fa467ce628
core: add txes duplication check on block.DecodeBinary
2020-04-27 18:00:01 +03:00
Anna Shaleva
dbda721599
consensus.Block: removed unnecessary setters
...
As far as we have consensus context in NewBlockFromContext, we don't
need them anymore.
2020-04-27 17:59:56 +03:00
Anna Shaleva
6db4ca874d
consensus: replace NewBlock() with NewBlockFromContext(ctx *Context)
...
We have to set ConsensusData.PrimaryIndex field of Block, so this value
can be retrieved from consensus context.
2020-04-27 17:58:25 +03:00
Anna Shaleva
29d321b5e1
*: drop miner transaction
...
1. Completely remove miner transaction
2. Change validation rule for block: block without transactions is
valid.
2020-04-27 17:57:37 +03:00
Anna Shaleva
55fd9f8d24
core: change block.ConsensusData to neo3 format
...
1. Dropped `Base.ConsensusData` block field
2. Added `Block.ConsensusData` field with `Nonce` and `PrimaryIndex`
3. Removed "Neo.Header.GetConsensusData" and
"AntShares.Header.GetConsensusData" interops
2020-04-27 17:57:37 +03:00
Anna Shaleva
0de5cb1bde
core, consensus: nanoseconds-precision timestamp
...
Keep timestamp of consensus messages in nanoseconds-precision state
2020-04-27 17:57:32 +03:00
Anna Shaleva
aa554f0a9a
core: update block timestamp format
...
Changed block.Timestamp from uint32 to uint64
2020-04-27 17:56:44 +03:00
Roman Khimov
de91418d45
Merge pull request #894 from nspcc-dev/neo3/genesis/init_native_interops
...
core: init native interops in the genesis block
2020-04-27 16:32:20 +03:00
Evgenii Stratonikov
dca257f584
vm: move ISNULL opcode
...
Change it according to NEO3-preview2.
2020-04-27 16:09:03 +03:00
Roman Khimov
e6f5cffff6
transaction: drop Enrollment and State types
...
They're completely replaced now by the NEO native contract voting system.
2020-04-27 16:06:58 +03:00
Roman Khimov
b83e84ca08
core: switch to the new voting system (via native NEO contract)
...
It has all the methods required now, so you can register, vote and get
voting results. Fixes #865 .
2020-04-27 16:06:50 +03:00
Roman Khimov
2fa3bdf6a9
core/native: move Votes from account to native NEO state
2020-04-27 12:30:39 +03:00
Roman Khimov
bc4a6a6bab
core/native: move NextValidators storage to NEO contract
2020-04-27 12:30:39 +03:00
Roman Khimov
66c80d429e
native: update voting information when changing Neo balance
2020-04-27 12:30:39 +03:00
Roman Khimov
36c6c6690b
native: distribute GAS even for empty transfers
...
As it's one of the use cases.
2020-04-27 12:30:39 +03:00
Roman Khimov
064636768b
core/native: move ValidatorsCount processing into native NEO contract
2020-04-27 12:30:39 +03:00
Roman Khimov
3476a18fa9
core/native: store validators in NEO native contract state
...
This technically breaks voting with UTXO-based NEO (processTXWithValidators*),
but we're moving towards the new system.
2020-04-27 12:30:39 +03:00
Roman Khimov
4e8ee697ee
native: store NEO and GAS state in the storage
...
As it should be done (although current serialization format is not quite
right).
2020-04-27 12:30:39 +03:00
Roman Khimov
8c02c6b22c
native: put proper Null StackItem for transfer event
...
nil is not a good StackItem, we have proper VM-level Null for this.
2020-04-27 12:30:39 +03:00
Roman Khimov
1dcace1594
native: don't distribute gas at block 0
...
It fails at the moment and it doesn't make sense at conceptual level.
2020-04-27 12:30:39 +03:00
Roman Khimov
30836ca69b
core/native: untangle native contracts initialization
...
The notion of NativeContractState shouldn't ever existed, native contract is a
contract and its state is saved as regular contract state which is critical
because we'll have MPT calculations over this state soon.
Initial minting should be done in Neo.Native.Deploy because it generates
notification that should have proper transaction context.
RegisterNative() shouldn't exist as a public method, native contracts are only
registered at block 0 and they can do it internally, no outside user should be
able to mess with it.
Move some structures from `native` package to `interop` also to avoid circular
references as interop.Context has to have a list of native contracts (exposing
them via Blockchainer is again too dangerous, it's too powerful tool).
2020-04-27 12:30:39 +03:00
Anna Shaleva
869c7d6afa
core: init native interops in the genesis block
...
closes #836
2020-04-27 12:30:39 +03:00
Roman Khimov
aa8d4d2f57
Merge pull request #907 from nspcc-dev/feature/compound
...
vm: implement Array/Struct/Map opcodes
2020-04-27 12:10:40 +03:00
Evgenii Stratonikov
7c3d7c0261
vm: implement NEWARRAYT opcode
2020-04-27 09:06:48 +03:00
Evgenii Stratonikov
d3b9aef8e2
vm: implement ISTYPE opcode
...
Also make StackItemType public and reorder it according to NEO3.
2020-04-27 09:01:26 +03:00
Evgenii Stratonikov
48a41bd737
vm: implement CLEARITEMS opcode
2020-04-27 09:01:26 +03:00
Evgenii Stratonikov
9fd04aefa5
vm: implement NEWARRAY0 and NEWSTRUCT0 opcodes
2020-04-24 13:49:10 +03:00
Evgenii Stratonikov
03761421f8
vm: reorder Array/Map opcodes
...
Also SIZE can be used for both Arrays/Maps and ByteArrays.
2020-04-24 13:48:44 +03:00
Roman Khimov
f940d6e5ad
Merge pull request #901 from nspcc-dev/feature/flowopcodes
...
vm: implement new flow-control opcodes
2020-04-24 11:15:19 +03:00
Evgenii Stratonikov
d6624a92ca
vm: implement new JMP* and CALL* opcodes
...
In compiler JMP*_L opcodes are always used, as this requires less effort.
2020-04-24 10:16:41 +03:00
Evgenii Stratonikov
fba185cd99
vm: remove stack isolation opcodes
...
They are not present in NEO3 and will be creating additional difficulties
during future flow-control opcodes implementation.
2020-04-24 10:15:14 +03:00
Roman Khimov
ab9d334182
Merge pull request #903 from nspcc-dev/fix/tests
...
rpc: simplify RPC tests
2020-04-24 09:41:34 +03:00
Evgenii Stratonikov
7caa81a81c
rpc/test: generate block for submitblock on-the-fly
...
There is no need to provide hex when chain is dumped.
2020-04-24 08:54:22 +03:00