This repository was archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 839
fix delegate call with insufficient balance #1069
Merged
ed255
merged 5 commits into
privacy-ethereum:main
from
scroll-tech:delegatecall_insufficient
Jan 20, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7b50e4f
fix delegate call with insufficient balance
DreamWuGit 05823d5
Merge branch 'main' into delegatecall_insufficient
DreamWuGit b5f92fb
use debug info
DreamWuGit ff3af9c
Merge branch 'delegatecall_insufficient' of https://github.com/scroll…
DreamWuGit 687a5ba
Merge branch 'main' into delegatecall_insufficient
lispc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,7 +155,7 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> { | |
|
|
||
| let caller_balance_word = cb.query_word_rlc(); | ||
| cb.account_read( | ||
| callee_address.expr(), | ||
| caller_address.expr(), | ||
| AccountFieldTag::Balance, | ||
| caller_balance_word.expr(), | ||
| ); | ||
|
|
@@ -488,8 +488,7 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> { | |
| self.is_insufficient_balance | ||
| .assign(region, offset, caller_balance, value)?; | ||
|
|
||
| let is_insufficient = value > caller_balance; | ||
|
|
||
| let is_insufficient = (value > caller_balance) && (is_call || is_callcode); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The corresponding circuit expression only does So I believe adding the |
||
| // only call opcode do transfer in sucessful case. | ||
| let (caller_balance_pair, callee_balance_pair) = if is_call & !is_insufficient { | ||
| rw_offset += 2; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.