Skip to content

Commit

Permalink
TraceCall
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 2, 2024
1 parent d8b2fd5 commit 2c08157
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions rpc/backend/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (b *Backend) TraceCall(
if err != nil {
return nil, err
}
blk, err := b.TendermintBlockByNumber(blockNr)
header, err := b.TendermintHeaderByNumber(blockNr)
if err != nil {
// the error message imitates geth behavior
return nil, errors.New("header not found")
Expand All @@ -240,10 +240,10 @@ func (b *Backend) TraceCall(
traceCallRequest := evmtypes.QueryTraceCallRequest{
Args: bz,
GasCap: b.RPCGasCap(),
ProposerAddress: sdk.ConsAddress(blk.Block.ProposerAddress),
BlockNumber: blk.Block.Height,
BlockHash: common.Bytes2Hex(blk.BlockID.Hash),
BlockTime: blk.Block.Time,
ProposerAddress: sdk.ConsAddress(header.Header.ProposerAddress),
BlockNumber: header.Header.Height,
BlockHash: common.Bytes2Hex(header.Header.Hash()),
BlockTime: header.Header.Time,
ChainId: b.chainID.Int64(),
}

Expand All @@ -252,7 +252,7 @@ func (b *Backend) TraceCall(
}

// get the context of provided block
contextHeight := blk.Block.Height
contextHeight := header.Header.Height
if contextHeight < 1 {
// 0 is a special value in `ContextWithHeight`
contextHeight = 1
Expand Down
3 changes: 2 additions & 1 deletion rpc/backend/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ func (suite *BackendTestSuite) TestDebugTraceCall() {
func() {
client := suite.backend.clientCtx.Client.(*mocks.Client)
queryClient := suite.backend.queryClient.QueryClient.(*mocks.EVMQueryClient)
RegisterBlock(client, 1, bz)
height := int64(1)
RegisterHeader(client, &height, bz)
RegisterTraceCall(
queryClient,
&evmtypes.QueryTraceCallRequest{Args: argsBz, ChainId: suite.backend.chainID.Int64(), BlockNumber: 1},
Expand Down

0 comments on commit 2c08157

Please sign in to comment.