Skip to content

Commit

Permalink
temp dump traces
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmountaintop committed Mar 11, 2024
1 parent a807a41 commit 7a0271e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion eth/tracers/api_blocktrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package tracers

import (
"context"
"encoding/json"
"errors"
"fmt"
"os"

"github.com/scroll-tech/go-ethereum/consensus"
"github.com/scroll-tech/go-ethereum/core"
Expand Down Expand Up @@ -107,5 +110,19 @@ func (api *API) createTraceEnvAndGetBlockTrace(ctx context.Context, config *Trac
}

chaindb := api.backend.ChainDb()
return api.scrollTracerWrapper.CreateTraceEnvAndGetBlockTrace(api.backend.ChainConfig(), api.chainContext(ctx), api.backend.Engine(), chaindb, statedb, parent, block, true)

traces, err := api.scrollTracerWrapper.CreateTraceEnvAndGetBlockTrace(api.backend.ChainConfig(), api.chainContext(ctx), api.backend.Engine(), chaindb, statedb, parent, block, true)
if err != nil {
return nil, err
}
tracesByt, err := json.Marshal(traces)
if err != nil {
return nil, err
}
fileName := fmt.Sprintf("/l2geth/data/%s.json", block.Transactions()[0].Hash().Hex())
err = os.WriteFile(fileName, tracesByt, 0644)
if err != nil {
return nil, err
}
return nil, nil
}

0 comments on commit 7a0271e

Please sign in to comment.