Skip to content

Commit

Permalink
feat: add overhead and l1feescalar proofs to trace (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyc228 authored Apr 8, 2024
1 parent 9cc463d commit f5b70a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/vm/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package vm

import (
"bytes"
"encoding/hex"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -502,6 +503,13 @@ func (l *StructLogger) MaybeAddFeeRecipientsToStatesAffected(tx *types.Transacti
}
}

func (l *StructLogger) MaybeAddL1BlockInfo(tx *types.Transaction) {
if contractAddress := *tx.To(); bytes.Equal(contractAddress[:], types.L1BlockAddr[:]) {
l.storage[contractAddress][types.OverheadSlot] = l.env.StateDB.GetState(contractAddress, types.OverheadSlot)
l.storage[contractAddress][types.L1FeeScalarsSlot] = l.env.StateDB.GetState(contractAddress, types.L1FeeScalarsSlot)
}
}

// WriteTrace writes a formatted trace to the given writer
// [Scroll: START]
func WriteTrace(writer io.Writer, logs []*StructLog) {
Expand Down
1 change: 1 addition & 0 deletions eth/tracers/api_blocktrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func (api *API) getTxResult(env *traceEnv, state *state.StateDB, index int, bloc
}

tracer.MaybeAddFeeRecipientsToStatesAffected(tx)
tracer.MaybeAddL1BlockInfo(tx)

// merge required proof data
proofAccounts := tracer.UpdatedAccounts()
Expand Down

0 comments on commit f5b70a2

Please sign in to comment.