-
Notifications
You must be signed in to change notification settings - Fork 597
feat(avm): implement avm state getter opcodes within noir contracts #4402
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
Merged
Maddiaa0
merged 6 commits into
master
from
md/02-02-feat_avm_access_execution_environment_within_noir_contracts
Feb 5, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
93ff6a4
feat(avm): access execution environment within noir contracts
Maddiaa0 e9c077a
feat: add tests for all env types
Maddiaa0 f619cf4
fmt
Maddiaa0 8c69cf1
fix: test globals, run write oracles inline
Maddiaa0 4561249
whoopsie
Maddiaa0 ddd0cb6
fix indent
Maddiaa0 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
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mod context; |
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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| use dep::protocol_types::address::{ | ||
| AztecAddress, | ||
| EthAddress, | ||
| }; | ||
|
|
||
| // Getters that will be converted by the transpiler into their | ||
| // own opcodes | ||
| struct AvmContext {} | ||
|
|
||
| // No new function as this struct is entirely static getters | ||
| impl AvmContext { | ||
| #[oracle(address)] | ||
| pub fn address() -> AztecAddress {} | ||
|
|
||
| #[oracle(storageAddress)] | ||
| pub fn storage_address() -> AztecAddress {} | ||
|
|
||
| #[oracle(origin)] | ||
| pub fn origin() -> AztecAddress {} | ||
|
|
||
| #[oracle(sender)] | ||
| pub fn sender() -> AztecAddress {} | ||
|
|
||
| #[oracle(portal)] | ||
| pub fn portal() -> EthAddress {} | ||
|
|
||
| #[oracle(feePerL1Gas)] | ||
| pub fn fee_per_l1_gas() -> Field {} | ||
|
|
||
| #[oracle(feePerL2Gas)] | ||
| pub fn fee_per_l2_gas() -> Field {} | ||
|
|
||
| #[oracle(feePerDaGas)] | ||
| pub fn fee_per_da_gas() -> Field {} | ||
|
|
||
| #[oracle(chainId)] | ||
| pub fn chain_id() -> Field {} | ||
|
|
||
| #[oracle(version)] | ||
| pub fn version() -> Field {} | ||
|
|
||
| #[oracle(blockNumber)] | ||
| pub fn block_number() -> Field {} | ||
|
|
||
| #[oracle(timestamp)] | ||
| pub fn timestamp() -> Field {} | ||
|
|
||
| // #[oracle(contractCallDepth)] | ||
| // pub fn contract_call_depth() -> Field {} | ||
| } |
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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| mod abi; | ||
| mod avm; | ||
| mod context; | ||
| mod hash; | ||
| mod history; | ||
|
|
||
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
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.