-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(iota-replay): sandbox snapshots are outdated due to rename (#2269)
* fix(iota-replay): script for generation replay snapshots has been created, regenerating snapshots based on testnet transactions
- Loading branch information
Showing
11 changed files
with
90 additions
and
3 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,32 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::{env, path::PathBuf, str::FromStr}; | ||
|
||
use anyhow::Result; | ||
use iota_replay::{ReplayToolCommand, execute_replay_command}; | ||
|
||
const TESTNET_ADDR: &str = "https://api.testnet.iota.cafe"; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), anyhow::Error> { | ||
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
path.push("tests/sandbox_snapshots"); | ||
|
||
// Retrieve `tx_digest` from command-line arguments | ||
let args: Vec<String> = env::args().collect(); | ||
if args.len() != 2 { | ||
println!("Usage: <tx_digest>"); | ||
return Ok(()); | ||
} | ||
let tx_digest = &args[1]; // tx_digest passed as the first argument | ||
let localnet_addr = String::from_str(TESTNET_ADDR).unwrap(); | ||
|
||
let cmd = ReplayToolCommand::PersistSandbox { | ||
tx_digest: tx_digest.clone(), | ||
base_path: path, | ||
}; | ||
|
||
execute_replay_command(Some(localnet_addr), true, true, None, None, cmd).await?; | ||
Ok(()) | ||
} |
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,9 @@ | ||
[package] | ||
name = "tx_instance" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
Iota = { local = "../../../../iota-framework/packages/iota-framework" } | ||
|
||
[addresses] | ||
tx_instance = "0x0" |
16 changes: 16 additions & 0 deletions
16
crates/iota-replay/examples/move/tx_instance/sources/tx_instance.move
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,16 @@ | ||
module tx_instance::tx_instance { | ||
use iota::event; | ||
use iota::tx_context::{Self, TxContext}; | ||
|
||
struct TxInstance has copy, drop { | ||
user: address, | ||
published: bool | ||
} | ||
|
||
fun init(ctx: &mut TxContext) { | ||
event::emit(TxInstance { | ||
user: tx_context::sender(ctx), | ||
published: true | ||
}) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
crates/iota-replay/examples/move/tx_instance/sources/tx_instance_upgrade.move
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,18 @@ | ||
module tx_instance::tx_instance_upgrade { | ||
use iota::event; | ||
use iota::tx_context::{Self, TxContext}; | ||
|
||
struct TxInstance has copy, drop { | ||
user: address, | ||
published: bool, | ||
name: vector<u8> | ||
} | ||
|
||
fun init(ctx: &mut TxContext) { | ||
event::emit(TxInstance { | ||
user: tx_context::sender(ctx), | ||
published: true, | ||
name: b"TxInstance" | ||
}) | ||
} | ||
} |
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,9 @@ | ||
The sandbox snapshots are generated according to specific transactions we want to replay. | ||
|
||
To make a snapshot(local example): | ||
|
||
1. iota-test-validator - `cargo run` | ||
2. `iota client faucet` | ||
3. iota-replay/examples/move/tx_instance - `iota client publish --gas-budget 1000000000` | ||
4. Save tx digest | ||
5. iota-replay - `cargo run --example make_sandbox_snapshot <your tx digest>` |
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
1 change: 0 additions & 1 deletion
1
crates/iota-replay/tests/sandbox_snapshots/4fxF3X4N8D6JGByWdbJvCCv1iuoT8GSEhXgPHJnzNHWP.json
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/iota-replay/tests/sandbox_snapshots/7qq4W43TqHg9tQPMvdAFW4Tz6J88KnPppBPR1hNKmQAd.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/iota-replay/tests/sandbox_snapshots/B9jn6GZsPebSEX6fp9rV7U6k6sZrgokgkGpFMEE6x7Us.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
crates/iota-replay/tests/sandbox_snapshots/ozN2rhczEUC39poaeVYxMN6b6TEAjiFX7jFSQFhbKmL.json
This file was deleted.
Oops, something went wrong.