diff --git a/core/blockchain.go b/core/blockchain.go index 14c457eedb..c60a19c498 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1382,6 +1382,8 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. // TODO: return the error and stop importing the current chain. // I'm leaving it like this so I can watch validation errors as // the client follows the chain. + } else { + log.Info("successfully cross-validated block", "number", witness.Block.NumberU64(), "hash", witness.Block.Hash()) } } // Irrelevant of the canonical status, write the block itself to the database. diff --git a/core/cross_validator.go b/core/cross_validator.go index 36fb78ab88..fb4ad07d5e 100644 --- a/core/cross_validator.go +++ b/core/cross_validator.go @@ -26,9 +26,10 @@ type crossValidator struct { // TODO: differentiate between errors from witness verification (maybe consensus // failure) and anything else. func (c *crossValidator) CrossValidateBlock(chainConfig *params.ChainConfig, witness *state.Witness) error { - // encode the witness to RLP, zeroing-out the block state root before sending - // it for cross validation to make it impossible for a cross-validator to - // produce a correct validation result without computing it. + // encode the witness to RLP, zeroing-out the block state root before encoding. + // this is to make it impossible for a cross-validator to + // produce a correct post-state root without executing the + // witness themselves. enc, _ := witness.EncodeRLP() // TODO: implement retry if endpoint can't be reached @@ -55,7 +56,6 @@ func (c *crossValidator) CrossValidateBlock(chainConfig *params.ChainConfig, wit if bytes.Compare(body, witness.Block.Header().Root[:]) != 0 { if errInner := state.DumpBlockWitnessToFile(chainConfig, witness, c.witnessRecordingPath); errInner != nil { log.Error("failed to dump block to file", "error", errInner) - panic("should not happen") } return err }