Skip to content

Commit 8a50c4b

Browse files
committed
WIP: Debug
1 parent 74b9d70 commit 8a50c4b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

core/state_snapshot.go

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ type stateSnapshot struct {
1515
state StateHistoryReader
1616
}
1717

18+
func GetBlockNumber(state StateReader) uint64 {
19+
if snapshot, ok := state.(*stateSnapshot); ok {
20+
return snapshot.blockNumber
21+
}
22+
return 0
23+
}
24+
1825
func NewStateSnapshot(state StateHistoryReader, blockNumber uint64) StateReader {
1926
return &stateSnapshot{
2027
blockNumber: blockNumber,

rpc/v8/trace.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,17 @@ func (h *Handler) traceBlockTransactions(ctx context.Context, block *core.Block)
241241
}
242242
// Since we are tracing an existing block, we know that there should be no errors during execution. If we encounter any,
243243
// report them as unexpected errors
244-
return nil, httpHeader, rpccore.ErrUnexpectedError.CloneWithData(err.Error())
244+
return nil, httpHeader, rpccore.ErrUnexpectedError.CloneWithData(struct {
245+
Error string `json:"error"`
246+
StateBlock uint64 `json:"state_block"`
247+
ParentBlock string `json:"parent_block"`
248+
Number uint64 `json:"number"`
249+
}{
250+
Error: err.Error(),
251+
StateBlock: core.GetBlockNumber(state),
252+
ParentBlock: block.ParentHash.String(),
253+
Number: block.Number,
254+
})
245255
}
246256

247257
result := make([]TracedBlockTransaction, len(executionResult.Traces))

0 commit comments

Comments
 (0)