Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion consensus/consortium/v2/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (s *Snapshot) apply(headers []*types.Header, chain consensus.ChainHeaderRea
if err != nil {
return nil, err
}
if !snap.inInValidatorSet(validator) {
if !snap.inInValidatorSet(validator) && !s.chainConfig.IsL2Migration(header.Number) {
return nil, errUnauthorizedValidator
}
for _, recent := range snap.Recents {
Expand Down
6 changes: 6 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,12 @@ func (bc *BlockChain) processBlock(block *types.Block, statedb *state.StateDB, s

// Validate the state using the default validator
substart = time.Now()
// support Conduit to force persist L2 block, after alloc updates,
// state root has been changed and it breaks validations
if bc.chainConfig.IsL2Migration(block.Number()) {
root := statedb.IntermediateRoot(bc.chainConfig.IsEIP158(block.Header().Number))
block.SetStateRoot(root)
}
if err := bc.validator.ValidateState(block, statedb, receipts, usedGas); err != nil {
bc.reportBlock(block, receipts, err)
return nil, err
Expand Down
9 changes: 9 additions & 0 deletions core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,4 +652,13 @@ func (b *Block) Hash() common.Hash {
return v
}

// SetStateRoot
// Warning: support only for Conduit migration
func (b *Block) SetStateRoot(root common.Hash) common.Hash {
b.header.Root = root
v := b.header.Hash()
b.hash.Store(v)
return v
}

type Blocks []*Block