From 6f42e6ddf525f089e422a86516552ddc3adf44c3 Mon Sep 17 00:00:00 2001 From: bingyanglin Date: Tue, 29 Oct 2024 09:22:06 +0100 Subject: [PATCH 1/5] Fix test_upgrade_compatibility --- crates/iota-benchmark/tests/simtest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-benchmark/tests/simtest.rs b/crates/iota-benchmark/tests/simtest.rs index f903d1db610..6a245efdce7 100644 --- a/crates/iota-benchmark/tests/simtest.rs +++ b/crates/iota-benchmark/tests/simtest.rs @@ -668,7 +668,7 @@ mod test { } async fn test_protocol_upgrade_compatibility_impl() { - let max_ver = ProtocolVersion::MAX.as_u64(); + let max_ver = ProtocolVersion::MAX.as_u64() + 1; let manifest = iota_framework_snapshot::load_bytecode_snapshot_manifest(); let Some((&starting_version, _)) = manifest.range(..max_ver).last() else { From 5d91a7975c69bc6a49fdde5e1199ad845dfb3f47 Mon Sep 17 00:00:00 2001 From: Bing-Yang <51323441+bingyanglin@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:14:41 +0800 Subject: [PATCH 2/5] Update crates/iota-benchmark/tests/simtest.rs Co-authored-by: muXxer --- crates/iota-benchmark/tests/simtest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-benchmark/tests/simtest.rs b/crates/iota-benchmark/tests/simtest.rs index 6a245efdce7..44fd754e58a 100644 --- a/crates/iota-benchmark/tests/simtest.rs +++ b/crates/iota-benchmark/tests/simtest.rs @@ -668,7 +668,7 @@ mod test { } async fn test_protocol_upgrade_compatibility_impl() { - let max_ver = ProtocolVersion::MAX.as_u64() + 1; + let max_ver = ProtocolVersion::MAX_ALLOWED.as_u64(); let manifest = iota_framework_snapshot::load_bytecode_snapshot_manifest(); let Some((&starting_version, _)) = manifest.range(..max_ver).last() else { From 60e3a3eed43101edf1a94c9db77296de6389eab8 Mon Sep 17 00:00:00 2001 From: bingyanglin Date: Tue, 29 Oct 2024 10:28:07 +0100 Subject: [PATCH 3/5] Modify the ProtocolVersion::MAX_ALLOWED --- crates/iota-protocol-config/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/iota-protocol-config/src/lib.rs b/crates/iota-protocol-config/src/lib.rs index 8b2f8cd07d7..9c5e814c909 100644 --- a/crates/iota-protocol-config/src/lib.rs +++ b/crates/iota-protocol-config/src/lib.rs @@ -37,10 +37,10 @@ impl ProtocolVersion { #[cfg(not(msim))] const MAX_ALLOWED: Self = Self::MAX; - // We create 4 additional "fake" versions in simulator builds so that we can + // We create 1 additional "fake" versions in simulator builds so that we can // test upgrades. #[cfg(msim)] - pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 4); + pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1); pub fn new(v: u64) -> Self { Self(v) From 5fb7204a9ae75510a05c8e5004fe051bebcd5c54 Mon Sep 17 00:00:00 2001 From: bingyanglin Date: Tue, 29 Oct 2024 10:42:36 +0100 Subject: [PATCH 4/5] Revert the MAX_ALLOWED to avoid breaking other testings --- crates/iota-protocol-config/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/iota-protocol-config/src/lib.rs b/crates/iota-protocol-config/src/lib.rs index 9c5e814c909..8b2f8cd07d7 100644 --- a/crates/iota-protocol-config/src/lib.rs +++ b/crates/iota-protocol-config/src/lib.rs @@ -37,10 +37,10 @@ impl ProtocolVersion { #[cfg(not(msim))] const MAX_ALLOWED: Self = Self::MAX; - // We create 1 additional "fake" versions in simulator builds so that we can + // We create 4 additional "fake" versions in simulator builds so that we can // test upgrades. #[cfg(msim)] - pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1); + pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 4); pub fn new(v: u64) -> Self { Self(v) From 24ad1a94402fb4d8026daf3de62d0acc08bd7731 Mon Sep 17 00:00:00 2001 From: bingyanglin Date: Tue, 29 Oct 2024 10:45:09 +0100 Subject: [PATCH 5/5] Use MAX + 1 for protocol upgrade testing for now --- crates/iota-benchmark/tests/simtest.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/iota-benchmark/tests/simtest.rs b/crates/iota-benchmark/tests/simtest.rs index 44fd754e58a..d59d8a0b66f 100644 --- a/crates/iota-benchmark/tests/simtest.rs +++ b/crates/iota-benchmark/tests/simtest.rs @@ -668,7 +668,8 @@ mod test { } async fn test_protocol_upgrade_compatibility_impl() { - let max_ver = ProtocolVersion::MAX_ALLOWED.as_u64(); + // TODO: Remove the `+ 1` after we have Protocol version 2 + let max_ver = ProtocolVersion::MAX.as_u64() + 1; let manifest = iota_framework_snapshot::load_bytecode_snapshot_manifest(); let Some((&starting_version, _)) = manifest.range(..max_ver).last() else {