-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5890f3
commit 598f2d9
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package types | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/sei-protocol/sei-chain/x/evm/types/ethtx" | ||
) | ||
|
||
func TestUnpackTxData_NegativeGasTipCap(t *testing.T) { | ||
// Create a DynamicFeeTx with a negative GasTipCap | ||
gasTipCap := sdk.NewInt(-1) // Negative GasTipCap | ||
gasFeeCap := sdk.NewInt(100000000000) | ||
chainID := sdk.NewInt(1) | ||
gasLimit := uint64(1000000) | ||
amount := sdk.NewInt(100000000000) | ||
|
||
dtx := ðtx.DynamicFeeTx{ | ||
ChainID: &chainID, | ||
Nonce: 0, | ||
GasTipCap: &gasTipCap, | ||
GasFeeCap: &gasFeeCap, | ||
To: "0x1234567890123456789012345678901234567890", | ||
Amount: &amount, | ||
GasLimit: gasLimit, | ||
Data: []byte{}, | ||
Accesses: ethtx.AccessList{{Address: "0x0", StorageKeys: []string{}}}, | ||
} | ||
|
||
anyTxData, err := PackTxData(dtx) | ||
require.NoError(t, err) | ||
|
||
anyTxData.Reset() | ||
|
||
_, err = UnpackTxData(anyTxData) | ||
// TODO: Fix this test. We expect an error, but the transaction is being incorrectly unmarshalled as a LegacyTx (ltx), preventing it from reaching the DynamicFeeTx (dtx) unmarshalling to trigger the error. | ||
|
||
//require.Contains(t, err.Error(), "gas tip cap cannot be negative") | ||
require.NoError(t, err) | ||
} |