Skip to content

Commit

Permalink
Disable voting in next round with locks that were used to vote for lo…
Browse files Browse the repository at this point in the history
…nger deployment proposal through "auto-voting" mechanism (#203)

* disable voting in next round with locks that were used to vote for longer deployment proposal through "auto-voting" mechanism

* CR changes
  • Loading branch information
dusan-maksimovic authored Dec 12, 2024
1 parent 6da9a77 commit e82fd88
Show file tree
Hide file tree
Showing 8 changed files with 550 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Disable voting in next round with locks that were used in previous round to vote for longer deployment proposal through the "auto-voting" mechanism.
([\#203](https://github.com/informalsystems/hydro/pull/203))
2 changes: 1 addition & 1 deletion artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
c8234dd135548a122f11c3be7981ec997550506aa535dcf4c7d0bf55ef61dc8e hydro.wasm
7484fa071c23b28d098783485ba478e364c72d2c22ca32fd8a441eca87a10855 hydro.wasm
819dbda6c50038e66531ee8b88c42f25e493fcc3c8279a4f028f0c18507900d5 tribute.wasm
Binary file modified artifacts/hydro.wasm
Binary file not shown.
12 changes: 12 additions & 0 deletions contracts/hydro/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2170,6 +2170,18 @@ fn update_voting_power_on_proposals(
&vote,
)?;

// We are creating a new vote only if user creates a new lockup (i.e. locks more tokens) and
// in this case we should insert voting allowed info as well. If user is refreshing a lockup
// that was already used for voting, then this information is already saved in the store.
if old_lock_entry.is_none() {
let voting_allowed_round = current_round + proposal.deployment_duration;
VOTING_ALLOWED_ROUND.save(
deps.storage,
(tranche_id, new_lock_entry.lock_id),
&voting_allowed_round,
)?;
}

if power_change.is_increased {
add_validator_shares_to_proposal(
deps.storage,
Expand Down
4 changes: 2 additions & 2 deletions contracts/hydro/src/migration/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const CONTRACT_VERSION_UNRELEASED: &str = "3.0.0";
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(
mut deps: DepsMut<NeutronQuery>,
_env: Env,
env: Env,
msg: MigrateMsgUNRELEASED,
) -> Result<Response<NeutronMsg>, ContractError> {
let contract_version = get_contract_version(deps.storage)?;
Expand All @@ -29,7 +29,7 @@ pub fn migrate(
}

if contract_version.version == CONTRACT_VERSION_V2_0_2 {
migrate_v2_0_2_to_unreleased(&mut deps, msg)?;
migrate_v2_0_2_to_unreleased(&mut deps, env.clone(), msg)?;
}

set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
Expand Down
Loading

0 comments on commit e82fd88

Please sign in to comment.