Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

fix: fix early return for create #810

Merged
merged 8 commits into from
Nov 23, 2023
Merged

Conversation

Eikix
Copy link
Member

@Eikix Eikix commented Nov 14, 2023

Time spent on this PR: 0.2 day

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Resolves #795

What is the new behavior?

  • add early return for collision in create
  • add early return for unsufficient balance in create (value > 0)

Copy link
Member

@ClementWalter ClementWalter left a comment

Choose a reason for hiding this comment

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

how many ef tests does this solve?
Also, I think that there is a place where the value is used to do early return and not add_transfer, that should be fixed

you add a lot of comments I don't fell bring any value to the codebase.

@Eikix
Copy link
Member Author

Eikix commented Nov 15, 2023

Also, I think that there is a place where the value is used to do early return and not add_transfer, that should be fixed

In system operations, line 800, we handle transfer in CREATE, but adding an "if amount == 0" would probably disturb the references and result in revoked reference errors. Not sure how to handle this without an early return inside the add_transfer. But I agree this early return should probably not be used

@ClementWalter
Copy link
Member

Also, I think that there is a place where the value is used to do early return and not add_transfer, that should be fixed

In system operations, line 800, we handle transfer in CREATE, but adding an "if amount == 0" would probably disturb the references and result in revoked reference errors. Not sure how to handle this without an early return inside the add_transfer. But I agree this early return should probably not be used

early return in add_transfer is fine for me. I was referring to this

https://github.com/ClementWalter/kakarot/blob/bff112a701d00e9e6991b9780ba66a2fad389f54/src/kakarot/instructions/system_operations.cairo#L238

that should then probably be removed since the add_transfer integrates it.

@Eikix Eikix force-pushed the fix/create branch 2 times, most recently from 8d6b86b to c0492e5 Compare November 15, 2023 14:40
Copy link
Member

@ClementWalter ClementWalter left a comment

Choose a reason for hiding this comment

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

I'm ok with the proposed changes in terms of code (though need to fix 2 tests). However I'm wondering if the proposed change implements the right behavior as it makes 30 ef-tests failing

@Eikix
Copy link
Member Author

Eikix commented Nov 22, 2023

Blocked by an update on the ef-test runner

@Eikix Eikix force-pushed the fix/create branch 2 times, most recently from 4f2b216 to c05e37a Compare November 22, 2023 15:32
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (4c10873) 71.90% compared to head (c7f62b0) 72.11%.
Report is 2 commits behind head on main.

Files Patch % Lines
src/kakarot/instructions/system_operations.cairo 61.53% 10 Missing ⚠️
src/kakarot/state.cairo 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #810      +/-   ##
==========================================
+ Coverage   71.90%   72.11%   +0.21%     
==========================================
  Files          47       47              
  Lines        6041     6040       -1     
==========================================
+ Hits         4344     4356      +12     
+ Misses       1697     1684      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ClementWalter ClementWalter merged commit ae90be8 into kkrt-labs:main Nov 23, 2023
6 of 7 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: collision in CREATE and CREATE2 should not revert
2 participants