Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dusannosovic-ethernal committed Feb 13, 2024
1 parent d17ce93 commit 7e2c271
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions jsonrpc/txpool_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func TestContentEndpoint(t *testing.T) {
assert.NotNil(t, txData)
assert.Equal(t, testTx1.Gas(), uint64(txData.Gas))
assert.Equal(t, *(testTx1.GasPrice()), big.Int(*txData.GasPrice))
assert.Equal(t, (*argBig)(nil), txData.GasFeeCap)
assert.Equal(t, (*argBig)(nil), txData.GasTipCap)
assert.Equal(t, *(testTx1.GasFeeCap()), big.Int(*txData.GasFeeCap))
assert.Equal(t, *(testTx1.GasTipCap()), big.Int(*txData.GasTipCap))
assert.Equal(t, testTx1.To(), txData.To)
assert.Equal(t, testTx1.From(), txData.From)
assert.Equal(t, *(testTx1.Value()), big.Int(txData.Value))
Expand All @@ -62,7 +62,7 @@ func TestContentEndpoint(t *testing.T) {
assert.NotNil(t, txData)
assert.Equal(t, (argUint64)(types.DynamicFeeTxType), txData.Type)
assert.Equal(t, testTx2.Gas(), uint64(txData.Gas))
assert.Equal(t, (*argBig)(nil), txData.GasPrice)
assert.Equal(t, (*testTx2.GasPrice()), big.Int(*txData.GasPrice))
assert.Equal(t, *(testTx2.GasFeeCap()), big.Int(*txData.GasFeeCap))
assert.Equal(t, *(testTx2.GasTipCap()), big.Int(*txData.GasTipCap))
assert.Equal(t, testTx2.To(), txData.To)
Expand Down Expand Up @@ -98,8 +98,8 @@ func TestContentEndpoint(t *testing.T) {
assert.NotNil(t, txData)
assert.Equal(t, testTx1.Gas(), uint64(txData.Gas))
assert.Equal(t, *(testTx1.GasPrice()), big.Int(*txData.GasPrice))
assert.Equal(t, (*argBig)(nil), txData.GasFeeCap)
assert.Equal(t, (*argBig)(nil), txData.GasTipCap)
assert.Equal(t, *(testTx1.GasFeeCap()), big.Int(*txData.GasFeeCap))
assert.Equal(t, *(testTx1.GasTipCap()), big.Int(*txData.GasTipCap))
assert.Equal(t, testTx1.To(), txData.To)
assert.Equal(t, testTx1.From(), txData.From)
assert.Equal(t, *(testTx1.Value()), big.Int(txData.Value))
Expand All @@ -111,7 +111,7 @@ func TestContentEndpoint(t *testing.T) {
assert.NotNil(t, txData)
assert.Equal(t, (argUint64)(types.DynamicFeeTxType), txData.Type)
assert.Equal(t, testTx2.Gas(), uint64(txData.Gas))
assert.Equal(t, (*argBig)(nil), txData.GasPrice)
assert.Equal(t, *(testTx2.GasPrice()), big.Int(*txData.GasPrice))
assert.Equal(t, *(testTx2.GasFeeCap()), big.Int(*txData.GasFeeCap))
assert.Equal(t, *(testTx2.GasTipCap()), big.Int(*txData.GasTipCap))
assert.Equal(t, testTx2.To(), txData.To)
Expand Down
6 changes: 3 additions & 3 deletions jsonrpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ func toTransaction(
BlockHash: blockHash,
}

if t.GasPrice() != nil {
if t.GasPrice() != nil && t.Type() != types.DynamicFeeTxType {
gasPrice := argBig(*(t.GasPrice()))
res.GasPrice = &gasPrice
}

if t.GasTipCap() != nil {
if t.GasTipCap() != nil && t.Type() == types.DynamicFeeTxType {
gasTipCap := argBig(*(t.GasTipCap()))
res.GasTipCap = &gasTipCap
}

if t.GasFeeCap() != nil {
if t.GasFeeCap() != nil && t.Type() == types.DynamicFeeTxType {
gasFeeCap := argBig(*(t.GasFeeCap()))
res.GasFeeCap = &gasFeeCap
}
Expand Down
3 changes: 2 additions & 1 deletion jsonrpc/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ func Test_toBlock(t *testing.T) {
require.NoError(t, err)

expectedJSON := loadTestData(t, "testsuite/block-with-txn-full.json")
require.JSONEq(t, expectedJSON, string(res))
str := string(res)
require.JSONEq(t, expectedJSON, str)
}

func loadTestData(t *testing.T, name string) string {
Expand Down
3 changes: 1 addition & 2 deletions types/legacy_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ func (tx *LegacyTx) setGasPrice(gas *big.Int) {
}

func (tx *LegacyTx) setGasFeeCap(gas *big.Int) {
tx.GasPrice = gas
}

func (tx *LegacyTx) setGasTipCap(gas *big.Int) {
tx.GasPrice = gas

}

func (tx *LegacyTx) setTransactionType(t TxType) {}
Expand Down

0 comments on commit 7e2c271

Please sign in to comment.