Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bundle simulation based on real inturn header #57

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,28 @@ func (miner *Miner) prepareSimulationEnv(parent *types.Header, state *state.Stat
timestamp = int64(parent.Time + 1)
}

// take the next in-turn validator as coinbase
coinbase, err := miner.worker.engine.NextInTurnValidator(miner.worker.chain, parent)
if err != nil {
log.Error("Failed to get next in-turn validator", "err", err)
return nil, err
}

// set validator to the consensus engine
if posa, ok := miner.worker.engine.(consensus.PoSA); ok {
posa.SetValidator(coinbase)
} else {
log.Error("Consensus engine does not support validator setting")
return nil, err
}

header := &types.Header{
ParentHash: parent.Hash(),
Number: new(big.Int).Add(parent.Number, common.Big1),
GasLimit: core.CalcGasLimitForBuilder(parent.GasLimit, miner.worker.config.GasCeil),
Extra: miner.worker.extra,
Time: uint64(timestamp),
Coinbase: miner.worker.etherbase(),
Coinbase: coinbase,
}

// Set baseFee and GasLimit if we are on an EIP-1559 chain
Expand Down
Loading