Skip to content

Commit

Permalink
more test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Sep 24, 2024
1 parent 33a58e9 commit 22ddad6
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions x/evm/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,18 @@ func (suite *GRPCServerTestSuiteSuite) TestEstimateGas() {
suite.enableFeemarket = false // reset flag
}

func (suite *GRPCServerTestSuiteSuite) fundAddress() {
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(1000000000000000000)}
err := suite.App.BankKeeper.MintCoins(suite.Ctx, types.ModuleName, amt)
if err != nil {
panic(err)
}
err = suite.App.BankKeeper.SendCoinsFromModuleToAccount(suite.Ctx, types.ModuleName, suite.Address.Bytes(), amt)
if err != nil {
panic(err)
}
}

func (suite *GRPCServerTestSuiteSuite) TestTraceTx() {
// TODO deploy contract that triggers internal transactions
var (
Expand Down Expand Up @@ -902,6 +914,21 @@ func (suite *GRPCServerTestSuiteSuite) TestTraceTx() {
expPass: false,
enableFeemarket: true,
},
{
msg: "default trace with enableFeemarket and sufficient balance",
malleate: func() {
suite.fundAddress()
traceConfig = &types.TraceConfig{
DisableStack: true,
DisableStorage: true,
EnableMemory: false,
}
predecessors = []*types.MsgEthereumTx{}
},
expPass: true,
traceResponse: "{\"gas\":34828,\"failed\":false,\"returnValue\":\"0000000000000000000000000000000000000000000000000000000000000001\",\"structLogs\":[{\"pc\":0,\"op\":\"PUSH1\",\"gas\":",
enableFeemarket: true,
},
{
msg: "javascript tracer with enableFeemarket",
malleate: func() {
Expand All @@ -913,6 +940,19 @@ func (suite *GRPCServerTestSuiteSuite) TestTraceTx() {
expPass: false,
enableFeemarket: true,
},
{
msg: "javascript tracer with enableFeemarket and sufficient balance",
malleate: func() {
suite.fundAddress()
traceConfig = &types.TraceConfig{
Tracer: "{data: [], fault: function(log) {}, step: function(log) { if(log.op.toString() == \"CALL\") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}",
}
predecessors = []*types.MsgEthereumTx{}
},
expPass: true,
traceResponse: "[]",
enableFeemarket: true,
},
{
msg: "default tracer with predecessors",
malleate: func() {
Expand Down

0 comments on commit 22ddad6

Please sign in to comment.