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

Multisig #1193

Merged
merged 31 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f75278d
Add Multisig initial implementation
immrsd Oct 25, 2024
9328c92
Edit error messages
immrsd Oct 29, 2024
a4616e5
Change Multisig naming: quorum instead of threshold
immrsd Oct 31, 2024
f86f519
Add Multisig mock
immrsd Oct 31, 2024
18121a6
Refactor Multisig not to store calls
immrsd Nov 4, 2024
1c4c0eb
Add Multisig target mock
immrsd Nov 4, 2024
2285275
Cover Multisig functionality with tests
immrsd Nov 4, 2024
f0393c5
Merge main
immrsd Nov 4, 2024
256ff40
Add tests for signer management functionality
immrsd Nov 5, 2024
f93e572
Add more test cases for Multisig
immrsd Nov 5, 2024
bc7b292
Run linter
immrsd Nov 5, 2024
9b2a83e
Address review comments
immrsd Nov 6, 2024
59e789c
Support review fixes in tests
immrsd Nov 6, 2024
c8c621d
Change quorum and confirmations types to u32
immrsd Nov 6, 2024
3e0ba17
Optimize Multisig storage usage
immrsd Nov 6, 2024
be77601
Solve confirmation issue when signer is removed
immrsd Nov 6, 2024
c0705b8
Update changelog
immrsd Nov 6, 2024
3e70d5e
Fix review issues
immrsd Nov 6, 2024
706863f
Run linter
immrsd Nov 6, 2024
d6d5f13
Add breaking change entry to changelog
immrsd Nov 6, 2024
4cb68fe
Make review fixes
immrsd Nov 6, 2024
49e80d7
Merge main
immrsd Nov 6, 2024
642e463
Fix review issues
immrsd Nov 7, 2024
6943fe3
Document storage helpers
immrsd Nov 7, 2024
20f082c
Document events
immrsd Nov 7, 2024
0596705
Document Multisig component itself
immrsd Nov 7, 2024
ffa80fb
Document all the Multisig functions
immrsd Nov 7, 2024
f3c0f9d
Run linter
immrsd Nov 7, 2024
5db4048
Make minor doc fixes
immrsd Nov 7, 2024
30b2166
Fix in-code doc according to review comments
immrsd Nov 8, 2024
a7c569e
Improve couple of comments
immrsd Nov 8, 2024
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
4 changes: 1 addition & 3 deletions packages/account/src/account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ pub mod AccountComponent {
use openzeppelin_introspection::src5::SRC5Component::SRC5Impl;
use openzeppelin_introspection::src5::SRC5Component;
use starknet::account::Call;
use starknet::get_caller_address;
use starknet::get_contract_address;
use starknet::get_tx_info;
use starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};
use starknet::{get_caller_address, get_contract_address, get_tx_info};

#[storage]
pub struct Storage {
Expand Down
1 change: 1 addition & 0 deletions packages/governance/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod multisig;
#[cfg(test)]
mod tests;

Expand Down
2 changes: 2 additions & 0 deletions packages/governance/src/multisig.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod interface;
pub mod multisig;
41 changes: 41 additions & 0 deletions packages/governance/src/multisig/interface.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts for Cairo v0.18.0 (governance/multisig/interface.cairo)

use starknet::ContractAddress;
use starknet::account::Call;

pub type TransactionID = u64;

#[derive(Copy, Drop, Serde)]
pub enum TransactionStatus {
NotFound,
Submitted,
Confirmed,
Executed
}

/// Interface for a contract providing the Multisig functionality.
#[starknet::interface]
pub trait IMultisig<TState> {
fn is_confirmed(self: @TState, id: TransactionID) -> bool;
fn is_executed(self: @TState, id: TransactionID) -> bool;
fn get_transaction_status(self: @TState, id: TransactionID) -> TransactionStatus;
fn get_transaction_calls(self: @TState, id: TransactionID) -> Span<Call>;
fn get_threshold(self: @TState) -> u32;
fn is_signer(self: @TState, signer: ContractAddress) -> bool;
fn add_signers(ref self: TState, new_threshold: u32, signers_to_add: Span<ContractAddress>);
fn remove_signers(
ref self: TState, new_threshold: u32, signers_to_remove: Span<ContractAddress>
);
fn replace_signer(
ref self: TState, signer_to_remove: ContractAddress, signer_to_add: ContractAddress
);
fn change_threshold(ref self: TState, new_threshold: u32);
fn submit_transaction(
ref self: TState, to: ContractAddress, selector: felt252, calldata: Span<felt252>
) -> TransactionID;
fn submit_transaction_batch(ref self: TState, calls: Span<Call>) -> TransactionID;
fn confirm_transaction(ref self: TState, id: TransactionID);
fn revoke_confirmation(ref self: TState, id: TransactionID);
fn execute_transaction(ref self: TState, id: TransactionID);
}
Loading