Evgenii Stratonikov
115919aaf7
vm: process OLDPUSH1 at the context level
...
The only usecase for this opcode is single-byte verification scripts.
2020-05-06 13:00:00 +03:00
Roman Khimov
ec6ade4c9b
Merge pull request #920 from nspcc-dev/neo3/transaction/cosigners
...
core: implement cosigners mechanism
2020-05-04 17:15:07 +03:00
Roman Khimov
712d7b9de6
Merge pull request #922 from nspcc-dev/neo3/compiler/generate_abi
...
compiler: add ability to generate .abi.json file
2020-05-04 12:04:20 +03:00
Anna Shaleva
5ece9922c1
vm: hide GetContextScriptHash() method
...
After adding ScriptHashGetter interface to vm, there's no need in
GetContextScriptHash() to be exported.
2020-05-04 11:53:31 +03:00
Anna Shaleva
73167999cc
core: add cosigners field to transaction
...
closes #864
2020-05-04 11:53:31 +03:00
Anna Shaleva
9ecac14aee
vm: fix bug in GetContextScriptHash()
...
v.Istack.Peek(n) can return nil pointer, so .Value() on this pointer
leads to panic here. Fixed by adding nil check.
2020-05-04 11:49:14 +03:00
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
Anna Shaleva
2ec1d76320
compiler: add ability to generate .abi.json file
...
A part of integration with NEO Blockchain Toolkit (see #902 ). To be
able to deploy smart-contract compiled with neo-go compiler via NEO
Express, we have to generate additional .abi.json file. This file
contains the following information:
- hash of the compiled contract
- smart-contract metadata (title, description, version, author,
email, has-storage, has-dynamic-invoke, is-payable)
- smart-contract entry point
- functions
- events
However, this .abi.json file is slightly different from the one,
described in manifest.go, so we have to add auxilaury stractures for
json marshalling. The .abi.json format used by NEO-Express is described
[here](https://github.com/neo-project/neo-devpack-dotnet/blob/master/src/Neo.Compiler.MSIL/FuncExport.cs#L66 ).
2020-05-04 08:37:39 +03:00
Anna Shaleva
ab7f2cb4fb
compiler: fix bug with missing methods parameters
...
Method `methodInfoFromScope(...)` always returned an empty parameters
set, so we were missing this information in both .abi.json and
.debug.json files. Fixed now.
2020-05-04 08:37:39 +03:00
Anna Shaleva
861aca1547
rpc, smartcontract: move contract metadata to smartcontract package
2020-05-04 08:37:39 +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