Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyizxx authored Nov 14, 2024
2 parents 02bde0f + 2561ddb commit c0178f3
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 949 deletions.
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@

- Change event index in message ids from u32 to u64. Emit message id from voting verifier [#666](https://github.com/axelarnetwork/axelar-amplifier/pull/666)

#### Migration Notes
#### v1.3.0 Migration Notes

Components that need upgrading:
ampd

Contracts that need migration:
coordinator
voting-verifier
service-registry
rewards
router
multisig-prover

Contracts that should be redeployed (deploy fresh instance):
interchain-token-service
axelarnet-gateway (deploy with chain name "axelar")

Contracts no longer used (no longer part of the active system):
nexus-gateway

The voting verifier contracts must be migrated before ampd is upgraded. Existing ampd instances will continue to work even after the contract migration, but we recommend upgrading ampd.

The voting verifier contracts must be migrated before ampd is upgraded. Existing ampd instances will continue to work even after the contract migration, but we recommend upgrading ampd.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions contracts/multisig-prover/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub const START_MULTISIG_REPLY_ID: u64 = 1;

const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
const BASE_VERSION: &str = "1.0.0";

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn instantiate(
Expand Down Expand Up @@ -122,9 +123,9 @@ pub fn migrate(
_env: Env,
_msg: Empty,
) -> Result<Response, axelar_wasm_std::error::ContractError> {
migrations::v1_0_0::migrate(deps.storage)?;

cw2::assert_contract_version(deps.storage, CONTRACT_NAME, BASE_VERSION)?;
cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;

Ok(Response::default())
}

Expand Down Expand Up @@ -290,6 +291,17 @@ mod tests {
query(deps, mock_env(), QueryMsg::CurrentVerifierSet {}).map(|res| from_json(res).unwrap())
}

#[test]
fn migrate_sets_contract_version() {
let mut deps = setup_test_case();

migrate(deps.as_mut(), mock_env(), Empty {}).unwrap();

let contract_version = cw2::get_contract_version(deps.as_mut().storage).unwrap();
assert_eq!(contract_version.contract, CONTRACT_NAME);
assert_eq!(contract_version.version, CONTRACT_VERSION);
}

#[test]
#[allow(clippy::arithmetic_side_effects)]
fn test_instantiation() {
Expand Down
2 changes: 1 addition & 1 deletion contracts/multisig-prover/src/contract/migrations/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod v1_0_0;

239 changes: 0 additions & 239 deletions contracts/multisig-prover/src/contract/migrations/v1_0_0.rs

This file was deleted.

1 change: 1 addition & 0 deletions contracts/rewards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ serde_json = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
assert_ok = { workspace = true }
cw-multi-test = "0.15.1"

[lints]
Expand Down
22 changes: 15 additions & 7 deletions contracts/rewards/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ mod query;

const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME");
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
const BASE_VERSION: &str = "1.1.0";

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(
deps: DepsMut,
_env: Env,
_msg: Empty,
) -> Result<Response, axelar_wasm_std::error::ContractError> {
migrations::v1_0_0::migrate(deps.storage)?;

// any version checks should be done before here
cw2::assert_contract_version(deps.storage, CONTRACT_NAME, BASE_VERSION)?;

cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;

Expand Down Expand Up @@ -191,7 +190,8 @@ pub fn query(

#[cfg(test)]
mod tests {
use cosmwasm_std::testing::{mock_dependencies, mock_env};
use assert_ok::assert_ok;
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info};
use cosmwasm_std::{coins, Addr, BlockInfo, Uint128};
use cw_multi_test::{App, ContractWrapper, Executor};
use router_api::ChainName;
Expand All @@ -203,9 +203,17 @@ mod tests {
#[test]
fn migrate_sets_contract_version() {
let mut deps = mock_dependencies();

#[allow(deprecated)]
migrations::v1_0_0::tests::instantiate_contract(deps.as_mut(), "denom");
let env = mock_env();
let info = mock_info("instantiator", &[]);
assert_ok!(instantiate(
deps.as_mut(),
env,
info,
InstantiateMsg {
governance_address: "governance".to_string(),
rewards_denom: "uaxl".to_string()
}
));

migrate(deps.as_mut(), mock_env(), Empty {}).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion contracts/rewards/src/contract/migrations/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod v1_0_0;

Loading

0 comments on commit c0178f3

Please sign in to comment.