Skip to content

Commit

Permalink
txCond HexOrDecimal
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdiallam committed Oct 25, 2024
1 parent 7b56c73 commit 6d38391
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
9 changes: 5 additions & 4 deletions core/types/gen_transaction_conditional_json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions core/types/transaction_conditional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,21 @@ func TestTransactionConditionalSerDeser(t *testing.T) {
},
{
name: "BlockNumberMax",
input: `{"blockNumberMin":"0x1", "blockNumberMax":"0x2"}`,
input: `{"blockNumberMax":"0x2"}`,
mustFail: false,
expected: TransactionConditional{
BlockNumberMin: big.NewInt(1),
BlockNumberMax: big.NewInt(2),
},
},
{
name: "BlockNumber (decimal)",
input: `{"blockNumberMin": 0, "blockNumberMax": 1}`,
mustFail: false,
expected: TransactionConditional{
BlockNumberMin: big.NewInt(0),
BlockNumberMax: big.NewInt(1),
},
},
{
name: "TimestampMin",
input: `{"timestampMin":"0xffff"}`,
Expand All @@ -227,6 +235,15 @@ func TestTransactionConditionalSerDeser(t *testing.T) {
TimestampMax: uint64Ptr(uint64(0xffffff)),
},
},
{
name: "Timestamp (decimal)",
input: `{"timestampMin": 0, "timestampMax": 1}`,
mustFail: false,
expected: TransactionConditional{
TimestampMin: uint64Ptr(0),
TimestampMax: uint64Ptr(1),
},
},
{
name: "UnknownField",
input: `{"foobarbaz": 1234}`,
Expand Down

0 comments on commit 6d38391

Please sign in to comment.