Enable more tx tests by expecting most common encoding of values
This commit is contained in:
parent
6dc2146ed7
commit
6d20d634ca
@ -9,16 +9,8 @@ func TestTransactions(t *testing.T) {
|
|||||||
// TODO: all commented out tests should work!
|
// TODO: all commented out tests should work!
|
||||||
|
|
||||||
snafus := []string{
|
snafus := []string{
|
||||||
"AddressLessThan20Prefixed0",
|
|
||||||
"DataTest",
|
|
||||||
"EmptyTransaction",
|
"EmptyTransaction",
|
||||||
"RightVRSTest",
|
|
||||||
"SenderTest",
|
|
||||||
"TransactionWithGasLimitxPriceOverflow",
|
|
||||||
"TransactionWithHihghGas",
|
|
||||||
"TransactionWithHihghGasPrice",
|
|
||||||
"TransactionWithHihghNonce",
|
"TransactionWithHihghNonce",
|
||||||
"TransactionWithHihghValue",
|
|
||||||
"TransactionWithRvalueWrongSize",
|
"TransactionWithRvalueWrongSize",
|
||||||
"TransactionWithSvalueHigh",
|
"TransactionWithSvalueHigh",
|
||||||
"TransactionWithSvalueTooHigh",
|
"TransactionWithSvalueTooHigh",
|
||||||
@ -26,7 +18,8 @@ func TestTransactions(t *testing.T) {
|
|||||||
"ValuesAsDec",
|
"ValuesAsDec",
|
||||||
"ValuesAsHex",
|
"ValuesAsHex",
|
||||||
"libsecp256k1test",
|
"libsecp256k1test",
|
||||||
"unpadedRValue"}
|
"unpadedRValue",
|
||||||
|
}
|
||||||
|
|
||||||
for _, name := range snafus {
|
for _, name := range snafus {
|
||||||
notWorking[name] = true
|
notWorking[name] = true
|
||||||
|
@ -30,7 +30,7 @@ type TransactionTest struct {
|
|||||||
Transaction TtTransaction
|
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)
|
bt := make(map[string]TransactionTest)
|
||||||
if err := LoadJSON(file, &bt); err != nil {
|
if err := LoadJSON(file, &bt); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -60,7 +60,7 @@ func runTest(txTest TransactionTest) (err error) {
|
|||||||
}
|
}
|
||||||
tx := new(types.Transaction)
|
tx := new(types.Transaction)
|
||||||
rlp.DecodeBytes(rlpBytes, tx)
|
rlp.DecodeBytes(rlpBytes, tx)
|
||||||
|
//fmt.Println("HURR tx: %v", tx)
|
||||||
sender, err := tx.From()
|
sender, err := tx.From()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -120,15 +120,15 @@ func convertTestTypes(txTest TransactionTest) (sender, to common.Address,
|
|||||||
txInputData = mustConvertBytes(txTest.Transaction.Data)
|
txInputData = mustConvertBytes(txTest.Transaction.Data)
|
||||||
rlpBytes = mustConvertBytes(txTest.Rlp)
|
rlpBytes = mustConvertBytes(txTest.Rlp)
|
||||||
|
|
||||||
gasLimit = mustConvertBigIntHex(txTest.Transaction.GasLimit)
|
gasLimit = mustConvertBigInt10(txTest.Transaction.GasLimit)
|
||||||
gasPrice = mustConvertBigIntHex(txTest.Transaction.GasPrice)
|
gasPrice = mustConvertBigInt10(txTest.Transaction.GasPrice)
|
||||||
value = mustConvertBigIntHex(txTest.Transaction.Value)
|
value = mustConvertBigInt10(txTest.Transaction.Value)
|
||||||
|
|
||||||
r = common.Bytes2Big(mustConvertBytes(txTest.Transaction.R))
|
r = common.Bytes2Big(mustConvertBytes(txTest.Transaction.R))
|
||||||
s = common.Bytes2Big(mustConvertBytes(txTest.Transaction.S))
|
s = common.Bytes2Big(mustConvertBytes(txTest.Transaction.S))
|
||||||
|
|
||||||
nonce = mustConvertUintHex(txTest.Transaction.Nonce)
|
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
|
return sender, to, txInputData, rlpBytes, gasLimit, gasPrice, value, r, s, nonce, v, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user