-
Notifications
You must be signed in to change notification settings - Fork 597
refactor: move validation and error handling out of transport layer #23422
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
da5c9cc
refactor(txe): move validation and error handling out of transport layer
nchamo 893894e
chore(txe): fix import order in rpc_translator
nchamo 4d3378e
fix(txe): move offchain constants to constants.ts to break import cycle
nchamo cd0d70d
Merge remote-tracking branch 'origin/merge-train/fairies' into nchamo…
nchamo 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
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,3 +1,9 @@ | ||
| import { PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants'; | ||
| import { AztecAddress } from '@aztec/stdlib/aztec-address'; | ||
|
|
||
| export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42); | ||
|
|
||
| // Arbitrarily set at 64 because we need a bound. Nothing inherent about it. | ||
| export const MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY = 64; | ||
| // Must match MAX_OFFCHAIN_EFFECT_LEN in noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr. | ||
| export const MAX_OFFCHAIN_EFFECT_LEN = 2 + PRIVATE_LOG_CIPHERTEXT_LEN; |
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
30 changes: 30 additions & 0 deletions
30
yarn-project/txe/src/oracle/txe_private_execution_oracle.ts
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,30 @@ | ||
| import type { Fr } from '@aztec/foundation/curves/bn254'; | ||
| import { PrivateExecutionOracle } from '@aztec/pxe/simulator'; | ||
| import type { FunctionSelector } from '@aztec/stdlib/abi'; | ||
| import type { AztecAddress } from '@aztec/stdlib/aztec-address'; | ||
|
|
||
| /** | ||
| * TXE-specific subclass of PrivateExecutionOracle that forbids operations not supported in | ||
| * TestEnvironment::private_context. TXE uses dedicated oracle flows (e.g. private_call) instead. | ||
| */ | ||
| export class TXEPrivateExecutionOracle extends PrivateExecutionOracle { | ||
| override callPrivateFunction( | ||
| _targetContractAddress: AztecAddress, | ||
| _functionSelector: FunctionSelector, | ||
| _argsHash: Fr, | ||
| _sideEffectCounter: number, | ||
| _isStaticCall: boolean, | ||
| ): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }> { | ||
| throw new Error( | ||
| 'Contract calls are forbidden inside a `TestEnvironment::private_context`, use `private_call` instead', | ||
| ); | ||
| } | ||
|
|
||
| override assertValidPublicCalldata(_calldataHash: Fr): Promise<void> { | ||
| throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context'); | ||
| } | ||
|
|
||
| override notifyRevertiblePhaseStart(_minRevertibleSideEffectCounter: number): Promise<void> { | ||
| throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context'); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.