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(grandpa): expose migrate entry point #502

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions light-clients/ics08-wasm/src/instantiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ pub struct InstantiateMessage {
#[cfg_attr(feature = "cosmwasm", serde(with = "Base64", default))]
pub checksum: Bytes,
}


1 change: 1 addition & 0 deletions light-clients/ics08-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub mod client_message;
pub mod client_state;
pub mod consensus_state;
pub mod instantiate;
pub mod migrate;
pub mod msg;

pub type Bytes = Vec<u8>;
Expand Down
9 changes: 9 additions & 0 deletions light-clients/ics08-wasm/src/migrate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use crate::{msg::Base64, Bytes};
#[cfg(feature = "cosmwasm")]
use cosmwasm_schema::cw_serde;


#[cfg_attr(feature = "cosmwasm", cw_serde)]
#[cfg_attr(not(feature = "cosmwasm"), derive(Clone, Debug, PartialEq))]
#[derive(Eq)]
pub struct MigrateMsg {}
11 changes: 10 additions & 1 deletion light-clients/ics10-grandpa-cw/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use ibc::core::{
ics24_host::identifier::ClientId,
};
use ibc_proto::google::protobuf::Any;
use ics08_wasm::{instantiate::InstantiateMessage, SUBJECT_PREFIX, SUBSTITUTE_PREFIX};
use ics08_wasm::{instantiate::InstantiateMessage, migrate::MigrateMsg, SUBJECT_PREFIX, SUBSTITUTE_PREFIX};
use ics10_grandpa::{
client_def::GrandpaClient,
client_message::{ClientMessage, RelayChainHeader},
Expand All @@ -64,6 +64,8 @@ const CONTRACT_NAME: &str = "crates.io:ics10-grandpa-cw";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
*/



pub const CHANNELS_CONNECTION: Map<Bytes, Vec<(Bytes, Bytes)>> = Map::new("channels_connection");
pub const CLIENT_UPDATE_TIME: Map<(Bytes, Bytes), u64> = Map::new("client_update_time");
pub const CLIENT_UPDATE_HEIGHT: Map<(Bytes, Bytes), Bytes> = Map::new("client_update_height");
Expand Down Expand Up @@ -117,6 +119,13 @@ impl grandpa_light_client_primitives::HostFunctions for HostFunctions {
}
}


#[entry_point]
pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
// No state migrations performed, just returned a Response
Ok(Response::default())
}

fn process_instantiate_msg(
msg: InstantiateMessage,
ctx: &mut Context<HostFunctions>,
Expand Down