Skip to content

Commit

Permalink
Merge branch 'develop' into feature/mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
lrubasze committed Nov 21, 2024
2 parents df784c5 + 0c4aa93 commit c8c5f33
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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);
Expand Down
38 changes: 19 additions & 19 deletions core-rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions core-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ resolver = "2"
# Then use tag="release_name-BLAH" in the below dependencies.
# =================================================================

sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6", features = ["serde"] }
radix-transactions = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
radix-transaction-scenarios = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
radix-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6", features = ["serde"] }
radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
radix-substate-store-impls = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
radix-substate-store-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
radix-substate-store-queries = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
radix-rust = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6", features = ["serde"] }
radix-blueprint-schema-init = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6", features = ["serde"] }
radix-engine-toolkit-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-640cc0f6" }
sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337", features = ["serde"] }
radix-transactions = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }
radix-transaction-scenarios = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }
radix-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337", features = ["serde"] }
radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }
radix-substate-store-impls = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }
radix-substate-store-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }
radix-substate-store-queries = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }
radix-rust = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337", features = ["serde"] }
radix-blueprint-schema-init = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337", features = ["serde"] }
radix-engine-toolkit-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "cuttlefish-c3aa4337" }

itertools = { version = "=0.10.5" }
jni = { version = "=0.19.0" }
Expand Down
1 change: 1 addition & 0 deletions core-rust/core-api-server/core-api-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4384,6 +4384,7 @@ components:
enum:
- V1
- V2
- V3
SystemParameters:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub enum SystemVersion {
V1,
#[serde(rename = "V2")]
V2,
#[serde(rename = "V3")]
V3,

}

Expand All @@ -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"),
}
}
}
Expand Down
30 changes: 22 additions & 8 deletions core-rust/state-manager/src/protocol/protocol_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand All @@ -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()),
Expand All @@ -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,
}
Expand All @@ -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()))
Expand Down Expand Up @@ -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 {
Expand All @@ -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(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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::<Utc>::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))];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -44,5 +44,8 @@ pub fn dumunet_protocol_config() -> ProtocolConfig {
},
],
},
ProtocolVersionName::cuttlefish_part2() => EnactImmediatelyAfterEndOfProtocolUpdate {
trigger_after: ProtocolVersionName::cuttlefish_part1(),
},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn mainnet_protocol_config() -> ProtocolConfig {
},
],
},
ProtocolVersionName::cuttlefish() => EnactAtStartOfEpochIfValidatorsReady {
ProtocolVersionName::cuttlefish_part1() => EnactAtStartOfEpochIfValidatorsReady {
// =================================================================
// PROTOCOL_VERSION: "cuttlefish"
// READINESS_SIGNAL: "96e00440adafe5e2000000cuttlefish"
Expand All @@ -63,5 +63,8 @@ pub fn mainnet_protocol_config() -> ProtocolConfig {
},
],
},
ProtocolVersionName::cuttlefish_part2() => EnactImmediatelyAfterEndOfProtocolUpdate {
trigger_after: ProtocolVersionName::cuttlefish_part1(),
},
})
}
Loading

0 comments on commit c8c5f33

Please sign in to comment.