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

grow_stack and empty $hp range write fixes #788

Merged
merged 4 commits into from
Jul 4, 2024
Merged

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Jul 4, 2024

Fixes two minor bugs in the memory implementation:

  • grow_stack was silently truncating the sp to MEM_SIZE even if it was above that
  • Empty ranges at $hp would fail ownership check, even if they really should pass

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The grow_stack case is not tested, as it's not really reachable externally.
  • If performance characteristic of an instruction change, update gas costs as well or make a follow-up PR for that
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself

@Dentosal Dentosal added the bug Something isn't working label Jul 4, 2024
@Dentosal Dentosal self-assigned this Jul 4, 2024
@Dentosal Dentosal marked this pull request as ready for review July 4, 2024 16:49
@@ -972,11 +977,10 @@ impl OwnershipRegisters {

/// Empty range is owned iff the range.start is owned
pub(crate) fn has_ownership_heap(&self, range: &Range<Word>) -> bool {
// TODO implement fp->hp and (addr, size) validations
Copy link
Member Author

Choose a reason for hiding this comment

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

These were already implemented, so this comment was obsolete.

@Dentosal Dentosal requested a review from xgreenx July 4, 2024 16:50
@Dentosal Dentosal changed the title Dento/stack grow fix stack_grow fix Jul 4, 2024
@Dentosal Dentosal enabled auto-merge July 4, 2024 16:52
@Dentosal Dentosal changed the title stack_grow fix grow_stack and empty $hp range write fixes Jul 4, 2024
@Dentosal Dentosal added this pull request to the merge queue Jul 4, 2024
Merged via the queue into master with commit cf63a54 Jul 4, 2024
38 of 39 checks passed
@Dentosal Dentosal deleted the dento/stack_grow-fix branch July 4, 2024 17:02
@xgreenx xgreenx mentioned this pull request Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants