Skip to content

Commit

Permalink
miner, core, params: enable empty blocks + Developer Chain Config (#36)
Browse files Browse the repository at this point in the history
* miner: remove empty block breaks

* core, params: Suave Developer chain config

---------

Co-authored-by: dmarzzz <danamrzec@icloud.com>
  • Loading branch information
dmarzzz and dmarzzz authored Sep 19, 2023
1 parent d2ad76b commit 8f443af
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
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

0 comments on commit 8f443af

Please sign in to comment.