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

miner, core, params: enable empty blocks + Developer Chain Config #36

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func DefaultSepoliaGenesisBlock() *Genesis {
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
func DeveloperGenesisBlock(period uint64, gasLimit uint64, faucet common.Address) *Genesis {
// Override the default period to the user requested one
config := *params.SuaveChainConfig
config := *params.DeveloperSuaveChainConfig

// Assemble and return the genesis with the precompiles and faucet pre-funded
return &Genesis{
Expand Down
6 changes: 1 addition & 5 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,7 @@ func (w *worker) mainLoop() {
// Special case, if the consensus engine is 0 period clique(dev mode),
// submit sealing work here since all empty submission will be rejected
// by clique. Of course the advance sealing(empty submission) is disabled.
if w.chainConfig.Clique != nil && false { // && w.chainConfig.Clique.Period == 0 {
// Don't commit empty!
if w.chainConfig.Clique != nil && w.chainConfig.Clique.Period == 0 {
w.commitWork(nil, true, time.Now().Unix())
}
}
Expand Down Expand Up @@ -730,9 +729,6 @@ func (w *worker) resultLoop() {
if block == nil {
continue
}
if block.Transactions().Len() == 0 {
continue
}
// Short circuit when receiving duplicate result caused by resubmitting.
if w.chain.HasBlock(block.Hash(), block.NumberU64()) {
continue
Expand Down
24 changes: 24 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,30 @@ var (
Epoch: 30000,
},
}

// SuaveChainConfig for development with 0 period to avoid mining empty blocks
DeveloperSuaveChainConfig = &ChainConfig{
ChainID: big.NewInt(424242),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
SuaveBlock: big.NewInt(0),
ArrowGlacierBlock: nil,
Clique: &CliqueConfig{
Period: 0,
Epoch: 30000,
},
}
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus.
AllEthashProtocolChanges = &ChainConfig{
Expand Down
Loading