Skip to content

Commit e187005

Browse files
authored
add switch to add proofs to blocks (#278)
1 parent e0dcce7 commit e187005

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

consensus/beacon/consensus.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
391391
k verkle.StateDiff
392392
keys = state.Witness().Keys()
393393
)
394-
if chain.Config().IsPrague(header.Number, header.Time) {
394+
if chain.Config().IsPrague(header.Number, header.Time) && chain.Config().ProofInBlock {
395395
// Open the pre-tree to prove the pre-state against
396396
parent := chain.GetHeaderByNumber(header.Number.Uint64() - 1)
397397
if parent == nil {
@@ -441,7 +441,9 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
441441

442442
// Assemble and return the final block.
443443
block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, trie.NewStackTrie(nil))
444-
block.SetVerkleProof(p, k)
444+
if chain.Config().IsPrague(header.Number, header.Time) && chain.Config().ProofInBlock {
445+
block.SetVerkleProof(p, k)
446+
}
445447
return block, nil
446448
}
447449

core/state_processor_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ func TestProcessVerkle(t *testing.T) {
454454
PragueTime: u64(0),
455455
TerminalTotalDifficulty: common.Big0,
456456
TerminalTotalDifficultyPassed: true,
457+
ProofInBlock: true,
457458
}
458459
signer = types.LatestSigner(config)
459460
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")

params/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ type ChainConfig struct {
299299
Ethash *EthashConfig `json:"ethash,omitempty"`
300300
Clique *CliqueConfig `json:"clique,omitempty"`
301301
IsDevMode bool `json:"isDev,omitempty"`
302+
303+
// Proof in block
304+
ProofInBlock bool `json:"proofInBlock,omitempty"`
302305
}
303306

304307
// EthashConfig is the consensus engine configs for proof-of-work based sealing.

0 commit comments

Comments
 (0)