Roman Khimov
a986e2a064
*: drop support for old on-chain assets
...
You no longer can transfer them, so creating/renewing/storing doesn't make
much sense.
2020-06-05 19:21:37 +03:00
Roman Khimov
bf6435eeaa
storage: drop STValidator prefix, it's not used
2020-06-05 19:20:16 +03:00
Roman Khimov
709146f295
transaction: drop Inputs and Outputs, forget UTXO
2020-06-05 19:20:16 +03:00
Roman Khimov
21efccd300
transaction: remove type field, set Version to 0
...
Two changes being done here, because they require a lot of updates to
tests. Now we're back into version 0 and we only have one type of
transaction.
It also removes GetType and GetScript interops, both are obsolete in Neo 3.
2020-06-05 19:20:16 +03:00
Roman Khimov
dfb26f9ab2
block: don't attempt verification if there was a decoding error
2020-06-05 19:20:16 +03:00
Roman Khimov
f63b286c35
core: update genesis block to store timestamp in ms
2020-06-05 19:20:16 +03:00
Roman Khimov
35b30ccfdf
core: drop OLDPUSH1, it's no longer needed
...
Fixes #927 .
2020-06-05 19:20:16 +03:00
Roman Khimov
0a09a20900
transaction: drop Register transaction type
...
And everything associated like SystemFee configuration.
2020-06-05 19:20:16 +03:00
Roman Khimov
169c5ae775
transaction: drop Issue TX support
2020-06-05 19:20:16 +03:00
Roman Khimov
f445f7c602
transaction: drop Contract transaction type
2020-06-05 19:20:16 +03:00
Roman Khimov
6853470603
block: precompute ConsensusData hash on UnmarshalJSON
...
That's what we usually do for block or transaction hashes.
2020-06-05 19:20:16 +03:00
Roman Khimov
dfc7a9bfd1
transaction: drop Claim TX type
2020-06-05 19:20:16 +03:00
Roman Khimov
3d18f09def
core: fix CalculateClaimable for NEP5 NEO
...
It's not stored as Fixed8, so calculations need to be adjusted for that.
2020-06-05 19:20:16 +03:00
Roman Khimov
39dfebccc4
core: no longer treat sysfee as claimable
...
As it's not on Neo 3, it just gets burned and that's it. Only network fee is
being redistributed to CNs.
2020-06-05 19:20:16 +03:00
Roman Khimov
50ed4c5967
core: don't return an error from CalculateClaimable
...
As it never returns one.
2020-06-05 19:20:16 +03:00
Roman Khimov
1bc6d29c0d
core: fix potential NPE in GetUtilityTokenBalance
2020-06-05 19:20:16 +03:00
Roman Khimov
9f5fd21160
core: drop UXTO NEO and GAS transactions from the genesis block
...
They're no longer required. Adjust test chain for that, now it only has
invocations, transfers NEO/GAS and pays the fees with NEP5 GAS.
2020-06-05 19:20:16 +03:00
Roman Khimov
a9955719da
native: make mint/burn for 0 no-ops
...
Prevent emitting useless transfer events and doing useless gets/puts.
2020-06-05 19:20:16 +03:00
Roman Khimov
657bb7575e
rpc: change getunclaimed to getunclaimedgas
...
getunclaimed doesn't exist on Neo 3 and getunclaimedgas works for NEP5 GAS.
2020-06-05 19:20:16 +03:00
Roman Khimov
31ef0c4339
core: don't check systemfee with UTXO outputs
...
SystemFee is already being checked by verifyTx against Sender's balance.
2020-06-05 19:20:16 +03:00
Roman Khimov
d9400800e3
transaction: drop Gas field from InvocationTX
...
It essentialy is the new SystemFee, so use that. Had to increase GAS transfer
in test chain to 1000 to pay for deployment.
2020-06-05 19:20:16 +03:00
Roman Khimov
30c74152ce
core: add balance checks for NEP5 transfer to TestCreateBasicChain
2020-06-05 19:20:16 +03:00
Roman Khimov
0a35ee00c6
core: print txes in LE in TestCreateBasicChain
...
LE is human and RPC compatible representation, BE hex is almost unusable.
2020-06-05 19:20:16 +03:00
Roman Khimov
bf6525e54d
core: fix GetUtilityTokenBalance
...
The value stored in NEP5 tracker for GAS is Fixed8 already, so we need to
type-cast it, but not multiply by 10⁸ again.
2020-06-05 19:20:16 +03:00
Roman Khimov
7e586cc6ab
native: deduce transferred assets from sender on transfer
...
When money is being sent usually they go away from someone's pocket, so that
there is a little less money left there. Not in our case as it turns out, we
actually were adding money both to sender and receiver which is nice, but a
bit different from usual economic's expectations.
2020-06-05 19:20:16 +03:00
Anna Shaleva
8fb67615f8
core: sort results of Storage.Find and NEO.getRegisterValidators
...
Closes #909
We need to match elements order with C# implementation.
2020-05-29 17:33:01 +03:00
Evgenii Stratonikov
44709cf6fe
core: make GetUnspentCoins interop return array, fix #978 .
2020-05-27 12:01:50 +03:00
Roman Khimov
8231953842
core: fix Neo.Contract.GetStorageContext security check
...
This syscall should only work for contracts created by current transaction and
that is what is supposed to be checked here. Do so by looking at the
differences between ic.dao and original lower DAO.
2020-05-26 19:58:49 +03:00
Roman Khimov
7633439845
rpc/block: rework the way Block is JSONized
...
Our block.Block was JSONized in a bit different fashion than result.Block in
its NextConsensus and Index fields. It's not good for notifications because
third-party clients would probably expect to see the same format. Also, using
completely different Block representation is probably making our client a bit
weaker as this representation is harder to use with other neo-go components.
So use the same approach we took for Transactions and wrap block.Block which is
to be serialized in proper way.
Fix `Script` JSONization along the way, 3.0 node wraps it within `witnesses`.
2020-05-26 11:36:47 +03:00
Roman Khimov
2dc16c0694
transaction: add json.Unmarshaler to Attribute
...
It actually was missing and it might affect Transaction conversion to/from
JSON.
2020-05-26 11:36:47 +03:00
Roman Khimov
44ae9086b6
core: improve and fix locking in storeBlock
...
Getting batch, updating Prometheus metrics and pushing events doesn't require
any locking: batch is a local cache batch that no one outside cares about,
Prometheus metrics are not critical to be in perfect sync and events are
asynchronous anyway.
Native contracts also don't require any locks and they should be processed
before dumping storage changes.
2020-05-26 11:36:47 +03:00
Roman Khimov
3ca71d5e8d
core: add Blockchain event subscription mechanism
...
A deep internal part of #895 . Blockchainer interface is also extended for
various uses of these methods.
2020-05-25 00:27:39 +03:00
Roman Khimov
ac40d357f0
core: improve documentation a little
2020-05-24 23:54:01 +03:00
Roman Khimov
c9b1d359d8
core: ensure we produce correct blocks for tests
...
Check for correct merkle root generation.
2020-05-24 23:52:54 +03:00
Anna Shaleva
9f2cb1726b
core: add witness check to nep5 transfer method
...
We have to check, whether transaction's sender is authorised to transfer
nep5 assets.
2020-05-20 23:34:27 +03:00
Anna Shaleva
1afd630169
core: add senders' fees monitor to mempool
...
In order to simplify maintainance of overall current senders` fees
in the mempool we are to keep them in a separate map.
2020-05-20 23:34:25 +03:00
Anna Shaleva
7acf5b2841
core: add SystemFee and NetworkFee to transaction
...
closes #831
2020-05-20 23:26:48 +03:00
Anna Shaleva
fc3acdc80c
core: add native contracts' hashes getters
2020-05-20 23:16:04 +03:00
Anna Shaleva
6b2f4efdd4
core: fix bug in nep5TokenNative.addTokens method
...
Sometimes we want to add negative amount (e.g. when burning tokens).
2020-05-20 23:16:04 +03:00
Anna Shaleva
c7a040ff81
core: fix bug with native contracts methods initialisation
...
`NewNEO()` and `NewGAS()` methods are trying to initialise
both `onPersist` and `incBalance` methods of NEO and GAS AFTER
nep5TokenNative is set to the VALUE of created nep5 token.
In this situation an attemmpt to call the corresponding native contracts
methods (e.g. transfer native GAS) leads to contract invocation failure,
as far as `nep5TokenNative.incBalance` method is nil.
Fixed this by initializing both `onPersist` and `incBalance` methods
before getting the value of nep5 contract.
2020-05-20 23:16:04 +03:00
Anna Shaleva
4ebac5a069
core: fix bug in nep5 notifications handling
...
Native contracts deployment creates `Transfer` notifications and adds
them into interop context. However, these notifications were not stored
for two reasons:
1. typo in `Transfer` (so these notifications were not recognised during
processing of the invocation tx in (*Blockchain).storeBlock(...) method)
2. these notifications have `from` adress setted to null, so conversion
to []byte fails. Same thing could happen with `to`.
Related C# issue: https://github.com/neo-project/neo/issues/1646
For now, made both `transfer` and `Transfer` valid.
2020-05-20 23:16:04 +03:00
Evgenii Stratonikov
c0147c76ac
emit: remove tailCall argument from AppCall
...
There is no TAILCALL opcode in NEO3.
2020-05-07 14:59:01 +03:00
Evgenii Stratonikov
73c82584a3
vm,compiler: replace APPCALL with System.Contract.Call
...
Contract calls are performed via syscall System.Contract.Call
in NEO3. This implements this in compiler and removes APPCALL from the
VM.
2020-05-07 14:52:03 +03:00
Evgenii Stratonikov
ec900c7ff7
core: implement System.Contract.Call interop
2020-05-07 14:39:06 +03:00
Evgenii Stratonikov
301c1b7601
native: save native contract state on deploy
2020-05-07 14:03:14 +03:00
Evgenii Stratonikov
f9f3192b48
vm: move RET and SYSCALL opcodes
2020-05-07 13:23:05 +03:00
Evgenii Stratonikov
5ab4b9284b
core: remove unused function from tests
2020-05-06 16:00:16 +03:00
Evgenii Stratonikov
977c431bf1
vm: implement ASSERT/ABORT opcodes
...
Rename THROWIFNOT to ASSERT, add ABORT opcode.
ABORT cannot be caught, but the implementation should be postponed until
exception handling is implemented.
2020-05-06 15:54:19 +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
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
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
be38798785
vm: move Bool method to the StackItem interface
2020-04-28 15:13:41 +03:00
Anna Shaleva
fa467ce628
core: add txes duplication check on block.DecodeBinary
2020-04-27 18:00:01 +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
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
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
Evgenii Stratonikov
0f17402599
testchain: implement Sign function
...
Sign any data by all consensus nodes.
2020-04-23 17:09:09 +03:00
Evgenii Stratonikov
008e6eb233
vm: implement new PUSH opcodes
2020-04-23 10:52:28 +03:00
Evgenii Stratonikov
cc20ba651d
core: use opcodes instead of raw bytes in tests
...
It will be helpful during future opcode reordering in NEO3.
2020-04-23 10:37:01 +03:00
Evgenii Stratonikov
351fdd469f
core: calcultate NEO owner on-the-fly
2020-04-23 10:36:44 +03:00
Evgenii Stratonikov
1e50016a91
core,test: move helper functions for testchain to the internal package
...
Our test chain is used in core,rpc and (in future) interop packages.
It is better to have all related declarations in one place to avoid
code duplication.
2020-04-22 18:17:11 +03:00
Evgenii Stratonikov
c508a36827
core,network: shutdown services in tests properly
2020-04-22 17:53:59 +03:00
Anna Shaleva
2b5c14160c
core: add sender field to transaction
...
closes #860
2020-04-20 17:21:28 +03:00
Evgenii Stratonikov
cde4ccf01c
vm: remove CHECKSIG/VERIFY/CHECKMULTISIG opcodes
2020-04-20 11:55:24 +03:00
Evgenii Stratonikov
4740d937aa
vm: dont use SetCheckedHash outside of vm
package
2020-04-20 11:55:24 +03:00
Evgenii Stratonikov
941410a840
core: change verification scripts to new format
...
Verification scripts now invoke Neo.Crypto.* interops instead of
CHECKSIG/VERIFY opcodes.
2020-04-20 11:55:24 +03:00
Roman Khimov
ab8296bc57
Merge pull request #857 from nspcc-dev/neo3/verifiable
...
core,crypto: implement Verifiable interface
2020-04-17 13:06:55 +03:00
Evgenii Stratonikov
ceff8736f2
vm: use ID-based syscalls
...
In NEO3 SYSCALL opcode has 4-byte ID parameter.
This commit removes support for string-based syscalls and
changes SYSCALL's parameter to be fixed 4-byte value.
2020-04-17 11:46:31 +03:00
Evgenii Stratonikov
bfbbef952a
vm: move InteropNameToID to emit package
2020-04-17 11:46:31 +03:00
Evgenii Stratonikov
82b230f19f
core: rename *block.Base.GetHashableData to GetSignedPart()
...
This allow to use `Block` as a Verifiable item.
When tx is provided, it is set as an interop's script container.
Otherwise, block is set.
2020-04-17 11:12:40 +03:00
Evgenii Stratonikov
a92872931c
interop/crypto: allow ECDsaVerify to verify ScriptContainer
...
When verifying transaction or block, verification script can be
a simple PUSHNULL + SYSCALL, which means that script-encontaining
entity should be verified.
2020-04-17 11:12:40 +03:00
Evgenii Stratonikov
8f08065a8e
interop/crypto: allow ECDsaVerify to accept interop items
...
When invokes with interop item on stack, it should check
for the signature of Verifiable item it contains.
2020-04-17 11:12:40 +03:00
Roman Khimov
888be75445
Merge pull request #863 from nspcc-dev/drop-publish-tx
...
Drop publish tx
2020-04-16 21:23:37 +03:00
Evgenii Stratonikov
76700f31cf
core: implement skeletons for NEO/GAS native contracts
2020-04-16 15:55:35 +03:00
Evgenii Stratonikov
25354c44f9
core: implement NativeContract support
2020-04-16 15:55:34 +03:00
Evgenii Stratonikov
9586af32f2
core: move runtime.CheckWitness interop to a separate package
2020-04-16 15:54:58 +03:00
Evgenii Stratonikov
8a2130f5b6
core: extend Blockchainer with GetStandByValidators()
...
A list of standby validators can be needed in native contracts.
2020-04-16 15:54:58 +03:00
Evgenii Stratonikov
b446753c57
core,vm: move get/putContextScriptHash to vm
package
2020-04-16 15:54:52 +03:00
Roman Khimov
40991d3be3
transaction: drop AgencyType and VotingType
...
I have no idea what are they about.
2020-04-16 14:44:46 +03:00
Roman Khimov
4912e4f425
*: drop Publish transaction type
...
It shouldn't be used even in NEO 2 as it was substituted by contract
deployment interop functions.
2020-04-16 14:40:20 +03:00
Anna Shaleva
5fa11987d2
core: add validUntilBlock field to transaction
...
1. closes #841
2. Commented out test cases where binary transaction are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.
3. Updated other tests.
4. Added cache to calculateValidUntilBlock() RPC-client method.
2020-04-15 13:46:43 +03:00
Roman Khimov
1e3c36433f
Merge pull request #844 from nspcc-dev/neo3/nonce
...
core: add nonce field to transaction
2020-04-14 16:24:02 +03:00