From 6d20d634ca424fc11665d5e0e560534ae8ec774b Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Fri, 10 Apr 2015 12:34:55 +0200 Subject: [PATCH] Enable more tx tests by expecting most common encoding of values --- tests/transaction_test.go | 11 ++--------- tests/transaction_test_util.go | 12 ++++++------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/tests/transaction_test.go b/tests/transaction_test.go index dd06398faf..dabc7823b5 100644 --- a/tests/transaction_test.go +++ b/tests/transaction_test.go @@ -9,16 +9,8 @@ func TestTransactions(t *testing.T) { // TODO: all commented out tests should work! snafus := []string{ - "AddressLessThan20Prefixed0", - "DataTest", "EmptyTransaction", - "RightVRSTest", - "SenderTest", - "TransactionWithGasLimitxPriceOverflow", - "TransactionWithHihghGas", - "TransactionWithHihghGasPrice", "TransactionWithHihghNonce", - "TransactionWithHihghValue", "TransactionWithRvalueWrongSize", "TransactionWithSvalueHigh", "TransactionWithSvalueTooHigh", @@ -26,7 +18,8 @@ func TestTransactions(t *testing.T) { "ValuesAsDec", "ValuesAsHex", "libsecp256k1test", - "unpadedRValue"} + "unpadedRValue", + } for _, name := range snafus { notWorking[name] = true diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go index 800891887a..1b2ee88b1f 100644 --- a/tests/transaction_test_util.go +++ b/tests/transaction_test_util.go @@ -30,7 +30,7 @@ type TransactionTest struct { Transaction TtTransaction } -func RunTransactionTests(file string, notWorking map[string]bool) error { +func RunTransactionTests(file string, notWorking map[string]bool) error { bt := make(map[string]TransactionTest) if err := LoadJSON(file, &bt); err != nil { return err @@ -60,7 +60,7 @@ func runTest(txTest TransactionTest) (err error) { } tx := new(types.Transaction) rlp.DecodeBytes(rlpBytes, tx) - + //fmt.Println("HURR tx: %v", tx) sender, err := tx.From() if err != nil { return err @@ -120,15 +120,15 @@ func convertTestTypes(txTest TransactionTest) (sender, to common.Address, txInputData = mustConvertBytes(txTest.Transaction.Data) rlpBytes = mustConvertBytes(txTest.Rlp) - gasLimit = mustConvertBigIntHex(txTest.Transaction.GasLimit) - gasPrice = mustConvertBigIntHex(txTest.Transaction.GasPrice) - value = mustConvertBigIntHex(txTest.Transaction.Value) + gasLimit = mustConvertBigInt10(txTest.Transaction.GasLimit) + gasPrice = mustConvertBigInt10(txTest.Transaction.GasPrice) + value = mustConvertBigInt10(txTest.Transaction.Value) r = common.Bytes2Big(mustConvertBytes(txTest.Transaction.R)) s = common.Bytes2Big(mustConvertBytes(txTest.Transaction.S)) nonce = mustConvertUintHex(txTest.Transaction.Nonce) - v = mustConvertUintHex(txTest.Transaction.V) + v = mustConvertUint(txTest.Transaction.V) return sender, to, txInputData, rlpBytes, gasLimit, gasPrice, value, r, s, nonce, v, nil }