Skip to content
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

feat(public)!: reroute public calls to dispatch function #8972

Merged
merged 9 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update comments
fcarreiro committed Oct 3, 2024
commit 768b5ecef7887c53c03665e6d34d6c25c2b0419a
12 changes: 8 additions & 4 deletions noir-projects/aztec-nr/aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
@@ -468,8 +468,10 @@ impl PrivateContext {
let counter = self.next_counter();

let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;
// TODO():
// WARNING:
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8985): Fix this.
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
fcarreiro marked this conversation as resolved.
Show resolved Hide resolved
let args_hash = enqueue_public_function_call_internal(
contract_address,
function_selector,
@@ -516,8 +518,10 @@ impl PrivateContext {
let counter = self.next_counter();

let mut is_static_call = is_static_call | self.inputs.call_context.is_static_call;
// TODO():
// WARNING:
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8985): Fix this.
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
let args_hash = set_public_teardown_function_call_internal(
contract_address,
function_selector,
12 changes: 8 additions & 4 deletions yarn-project/simulator/src/client/client_execution_context.ts
Original file line number Diff line number Diff line change
@@ -536,8 +536,10 @@ export class ClientExecutionContext extends ViewDataOracle {
isStaticCall: boolean,
isDelegateCall: boolean,
): Promise<Fr> {
// TODO():
// WARNING:
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8985): Fix this.
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
const newArgsHash = this.packedValuesCache.pack([
functionSelector.toField(),
...this.packedValuesCache.unpack(argsHash),
@@ -573,8 +575,10 @@ export class ClientExecutionContext extends ViewDataOracle {
isStaticCall: boolean,
isDelegateCall: boolean,
): Promise<Fr> {
// TODO():
// WARNING:
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8985): Fix this.
// WARNING: This is insecure and should be temporary!
// The oracle repacks the arguments and returns a new args_hash.
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
const newArgsHash = this.packedValuesCache.pack([
functionSelector.toField(),
...this.packedValuesCache.unpack(argsHash),