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

Avoid proposing chains that are longer than max. #206

Merged
merged 1 commit into from May 14, 2024
Merged

Conversation

anorth
Copy link
Member

@anorth anorth commented May 9, 2024

Closes #203

@@ -145,6 +145,8 @@ func (p *Participant) ReceiveAlarm() (err error) {

func (p *Participant) beginInstance() error {
chain, power, beacon := p.host.GetCanonicalChain()
// Limit length of the chain to be proposed.
chain = chain.Prefix(CHAIN_MAX_LEN - 1)
Copy link
Member

Choose a reason for hiding this comment

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

The chain includes the base, right? This should be CHAIN_MAX_LEN in that case (no -1).

Copy link
Member

Choose a reason for hiding this comment

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

(it would be nice to assert that the base matches the end of our previous proposal...

Copy link
Member Author

Choose a reason for hiding this comment

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

The Prefix method adds one: Prefix(0) is the base chain. Yes perhaps this isn't the ideal semantics, but it makes more sense at some other call sites. I wouldn't object to you overhauling that in another PR, but it's below my threshold at the moment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Or did you mean that the max length should be CHAIN_MAX_LEN tips plus one for the base?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, no. I misunderstood prefix. LGTM.

@anorth anorth requested a review from Stebalien May 13, 2024 21:27
@anorth anorth force-pushed the anorth/max-chain branch 2 times, most recently from 15198a7 to cea0df8 Compare May 14, 2024 01:45
@anorth anorth enabled auto-merge May 14, 2024 23:39
@anorth anorth added this pull request to the merge queue May 14, 2024
Merged via the queue into main with commit dc42822 May 14, 2024
3 checks passed
@anorth anorth deleted the anorth/max-chain branch May 14, 2024 23:49
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.

Avoid proposing Values with more than CHAIN_MAX_LEN
3 participants