Skip to content

Commit

Permalink
Fix(xcc): Only update the router contract version in storage if the d…
Browse files Browse the repository at this point in the history
…eploy is successful (#616)
  • Loading branch information
birchmd authored Oct 5, 2022
1 parent c46339f commit 9067b57
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,12 @@ mod contract {
pub extern "C" fn factory_update_address_version() {
let mut io = Runtime;
io.assert_private_call().sdk_unwrap();
let check_deploy: Result<(), &[u8]> = match io.promise_result(0) {
Some(PromiseResult::Successful(_)) => Ok(()),
Some(_) => Err(b"ERR_ROUTER_DEPLOY_FAILED"),
None => Err(b"ERR_ROUTER_UPDATE_NOT_CALLBACK"),
};
check_deploy.sdk_unwrap();
let args: crate::xcc::AddressVersionUpdateArgs = io.read_input_borsh().sdk_unwrap();
crate::xcc::set_code_version_of_address(&mut io, &args.address, args.version);
}
Expand Down

0 comments on commit 9067b57

Please sign in to comment.