Skip to content

Commit

Permalink
fixed interchain tests (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
dusan-maksimovic authored Jan 31, 2025
1 parent 82c43c3 commit 4b5a2ff
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test-e2e:

# Note: If the neutron-org/neutron-query-relayer docker image does not exist locally, run `make build-docker-relayer` before running the interchain tests.
test-interchain:
cd test/interchain && go test ./... -timeout 30m
cd test/interchain && go test ./... -timeout 40m

coverage:
# to install see here: https://crates.io/crates/cargo-tarpaulin
Expand Down
2 changes: 1 addition & 1 deletion artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
e2c17ff7bac4ff4ec80e63b8dfa6c0d65f53bad633f9fb80b26121431b97f07e hydro.wasm
98e7c175d92fb0c9791886af183f65a21c88e85ead116c8eac50a68d1595776a hydro.wasm
83f12ed4aa3b4900588096c639a9abec78080a4c91720442b47cba1b8059e63a tribute.wasm
Binary file modified artifacts/hydro.wasm
Binary file not shown.
8 changes: 4 additions & 4 deletions contracts/hydro/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,16 +1159,16 @@ fn update_config(
known_users_cap: Option<u128>,
max_deployment_duration: Option<u64>,
) -> Result<Response<NeutronMsg>, ContractError> {
// Validate that the contract is not paused based on the current constants
let constants = load_current_constants(&deps.as_ref(), &env)?;
validate_contract_is_not_paused(&constants)?;

if env.block.time > activate_at {
return Err(ContractError::Std(StdError::generic_err(
"Can not update config in the past.",
)));
}

// Validate that the contract is not paused based on the current constants
let constants = load_current_constants(&deps.as_ref(), &env)?;
validate_contract_is_not_paused(&constants)?;

// Load the Constants active at the given timestamp and base the updates on them.
// This allows us to update the Constants in arbitrary order. E.g. at the similar block
// height we can schedule multiple updates for the future, where each new Constants will
Expand Down
4 changes: 2 additions & 2 deletions contracts/hydro/src/lsm_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pub fn update_total_power_due_to_power_ratio_change(
TOTAL_VOTING_POWER_PER_ROUND.save(
storage,
round_id,
&new_total_voting_power.to_uint_floor(),
&new_total_voting_power.to_uint_ceil(),
current_height,
)?;

Expand Down Expand Up @@ -327,7 +327,7 @@ pub fn add_validator_shares_to_round_total(

Ok(total_power_before
.checked_add(num_shares.checked_mul(val_power_ratio)?)?
.to_uint_floor())
.to_uint_ceil())
},
)?;

Expand Down
3 changes: 2 additions & 1 deletion test/interchain/hydro_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,10 @@ func (s *HydroSuite) RefreshLock(contractAddr string, new_lock_duration, lock_id
return nil
}

func (s *HydroSuite) UpdateMaxLockedTokens(contractAddr string, newMaxLockedTokens int64) error {
func (s *HydroSuite) UpdateMaxLockedTokens(contractAddr string, newMaxLockedTokens, activate_at int64) error {
updateMaxLockedTokensTxData := map[string]interface{}{
"update_config": map[string]interface{}{
"activate_at": strconv.FormatInt(activate_at, 10),
"max_locked_tokens": newMaxLockedTokens,
},
}
Expand Down
3 changes: 2 additions & 1 deletion test/interchain/hydro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"strings"
"testing"
"time"

"hydro/test/interchain/chainsuite"

Expand Down Expand Up @@ -196,7 +197,7 @@ func (s *HydroSuite) TestPauseContract() {
err = s.RemoveICQManager(contractAddr, s.NeutronChain.ValidatorWallets[1].Address)
RequirePaused(s, err)

err = s.UpdateMaxLockedTokens(contractAddr, 100000000000)
err = s.UpdateMaxLockedTokens(contractAddr, 100000000000, time.Now().UTC().Add(time.Hour).UnixNano())
RequirePaused(s, err)
}

Expand Down

0 comments on commit 4b5a2ff

Please sign in to comment.