Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions rs/prep/src/subnet_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ impl SubnetConfig {
let der_pk = threshold_sig_public_key_to_der(pk)?;
let subnet_id = SubnetId::from(PrincipalId::new_self_authenticating(&der_pk[..]));

let (cup_type, state_hash) = match self.initial_height {
0 => (CupType::Genesis(GenesisArgs {}), vec![]),
let cup_type = match self.initial_height {
0 => CupType::Genesis(GenesisArgs {}),
height => {
let state_hashes: Vec<_> = initialized_nodes
.values()
Expand All @@ -419,14 +419,11 @@ impl SubnetConfig {
"Generated initial states do not have the same state hash"
);

(
CupType::Recovery(RecoveryArgs {
height,
time: 0,
state_hash: state_hashes[0].clone(),
}),
state_hashes[0].clone(),
)
CupType::Recovery(RecoveryArgs {
height,
time: 0,
state_hash: state_hashes[0].clone(),
})
}
};

Expand All @@ -437,9 +434,6 @@ impl SubnetConfig {
initial_ni_dkg_transcript_high_threshold: Some(InitialNiDkgTranscriptRecord::from(
ni_dkg_transcript_high_threshold,
)),
state_hash,
height: self.initial_height,
time: 0,
registry_store_uri: None,
ecdsa_initializations: vec![],
chain_key_initializations: vec![],
Expand Down
15 changes: 3 additions & 12 deletions rs/protobuf/def/registry/subnet/v1/subnet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,15 @@ message ChainKeyInitialization {
// a CUP with no dependencies on previous CUPs or blocks). Such CUP materials can be used to
// construct the genesis CUP or a recovery CUP in the event of a subnet stall.
message CatchUpPackageContents {
reserved 3, 4, 5;
reserved "height", "time", "state_hash";

// Initial non-interactive low-threshold DKG transcript
InitialNiDkgTranscriptRecord initial_ni_dkg_transcript_low_threshold = 1;

// Initial non-interactive high-threshold DKG transcript
InitialNiDkgTranscriptRecord initial_ni_dkg_transcript_high_threshold = 2;

// The blockchain height that the CUP should have
// TODO(CON-1671): deprecate this field in favor of `cup_type`
uint64 height = 3;

// Block time for the CUP's block
// TODO(CON-1671): deprecate this field in favor of `cup_type`
uint64 time = 4;

// The hash of the state that the subnet should use
// TODO(CON-1671): deprecate this field in favor of `cup_type`
bytes state_hash = 5;

// A uri from which data to replace the registry local store should be downloaded
RegistryStoreUri registry_store_uri = 6;

Expand Down
12 changes: 0 additions & 12 deletions rs/protobuf/src/gen/registry/registry.subnet.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,6 @@ pub struct CatchUpPackageContents {
#[prost(message, optional, tag = "2")]
pub initial_ni_dkg_transcript_high_threshold:
::core::option::Option<InitialNiDkgTranscriptRecord>,
/// The blockchain height that the CUP should have
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(uint64, tag = "3")]
pub height: u64,
/// Block time for the CUP's block
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(uint64, tag = "4")]
pub time: u64,
/// The hash of the state that the subnet should use
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(bytes = "vec", tag = "5")]
pub state_hash: ::prost::alloc::vec::Vec<u8>,
/// A uri from which data to replace the registry local store should be downloaded
#[prost(message, optional, tag = "6")]
pub registry_store_uri: ::core::option::Option<RegistryStoreUri>,
Expand Down
12 changes: 0 additions & 12 deletions rs/protobuf/src/gen/state/registry.subnet.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,6 @@ pub struct CatchUpPackageContents {
#[prost(message, optional, tag = "2")]
pub initial_ni_dkg_transcript_high_threshold:
::core::option::Option<InitialNiDkgTranscriptRecord>,
/// The blockchain height that the CUP should have
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(uint64, tag = "3")]
pub height: u64,
/// Block time for the CUP's block
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(uint64, tag = "4")]
pub time: u64,
/// The hash of the state that the subnet should use
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(bytes = "vec", tag = "5")]
pub state_hash: ::prost::alloc::vec::Vec<u8>,
/// A uri from which data to replace the registry local store should be downloaded
#[prost(message, optional, tag = "6")]
pub registry_store_uri: ::core::option::Option<RegistryStoreUri>,
Expand Down
12 changes: 0 additions & 12 deletions rs/protobuf/src/gen/types/registry.subnet.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,6 @@ pub struct CatchUpPackageContents {
#[prost(message, optional, tag = "2")]
pub initial_ni_dkg_transcript_high_threshold:
::core::option::Option<InitialNiDkgTranscriptRecord>,
/// The blockchain height that the CUP should have
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(uint64, tag = "3")]
pub height: u64,
/// Block time for the CUP's block
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(uint64, tag = "4")]
pub time: u64,
/// The hash of the state that the subnet should use
/// TODO(CON-1671): deprecate this field in favor of `cup_type`
#[prost(bytes = "vec", tag = "5")]
pub state_hash: ::prost::alloc::vec::Vec<u8>,
/// A uri from which data to replace the registry local store should be downloaded
#[prost(message, optional, tag = "6")]
pub registry_store_uri: ::core::option::Option<RegistryStoreUri>,
Expand Down
3 changes: 0 additions & 3 deletions rs/registry/canister/src/mutations/do_create_subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ impl Registry {
),
chain_key_initializations,
cup_type: Some(CupType::Genesis(GenesisArgs {})),
height: 0,
time: 0,
state_hash: vec![],
registry_store_uri: None,
ecdsa_initializations: vec![],
};
Expand Down
4 changes: 0 additions & 4 deletions rs/registry/canister/src/mutations/do_recover_subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,6 @@ impl Registry {
}

// Set the height, time and state hash of the payload
cup_contents.height = payload.height;
cup_contents.time = payload.time_ns;
cup_contents.state_hash = payload.state_hash.clone();

cup_contents.cup_type = Some(CupType::Recovery(RecoveryArgs {
height: payload.height,
time: payload.time_ns,
Expand Down
3 changes: 0 additions & 3 deletions rs/registry/canister/tests/recover_subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ fn test_recover_subnet_with_replacement_nodes() {
get_value_or_panic(&registry, &cup_contents_key).await;

// Assert that the CatchUpPackageContents was updated as expected
assert_eq!(payload.height, updated_cup_contents.height);
assert_eq!(payload.time_ns, updated_cup_contents.time);
assert_eq!(payload.state_hash, updated_cup_contents.state_hash);
assert_eq!(
updated_cup_contents.cup_type,
Some(CupType::Recovery(RecoveryArgs {
Expand Down
3 changes: 0 additions & 3 deletions rs/replay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,6 @@ fn cmd_get_recovery_cup(
let cup_contents = CatchUpPackageContents {
initial_ni_dkg_transcript_low_threshold,
initial_ni_dkg_transcript_high_threshold,
height: cmd.height,
time: time.as_nanos_since_unix_epoch(),
state_hash: state_hash.clone(),
registry_store_uri: None,
ecdsa_initializations: vec![],
chain_key_initializations: vec![],
Expand Down
Loading