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

Previous header proof in block structure #6814

Merged

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Feb 17, 2025

Reasoning behind the pull request

  • Extended API block structure with extra fields

Proposed changes

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@miiu96 miiu96 self-assigned this Feb 17, 2025

func addPreviousHeaderProof(header data.HeaderHandler, apiBlock *api.Block) {
prevHeaderProof := header.GetPreviousProof()
if prevHeaderProof == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if prevHeaderProof == nil {
if check.IfNilReflect(prevHeaderProof) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -410,6 +410,34 @@ func TestAddScheduledInfoInBlock(t *testing.T) {
}, apiBlock)
}

func TestAddPreviousHeaderProofInBlock(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.Paralel() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

apiBlock := &api.Block{}
addPreviousHeaderProof(blockHeader, apiBlock)
require.Equal(t, &api.HeaderProof{
PubKeysBitmap: "6269746d6170",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use hex.Encode / Decode and extract it to some "provided..." variables, for more clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

AdoAdoAdo
AdoAdoAdo previously approved these changes Feb 18, 2025
sstanculeanu
sstanculeanu previously approved these changes Feb 19, 2025
Base automatically changed from fixes-delayed-broadcast to feat/equivalent-messages February 19, 2025 14:28
@sstanculeanu sstanculeanu dismissed stale reviews from AdoAdoAdo and themself February 19, 2025 14:28

The base branch was changed.

@AdoAdoAdo AdoAdoAdo merged commit 5a4bf27 into feat/equivalent-messages Feb 19, 2025
4 checks passed
@AdoAdoAdo AdoAdoAdo deleted the extend-api-block-structure-header-proof branch February 19, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants