-
Notifications
You must be signed in to change notification settings - Fork 311
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
refactor: replacing use of capsules 1.0 with pxe_db + nuking capsules 1.0 #11885
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
mod events; | ||
mod capsule; | ||
|
||
use dep::aztec::macros::aztec; | ||
|
||
|
@@ -11,7 +10,7 @@ pub contract ContractClassRegisterer { | |
ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, FUNCTION_TREE_HEIGHT, | ||
MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS, | ||
MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS, | ||
MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS, | ||
MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS, REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT, | ||
}, | ||
contract_class_id::ContractClassId, | ||
}; | ||
|
@@ -33,8 +32,7 @@ pub contract ContractClassRegisterer { | |
}; | ||
|
||
// docs:start:import_pop_capsule | ||
use crate::capsule::pop_capsule; | ||
|
||
use dep::aztec::oracle::pxe_db; | ||
// docs:end:import_pop_capsule | ||
|
||
#[private] | ||
|
@@ -47,8 +45,13 @@ pub contract ContractClassRegisterer { | |
// TODO: Validate public_bytecode_commitment is the correct commitment of packed_public_bytecode | ||
// TODO: We should be able to remove public_bytecode_commitment from the input if it's calculated in this function | ||
// docs:start:pop_capsule | ||
let packed_public_bytecode: [Field; MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS] = | ||
unsafe { pop_capsule() }; | ||
let packed_public_bytecode: [Field; MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS] = unsafe { | ||
pxe_db::load( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know before we only had one logical storage slot for pub / priv / unconstrained due to capsule design, but does it make sense still given the new design ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It worked before with the same storage slot so I didn't bother with changing it. Would change it if it for whatever reason becomes an issue. |
||
context.this_address(), | ||
REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT, | ||
) | ||
.unwrap() | ||
}; | ||
// docs:end:pop_capsule | ||
// First field element contains the length of the bytecode | ||
let bytecode_length_in_bytes: u32 = packed_public_bytecode[0] as u32; | ||
|
@@ -121,8 +124,13 @@ pub contract ContractClassRegisterer { | |
artifact_function_tree_leaf_index: Field, | ||
function_data: InnerPrivateFunction, | ||
) { | ||
let private_bytecode: [Field; MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS] = | ||
unsafe { pop_capsule() }; | ||
let private_bytecode: [Field; MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS] = unsafe { | ||
pxe_db::load( | ||
context.this_address(), | ||
REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT, | ||
) | ||
.unwrap() | ||
}; | ||
|
||
let event = ClassPrivateFunctionBroadcasted { | ||
contract_class_id, | ||
|
@@ -162,8 +170,13 @@ pub contract ContractClassRegisterer { | |
artifact_function_tree_leaf_index: Field, | ||
function_data: InnerUnconstrainedFunction, | ||
) { | ||
let unconstrained_bytecode: [Field; MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS] = | ||
unsafe { pop_capsule() }; | ||
let unconstrained_bytecode: [Field; MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS] = unsafe { | ||
pxe_db::load( | ||
context.this_address(), | ||
REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT, | ||
) | ||
.unwrap() | ||
}; | ||
let event = ClassUnconstrainedFunctionBroadcasted { | ||
contract_class_id, | ||
artifact_metadata_hash, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,8 +67,8 @@ export abstract class BaseWallet implements Wallet { | |
getAddress() { | ||
return this.getCompleteAddress().address; | ||
} | ||
addCapsule(capsule: Fr[]): Promise<void> { | ||
return this.pxe.addCapsule(capsule); | ||
addCapsule(contract: AztecAddress, storageSlot: Fr, capsule: Fr[]): Promise<void> { | ||
return this.pxe.addCapsule(contract, storageSlot, capsule); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kept the capsules name here as I will rename pxe_db to it in a followup PR. |
||
} | ||
registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress> { | ||
return this.pxe.registerAccount(secretKey, partialAddress); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs need to be updated. I plan on doing that in a follow-up PR once I rename pxe_db to capsules.