Skip to content

Commit 5c85958

Browse files
gballetrenaynay
authored andcommitted
consensus: remove seal verification from the consensus engine interface (ethereum#22274)
1 parent 0ccba9b commit 5c85958

File tree

5 files changed

+4
-20
lines changed

5 files changed

+4
-20
lines changed

consensus/clique/clique.go

-6
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,6 @@ func (c *Clique) VerifyUncles(chain consensus.ChainReader, block *types.Block) e
434434
return nil
435435
}
436436

437-
// VerifySeal implements consensus.Engine, checking whether the signature contained
438-
// in the header satisfies the consensus protocol requirements.
439-
func (c *Clique) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error {
440-
return c.verifySeal(chain, header, nil)
441-
}
442-
443437
// verifySeal checks whether the signature contained in the header satisfies the
444438
// consensus protocol requirements. The method accepts an optional list of parent
445439
// headers that aren't yet part of the local blockchain to generate the snapshots

consensus/consensus.go

-4
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ type Engine interface {
7777
// rules of a given engine.
7878
VerifyUncles(chain ChainReader, block *types.Block) error
7979

80-
// VerifySeal checks whether the crypto seal on a header is valid according to
81-
// the consensus rules of the given engine.
82-
VerifySeal(chain ChainHeaderReader, header *types.Header) error
83-
8480
// Prepare initializes the consensus fields of a block header according to the
8581
// rules of a particular engine. The changes are executed inline.
8682
Prepare(chain ChainHeaderReader, header *types.Header) error

consensus/ethash/algorithm_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ func TestConcurrentDiskCacheGeneration(t *testing.T) {
731731
defer pend.Done()
732732
ethash := New(Config{cachedir, 0, 1, false, "", 0, 0, false, ModeNormal, nil}, nil, false)
733733
defer ethash.Close()
734-
if err := ethash.VerifySeal(nil, block.Header()); err != nil {
734+
if err := ethash.verifySeal(nil, block.Header(), false); err != nil {
735735
t.Errorf("proc %d: block verification failed: %v", idx, err)
736736
}
737737
}(i)

consensus/ethash/consensus.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, pa
288288
}
289289
// Verify the engine specific seal securing the block
290290
if seal {
291-
if err := ethash.VerifySeal(chain, header); err != nil {
291+
if err := ethash.verifySeal(chain, header, false); err != nil {
292292
return err
293293
}
294294
}
@@ -488,12 +488,6 @@ var FrontierDifficultyCalulator = calcDifficultyFrontier
488488
var HomesteadDifficultyCalulator = calcDifficultyHomestead
489489
var DynamicDifficultyCalculator = makeDifficultyCalculator
490490

491-
// VerifySeal implements consensus.Engine, checking whether the given block satisfies
492-
// the PoW difficulty requirements.
493-
func (ethash *Ethash) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error {
494-
return ethash.verifySeal(chain, header, false)
495-
}
496-
497491
// verifySeal checks whether a block satisfies the PoW difficulty requirements,
498492
// either using the usual ethash cache for it, or alternatively using a full DAG
499493
// to make remote mining fast.

consensus/ethash/ethash_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestTestMode(t *testing.T) {
4646
case block := <-results:
4747
header.Nonce = types.EncodeNonce(block.Nonce())
4848
header.MixDigest = block.MixDigest()
49-
if err := ethash.VerifySeal(nil, header); err != nil {
49+
if err := ethash.verifySeal(nil, header, false); err != nil {
5050
t.Fatalf("unexpected verification error: %v", err)
5151
}
5252
case <-time.NewTimer(4 * time.Second).C:
@@ -86,7 +86,7 @@ func verifyTest(wg *sync.WaitGroup, e *Ethash, workerIndex, epochs int) {
8686
block = 0
8787
}
8888
header := &types.Header{Number: big.NewInt(block), Difficulty: big.NewInt(100)}
89-
e.VerifySeal(nil, header)
89+
e.verifySeal(nil, header, false)
9090
}
9191
}
9292

0 commit comments

Comments
 (0)