Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

ENG 210 Fee Market unit tests 2 #758

Merged
merged 16 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 83 additions & 7 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func (suite AnteTestSuite) TestAnteHandler() {

suite.app.EvmKeeper.AddBalance(addr, big.NewInt(10000000000))

suite.app.FeeMarketKeeper.SetBaseFee(suite.ctx, big.NewInt(100))

testCases := []struct {
name string
txFn func() sdk.Tx
Expand All @@ -35,7 +37,17 @@ func (suite AnteTestSuite) TestAnteHandler() {
{
"success - DeliverTx (contract)",
func() sdk.Tx {
signedContractTx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedContractTx := evmtypes.NewTxContract(
suite.app.EvmKeeper.ChainID(),
1,
big.NewInt(10),
100000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
nil,
)
signedContractTx.From = addr.Hex()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
Expand All @@ -46,7 +58,17 @@ func (suite AnteTestSuite) TestAnteHandler() {
{
"success - CheckTx (contract)",
func() sdk.Tx {
signedContractTx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedContractTx := evmtypes.NewTxContract(
suite.app.EvmKeeper.ChainID(),
1,
big.NewInt(10),
100000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
nil,
)
signedContractTx.From = addr.Hex()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
Expand All @@ -57,7 +79,17 @@ func (suite AnteTestSuite) TestAnteHandler() {
{
"success - ReCheckTx (contract)",
func() sdk.Tx {
signedContractTx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedContractTx := evmtypes.NewTxContract(
suite.app.EvmKeeper.ChainID(),
1,
big.NewInt(10),
100000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
nil,
)
signedContractTx.From = addr.Hex()

tx := suite.CreateTestTx(signedContractTx, privKey, 1, false)
Expand All @@ -68,7 +100,18 @@ func (suite AnteTestSuite) TestAnteHandler() {
{
"success - DeliverTx",
func() sdk.Tx {
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 1, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx := evmtypes.NewTx(
suite.app.EvmKeeper.ChainID(),
1,
&to,
big.NewInt(10),
100000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
nil,
)
signedTx.From = addr.Hex()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
Expand All @@ -79,7 +122,18 @@ func (suite AnteTestSuite) TestAnteHandler() {
{
"success - CheckTx",
func() sdk.Tx {
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 2, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx := evmtypes.NewTx(
suite.app.EvmKeeper.ChainID(),
2,
&to,
big.NewInt(10),
100000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
nil,
)
signedTx.From = addr.Hex()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
Expand All @@ -90,7 +144,18 @@ func (suite AnteTestSuite) TestAnteHandler() {
{
"success - ReCheckTx",
func() sdk.Tx {
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 3, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx := evmtypes.NewTx(
suite.app.EvmKeeper.ChainID(),
3,
&to,
big.NewInt(10),
100000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
nil,
)
signedTx.From = addr.Hex()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
Expand All @@ -100,7 +165,18 @@ func (suite AnteTestSuite) TestAnteHandler() {
{
"success - CheckTx (cosmos tx not signed)",
func() sdk.Tx {
signedTx := evmtypes.NewTx(suite.app.EvmKeeper.ChainID(), 4, &to, big.NewInt(10), 100000, big.NewInt(1), nil, nil, nil, nil)
signedTx := evmtypes.NewTx(
suite.app.EvmKeeper.ChainID(),
4,
&to,
big.NewInt(10),
100000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
nil,
)
signedTx.From = addr.Hex()

tx := suite.CreateTestTx(signedTx, privKey, 1, false)
Expand Down
26 changes: 24 additions & 2 deletions app/ante/eth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,30 @@ func (suite AnteTestSuite) TestCanTransferDecorator() {

addr, privKey := tests.NewAddrKey()

tx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil, nil, &ethtypes.AccessList{})
tx2 := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), 1000, big.NewInt(1), nil, nil, nil, &ethtypes.AccessList{})
suite.app.FeeMarketKeeper.SetBaseFee(suite.ctx, big.NewInt(100))

tx := evmtypes.NewTxContract(
suite.app.EvmKeeper.ChainID(),
1,
big.NewInt(10),
1000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
&ethtypes.AccessList{},
)
tx2 := evmtypes.NewTxContract(
suite.app.EvmKeeper.ChainID(),
1,
big.NewInt(10),
1000,
big.NewInt(150),
big.NewInt(200),
nil,
nil,
&ethtypes.AccessList{},
)

tx.From = addr.Hex()

Expand Down
4 changes: 2 additions & 2 deletions client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading