From 5b6093e961fb4e20073ad1a648a8737e39aea3a3 Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Thu, 1 Aug 2024 20:37:31 -0400 Subject: [PATCH 1/2] fix cargo errors --- .../external/cw-tokenfactory-issuer/tests/mod.rs | 4 ---- contracts/external/dao-migrator/README.md | 14 ++++++++------ .../dao-proposal-condorcet/src/testing/suite.rs | 2 +- .../src/tests/test_tube/mod.rs | 4 ---- packages/dao-testing/src/test_tube/mod.rs | 4 ---- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/contracts/external/cw-tokenfactory-issuer/tests/mod.rs b/contracts/external/cw-tokenfactory-issuer/tests/mod.rs index 73b60899d..8ad6cfb23 100644 --- a/contracts/external/cw-tokenfactory-issuer/tests/mod.rs +++ b/contracts/external/cw-tokenfactory-issuer/tests/mod.rs @@ -1,7 +1,3 @@ -// Ignore integration tests for code coverage since there will be problems with dynamic linking libosmosistesttube -// and also, tarpaulin will not be able read coverage out of wasm binary anyway -#![cfg(not(tarpaulin))] - #[cfg(feature = "test-tube")] mod cases; #[cfg(feature = "test-tube")] diff --git a/contracts/external/dao-migrator/README.md b/contracts/external/dao-migrator/README.md index f61a3bb52..ba51df374 100644 --- a/contracts/external/dao-migrator/README.md +++ b/contracts/external/dao-migrator/README.md @@ -5,7 +5,7 @@ Here is the [discussion](https://github.com/DA0-DA0/dao-contracts/discussions/607). -A migrator module for a DAO DAO DAO which handles migration for DAO modules +A migrator module for a DAO DAO DAO which handles migration for DAO modules and test it went successfully. DAO core migration is handled by a proposal, which adds this module and do @@ -14,6 +14,7 @@ If custom module is found, this TX fails and migration is cancelled, custom module requires a custom migration to be done by the DAO. # General idea + 1. Proposal is made to migrate DAO core to V2, which also adds this module to the DAO. 2. On init of this contract, a callback is fired to do the migration. 3. Then we check to make sure the DAO doesn't have custom modules. @@ -23,9 +24,10 @@ module requires a custom migration to be done by the DAO. 7. In any case where 1 migration fails, we fail the whole TX. # Important notes -* custom modules cannot reliably be migrated by this contract, -because of that we fail the process to avoid any unwanted results. -* If any module migration fails we fail the whole thing, -this is to make sure that we either have a fully working V2, -or we do nothing and make sure the DAO is operational at any time. \ No newline at end of file +- custom modules cannot reliably be migrated by this contract, + because of that we fail the process to avoid any unwanted results. + +- If any module migration fails we fail the whole thing, + this is to make sure that we either have a fully working V2, + or we do nothing and make sure the DAO is operational at any time. diff --git a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs index 79d18154f..c268bc5c1 100644 --- a/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs +++ b/contracts/proposal/dao-proposal-condorcet/src/testing/suite.rs @@ -146,7 +146,7 @@ impl SuiteBuilder { if let Some(candidates) = self.with_proposal { suite .propose( - &suite.sender(), + suite.sender(), (0..candidates) .map(|_| vec![unimportant_message()]) .collect(), diff --git a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/mod.rs b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/mod.rs index fe51e9fb6..eb0b4f91b 100644 --- a/contracts/voting/dao-voting-token-staked/src/tests/test_tube/mod.rs +++ b/contracts/voting/dao-voting-token-staked/src/tests/test_tube/mod.rs @@ -1,6 +1,2 @@ -// Ignore integration tests for code coverage since there will be problems with dynamic linking libosmosistesttube -// and also, tarpaulin will not be able read coverage out of wasm binary anyway -#![cfg(not(tarpaulin))] - mod integration_tests; mod test_env; diff --git a/packages/dao-testing/src/test_tube/mod.rs b/packages/dao-testing/src/test_tube/mod.rs index c764df4d1..107ea403d 100644 --- a/packages/dao-testing/src/test_tube/mod.rs +++ b/packages/dao-testing/src/test_tube/mod.rs @@ -1,7 +1,3 @@ -// Ignore integration tests for code coverage since there will be problems with dynamic linking libosmosistesttube -// and also, tarpaulin will not be able read coverage out of wasm binary anyway -#![cfg(not(tarpaulin))] - // Integrationg tests using an actual chain binary, requires // the "test-tube" feature to be enabled // cargo test --features test-tube From b4ab941352325a9c9185ad4000b29fa059f102bc Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Thu, 1 Aug 2024 20:48:32 -0400 Subject: [PATCH 2/2] validate pre propose submission policy update before reading from storage --- packages/dao-pre-propose-base/src/execute.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/dao-pre-propose-base/src/execute.rs b/packages/dao-pre-propose-base/src/execute.rs index bba2db9f1..23c396ef7 100644 --- a/packages/dao-pre-propose-base/src/execute.rs +++ b/packages/dao-pre-propose-base/src/execute.rs @@ -207,10 +207,13 @@ where .map(|d| d.into_checked(deps.as_ref(), dao)) .transpose()?; + if let Some(submision_policy) = &submission_policy { + submision_policy.validate()? + } + self.config .update(deps.storage, |prev| -> Result { let new_submission_policy = if let Some(submission_policy) = submission_policy { - submission_policy.validate()?; submission_policy } else { prev.submission_policy