Skip to content

Commit bfcc1fa

Browse files
committed
More renames
1 parent e4a4d7e commit bfcc1fa

40 files changed

+213
-211
lines changed

crates/iota-config/src/node.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ pub const DEFAULT_COMMISSION_RATE: u64 = 200;
5252
#[serde(rename_all = "kebab-case")]
5353
pub struct NodeConfig {
5454
#[serde(default = "default_authority_key_pair")]
55-
pub protocol_key_pair: AuthorityKeyPairWithPath,
55+
pub authority_key_pair: AuthorityKeyPairWithPath,
5656
#[serde(default = "default_key_pair")]
57-
pub worker_key_pair: KeyPairWithPath,
57+
pub protocol_key_pair: KeyPairWithPath,
5858
#[serde(default = "default_key_pair")]
5959
pub account_key_pair: KeyPairWithPath,
6060
#[serde(default = "default_key_pair")]
@@ -368,12 +368,12 @@ fn is_true(value: &bool) -> bool {
368368
impl Config for NodeConfig {}
369369

370370
impl NodeConfig {
371-
pub fn protocol_key_pair(&self) -> &AuthorityKeyPair {
372-
self.protocol_key_pair.authority_keypair()
371+
pub fn authority_key_pair(&self) -> &AuthorityKeyPair {
372+
self.authority_key_pair.authority_keypair()
373373
}
374374

375-
pub fn worker_key_pair(&self) -> &NetworkKeyPair {
376-
match self.worker_key_pair.keypair() {
375+
pub fn protocol_key_pair(&self) -> &NetworkKeyPair {
376+
match self.protocol_key_pair.keypair() {
377377
IotaKeyPair::Ed25519(kp) => kp,
378378
other => panic!(
379379
"Invalid keypair type: {:?}, only Ed25519 is allowed for worker key",
@@ -393,7 +393,7 @@ impl NodeConfig {
393393
}
394394

395395
pub fn protocol_public_key(&self) -> AuthorityPublicKeyBytes {
396-
self.protocol_key_pair().public().into()
396+
self.authority_key_pair().public().into()
397397
}
398398

399399
pub fn db_path(&self) -> PathBuf {
@@ -1167,17 +1167,17 @@ mod tests {
11671167

11681168
#[test]
11691169
fn load_key_pairs_to_node_config() {
1170-
let protocol_key_pair: AuthorityKeyPair =
1170+
let authority_key_pair: AuthorityKeyPair =
11711171
get_key_pair_from_rng(&mut StdRng::from_seed([0; 32])).1;
1172-
let worker_key_pair: NetworkKeyPair =
1172+
let protocol_key_pair: NetworkKeyPair =
11731173
get_key_pair_from_rng(&mut StdRng::from_seed([0; 32])).1;
11741174
let network_key_pair: NetworkKeyPair =
11751175
get_key_pair_from_rng(&mut StdRng::from_seed([0; 32])).1;
11761176

1177-
write_authority_keypair_to_file(&protocol_key_pair, PathBuf::from("protocol.key")).unwrap();
1177+
write_authority_keypair_to_file(&authority_key_pair, PathBuf::from("authority.key")).unwrap();
11781178
write_keypair_to_file(
1179-
&IotaKeyPair::Ed25519(worker_key_pair.copy()),
1180-
PathBuf::from("worker.key"),
1179+
&IotaKeyPair::Ed25519(protocol_key_pair.copy()),
1180+
PathBuf::from("protocol.key"),
11811181
)
11821182
.unwrap();
11831183
write_keypair_to_file(
@@ -1189,16 +1189,16 @@ mod tests {
11891189
const TEMPLATE: &str = include_str!("../data/fullnode-template-with-path.yaml");
11901190
let template: NodeConfig = serde_yaml::from_str(TEMPLATE).unwrap();
11911191
assert_eq!(
1192-
template.protocol_key_pair().public(),
1193-
protocol_key_pair.public()
1192+
template.authority_key_pair().public(),
1193+
authority_key_pair.public()
11941194
);
11951195
assert_eq!(
11961196
template.network_key_pair().public(),
11971197
network_key_pair.public()
11981198
);
11991199
assert_eq!(
1200-
template.worker_key_pair().public(),
1201-
worker_key_pair.public()
1200+
template.protocol_key_pair().public(),
1201+
protocol_key_pair.public()
12021202
);
12031203
}
12041204
}

crates/iota-core/src/authority/authority_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub async fn init_state_with_objects<I: IntoIterator<Item = Object>>(
234234
iota_swarm_config::network_config_builder::ConfigBuilder::new(&dir).build();
235235
let genesis = network_config.genesis;
236236
let keypair = network_config.validator_configs[0]
237-
.protocol_key_pair()
237+
.authority_key_pair()
238238
.copy();
239239
init_state_with_objects_and_committee(objects, &genesis, &keypair).await
240240
}

crates/iota-core/src/authority/test_authority_builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'a> TestAuthorityBuilder<'a> {
139139
pub fn with_network_config(self, config: &'a NetworkConfig, node_idx: usize) -> Self {
140140
self.with_genesis_and_keypair(
141141
&config.genesis,
142-
config.validator_configs()[node_idx].protocol_key_pair(),
142+
config.validator_configs()[node_idx].authority_key_pair(),
143143
)
144144
}
145145

@@ -216,7 +216,7 @@ impl<'a> TestAuthorityBuilder<'a> {
216216
let keypair = if let Some(keypair) = self.node_keypair {
217217
keypair
218218
} else {
219-
config.protocol_key_pair()
219+
config.authority_key_pair()
220220
};
221221

222222
let secret = Arc::pin(keypair.copy());
@@ -342,7 +342,7 @@ impl<'a> TestAuthorityBuilder<'a> {
342342
Arc::downgrade(&epoch_store),
343343
consensus_client,
344344
randomness::Handle::new_stub(),
345-
config.protocol_key_pair(),
345+
config.authority_key_pair(),
346346
)
347347
.await;
348348
if let Some(randomness_manager) = randomness_manager {

crates/iota-core/src/consensus_manager/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl ProtocolManager {
7171
client: Arc<LazyMysticetiClient>,
7272
) -> Self {
7373
Self::Mysticeti(MysticetiManager::new(
74-
config.worker_key_pair().copy(),
74+
config.protocol_key_pair().copy(),
7575
config.network_key_pair().copy(),
7676
consensus_config.db_path().to_path_buf(),
7777
registry_service.clone(),

crates/iota-core/src/epoch/randomness.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ mod tests {
890890

891891
let state = TestAuthorityBuilder::new()
892892
.with_protocol_config(protocol_config.clone())
893-
.with_genesis_and_keypair(&network_config.genesis, validator.protocol_key_pair())
893+
.with_genesis_and_keypair(&network_config.genesis, validator.authority_key_pair())
894894
.build()
895895
.await;
896896
let consensus_adapter = Arc::new(ConsensusAdapter::new(
@@ -909,7 +909,7 @@ mod tests {
909909
Arc::downgrade(&epoch_store),
910910
Box::new(consensus_adapter.clone()),
911911
iota_network::randomness::Handle::new_stub(),
912-
validator.protocol_key_pair(),
912+
validator.authority_key_pair(),
913913
)
914914
.await
915915
.unwrap();
@@ -1022,7 +1022,7 @@ mod tests {
10221022

10231023
let state = TestAuthorityBuilder::new()
10241024
.with_protocol_config(protocol_config.clone())
1025-
.with_genesis_and_keypair(&network_config.genesis, validator.protocol_key_pair())
1025+
.with_genesis_and_keypair(&network_config.genesis, validator.authority_key_pair())
10261026
.build()
10271027
.await;
10281028
let consensus_adapter = Arc::new(ConsensusAdapter::new(
@@ -1041,7 +1041,7 @@ mod tests {
10411041
Arc::downgrade(&epoch_store),
10421042
Box::new(consensus_adapter.clone()),
10431043
iota_network::randomness::Handle::new_stub(),
1044-
validator.protocol_key_pair(),
1044+
validator.authority_key_pair(),
10451045
)
10461046
.await
10471047
.unwrap();

crates/iota-core/src/test_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ where
113113
.build();
114114
let genesis = network_config.genesis;
115115
let authority_key = network_config.validator_configs[0]
116-
.protocol_key_pair()
116+
.authority_key_pair()
117117
.copy();
118118

119119
(genesis, authority_key)
@@ -236,8 +236,8 @@ async fn init_genesis(
236236
let network_key_pair: NetworkKeyPair = get_key_pair().1;
237237
let validator_info = ValidatorInfo {
238238
name: format!("validator-{i}"),
239-
protocol_key: authority_name,
240-
worker_key: worker_name,
239+
authority_key: authority_name,
240+
protocol_key: worker_name,
241241
account_address: IotaAddress::from(&account_key_pair.public()),
242242
network_key: network_key_pair.public().clone(),
243243
gas_price: 1,

crates/iota-core/src/unit_tests/authority_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4873,10 +4873,10 @@ async fn test_consensus_message_processed() {
48734873
let genesis = network_config.genesis;
48744874

48754875
let sec1 = network_config.validator_configs[0]
4876-
.protocol_key_pair()
4876+
.authority_key_pair()
48774877
.copy();
48784878
let sec2 = network_config.validator_configs[1]
4879-
.protocol_key_pair()
4879+
.authority_key_pair()
48804880
.copy();
48814881

48824882
let authority1 = init_state_with_objects_and_committee(

crates/iota-core/src/unit_tests/mysticeti_manager_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async fn test_mysticeti_manager() {
6060

6161
let consensus_config = config.consensus_config().unwrap();
6262
let registry_service = RegistryService::new(Registry::new());
63-
let secret = Arc::pin(config.protocol_key_pair().copy());
63+
let secret = Arc::pin(config.authority_key_pair().copy());
6464
let genesis = config.genesis().unwrap();
6565

6666
let state = TestAuthorityBuilder::new()
@@ -73,7 +73,7 @@ async fn test_mysticeti_manager() {
7373
let client = Arc::new(LazyMysticetiClient::default());
7474

7575
let manager = MysticetiManager::new(
76-
config.worker_key_pair().copy(),
76+
config.protocol_key_pair().copy(),
7777
config.network_key_pair().copy(),
7878
consensus_config.db_path().to_path_buf(),
7979
registry_service,

crates/iota-core/src/unit_tests/pay_iota_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ async fn execute_pay_all_iota(
444444
)
445445
.build();
446446
let genesis = network_config.genesis;
447-
let keypair = network_config.validator_configs[0].protocol_key_pair();
447+
let keypair = network_config.validator_configs[0].authority_key_pair();
448448

449449
let authority_state = init_state_with_committee(&genesis, keypair).await;
450450
let rgp = authority_state.reference_gas_price_for_testing().unwrap();

crates/iota-framework-snapshot/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"1": {
3-
"git_revision": "e341f0f217bb-dirty",
3+
"git_revision": "cc1e39584c82-dirty",
44
"package_ids": [
55
"0x0000000000000000000000000000000000000000000000000000000000000001",
66
"0x0000000000000000000000000000000000000000000000000000000000000002",

0 commit comments

Comments
 (0)