Commit graph

36 commits

Author SHA1 Message Date
Evgenii Stratonikov
7ee1ddff61 transaction: add tests for (*Transaction).isValid() 2020-08-23 09:39:46 +03:00
Evgenii Stratonikov
2661ebd295 transaction: add HighPriority attribute
HighPriority attributes specifies that transaction was
signed by a committee.
2020-08-23 09:39:46 +03:00
Evgenii Stratonikov
04bff62d65 transaction: update binary test data 2020-08-18 15:09:30 +03:00
Anna Shaleva
90825efa16 core: move transaction's sender to cosigners
Closes #1184

Ported changes from https://github.com/neo-project/neo/pull/1752
2020-08-04 17:33:50 +03:00
Evgenii Stratonikov
5787d7775f transaction: fail creating tx if there is additional data present 2020-07-03 18:03:57 +03:00
Anna Shaleva
73b630db9b *: switch from fixed8 to int64
Follow C# implementation, we have to marshall JSON Fixed8 fields without
taking into account decimals.
2020-06-29 21:39:27 +03:00
Roman Khimov
b483c38593 block/transaction: add network magic into the hash
We make it explicit in the appropriate Block/Transaction structures, not via a
singleton as C# node does. I think this approach has a bit more potential and
allows better packages reuse for different purposes.
2020-06-18 12:39:50 +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
0a09a20900 transaction: drop Register transaction type
And everything associated like SystemFee configuration.
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
dfc7a9bfd1 transaction: drop Claim TX type 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
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
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
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
65503aa9b4 core: add nonce field to transaction
1. Closes #840: added Nonce field to transaction.Transaction and
removed Nonce field from transaction.MinerTx

2. Added following methods to different tx types:
  - NewMinerTx()
  - NewMinerTxWithNonce(...)
  - NewEnrollmentTx(...)
  - NewIssueTx()
  - NewPublishTx(...)
  - NewRegisterTx(...)
  - NewStateTx(...)
in order to avoid code duplication when new transaction is created.

3. Commented out test cases where binary transaction/block are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.

4. Updated other tests

5. Added constant Nonce to GoveringTockenTx, UtilityTokenTx and genesis
block to avoid data variability. Also marked with TODO.
2020-04-14 16:19:41 +03:00
Anna Shaleva
9c09ad9c89 rpc: fix marshalling of type-specific tx data
closes #585
2020-03-30 15:48:50 +03:00
Evgenii Stratonikov
9abda40171 testserdes: implement helpers for encode/decode routines
Frequently one needs to check if struct serializes/deserializes
properly. This commit implements helpers for such cases including:
1. JSON
2. io.Serializable interface
2020-03-27 10:27:46 +03:00
Evgenii Stratonikov
634e9483d3 transaction: unmarshal Witness properly
Both verification and invocation scripts need to
be unmarshaled from hex.
Also fix failing RPC tests: block contains non-pointer
`transaction.Witness` field and (*Witness).MarshalJSON method
is not called.
2020-03-04 20:01:26 +03:00
Evgenii Stratonikov
33f99104e8 transaction: unmarshal Output properly
Address is marshaled in base58 and needs to be
decoded accordingly.
2020-03-04 20:01:26 +03:00
Roman Khimov
e41d434a49 *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
Roman Khimov
388fed06e5 transaction: forbid serializing invalid transactions
Transaction that has no data is invalid and can't be serialized, so throw an
error if someone tries to.
2020-02-03 16:33:03 +03:00
Roman Khimov
b246653f62 address: rename functions as per #579 comments
Make them more clear to understand.
2019-12-25 17:34:18 +03:00
Roman Khimov
e685e9bf9a address: move into its own package
Doesn't really belong to the crypto.
2019-12-25 15:22:02 +03:00
Evgenii Stratonikov
7179e4ba9f util: add LE suffix to Uint256 methods 2019-12-06 12:16:55 +03:00
Roman Khimov
27a57e1a2d transaction: allow system fee specification in NewInvocationTX
It's not possible to create any deployment TX without it.
2019-11-20 16:12:40 +03:00
Roman Khimov
8d0ed9259c transaction: fix invocation TX consistency in NewInvocationTX()
NewInvocationTX() returned a version number one transaction that actually
failed to pass that version down to the invocation data which lead to
serialization/deserialization inconsistency.
2019-10-23 14:50:24 +03:00
Roman Khimov
d1a4e43c48 io: redo Serializable to return errors in BinReader/BinWriter
Further simplifies error handling.
2019-09-17 13:21:52 +03:00
Roman Khimov
5bf00db2c9 io: move BinReader/BinWriter there, redo Serializable with it
The logic here is that we'll have all binary encoding/decoding done via our io
package, which simplifies error handling. This functionality doesn't belong to
util, so it's moved.

This also expands BufBinWriter with Reset() method to fit the needs of core
package.
2019-09-16 23:39:51 +03:00
Roman Khimov
203aab6a7e transaction: add binary encoding for publish
And expand the test to check for it. Fixes #319.
2019-08-30 19:19:43 +03:00
Vsevolod Brekelov
abc5833853 transaction: add version check for publish
-Version check done before reading NeedStorage flag
-Add testify according to review
2019-08-29 19:14:22 +03:00
Roman Khimov
d5d570f793 uint256: add Reverse(), change String() to be BE
This one makes a little more obvious that we're operating with LE
representations mostly. Refs. #307. See #314 also.
2019-08-26 13:32:19 +03:00
Anthony De Meulemeester
a67728628e
Persist blockchain with leveldb on disk (#48)
* Created test_data folder with block json files for testing + create separate file for block base.

* Fixed bug in WriteVarUint + Trim logic + unit tests

* Refactored store and add more tests for it.

* restore headerList from chain file

* Fix tx decode bug + lots of housekeeping.

* Implemented Node restore state from chain file.

* Created standalone package for storage. Added couple more methods to Batch and Store interfaces.

* Block persisting + tests

* bumped version -> 0.31.0
2018-03-17 12:53:21 +01:00
Anthony De Meulemeester
aa4bc1b6e8
Node improvements (#47)
* block partial persist

* replaced refactored files with old one.

* removed gokit/log from deps

* Tweaks to not overburden remote nodes with getheaders/getblocks

* Changed Transporter interface to not take the server as argument due to a cause of race warning from the compiler

* started server test suite

* more test + return errors from message handlers

* removed --race from build

* Little improvements.
2018-03-14 10:36:59 +01:00
Anthony De Meulemeester
1a1a19da7d
Smartcontract (#39)
* deleted transfer_output added asset type and transaction result to core

* removed writing 0x00 when buffer length is 0

* Refactored emit into VM package + moved tx to own package.

* implemented transaction along with claimTransaction.

* refactored naming of transaction + added decode address for uint160 types

* removed unnecessary folder and files.

* transaction/smartcontract logic

* bumped version 0.24.0
2018-03-04 14:56:49 +01:00