diff --git a/core-rust-bridge/src/main/java/com/radixdlt/protocol/ProtocolConfig.java b/core-rust-bridge/src/main/java/com/radixdlt/protocol/ProtocolConfig.java index 90893680d8..5c834ddd31 100644 --- a/core-rust-bridge/src/main/java/com/radixdlt/protocol/ProtocolConfig.java +++ b/core-rust-bridge/src/main/java/com/radixdlt/protocol/ProtocolConfig.java @@ -85,14 +85,16 @@ public record ProtocolConfig( public static final String GENESIS_PROTOCOL_VERSION_NAME = "babylon-genesis"; public static final String ANEMONE_PROTOCOL_VERSION_NAME = "anemone"; public static final String BOTTLENOSE_PROTOCOL_VERSION_NAME = "bottlenose"; - public static final String CUTTLEFISH_PROTOCOL_VERSION_NAME = "cuttlefish"; + public static final String CUTTLEFISH_PART1_PROTOCOL_VERSION_NAME = "cuttlefish"; + public static final String CUTTLEFISH_PART2_PROTOCOL_VERSION_NAME = "cuttlefish-part2"; public static ImmutableList VERSION_NAMES = ImmutableList.of( GENESIS_PROTOCOL_VERSION_NAME, ANEMONE_PROTOCOL_VERSION_NAME, BOTTLENOSE_PROTOCOL_VERSION_NAME, - CUTTLEFISH_PROTOCOL_VERSION_NAME); + CUTTLEFISH_PART1_PROTOCOL_VERSION_NAME, + CUTTLEFISH_PART2_PROTOCOL_VERSION_NAME); public static final String LATEST_PROTOCOL_VERSION_NAME = VERSION_NAMES.get(VERSION_NAMES.size() - 1); diff --git a/core-rust/Cargo.lock b/core-rust/Cargo.lock index 34a6ff9fc0..e999b21e77 100644 --- a/core-rust/Cargo.lock +++ b/core-rust/Cargo.lock @@ -17,6 +17,18 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.0.4" @@ -63,6 +75,12 @@ version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + [[package]] name = "async-trait" version = "0.1.73" @@ -924,6 +942,9 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", +] [[package]] name = "heck" @@ -1360,6 +1381,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "multi-stash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" + [[package]] name = "node-common" version = "0.1.0" @@ -1726,7 +1753,7 @@ dependencies = [ [[package]] name = "radix-blueprint-schema-init" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "bitflags 1.3.2", "radix-common", @@ -1737,7 +1764,7 @@ dependencies = [ [[package]] name = "radix-common" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "bech32", "blake2", @@ -1763,7 +1790,7 @@ dependencies = [ [[package]] name = "radix-common-derive" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "paste", "proc-macro2", @@ -1775,7 +1802,7 @@ dependencies = [ [[package]] name = "radix-engine" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "bitflags 1.3.2", "colored", @@ -1795,18 +1822,18 @@ dependencies = [ "radix-substate-store-interface", "radix-transactions", "radix-wasm-instrument", - "radix-wasmi", "sbor", "strum", "syn 1.0.109", "tempfile", + "wasmi", "wasmparser 0.107.0", ] [[package]] name = "radix-engine-interface" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "bitflags 1.3.2", "const-sha1", @@ -1827,7 +1854,7 @@ dependencies = [ [[package]] name = "radix-engine-profiling" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "fixedstr", ] @@ -1835,7 +1862,7 @@ dependencies = [ [[package]] name = "radix-engine-profiling-derive" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "proc-macro2", "quote", @@ -1846,7 +1873,7 @@ dependencies = [ [[package]] name = "radix-engine-toolkit-common" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "radix-common", "radix-engine", @@ -1860,7 +1887,7 @@ dependencies = [ [[package]] name = "radix-native-sdk" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "radix-common", "radix-engine-interface", @@ -1871,7 +1898,7 @@ dependencies = [ [[package]] name = "radix-rust" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "indexmap 2.2.6", "serde", @@ -1880,7 +1907,7 @@ dependencies = [ [[package]] name = "radix-sbor-derive" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "proc-macro2", "quote", @@ -1891,7 +1918,7 @@ dependencies = [ [[package]] name = "radix-substate-store-impls" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "hex", "itertools", @@ -1905,7 +1932,7 @@ dependencies = [ [[package]] name = "radix-substate-store-interface" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "hex", "itertools", @@ -1917,7 +1944,7 @@ dependencies = [ [[package]] name = "radix-substate-store-queries" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "hex", "itertools", @@ -1934,7 +1961,7 @@ dependencies = [ [[package]] name = "radix-transaction-scenarios" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "hex", "itertools", @@ -1954,7 +1981,7 @@ dependencies = [ [[package]] name = "radix-transactions" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "annotate-snippets", "bech32", @@ -1982,24 +2009,6 @@ dependencies = [ "wasmprinter", ] -[[package]] -name = "radix-wasmi" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59bf4a0498ed223122e726f9360e9889c2bb6eb6898069f4b6f9960b067a742d" -dependencies = [ - "radix-wasmi-arena", - "spin", - "wasmi_core", - "wasmparser-nostd", -] - -[[package]] -name = "radix-wasmi-arena" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a03d7e7816ade40c6ecedff7515198906d644527771bd8fb5a335094353a15a" - [[package]] name = "rand" version = "0.8.5" @@ -2145,7 +2154,7 @@ dependencies = [ [[package]] name = "sbor" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "const-sha1", "hex", @@ -2159,7 +2168,7 @@ dependencies = [ [[package]] name = "sbor-derive" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "proc-macro2", "sbor-derive-common", @@ -2169,7 +2178,7 @@ dependencies = [ [[package]] name = "sbor-derive-common" version = "1.3.0-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-ba329d35#ba329d35e3a150344198c4ac48687bd0d2e158b3" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?tag=cuttlefish-75118062#75118062bdc0c8eda4829e17fd5278803fa3100b" dependencies = [ "const-sha1", "indexmap 2.2.6", @@ -2503,6 +2512,17 @@ dependencies = [ "tracing", ] +[[package]] +name = "string-interner" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" +dependencies = [ + "cfg-if", + "hashbrown 0.14.3", + "serde", +] + [[package]] name = "strsim" version = "0.10.0" @@ -3007,16 +3027,48 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasmi" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7a1acc721dd73e4fff2dc3796cc3efda6e008369e859a20fdbe058bddeebc3" +dependencies = [ + "arrayvec", + "multi-stash", + "smallvec", + "spin", + "wasmi_collections", + "wasmi_core", + "wasmi_ir", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi_collections" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142fda775f9cda587681ff0ec63c7a7e5679dc95da75f3f9b7e3979ce3506a5b" +dependencies = [ + "string-interner", +] + [[package]] name = "wasmi_core" -version = "0.8.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d21fc8d8dafc2df566ebcba7d48a2df7b37386d6afa64237cdf9415c8d7d98ec" +checksum = "281a49ca3c12c8efa052cb67758454fc861d80ab5a03def352e04eb08c20beb2" dependencies = [ "downcast-rs", "libm", - "num-traits", - "paste", +] + +[[package]] +name = "wasmi_ir" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bbadcf529808086a74bacd3ce8aedece444a847292198a56dcde920d1fb213c" +dependencies = [ + "wasmi_core", ] [[package]] @@ -3041,9 +3093,9 @@ dependencies = [ [[package]] name = "wasmparser-nostd" -version = "0.91.0" +version = "0.100.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c37f310b5a62bfd5ae7c0f1d8e6f98af16a5d6d84ba764e9c36439ec14e318b" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" dependencies = [ "indexmap-nostd", ] @@ -3228,6 +3280,26 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.32", +] + [[package]] name = "zeroize" version = "1.8.1" diff --git a/core-rust/Cargo.toml b/core-rust/Cargo.toml index 31a6f44eb6..204b1c2020 100644 --- a/core-rust/Cargo.toml +++ b/core-rust/Cargo.toml @@ -26,18 +26,18 @@ resolver = "2" # Then use tag="release_name-BLAH" in the below dependencies. # ================================================================= -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35", features = ["serde"] } -radix-transactions = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } -radix-transaction-scenarios = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } -radix-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35", features = ["serde"] } -radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } -radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } -radix-substate-store-impls = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } -radix-substate-store-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } -radix-substate-store-queries = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } -radix-rust = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35", features = ["serde"] } -radix-blueprint-schema-init = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35", features = ["serde"] } -radix-engine-toolkit-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-ba329d35" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062", features = ["serde"] } +radix-transactions = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } +radix-transaction-scenarios = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } +radix-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062", features = ["serde"] } +radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } +radix-substate-store-impls = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } +radix-substate-store-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } +radix-substate-store-queries = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } +radix-rust = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062", features = ["serde"] } +radix-blueprint-schema-init = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062", features = ["serde"] } +radix-engine-toolkit-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-75118062" } itertools = { version = "=0.10.5" } jni = { version = "=0.19.0" } diff --git a/core-rust/core-api-server/core-api-schema.yaml b/core-rust/core-api-server/core-api-schema.yaml index 22d6b4c58f..6bfd4b2068 100644 --- a/core-rust/core-api-server/core-api-schema.yaml +++ b/core-rust/core-api-server/core-api-schema.yaml @@ -4384,6 +4384,7 @@ components: enum: - V1 - V2 + - V3 SystemParameters: type: object required: diff --git a/core-rust/core-api-server/src/core_api/conversions/substates/boot_loader_module.rs b/core-rust/core-api-server/src/core_api/conversions/substates/boot_loader_module.rs index 7b73a5941a..db7b067721 100644 --- a/core-rust/core-api-server/src/core_api/conversions/substates/boot_loader_module.rs +++ b/core-rust/core-api-server/src/core_api/conversions/substates/boot_loader_module.rs @@ -31,6 +31,7 @@ fn to_api_system_version(system_version: &SystemVersion) -> models::SystemVersio match system_version { SystemVersion::V1 => models::SystemVersion::V1, SystemVersion::V2 => models::SystemVersion::V2, + SystemVersion::V3 => models::SystemVersion::V3, } } diff --git a/core-rust/core-api-server/src/core_api/generated/models/system_version.rs b/core-rust/core-api-server/src/core_api/generated/models/system_version.rs index a497e754eb..c717c3eb5f 100644 --- a/core-rust/core-api-server/src/core_api/generated/models/system_version.rs +++ b/core-rust/core-api-server/src/core_api/generated/models/system_version.rs @@ -17,6 +17,8 @@ pub enum SystemVersion { V1, #[serde(rename = "V2")] V2, + #[serde(rename = "V3")] + V3, } @@ -25,6 +27,7 @@ impl ToString for SystemVersion { match self { Self::V1 => String::from("V1"), Self::V2 => String::from("V2"), + Self::V3 => String::from("V3"), } } } diff --git a/core-rust/state-manager/src/protocol/protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_config.rs index 9295a61a51..282300995a 100644 --- a/core-rust/state-manager/src/protocol/protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_config.rs @@ -10,13 +10,15 @@ const MAX_PROTOCOL_VERSION_NAME_LEN: usize = 16; const GENESIS_PROTOCOL_VERSION: &str = "babylon-genesis"; const ANEMONE_PROTOCOL_VERSION: &str = "anemone"; const BOTTLENOSE_PROTOCOL_VERSION: &str = "bottlenose"; -const CUTTLEFISH_PROTOCOL_VERSION: &str = "cuttlefish"; +const CUTTLEFISH_PART1_PROTOCOL_VERSION: &str = "cuttlefish"; +const CUTTLEFISH_PART2_PROTOCOL_VERSION: &str = "cuttlefish-part2"; pub enum ResolvedProtocolVersion { Babylon, Anemone, Bottlenose, - Cuttlefish, + CuttlefishPart1, + CuttlefishPart2, Custom(ProtocolVersionName), Test(ProtocolVersionName), } @@ -27,7 +29,8 @@ impl ResolvedProtocolVersion { GENESIS_PROTOCOL_VERSION => Some(ResolvedProtocolVersion::Babylon), ANEMONE_PROTOCOL_VERSION => Some(ResolvedProtocolVersion::Anemone), BOTTLENOSE_PROTOCOL_VERSION => Some(ResolvedProtocolVersion::Bottlenose), - CUTTLEFISH_PROTOCOL_VERSION => Some(ResolvedProtocolVersion::Cuttlefish), + CUTTLEFISH_PART1_PROTOCOL_VERSION => Some(ResolvedProtocolVersion::CuttlefishPart1), + CUTTLEFISH_PART2_PROTOCOL_VERSION => Some(ResolvedProtocolVersion::CuttlefishPart2), // Updates starting "custom-" are intended for use with tests, where the thresholds and config are injected on all nodes name_string if CustomProtocolUpdateDefinition::matches(name_string) => Some( ResolvedProtocolVersion::Custom(protocol_version_name.clone()), @@ -45,7 +48,8 @@ impl ResolvedProtocolVersion { ResolvedProtocolVersion::Babylon => Some(ProtocolVersion::Babylon), ResolvedProtocolVersion::Anemone => Some(ProtocolVersion::Anemone), ResolvedProtocolVersion::Bottlenose => Some(ProtocolVersion::Bottlenose), - ResolvedProtocolVersion::Cuttlefish => Some(ProtocolVersion::Cuttlefish), + ResolvedProtocolVersion::CuttlefishPart1 => Some(ProtocolVersion::CuttlefishPart1), + ResolvedProtocolVersion::CuttlefishPart2 => Some(ProtocolVersion::CuttlefishPart2), ResolvedProtocolVersion::Custom { .. } => None, ResolvedProtocolVersion::Test { .. } => None, } @@ -56,7 +60,12 @@ impl ResolvedProtocolVersion { ResolvedProtocolVersion::Babylon => Box::new(BabylonProtocolUpdateDefinition), ResolvedProtocolVersion::Anemone => Box::new(AnemoneProtocolUpdateDefinition), ResolvedProtocolVersion::Bottlenose => Box::new(BottlenoseProtocolUpdateDefinition), - ResolvedProtocolVersion::Cuttlefish => Box::new(CuttlefishProtocolUpdateDefinition), + ResolvedProtocolVersion::CuttlefishPart1 => { + Box::new(CuttlefishPart1ProtocolUpdateDefinition) + } + ResolvedProtocolVersion::CuttlefishPart2 => { + Box::new(CuttlefishPart2ProtocolUpdateDefinition) + } ResolvedProtocolVersion::Custom(..) => Box::new(CustomProtocolUpdateDefinition), ResolvedProtocolVersion::Test(name) => { Box::new(TestProtocolUpdateDefinition::new(name.clone())) @@ -179,8 +188,12 @@ impl ProtocolVersionName { Self::of(BOTTLENOSE_PROTOCOL_VERSION).unwrap() } - pub fn cuttlefish() -> Self { - Self::of(CUTTLEFISH_PROTOCOL_VERSION).unwrap() + pub fn cuttlefish_part1() -> Self { + Self::of(CUTTLEFISH_PART1_PROTOCOL_VERSION).unwrap() + } + + pub fn cuttlefish_part2() -> Self { + Self::of(CUTTLEFISH_PART2_PROTOCOL_VERSION).unwrap() } pub fn for_engine(version: ProtocolVersion) -> Self { @@ -189,7 +202,8 @@ impl ProtocolVersionName { ProtocolVersion::Babylon => Self::babylon(), ProtocolVersion::Anemone => Self::anemone(), ProtocolVersion::Bottlenose => Self::bottlenose(), - ProtocolVersion::Cuttlefish => Self::cuttlefish(), + ProtocolVersion::CuttlefishPart1 => Self::cuttlefish_part1(), + ProtocolVersion::CuttlefishPart2 => Self::cuttlefish_part2(), } } diff --git a/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs b/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs index 7397386d8d..4a674eba69 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/config_printer.rs @@ -19,7 +19,7 @@ use super::*; #[test] fn print_fixed_config_code() { // This is used for stokenet and dumunet - let version = ProtocolVersionName::cuttlefish(); + let version = ProtocolVersionName::cuttlefish_part2(); let start_epoch = Epoch::of(1); let end_epoch = Epoch::of(10000000); let thresholds = vec![SignalledReadinessThreshold { @@ -43,7 +43,7 @@ fn print_calculated_protocol_config_code() { // See https://learn.radixdlt.com/article/radix-foundation-protocol-update-candidate-policies // For guidance on how to set these paramaters - let version = ProtocolVersionName::cuttlefish(); + let version = ProtocolVersionName::cuttlefish_part1(); let target_start = DateTime::::from_str("2024-12-10T16:00:00.000Z").unwrap(); let enactment_window = Duration::days(10); // Normally set to 28 days, but shorter due to christmas let proposed_thresholds = [(dec!(0.75), Duration::days(14))]; diff --git a/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs index 334639a564..d38a16689e 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/dumunet_protocol_config.rs @@ -30,7 +30,7 @@ pub fn dumunet_protocol_config() -> ProtocolConfig { required_consecutive_completed_epochs_of_support: 10, }], }, - ProtocolVersionName::cuttlefish() => EnactAtStartOfEpochIfValidatorsReady { + ProtocolVersionName::cuttlefish_part1() => EnactAtStartOfEpochIfValidatorsReady { // ================================================================= // PROTOCOL_VERSION: "cuttlefish" // READINESS_SIGNAL: "034d3327f58995c6000000cuttlefish" @@ -44,5 +44,8 @@ pub fn dumunet_protocol_config() -> ProtocolConfig { }, ], }, + ProtocolVersionName::cuttlefish_part2() => EnactImmediatelyAfterEndOfProtocolUpdate { + trigger_after: ProtocolVersionName::cuttlefish_part1(), + }, }) } diff --git a/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs index eec616856b..8d65cc902e 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/mainnet_protocol_config.rs @@ -44,7 +44,7 @@ pub fn mainnet_protocol_config() -> ProtocolConfig { }, ], }, - ProtocolVersionName::cuttlefish() => EnactAtStartOfEpochIfValidatorsReady { + ProtocolVersionName::cuttlefish_part1() => EnactAtStartOfEpochIfValidatorsReady { // ================================================================= // PROTOCOL_VERSION: "cuttlefish" // READINESS_SIGNAL: "96e00440adafe5e2000000cuttlefish" @@ -63,5 +63,8 @@ pub fn mainnet_protocol_config() -> ProtocolConfig { }, ], }, + ProtocolVersionName::cuttlefish_part2() => EnactImmediatelyAfterEndOfProtocolUpdate { + trigger_after: ProtocolVersionName::cuttlefish_part1(), + }, }) } diff --git a/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs index e5fe46531e..d399d8c3c3 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/stokenet_protocol_config.rs @@ -30,7 +30,7 @@ pub fn stokenet_protocol_config() -> ProtocolConfig { required_consecutive_completed_epochs_of_support: 10, }], }, - ProtocolVersionName::cuttlefish() => EnactAtStartOfEpochIfValidatorsReady { + ProtocolVersionName::cuttlefish_part1() => EnactAtStartOfEpochIfValidatorsReady { // ================================================================= // PROTOCOL_VERSION: "cuttlefish" // READINESS_SIGNAL: "034d3327f58995c6000000cuttlefish" @@ -44,5 +44,19 @@ pub fn stokenet_protocol_config() -> ProtocolConfig { }, ], }, + ProtocolVersionName::cuttlefish_part2() => EnactAtStartOfEpochIfValidatorsReady { + // ================================================================= + // PROTOCOL_VERSION: "cuttlefish-part2" + // READINESS_SIGNAL: "c0d928cf271e039ecuttlefish-part2" + // ================================================================= + lower_bound_inclusive: Epoch::of(1), + upper_bound_exclusive: Epoch::of(10000000), + readiness_thresholds: vec![ + SignalledReadinessThreshold { + required_ratio_of_stake_supported: dec!(0.8), + required_consecutive_completed_epochs_of_support: 10, + }, + ], + }, }) } diff --git a/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs b/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs index 29dac64d91..a5078e7d48 100644 --- a/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs +++ b/core-rust/state-manager/src/protocol/protocol_configs/testnet_protocol_config.rs @@ -13,8 +13,11 @@ pub fn testnet_protocol_config() -> ProtocolConfig { ProtocolVersionName::bottlenose() => EnactImmediatelyAfterEndOfProtocolUpdate { trigger_after: ProtocolVersionName::anemone(), }, - ProtocolVersionName::cuttlefish() => EnactImmediatelyAfterEndOfProtocolUpdate { + ProtocolVersionName::cuttlefish_part1() => EnactImmediatelyAfterEndOfProtocolUpdate { trigger_after: ProtocolVersionName::bottlenose(), }, + ProtocolVersionName::cuttlefish_part2() => EnactImmediatelyAfterEndOfProtocolUpdate { + trigger_after: ProtocolVersionName::cuttlefish_part1(), + }, }) } diff --git a/core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_definition.rs b/core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_part1_definition.rs similarity index 69% rename from core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_definition.rs rename to core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_part1_definition.rs index 25e1ccb148..e726c8e033 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_definition.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_part1_definition.rs @@ -1,9 +1,9 @@ use crate::prelude::*; -pub struct CuttlefishProtocolUpdateDefinition; +pub struct CuttlefishPart1ProtocolUpdateDefinition; -impl ProtocolUpdateDefinition for CuttlefishProtocolUpdateDefinition { - type Overrides = CuttlefishSettings; +impl ProtocolUpdateDefinition for CuttlefishPart1ProtocolUpdateDefinition { + type Overrides = CuttlefishPart1Settings; fn create_batch_generator( &self, diff --git a/core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_part2_definition.rs b/core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_part2_definition.rs new file mode 100644 index 0000000000..ba3ac9f02a --- /dev/null +++ b/core-rust/state-manager/src/protocol/protocol_updates/definitions/cuttlefish_part2_definition.rs @@ -0,0 +1,20 @@ +use crate::prelude::*; + +pub struct CuttlefishPart2ProtocolUpdateDefinition; + +impl ProtocolUpdateDefinition for CuttlefishPart2ProtocolUpdateDefinition { + type Overrides = CuttlefishPart2Settings; + + fn create_batch_generator( + &self, + context: ProtocolUpdateContext, + overrides_hash: Option, + overrides: Option, + ) -> Box { + Box::new(create_default_generator_with_scenarios( + context, + overrides_hash, + overrides, + )) + } +} diff --git a/core-rust/state-manager/src/protocol/protocol_updates/definitions/mod.rs b/core-rust/state-manager/src/protocol/protocol_updates/definitions/mod.rs index 7473061385..c518a4f7e3 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/definitions/mod.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/definitions/mod.rs @@ -2,12 +2,14 @@ mod anemone_definition; mod babylon_definition; mod bottlenose_definition; mod custom_definition; -mod cuttlefish_definition; +mod cuttlefish_part1_definition; +mod cuttlefish_part2_definition; mod test_definition; pub use anemone_definition::*; pub use babylon_definition::*; pub use bottlenose_definition::*; pub use custom_definition::*; -pub use cuttlefish_definition::*; +pub use cuttlefish_part1_definition::*; +pub use cuttlefish_part2_definition::*; pub use test_definition::*; diff --git a/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs b/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs index 32ec128401..72d38d02ef 100644 --- a/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs +++ b/core-rust/state-manager/src/protocol/protocol_updates/protocol_content_overrides.rs @@ -10,7 +10,8 @@ pub struct ProtocolUpdateContentOverrides { babylon: Option>, anemone: Option>, bottlenose: Option>, - cuttlefish: Option>, + cuttlefish_part1: Option>, + cuttlefish_part2: Option>, custom: HashMap>, } @@ -37,11 +38,19 @@ impl ProtocolUpdateContentOverrides { self } - pub fn with_cuttlefish( + pub fn with_cuttlefish_part1( mut self, - config: Overrides, + config: Overrides, ) -> Self { - self.cuttlefish = Some(config); + self.cuttlefish_part1 = Some(config); + self + } + + pub fn with_cuttlefish_part2( + mut self, + config: Overrides, + ) -> Self { + self.cuttlefish_part2 = Some(config); self } @@ -83,9 +92,15 @@ impl From for RawProtocolUpdateContentOverrides scrypto_encode(&config).unwrap(), ); } - if let Some(config) = value.cuttlefish { + if let Some(config) = value.cuttlefish_part1 { + map.insert( + ProtocolVersionName::cuttlefish_part1(), + scrypto_encode(&config).unwrap(), + ); + } + if let Some(config) = value.cuttlefish_part2 { map.insert( - ProtocolVersionName::cuttlefish(), + ProtocolVersionName::cuttlefish_part2(), scrypto_encode(&config).unwrap(), ); } diff --git a/core/src/test-core/java/com/radixdlt/api/core/generated/models/SystemVersion.java b/core/src/test-core/java/com/radixdlt/api/core/generated/models/SystemVersion.java index b80047f930..2467188a9f 100644 --- a/core/src/test-core/java/com/radixdlt/api/core/generated/models/SystemVersion.java +++ b/core/src/test-core/java/com/radixdlt/api/core/generated/models/SystemVersion.java @@ -31,7 +31,9 @@ public enum SystemVersion { V1("V1"), - V2("V2"); + V2("V2"), + + V3("V3"); private String value; diff --git a/core/src/test/java/com/radixdlt/rev2/protocol/CuttlefishProtocolUpdateTest.java b/core/src/test/java/com/radixdlt/rev2/protocol/CuttlefishProtocolUpdateTest.java index 276153f9dc..68d2532ca3 100644 --- a/core/src/test/java/com/radixdlt/rev2/protocol/CuttlefishProtocolUpdateTest.java +++ b/core/src/test/java/com/radixdlt/rev2/protocol/CuttlefishProtocolUpdateTest.java @@ -88,10 +88,11 @@ public final class CuttlefishProtocolUpdateTest { private static final long ENACTMENT_EPOCH = 8; - private static final ProtocolConfig IMMEDIATELY_CUTTLEFISH = - ProtocolConfig.launchAt(ProtocolConfig.CUTTLEFISH_PROTOCOL_VERSION_NAME); - private static final ProtocolConfig CUTTLEFISH_AT_EPOCH = - ProtocolConfig.enactAtEpoch(ProtocolConfig.CUTTLEFISH_PROTOCOL_VERSION_NAME, ENACTMENT_EPOCH); + private static final ProtocolConfig IMMEDIATELY_CUTTLEFISH_PART2 = + ProtocolConfig.launchAt(ProtocolConfig.CUTTLEFISH_PART2_PROTOCOL_VERSION_NAME); + private static final ProtocolConfig CUTTLEFISH_PART1_AT_EPOCH = + ProtocolConfig.enactAtEpoch( + ProtocolConfig.CUTTLEFISH_PART1_PROTOCOL_VERSION_NAME, ENACTMENT_EPOCH); @Rule public TemporaryFolder folder = new TemporaryFolder(); @@ -121,7 +122,7 @@ private DeterministicTest createTest(ProtocolConfig protocolConfig, Module... ex @Test public void transaction_v2_behaviour_across_cuttlefish() throws ApiException { final var coreApiHelper = new CoreApiHelper(Network.INTEGRATIONTESTNET); - try (var test = createTest(CUTTLEFISH_AT_EPOCH, coreApiHelper.module())) { + try (var test = createTest(CUTTLEFISH_PART1_AT_EPOCH, coreApiHelper.module())) { final var stateComputer = test.getInstance(0, RustStateComputer.class); test.runUntilState(allAtOrOverEpoch(ENACTMENT_EPOCH - 1)); @@ -148,13 +149,13 @@ public void transaction_v2_behaviour_across_cuttlefish() throws ApiException { // Arrange: Run the protocol update: test.runUntilState( - allAtExactlyProtocolVersion(ProtocolConfig.CUTTLEFISH_PROTOCOL_VERSION_NAME)); + allAtExactlyProtocolVersion(ProtocolConfig.CUTTLEFISH_PART1_PROTOCOL_VERSION_NAME)); assertEquals( - ProtocolConfig.CUTTLEFISH_PROTOCOL_VERSION_NAME, + ProtocolConfig.CUTTLEFISH_PART1_PROTOCOL_VERSION_NAME, stateComputer.protocolState().currentProtocolVersion()); assertEquals( - ProtocolConfig.CUTTLEFISH_PROTOCOL_VERSION_NAME, + ProtocolConfig.CUTTLEFISH_PART1_PROTOCOL_VERSION_NAME, coreApiHelper.getNetworkStatus().getCurrentProtocolVersion()); // Act: Can now submit a new TransactionV2 @@ -189,7 +190,7 @@ public void transaction_v2_behaviour_across_cuttlefish() throws ApiException { @Test public void protocol_update_process_updates_status_summary() throws ApiException { final var coreApiHelper = new CoreApiHelper(Network.INTEGRATIONTESTNET); - try (var test = createTest(IMMEDIATELY_CUTTLEFISH, coreApiHelper.module())) { + try (var test = createTest(IMMEDIATELY_CUTTLEFISH_PART2, coreApiHelper.module())) { test.suppressUnusedWarning(); var latestStateVersion = @@ -208,7 +209,7 @@ public void protocol_update_process_updates_status_summary() throws ApiException .getNewValue() .getSubstateData(); assertEquals( - ProtocolConfig.CUTTLEFISH_PROTOCOL_VERSION_NAME, latestStatus.getProtocolVersion()); + ProtocolConfig.CUTTLEFISH_PART2_PROTOCOL_VERSION_NAME, latestStatus.getProtocolVersion()); assertEquals(ProtocolUpdateStatusType.COMPLETE, latestStatus.getUpdateStatus().getType()); } } diff --git a/sdk/typescript/lib/generated/models/SystemVersion.ts b/sdk/typescript/lib/generated/models/SystemVersion.ts index b4505f0219..66c995630d 100644 --- a/sdk/typescript/lib/generated/models/SystemVersion.ts +++ b/sdk/typescript/lib/generated/models/SystemVersion.ts @@ -19,7 +19,8 @@ */ export const SystemVersion = { V1: 'V1', - V2: 'V2' + V2: 'V2', + V3: 'V3' } as const; export type SystemVersion = typeof SystemVersion[keyof typeof SystemVersion];