aboutsummaryrefslogtreecommitdiffstats
path: root/tests/transaction_test_util.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-04-16 04:37:16 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-04-16 04:37:16 +0800
commitc617a6ec790a974770f3553fe0b2fed9ad560fcc (patch)
tree916080981cc2dc8c32ec57fb8fc4f18ac801256a /tests/transaction_test_util.go
parent2d8a2d0c9997e658bbdbf7a172c920dbb3c47821 (diff)
downloadgo-tangerine-c617a6ec790a974770f3553fe0b2fed9ad560fcc.tar
go-tangerine-c617a6ec790a974770f3553fe0b2fed9ad560fcc.tar.gz
go-tangerine-c617a6ec790a974770f3553fe0b2fed9ad560fcc.tar.bz2
go-tangerine-c617a6ec790a974770f3553fe0b2fed9ad560fcc.tar.lz
go-tangerine-c617a6ec790a974770f3553fe0b2fed9ad560fcc.tar.xz
go-tangerine-c617a6ec790a974770f3553fe0b2fed9ad560fcc.tar.zst
go-tangerine-c617a6ec790a974770f3553fe0b2fed9ad560fcc.zip
Fixes for TransactionTests
* Include tests which now has consistent HEX encodings * Comment out two failing tests: " "TransactionWithHihghNonce" due to wrong nonce size "TransactionWithSvalueHigh" due to wrong ECDSA s range * Cleanup conversion functions and fix expected encodings for tests validation fields
Diffstat (limited to 'tests/transaction_test_util.go')
-rw-r--r--tests/transaction_test_util.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go
index 1b2ee88b1..567aba66f 100644
--- a/tests/transaction_test_util.go
+++ b/tests/transaction_test_util.go
@@ -90,9 +90,16 @@ func runTest(txTest TransactionTest) (err error) {
if expectedV != uint64(tx.V) {
return fmt.Errorf("V mismatch: %v %v", expectedV, uint64(tx.V))
}
- if expectedTo != *tx.Recipient {
- return fmt.Errorf("To mismatch: %v %v", expectedTo, *tx.Recipient)
+ if tx.Recipient == nil {
+ if expectedTo != common.BytesToAddress([]byte{}) { // "empty" or "zero" address
+ return fmt.Errorf("To mismatch when recipient is nil (contract creation): %v", expectedTo)
+ }
+ } else {
+ if expectedTo != *tx.Recipient {
+ return fmt.Errorf("To mismatch: %v %v", expectedTo, *tx.Recipient)
+ }
}
+
if expectedValue.Cmp(tx.Amount) != 0 {
return fmt.Errorf("Value mismatch: %v %v", expectedValue, tx.Amount)
}
@@ -120,14 +127,14 @@ func convertTestTypes(txTest TransactionTest) (sender, to common.Address,
txInputData = mustConvertBytes(txTest.Transaction.Data)
rlpBytes = mustConvertBytes(txTest.Rlp)
- gasLimit = mustConvertBigInt10(txTest.Transaction.GasLimit)
- gasPrice = mustConvertBigInt10(txTest.Transaction.GasPrice)
- value = mustConvertBigInt10(txTest.Transaction.Value)
+ gasLimit = mustConvertBigInt(txTest.Transaction.GasLimit)
+ gasPrice = mustConvertBigInt(txTest.Transaction.GasPrice)
+ value = mustConvertBigInt(txTest.Transaction.Value)
r = common.Bytes2Big(mustConvertBytes(txTest.Transaction.R))
s = common.Bytes2Big(mustConvertBytes(txTest.Transaction.S))
- nonce = mustConvertUintHex(txTest.Transaction.Nonce)
+ nonce = mustConvertUint(txTest.Transaction.Nonce)
v = mustConvertUint(txTest.Transaction.V)
return sender, to, txInputData, rlpBytes, gasLimit, gasPrice, value, r, s, nonce, v, nil