Skip to content

Commit

Permalink
Return the correct light client payload proof (#14565)
Browse files Browse the repository at this point in the history
* Return the correct payload proof

* changelog <3
  • Loading branch information
rkapka authored Oct 22, 2024
1 parent 497c50a commit f8cb14c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
- Fixed mesh size by appending `gParams.Dhi = gossipSubDhi`
- Fix skipping partial withdrawals count.
- recover from panics when writing the event stream [pr](https://github.com/prysmaticlabs/prysm/pull/14545)
- Return the correct light client payload proof. [PR](https://github.com/prysmaticlabs/prysm/pull/14565)

### Security

Expand Down
18 changes: 4 additions & 14 deletions consensus-types/blocks/proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,13 @@ func PayloadProof(ctx context.Context, block interfaces.ReadOnlyBeaconBlock) ([]
return nil, errors.New("failed to cast block body")
}

blockBodyFieldRoots, err := ComputeBlockBodyFieldRoots(ctx, blockBody)
fieldRoots, err := ComputeBlockBodyFieldRoots(ctx, blockBody)
if err != nil {
return nil, err
}

blockBodyFieldRootsTrie := stateutil.Merkleize(blockBodyFieldRoots)
blockBodyProof := trie.ProofFromMerkleLayers(blockBodyFieldRootsTrie, payloadFieldIndex)
fieldRootsTrie := stateutil.Merkleize(fieldRoots)
proof := trie.ProofFromMerkleLayers(fieldRootsTrie, payloadFieldIndex)

beaconBlockFieldRoots, err := ComputeBlockFieldRoots(ctx, block)
if err != nil {
return nil, err
}

beaconBlockFieldRootsTrie := stateutil.Merkleize(beaconBlockFieldRoots)
beaconBlockProof := trie.ProofFromMerkleLayers(beaconBlockFieldRootsTrie, bodyFieldIndex)

finalProof := append(blockBodyProof, beaconBlockProof...)

return finalProof, nil
return proof, nil
}

0 comments on commit f8cb14c

Please sign in to comment.