-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: introduce execution oracle (#7521)
Discussing this and related topics with @Thunkar we realized that the `getContractAddress` and similar oracles were duplicated: they existed both in `UnconstrainedContext` and in `cheatcodes`. In my mind, `cheatcodes` are oracles that only exist on TXE and that should not be relied on for regular applications (i.e. they are not part of the PXE API), whereas `UnconstrainedContext` _does_ use the regular PXE API. These are clearly sort of standard, as can be seen in the fact that we're using them outside of `UnconstrainedContext`, so I removed them from both the context and cheatcodes, and created a new `oracle::execution` mod with these four oracles.
- Loading branch information
Showing
11 changed files
with
83 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use dep::protocol_types::address::AztecAddress; | ||
|
||
#[oracle(getContractAddress)] | ||
unconstrained fn get_contract_address_oracle() -> AztecAddress {} | ||
|
||
#[oracle(getBlockNumber)] | ||
unconstrained fn get_block_number_oracle() -> u32 {} | ||
|
||
#[oracle(getChainId)] | ||
unconstrained fn get_chain_id_oracle() -> Field {} | ||
|
||
#[oracle(getVersion)] | ||
unconstrained fn get_version_oracle() -> Field {} | ||
|
||
unconstrained pub fn get_contract_address() -> AztecAddress { | ||
get_contract_address_oracle() | ||
} | ||
|
||
unconstrained pub fn get_block_number() -> u32 { | ||
get_block_number_oracle() | ||
} | ||
|
||
unconstrained pub fn get_chain_id() -> Field { | ||
get_chain_id_oracle() | ||
} | ||
|
||
unconstrained pub fn get_version() -> Field { | ||
get_version_oracle() | ||
} |
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
Oops, something went wrong.