Skip to content

Commit

Permalink
turbo/jsonrpc: correction in fetching validatorByte in bor_snapshot.go (
Browse files Browse the repository at this point in the history
#12360)

**Fix: Outdated validatorByte Method in apply Function**

The outdated validatorByte method in apply() (found in
turbo/jsonrpc/bor_snapshot.go) caused the newVals array to remain empty.
As a result, the validator's power was always set to 0, leading to
incorrect RPC information.

This bug affected the following RPC calls:

- getSnapshot
- bor_getSnapshotProposerSequence

**Changes:**

- Fixed the logic within the apply() function to ensure newVals is
populated correctly.
- Validators now retain their proper power, resulting in accurate
responses for the affected RPC calls.

This fix ensures that the snapshot and proposer sequence information are
reflected correctly in RPC outputs.
  • Loading branch information
AryaLanjewar3005 authored Oct 21, 2024
1 parent 223ddd6 commit fd711cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion turbo/jsonrpc/bor_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
if err := bor.ValidateHeaderExtraLength(header.Extra); err != nil {
return nil, err
}
validatorBytes := header.Extra[extraVanity : len(header.Extra)-extraSeal]
validatorBytes := bor.GetValidatorBytes(header, s.config)

// get validators from headers and use that for new validator set
newVals, _ := valset.ParseValidators(validatorBytes)
Expand Down

0 comments on commit fd711cb

Please sign in to comment.