-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Aptos Framework][API][Transaction][VM] Add a richer multisig account model #5894
Conversation
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
af1bb6a
to
53248af
Compare
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.
coming together well... looking forward to the other half of this
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
e2a06e6
to
9ac9274
Compare
4849e13
to
43bbc29
Compare
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
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 first round review. I haven't fully figured out how the special txn works to execute.
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/multisig_account.move
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
// Charge gas for writeset before we do cleanup. This ensures we don't charge gas for | ||
// cleanup writeset changes, which is consistent with outer-level success cleanup | ||
// flow. We also wouldn't need to worry that we run out of gas when doing cleanup. | ||
let inner_function_change_set_ext = session | ||
.finish(&mut (), gas_meter.change_set_configs()) | ||
.map_err(|e| e.into_vm_status())?; | ||
gas_meter.charge_write_set_gas_for_io(inner_function_change_set_ext.write_set().iter())?; | ||
gas_meter.charge_storage_fee( | ||
inner_function_change_set_ext.write_set().iter(), | ||
inner_function_change_set_ext.change_set().events(), | ||
txn_data.transaction_size, | ||
txn_data.gas_unit_price, | ||
)?; |
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.
this same chunk of code seems to be in a few places
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.
Yep unfortunately. But they need to be done in different places in the entry function vs multisig tx execution flows. I'ev found a good way to deduplicate them yet.
DeltaStateView::new(&storage_with_changes, &delta_write_set).into_move_resolver(); | ||
let resolver = self.0.new_move_resolver(&storage_with_changes); | ||
let mut cleanup_session = self.0.new_session(&resolver, SessionId::txn_meta(txn_data)); | ||
cleanup_session.execute_function_bypass_visibility( |
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.
can't we just dispatch here based upon the type of txn? it seems like the rest of this code largely is copy pasta/
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.
What do you mean by dispatch here based upon the type of txn? This is calling a specific private function in the multisig_account module that's meant to resolve the successfully executed multisig tx.
types/src/transaction/script.rs
Outdated
module: ModuleId, | ||
function: Identifier, | ||
ty_args: Vec<TypeTag>, | ||
pub module: ModuleId, | ||
pub function: Identifier, | ||
pub ty_args: Vec<TypeTag>, | ||
#[serde(with = "vec_bytes")] | ||
args: Vec<Vec<u8>>, | ||
pub args: Vec<Vec<u8>>, |
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.
why when we have getters below?
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.
Needed for conversion logic which creates this struct. I can add a constructor but that doesn't seem better than making these public, at least in my noob Rust experience?
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.
Well the data structure went from immutable to mutable. So this is definitely not a desirable pattern.
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.
Fixed
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.
wen python support?
Good call. I'll do this in a separate followup PR |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hey @movekevin , please help me get this feature documented in Aptos.dev. I saw the changes to the Move reference files. Let me know if I should open an issue. Thanks! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
assert!( | ||
num_rejections >= multisig_account_resource.num_signatures_required, | ||
error::invalid_state(ENOT_ENOUGH_REJECTIONS), | ||
); |
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.
this is the same as remove_executed_transaction? we just need to return (num_approvals, num_rejections)
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.
That's true. Should be an easy refactor. I can do this in a followup PR
@movekevin , we have published Al Noki's multisig v1 doc in: How can I help get references to v2 in the docs? I have notes from your preso and want to collaborate with you. Might need a distinct issue to track... Thanks! |
#8346 Adds CLI support |
Description
Technical design doc: https://www.notion.so/aptoslabs/Multisig-accounts-a518df6e2af842f5b98519386624e37c
Will open an AIP for discussion soon.
This adds a multisig account module that will be paired with a new transaction payload type (existing user transaction). Detailed flow:
Test Plan
Unit + e2e tests in api/ + Typescript example in ecosystem/typescript/sdk/examples/typescript/multisig_account.ts