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: Migrate accounts to auth witness #2281

Merged
merged 15 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 0 additions & 10 deletions yarn-project/aztec-nr/aztec/src/account.nr
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ impl AccountActions {
}
}

// TODO: See if we can remove this function. Maybe we can have the entrypoint call directly into internal_set_is_valid_storage..?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rainbow Frog GIF

fn set_is_valid_storage(self, message_hash: Field, value: bool) {
let private_context = self.context.private.unwrap();
assert(private_context.msg_sender() == private_context.this_address(), "only the owner can set the storage");
// assert(_inner_is_valid(message_hash, context.this_address()), "only the owner can set the storage");

let selector = compute_selector("internal_set_is_valid_storage(Field,bool)");
let _void = private_context.call_public_function(private_context.this_address(), selector, [message_hash, value as Field]);
}

fn internal_set_is_valid_storage(self, message_hash: Field, value: bool) {
self.approved_action.at(message_hash).write(value);
}
Expand Down
72 changes: 24 additions & 48 deletions yarn-project/aztec.js/src/abis/ecdsa_account_contract.json

Large diffs are not rendered by default.

72 changes: 24 additions & 48 deletions yarn-project/aztec.js/src/abis/schnorr_account_contract.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions yarn-project/aztec.js/src/wallet/account_wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export class AccountWallet extends BaseWallet {
private getSetIsValidStorageAbi(): FunctionAbiHeader {
return {
name: 'set_is_valid_storage',
functionType: 'secret' as FunctionType,
isInternal: false,
functionType: 'open' as FunctionType,
isInternal: true,
parameters: [
{
name: 'message_hash',
Expand All @@ -60,7 +60,7 @@ export class AccountWallet extends BaseWallet {
},
{
name: 'value',
type: { kind: 'field' },
type: { kind: 'boolean' },
visibility: 'private' as ABIParameterVisibility,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,8 @@ contract EcdsaAccount {
actions.is_valid_public(message_hash)
}

#[aztec(private)]
fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::private(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.set_is_valid_storage(message_hash, value)
}

#[aztec(public)]
internal fn internal_set_is_valid_storage(message_hash: Field, value: bool) {
internal fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::public(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.internal_set_is_valid_storage(message_hash, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,8 @@ contract SchnorrAccount {
actions.is_valid_public(message_hash)
}

#[aztec(private)]
fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::private(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.set_is_valid_storage(message_hash, value)
}

#[aztec(public)]
internal fn internal_set_is_valid_storage(message_hash: Field, value: bool) {
internal fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::public(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.internal_set_is_valid_storage(message_hash, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@ contract SchnorrHardcodedAccount {
actions.is_valid_public(message_hash)
}

#[aztec(private)]
fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::private(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.set_is_valid_storage(message_hash, value)
}

#[aztec(public)]
internal fn internal_set_is_valid_storage(message_hash: Field, value: bool) {
internal fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::public(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.internal_set_is_valid_storage(message_hash, value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@ contract SchnorrSingleKeyAccount {
actions.is_valid_public(message_hash)
}

#[aztec(private)]
fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::private(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.set_is_valid_storage(message_hash, value)
}

#[aztec(public)]
internal fn internal_set_is_valid_storage(message_hash: Field, value: bool) {
internal fn set_is_valid_storage(message_hash: Field, value: bool) {
let actions = AccountActions::public(&mut context, ACCOUNT_ACTIONS_STORAGE_SLOT, is_valid_impl);
actions.internal_set_is_valid_storage(message_hash, value)
}
Expand Down