aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gen_tttransaction.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-07-11 19:49:14 +0800
committerGitHub <noreply@github.com>2017-07-11 19:49:14 +0800
commit225de7ca0a9e861696a5a43b666090b574c4c769 (patch)
tree68aff6fb74fece37626ced330fa9c5da91b483a4 /tests/gen_tttransaction.go
parentbd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba (diff)
downloaddexon-225de7ca0a9e861696a5a43b666090b574c4c769.tar
dexon-225de7ca0a9e861696a5a43b666090b574c4c769.tar.gz
dexon-225de7ca0a9e861696a5a43b666090b574c4c769.tar.bz2
dexon-225de7ca0a9e861696a5a43b666090b574c4c769.tar.lz
dexon-225de7ca0a9e861696a5a43b666090b574c4c769.tar.xz
dexon-225de7ca0a9e861696a5a43b666090b574c4c769.tar.zst
dexon-225de7ca0a9e861696a5a43b666090b574c4c769.zip
tests: update tests and implement general state tests (#14734)
Tests are now included as a submodule. This should make updating easier and removes ~60MB of JSON data from the working copy. State tests are replaced by General State Tests, which run the same test with multiple fork configurations. With the new test runner, consensus tests are run as subtests by walking json files. Many hex issues have been fixed upstream since the last update and most custom parsing code is replaced by existing JSON hex types. Tests can now be marked as 'expected failures', ensuring that fixes for those tests will trigger an update to test configuration. The new test runner also supports parallel execution and the -short flag.
Diffstat (limited to 'tests/gen_tttransaction.go')
-rw-r--r--tests/gen_tttransaction.go95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/gen_tttransaction.go b/tests/gen_tttransaction.go
new file mode 100644
index 000000000..b6759be91
--- /dev/null
+++ b/tests/gen_tttransaction.go
@@ -0,0 +1,95 @@
+// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
+
+package tests
+
+import (
+ "encoding/json"
+ "errors"
+ "math/big"
+
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/hexutil"
+ "github.com/ethereum/go-ethereum/common/math"
+)
+
+var _ = (*ttTransactionMarshaling)(nil)
+
+func (t ttTransaction) MarshalJSON() ([]byte, error) {
+ type ttTransaction struct {
+ Data hexutil.Bytes `gencodec:"required"`
+ GasLimit *math.HexOrDecimal256 `gencodec:"required"`
+ GasPrice *math.HexOrDecimal256 `gencodec:"required"`
+ Nonce math.HexOrDecimal64 `gencodec:"required"`
+ Value *math.HexOrDecimal256 `gencodec:"required"`
+ R *math.HexOrDecimal256 `gencodec:"required"`
+ S *math.HexOrDecimal256 `gencodec:"required"`
+ V *math.HexOrDecimal256 `gencodec:"required"`
+ To common.Address `gencodec:"required"`
+ }
+ var enc ttTransaction
+ enc.Data = t.Data
+ enc.GasLimit = (*math.HexOrDecimal256)(t.GasLimit)
+ enc.GasPrice = (*math.HexOrDecimal256)(t.GasPrice)
+ enc.Nonce = math.HexOrDecimal64(t.Nonce)
+ enc.Value = (*math.HexOrDecimal256)(t.Value)
+ enc.R = (*math.HexOrDecimal256)(t.R)
+ enc.S = (*math.HexOrDecimal256)(t.S)
+ enc.V = (*math.HexOrDecimal256)(t.V)
+ enc.To = t.To
+ return json.Marshal(&enc)
+}
+
+func (t *ttTransaction) UnmarshalJSON(input []byte) error {
+ type ttTransaction struct {
+ Data hexutil.Bytes `gencodec:"required"`
+ GasLimit *math.HexOrDecimal256 `gencodec:"required"`
+ GasPrice *math.HexOrDecimal256 `gencodec:"required"`
+ Nonce *math.HexOrDecimal64 `gencodec:"required"`
+ Value *math.HexOrDecimal256 `gencodec:"required"`
+ R *math.HexOrDecimal256 `gencodec:"required"`
+ S *math.HexOrDecimal256 `gencodec:"required"`
+ V *math.HexOrDecimal256 `gencodec:"required"`
+ To *common.Address `gencodec:"required"`
+ }
+ var dec ttTransaction
+ if err := json.Unmarshal(input, &dec); err != nil {
+ return err
+ }
+ if dec.Data == nil {
+ return errors.New("missing required field 'data' for ttTransaction")
+ }
+ t.Data = dec.Data
+ if dec.GasLimit == nil {
+ return errors.New("missing required field 'gasLimit' for ttTransaction")
+ }
+ t.GasLimit = (*big.Int)(dec.GasLimit)
+ if dec.GasPrice == nil {
+ return errors.New("missing required field 'gasPrice' for ttTransaction")
+ }
+ t.GasPrice = (*big.Int)(dec.GasPrice)
+ if dec.Nonce == nil {
+ return errors.New("missing required field 'nonce' for ttTransaction")
+ }
+ t.Nonce = uint64(*dec.Nonce)
+ if dec.Value == nil {
+ return errors.New("missing required field 'value' for ttTransaction")
+ }
+ t.Value = (*big.Int)(dec.Value)
+ if dec.R == nil {
+ return errors.New("missing required field 'r' for ttTransaction")
+ }
+ t.R = (*big.Int)(dec.R)
+ if dec.S == nil {
+ return errors.New("missing required field 's' for ttTransaction")
+ }
+ t.S = (*big.Int)(dec.S)
+ if dec.V == nil {
+ return errors.New("missing required field 'v' for ttTransaction")
+ }
+ t.V = (*big.Int)(dec.V)
+ if dec.To == nil {
+ return errors.New("missing required field 'to' for ttTransaction")
+ }
+ t.To = *dec.To
+ return nil
+}