From 8c9e745668045e4d203673e753cfe8e21122a785 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 15 Jul 2022 22:27:51 +0200 Subject: [PATCH 1/5] Add code to set multisig id during migration --- contracts/tgrade-ap-voting/MIGRATING.md | 9 ++++++++- contracts/tgrade-ap-voting/src/migration.rs | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/contracts/tgrade-ap-voting/MIGRATING.md b/contracts/tgrade-ap-voting/MIGRATING.md index 67c1b555..240ff704 100644 --- a/contracts/tgrade-ap-voting/MIGRATING.md +++ b/contracts/tgrade-ap-voting/MIGRATING.md @@ -2,9 +2,16 @@ 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. + 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. diff --git a/contracts/tgrade-ap-voting/src/migration.rs b/contracts/tgrade-ap-voting/src/migration.rs index 4787c67d..af6180ea 100644 --- a/contracts/tgrade-ap-voting/src/migration.rs +++ b/contracts/tgrade-ap-voting/src/migration.rs @@ -31,8 +31,13 @@ pub fn migrate_config( next_complaint_id: config.next_complaint_id, multisig_code_id: msg.multisig_code, } + } else if *version < "0.13.0".parse::().unwrap() && msg.multisig_code > 0 { + // tgrade-1.0.0 does not set multisig_code_id during bootstrap + let mut config = CONFIG.load(deps.storage)?; + config.multisig_code_id = msg.multisig_code; + config } else { - // It is already properly migrated + // It is already properly migrated / no multisig code id set return Ok(()); }; From f9d40ad0839cb6efa3b4748ecc4cca591e3f5d2e Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Sun, 17 Jul 2022 09:52:16 +0200 Subject: [PATCH 2/5] Also set waiting_period during migration --- contracts/tgrade-ap-voting/src/migration.rs | 12 +++++++++--- contracts/tgrade-ap-voting/src/msg.rs | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/contracts/tgrade-ap-voting/src/migration.rs b/contracts/tgrade-ap-voting/src/migration.rs index af6180ea..84c9831d 100644 --- a/contracts/tgrade-ap-voting/src/migration.rs +++ b/contracts/tgrade-ap-voting/src/migration.rs @@ -31,10 +31,16 @@ pub fn migrate_config( next_complaint_id: config.next_complaint_id, multisig_code_id: msg.multisig_code, } - } else if *version < "0.13.0".parse::().unwrap() && msg.multisig_code > 0 { - // tgrade-1.0.0 does not set multisig_code_id during bootstrap + } else if *version < "0.13.0".parse::().unwrap() { let mut config = CONFIG.load(deps.storage)?; - config.multisig_code_id = msg.multisig_code; + 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 / no multisig code id set diff --git a/contracts/tgrade-ap-voting/src/msg.rs b/contracts/tgrade-ap-voting/src/msg.rs index a4fd4d1b..b7582827 100644 --- a/contracts/tgrade-ap-voting/src/msg.rs +++ b/contracts/tgrade-ap-voting/src/msg.rs @@ -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, } From c273f602fcea96c68a7c5dc6e3cc97891a0d67e3 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Sun, 17 Jul 2022 10:24:55 +0200 Subject: [PATCH 3/5] Fix: contract name --- contracts/tgrade-ap-voting/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/tgrade-ap-voting/src/contract.rs b/contracts/tgrade-ap-voting/src/contract.rs index a4cf6352..7d8ec32f 100644 --- a/contracts/tgrade-ap-voting/src/contract.rs +++ b/contracts/tgrade-ap-voting/src/contract.rs @@ -33,7 +33,7 @@ pub type Response = cosmwasm_std::Response; pub type SubMsg = cosmwasm_std::SubMsg; // version info for migration info -const CONTRACT_NAME: &str = "crates.io:tgrade_validator_voting_proposals"; +const CONTRACT_NAME: &str = "crates.io:tgrade_ap_proposals"; const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); const AWAITING_MULTISIG_RESP: u64 = 1; From 99a389c44de309994be04ba0652d25bbe1b5cf0e Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Mon, 18 Jul 2022 07:37:07 +0200 Subject: [PATCH 4/5] Update MIGRATING.md --- contracts/tgrade-ap-voting/MIGRATING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contracts/tgrade-ap-voting/MIGRATING.md b/contracts/tgrade-ap-voting/MIGRATING.md index 240ff704..0cefa355 100644 --- a/contracts/tgrade-ap-voting/MIGRATING.md +++ b/contracts/tgrade-ap-voting/MIGRATING.md @@ -7,6 +7,7 @@ This guide lists API changes between releases of *Tgrade* contracts. ### 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 From 86aecd7079af113c7dc71da8a3668b4ee3d47017 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Mon, 18 Jul 2022 18:20:39 +0200 Subject: [PATCH 5/5] Update contract name Co-authored-by: Jakub Bogucki --- contracts/tgrade-ap-voting/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/tgrade-ap-voting/src/contract.rs b/contracts/tgrade-ap-voting/src/contract.rs index 7d8ec32f..643b3826 100644 --- a/contracts/tgrade-ap-voting/src/contract.rs +++ b/contracts/tgrade-ap-voting/src/contract.rs @@ -33,7 +33,7 @@ pub type Response = cosmwasm_std::Response; pub type SubMsg = cosmwasm_std::SubMsg; // version info for migration info -const CONTRACT_NAME: &str = "crates.io:tgrade_ap_proposals"; +const CONTRACT_NAME: &str = "crates.io:tgrade_ap_voting"; const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); const AWAITING_MULTISIG_RESP: u64 = 1;