-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(avm): Set gas allowance in public calls (#5567)
Allows user to set gas allowance in public calls, defaulting to the gas left in the current frame. - Adds the `(L1|L2|DA)GASLEFT` instructions. - Adds a new `GasOpts` option to the `(Public|Avm)Context.call_public_function` so the user can specify the gas allocation for a nested public call (ignored in public context, only used in avm context). Defaults gas to the result of gasleft, minus a buffer for L2 compute. - Updates the noir interface codegen to handle this new argument.
- Loading branch information
1 parent
7b88bac
commit ee23415
Showing
36 changed files
with
909 additions
and
307 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
struct GasOpts { | ||
l1_gas: Option<Field>, | ||
l2_gas: Option<Field>, | ||
da_gas: Option<Field>, | ||
} | ||
|
||
impl GasOpts { | ||
pub fn default() -> Self { | ||
GasOpts { l1_gas: Option::none(), l2_gas: Option::none(), da_gas: Option::none() } | ||
} | ||
|
||
pub fn new(l1_gas: Field, l2_gas: Field, da_gas: Field) -> Self { | ||
GasOpts { l1_gas: Option::some(l1_gas), l2_gas: Option::some(l2_gas), da_gas: Option::some(da_gas) } | ||
} | ||
} |
This file contains 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 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 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 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
Oops, something went wrong.