Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VerifyRandao returns proper error when parent state is unavailable #2092

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion consensus/istanbul/backend/randao.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,16 @@ func (p *ChainBlsPubkeyProvider) getAllCached(chain consensus.ChainReader, num *
return nil, errors.New("KIP113 address not set in ChainConfig")
}
} else if chain.Config().IsRandaoForkEnabled(num) {
var err error
// If no state exist at block number `parentNum`,
// return the error `consensus.ErrPrunedAncestor`
pHeader := chain.GetHeaderByNumber(parentNum.Uint64())
if pHeader == nil {
return nil, consensus.ErrUnknownAncestor
}
_, err := chain.StateAt(pHeader.Root)
if err != nil {
return nil, consensus.ErrPrunedAncestor
}
kip113Addr, err = system.ReadActiveAddressFromRegistry(backend, system.Kip113Name, parentNum)
if err != nil {
return nil, err
Expand Down