-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use v0.0.19 wasm for current upgrade test (#1553)
* test: use v0.0.19 wasm for current upgrade test * refactor: simplify with a list of version to download * chore: module not yet used * refactor: rename * chore: fmt
- Loading branch information
1 parent
0200f4e
commit 1b946c6
Showing
8 changed files
with
95 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub const BACKEND_V0_0_13_WASM_PATH: &str = "../../backend-v0.0.13.wasm.gz"; | ||
pub const BACKEND_V0_0_19_WASM_PATH: &str = "../../backend-v0.0.19.wasm.gz"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::upgrade::types::UserTokenV0_0_19; | ||
use shared::types::{TokenVersion, Version}; | ||
|
||
impl TokenVersion for UserTokenV0_0_19 { | ||
fn get_version(&self) -> Option<Version> { | ||
self.version | ||
} | ||
|
||
fn clone_with_incremented_version(&self) -> Self { | ||
let mut cloned = self.clone(); | ||
cloned.version = Some(cloned.version.unwrap_or_default() + 1); | ||
cloned | ||
} | ||
|
||
fn clone_with_initial_version(&self) -> Self { | ||
let mut cloned = self.clone(); | ||
cloned.version = Some(1); | ||
cloned | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
mod constants; | ||
mod impls; | ||
mod token_version; | ||
mod types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use candid::{CandidType, Deserialize}; | ||
use shared::types::token::ChainId; | ||
use shared::types::Version; | ||
|
||
#[derive(CandidType, Deserialize, Clone)] | ||
pub struct UserTokenV0_0_13 { | ||
pub contract_address: String, | ||
pub chain_id: ChainId, | ||
pub symbol: Option<String>, | ||
pub decimals: Option<u8>, | ||
} | ||
|
||
#[derive(CandidType, Deserialize, Clone, PartialEq, Debug)] | ||
pub struct UserTokenV0_0_19 { | ||
pub contract_address: String, | ||
pub chain_id: ChainId, | ||
pub symbol: Option<String>, | ||
pub decimals: Option<u8>, | ||
pub version: Option<Version>, | ||
} | ||
|
||
/// Options for unusual add_user_token behaviour. | ||
#[derive(Default)] | ||
pub struct AddUserTokenAfterUpgradeOptions { | ||
/// The version number should be None but we can set it to Some(n) for a few small values to check that. | ||
pub premature_increments: u8, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters