Skip to content

fix: Update SyncChainMmr endpoint upper bound logic#1860

Open
sergerad wants to merge 4 commits intonextfrom
sergerad-finality-exclusivity
Open

fix: Update SyncChainMmr endpoint upper bound logic#1860
sergerad wants to merge 4 commits intonextfrom
sergerad-finality-exclusivity

Conversation

@sergerad
Copy link
Copy Markdown
Collaborator

Closes #1842.

@sergerad sergerad requested a review from bobbinth March 30, 2026 00:40
@sergerad sergerad added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Mar 30, 2026
Comment on lines +504 to +511
oneof upper_bound {
// Sync up to this specific block number (inclusive), clamped to the effective tip.
fixed32 block_num = 3;
// Sync up to the latest committed block (chain tip).
bool last_committed = 4;
// Sync up to the latest proven block.
bool last_proven = 5;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this the recommended way to emulate sum types in protobuf?

Haven't seen bool used as a placeholder before - what happens if they're manually set to false?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The value of the boolean is ignored

        match value {
            UpperBound::BlockNum(block_num) => Ok(Self::BlockNumber(block_num.into())),
            UpperBound::CommittedChainTip(_) => Ok(Self::CommittedChainTip),
            UpperBound::ProvenChainTip(_) => Ok(Self::ProvenChainTip),
        }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know. But since these are numbered fields, and protobuf default inits fields at the receiver, what actually happens if I send last_proven = false -- does it not still get last_committed = false.

Copy link
Copy Markdown
Collaborator

@SantiagoPittella SantiagoPittella left a comment

Choose a reason for hiding this comment

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

Looks good, agree w Mirko's comments.

Copy link
Copy Markdown
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left one comment inline and agree with @Mirko-von-Leipzig's comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make finality and block_to mutually exclusive in sync_chain_mmr endpoint

4 participants