fix: sort blocks by number by mattsse · Pull Request #10505 · foundry-rs/foundry (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation3 Commits1 Checks22 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

mattsse

ensure blocks are sorted so that last is always highest, otherwise this can be nondeterministic

ref #10488

cc @naps62

@mattsse

grandizzy

Choose a reason for hiding this comment

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

lgtm!

@naps62

oh wow, never even considered this could be a thing
but if this is the case, wouldn't it be a better option to just lookup the highest block number on load, instead of sorting on save?

both for performance reasons, and for backward compatibility with existing states (this second reason is probably not a big deal, though)

@grandizzy

oh wow, never even considered this could be a thing but if this is the case, wouldn't it be a better option to just lookup the highest block number on load, instead of sorting on save?

both for performance reasons, and for backward compatibility with existing states (this second reason is probably not a big deal, though)

@naps62 mind to follow up with a PR for the improvement? going to merge this one to fix the inconsistency / flaky test, thank you!

naps62 added a commit to naps62/foundry that referenced this pull request

May 13, 2025

@naps62

mattsse pushed a commit that referenced this pull request

May 13, 2025

@naps62

Reviewers

@grandizzy grandizzy grandizzy approved these changes

@DaniPopes DaniPopes Awaiting requested review from DaniPopes DaniPopes is a code owner

@klkvr klkvr Awaiting requested review from klkvr klkvr is a code owner

@yash-atreya yash-atreya Awaiting requested review from yash-atreya yash-atreya is a code owner

@zerosnacks zerosnacks Awaiting requested review from zerosnacks zerosnacks is a code owner