transaction_test.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright 2015 The go-ethereum Authors
  2. // This file is part of the go-ethereum library.
  3. //
  4. // The go-ethereum library is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // The go-ethereum library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
  16. package tests
  17. import (
  18. "testing"
  19. "github.com/ethereum/go-ethereum/params"
  20. )
  21. func TestTransaction(t *testing.T) {
  22. t.Parallel()
  23. txt := new(testMatcher)
  24. // These can't be parsed, invalid hex in RLP
  25. txt.skipLoad("^ttWrongRLP/.*")
  26. // We don't allow more than uint64 in gas amount
  27. // This is a pseudo-consensus vulnerability, but not in practice
  28. // because of the gas limit
  29. txt.skipLoad("^ttGasLimit/TransactionWithGasLimitxPriceOverflow.json")
  30. //Quorum - skip the tests below as they have V=37/38 for transactions being tested and it is causing quorum to use quorum private signer for public transactions
  31. txt.skipLoad("^ttGasLimit/TransactionWithHihghGasLimit63m1.json")
  32. txt.skipLoad("^ttVValue/V_equals38.json")
  33. txt.skipLoad("^ttVValue/V_equals37.json")
  34. txt.skipLoad("^ttSignature/Vitalik_9.json")
  35. txt.skipLoad("^ttSignature/Vitalik_8.json")
  36. txt.skipLoad("^ttSignature/Vitalik_7.json")
  37. txt.skipLoad("^ttSignature/Vitalik_6.json")
  38. txt.skipLoad("^ttSignature/Vitalik_5.json")
  39. txt.skipLoad("^ttSignature/Vitalik_4.json")
  40. txt.skipLoad("^ttSignature/Vitalik_3.json")
  41. txt.skipLoad("^ttSignature/Vitalik_2.json")
  42. txt.skipLoad("^ttSignature/Vitalik_11.json")
  43. txt.skipLoad("^ttSignature/Vitalik_10.json")
  44. txt.skipLoad("^ttSignature/Vitalik_1.json")
  45. // We _do_ allow more than uint64 in gas price, as opposed to the tests
  46. // This is also not a concern, as long as tx.Cost() uses big.Int for
  47. // calculating the final cozt
  48. txt.skipLoad(".*TransactionWithGasPriceOverflow.*")
  49. // The nonce is too large for uint64. Not a concern, it means geth won't
  50. // accept transactions at a certain point in the distant future
  51. txt.skipLoad("^ttNonce/TransactionWithHighNonce256.json")
  52. // The value is larger than uint64, which according to the test is invalid.
  53. // Geth accepts it, which is not a consensus issue since we use big.Int's
  54. // internally to calculate the cost
  55. txt.skipLoad("^ttValue/TransactionWithHighValueOverflow.json")
  56. txt.walk(t, transactionTestDir, func(t *testing.T, name string, test *TransactionTest) {
  57. cfg := params.MainnetChainConfig
  58. if err := txt.checkFailure(t, name, test.Run(cfg)); err != nil {
  59. t.Error(err)
  60. }
  61. })
  62. }