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

feat: overrule pre-proposal module #NTRN-303 #22

Merged
merged 28 commits into from
Jan 16, 2023

Conversation

oldremez
Copy link
Contributor

@oldremez oldremez commented Dec 29, 2022

This PR is to add

  1. Pre-proposal module to build an overrule proposals for timelocked decisions of subdaos
  2. It modifies the integration script for timelocks by making the overrule not manually from admin account but with the overrule proposal made by main governance

How to test:

  1. Pull the branch of this PR from main Neutron repo
  2. run make kill-dev && make install && make init in neutron dir
  3. run ./test_subdao_proposal.sh in neutron-dao

(also check if the version of cwd_pre_propose_overrule.wasm in neutron/contracts corresponds to the current repo code by building the release version and checking the hash)

@oldremez oldremez changed the base branch from feat/subdao-timelocks-impl to main January 10, 2023 12:31
@oldremez oldremez marked this pull request as ready for review January 11, 2023 11:44
} => {
let overrule_msg = CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: timelock_contract.to_string(),
msg: to_binary(&TimelockExecuteMsg::OverruleProposal { proposal_id }).unwrap(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it costs nothing in terms of code complexity to change unwrap() with ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

},
}
}
_ => panic!("Overrule proposal wrapper doesn't allow anything but overrule proposals"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And again, why a panic and not a error. As far as i know a panic error text is not being passed into the transaction response.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, fixed

msg: ProposeMessageInternal::Propose {
// Fill in proposer based on message sender.
proposer: Some(info.sender.to_string()),
title: "Overrule proposal".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about to add proposal_id in a title or description

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a great idea! I'm to address it in my next PR since I believe the proposal id itself without the address/name of the subDAO might make more confusion rather than clarity (and the timelock contract address doesn't help there). I think in the next PR I'm to add queries to the timelock contract to get the subDAO address/name.

}

#[test]
fn test_query_deposit() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's more about of config, then just deposit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

Copy link
Collaborator

@pr0n00gler pr0n00gler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do cargo fmt please

pub(crate) const CONTRACT_NAME: &str = "crates.io:cwd-pre-propose-single-overrule";
pub(crate) const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[derive(Serialize, JsonSchema, Deserialize, Debug, Clone)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's no biggie, but usually messages are moved to a separate msg.rs file; wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will move it to the separate file in the next PR

Copy link
Contributor

@zavgorodnii zavgorodnii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested ACK

Copy link
Contributor

@ratik ratik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested. Looks great

},
};

let result = PrePropose::default().execute(deps, env, info, internal_msg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PrePropose::default() .execute(deps, env, info, internal_msg) .map_err(|e| PreProposeOverruleError::PreProposeBase(e))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make refactoring in the next PR

oldremez and others added 9 commits January 13, 2023 13:05
# Conflicts:
#	artifacts/checksums.txt
#	artifacts/checksums_intermediate.txt
#	artifacts/cwd_subdao_core.wasm
#	artifacts/cwd_subdao_proposal_single.wasm
# Conflicts:
#	Cargo.lock
#	artifacts/checksums.txt
#	artifacts/checksums_intermediate.txt
#	artifacts/cwd_core.wasm
#	artifacts/cwd_pre_propose_single.wasm
#	artifacts/cwd_proposal_single.wasm
#	artifacts/cwd_subdao_core.wasm
#	artifacts/cwd_subdao_pre_propose_single.wasm
#	artifacts/cwd_subdao_proposal_single.wasm
#	artifacts/cwd_subdao_timelock_single.wasm
#	contracts/dao/cwd-core/Cargo.toml
#	contracts/dao/pre-propose/cwd-pre-propose-single/Cargo.toml
#	contracts/dao/proposal/cwd-proposal-single/Cargo.toml
#	contracts/subdaos/cwd-subdao-core/Cargo.toml
#	contracts/subdaos/cwd-subdao-timelock-single/Cargo.toml
#	contracts/subdaos/pre-propose/cwd-subdao-pre-propose-single/Cargo.toml
#	contracts/subdaos/proposal/cwd-subdao-proposal-single/Cargo.toml
#	packages/cwd-voting/Cargo.toml
#	packages/neutron-subdao-timelock-single/Cargo.toml
@oldremez
Copy link
Contributor Author

oldremez commented Jan 16, 2023

@zavgorodnii zavgorodnii merged commit eb8d48d into main Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants