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

tgrade-ap-voting migrate multisig #513

Merged
merged 5 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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: 9 additions & 1 deletion contracts/tgrade-ap-voting/MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

This guide lists API changes between releases of *Tgrade* contracts.

## 0.12.1 -> UNRELEASED

### tgrade-ap-voting

* Add support for setting `multisig_code_id` during migration.
Also sets `waiting_period`.
Only for versions lower than 0.13.0.

## 0.8.1 -> UNRELEASED

### tgrade-ap-voting

* Added `multisig_code` field to instantiation message containing the code of
`cw3_fixed_multisig` contract to handle arbiters verification
`cw3_fixed_multisig` contract to handle arbiters verification.
2 changes: 1 addition & 1 deletion contracts/tgrade-ap-voting/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub type Response = cosmwasm_std::Response<TgradeMsg>;
pub type SubMsg = cosmwasm_std::SubMsg<TgradeMsg>;

// version info for migration info
const CONTRACT_NAME: &str = "crates.io:tgrade_validator_voting_proposals";
const CONTRACT_NAME: &str = "crates.io:tgrade_ap_voting";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

const AWAITING_MULTISIG_RESP: u64 = 1;
Expand Down
13 changes: 12 additions & 1 deletion contracts/tgrade-ap-voting/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,19 @@ pub fn migrate_config(
next_complaint_id: config.next_complaint_id,
multisig_code_id: msg.multisig_code,
}
} else if *version < "0.13.0".parse::<Version>().unwrap() {
let mut config = CONFIG.load(deps.storage)?;
if msg.multisig_code > 0 {
// tgrade-1.0.0 does not set multisig_code_id during bootstrap
config.multisig_code_id = msg.multisig_code;
}
if msg.waiting_period.seconds() > 0 {
// tgrade-1.0.0 does not set waiting_period during bootstrap
config.waiting_period = msg.waiting_period;
}
config
} else {
// It is already properly migrated
// It is already properly migrated / no multisig code id set
return Ok(());
};

Expand Down
2 changes: 2 additions & 0 deletions contracts/tgrade-ap-voting/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ pub struct ListComplaintsResp {
pub struct MigrationMsg {
/// Cw3 fixed multisig contract code
pub multisig_code: u64,
/// Waiting period in seconds for this contract
pub waiting_period: Duration,
}