|
|
@ -34,6 +34,9 @@ import ( |
|
|
|
"github.com/harmony-one/harmony/internal/params" |
|
|
|
"github.com/harmony-one/harmony/internal/params" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Beacon chain block 1213181 is a one-off block with empty receipts which is expected to be non-empty.
|
|
|
|
|
|
|
|
const beaconBadBlock = 1213181 |
|
|
|
|
|
|
|
|
|
|
|
// BlockValidator is responsible for validating block headers, uncles and
|
|
|
|
// BlockValidator is responsible for validating block headers, uncles and
|
|
|
|
// processed state.
|
|
|
|
// processed state.
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -93,14 +96,16 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.DB, re |
|
|
|
// Validate the received block's bloom with the one derived from the generated receipts.
|
|
|
|
// Validate the received block's bloom with the one derived from the generated receipts.
|
|
|
|
// For valid blocks this should always validate to true.
|
|
|
|
// For valid blocks this should always validate to true.
|
|
|
|
rbloom := types.CreateBloom(receipts) |
|
|
|
rbloom := types.CreateBloom(receipts) |
|
|
|
// Beacon chain block 1213181 is a one-off block with empty bloom which is expected to be non-empty.
|
|
|
|
// Beacon chain block 1213181 is a one-off block with empty receipts which is expected to be non-empty.
|
|
|
|
// Skip the validation for it to avoid failure.
|
|
|
|
// Skip the validation for it to avoid failure.
|
|
|
|
if rbloom != header.Bloom() && (block.NumberU64() != 1213181 || block.ShardID() != 0) { |
|
|
|
if rbloom != header.Bloom() && (block.NumberU64() != beaconBadBlock || block.ShardID() != 0) { |
|
|
|
return fmt.Errorf("invalid bloom (remote: %x local: %x)", header.Bloom(), rbloom) |
|
|
|
return fmt.Errorf("invalid bloom (remote: %x local: %x)", header.Bloom(), rbloom) |
|
|
|
} |
|
|
|
} |
|
|
|
// Tre receipt Trie's root (R = (Tr [[H1, R1], ... [Hn, R1]]))
|
|
|
|
// Tre receipt Trie's root (R = (Tr [[H1, R1], ... [Hn, R1]]))
|
|
|
|
receiptSha := types.DeriveSha(receipts) |
|
|
|
receiptSha := types.DeriveSha(receipts) |
|
|
|
if receiptSha != header.ReceiptHash() { |
|
|
|
// Beacon chain block 1213181 is a one-off block with empty receipts which is expected to be non-empty.
|
|
|
|
|
|
|
|
// Skip the validation for it to avoid failure.
|
|
|
|
|
|
|
|
if receiptSha != header.ReceiptHash() && (block.NumberU64() != beaconBadBlock || block.ShardID() != 0) { |
|
|
|
return fmt.Errorf("invalid receipt root hash (remote: %x local: %x)", header.ReceiptHash(), receiptSha) |
|
|
|
return fmt.Errorf("invalid receipt root hash (remote: %x local: %x)", header.ReceiptHash(), receiptSha) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|