Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
HAOYUatHZ committed Jul 6, 2023
1 parent 50e0ed9 commit 17248dd
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,27 @@ type traceEnv struct {
executionResults []*types.ExecutionResult
}

func (v *BlockValidator) createTraceEnv(parent *types.Block, statedb *state.StateDB, coinbase common.Address, block *types.Block) (*traceEnv, error) {
func (v *BlockValidator) createTraceEnv(block *types.Block) (*traceEnv, error) {
parent := v.bc.GetBlock(block.ParentHash(), block.NumberU64()-1)
if parent == nil {
return nil, errors.New("validateCircuitRowUsage: no parent block found")
}

statedb, err := v.bc.StateAt(parent.Hash())
if err != nil {
return nil, err
}

var coinbase common.Address
if v.config.Scroll.FeeVaultEnabled() {
coinbase = *v.config.Scroll.FeeVaultAddress
} else {
coinbase, err = v.engine.Author(block.Header())
if err != nil {
return nil, err
}
}

env := &traceEnv{
logConfig: &vm.LogConfig{
EnableMemory: false,
Expand Down Expand Up @@ -281,27 +301,14 @@ func (v *BlockValidator) validateCircuitRowUsage(block *types.Block) error {
return nil
}

parent := v.bc.GetBlock(block.ParentHash(), block.NumberU64()-1)
if parent == nil {
return errors.New("validateCircuitRowUsage: no parent block found")
}

statedb, err := v.bc.StateAt(parent.Hash())
env, err := v.createTraceEnv(block)
if err != nil {
return err
}

var coinbase common.Address
if v.config.Scroll.FeeVaultEnabled() {
coinbase = *v.config.Scroll.FeeVaultAddress
} else {
coinbase, err = v.engine.Author(block.Header())
if err != nil {
return err
}
}

v.createTraceEnv(parent, statedb, coinbase, block)
return getBlockTrace(env, block)
}

func getBlockTrace(env *traceEnv, block *types.Block) error {
return nil
}

0 comments on commit 17248dd

Please sign in to comment.