Skip to content

Commit 2f26d5a

Browse files
Seulgi Kimsgkim126
authored andcommitted
Rename ChangeShardOwners/Users to SetShardOwners/Users
1 parent f11b14d commit 2f26d5a

File tree

4 files changed

+45
-45
lines changed

4 files changed

+45
-45
lines changed

rpc/src/v1/types/action.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ pub enum Action {
4747
key: Public,
4848
},
4949
CreateShard,
50-
ChangeShardOwners {
50+
SetShardOwners {
5151
shard_id: ShardId,
5252
owners: Vec<PlatformAddress>,
5353
},
54-
ChangeShardUsers {
54+
SetShardUsers {
5555
shard_id: ShardId,
5656
users: Vec<PlatformAddress>,
5757
},
@@ -94,17 +94,17 @@ impl Action {
9494
key,
9595
},
9696
ActionType::CreateShard => Action::CreateShard,
97-
ActionType::ChangeShardOwners {
97+
ActionType::SetShardOwners {
9898
shard_id,
9999
owners,
100-
} => Action::ChangeShardOwners {
100+
} => Action::SetShardOwners {
101101
shard_id,
102102
owners: owners.into_iter().map(|owner| PlatformAddress::create(VERSION, network_id, owner)).collect(),
103103
},
104-
ActionType::ChangeShardUsers {
104+
ActionType::SetShardUsers {
105105
shard_id,
106106
users,
107-
} => Action::ChangeShardUsers {
107+
} => Action::SetShardUsers {
108108
shard_id,
109109
users: users.into_iter().map(|user| PlatformAddress::create(VERSION, network_id, user)).collect(),
110110
},
@@ -148,17 +148,17 @@ impl From<Action> for ActionType {
148148
key,
149149
},
150150
Action::CreateShard => ActionType::CreateShard,
151-
Action::ChangeShardOwners {
151+
Action::SetShardOwners {
152152
shard_id,
153153
owners,
154-
} => ActionType::ChangeShardOwners {
154+
} => ActionType::SetShardOwners {
155155
shard_id,
156156
owners: owners.into_iter().map(Into::into).collect(),
157157
},
158-
Action::ChangeShardUsers {
158+
Action::SetShardUsers {
159159
shard_id,
160160
users,
161-
} => ActionType::ChangeShardUsers {
161+
} => ActionType::SetShardUsers {
162162
shard_id,
163163
users: users.into_iter().map(Into::into).collect(),
164164
},

spec/JSON-RPC.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ A base32 string that starts with "ccc" or "tcc". See [the specification](https:/
6969
- action: "setRegularKey"
7070
- key: `H512`
7171

72-
### ChangeShardOwners Action
72+
### SetShardOwners Action
7373

74-
- action: "changeShardOwners"
74+
- action: "setShardOwners"
7575
- shard_id: `number`
7676
- owners: `PlatformAddress[]`
7777

78-
### ChangeShardUsers Action
78+
### SetShardUsers Action
7979

80-
- action: "changeShardUsers"
80+
- action: "setShardUsers"
8181
- shard_id: `number`
8282
- users: `PlatformAddress[]`
8383

state/src/impls/top_level.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,14 @@ impl TopLevelState {
469469
self.create_shard(&shard_creation_cost, fee_payer)?;
470470
Ok(ParcelInvoice::SingleSuccess)
471471
}
472-
Action::ChangeShardOwners {
472+
Action::SetShardOwners {
473473
shard_id,
474474
owners,
475475
} => {
476476
self.change_shard_owners(*shard_id, owners, fee_payer)?;
477477
Ok(ParcelInvoice::SingleSuccess)
478478
}
479-
Action::ChangeShardUsers {
479+
Action::SetShardUsers {
480480
shard_id,
481481
users,
482482
} => {
@@ -2431,7 +2431,7 @@ mod tests_parcel {
24312431
}
24322432

24332433
#[test]
2434-
fn change_shard_owners() {
2434+
fn set_shard_owners() {
24352435
let (sender, sender_public) = address();
24362436

24372437
let mut state = get_temp_state();
@@ -2445,7 +2445,7 @@ mod tests_parcel {
24452445

24462446
let parcel = Parcel {
24472447
fee: 5.into(),
2448-
action: Action::ChangeShardOwners {
2448+
action: Action::SetShardOwners {
24492449
shard_id,
24502450
owners: owners.clone(),
24512451
},
@@ -2491,7 +2491,7 @@ mod tests_parcel {
24912491

24922492
let parcel = Parcel {
24932493
fee: 5.into(),
2494-
action: Action::ChangeShardOwners {
2494+
action: Action::SetShardOwners {
24952495
shard_id,
24962496
owners,
24972497
},
@@ -2509,7 +2509,7 @@ mod tests_parcel {
25092509
}
25102510

25112511
#[test]
2512-
fn only_owner_can_change_owners() {
2512+
fn only_owner_can_set_owners() {
25132513
let (original_owner, _) = address();
25142514

25152515
let mut state = get_temp_state();
@@ -2539,7 +2539,7 @@ mod tests_parcel {
25392539

25402540
let parcel = Parcel {
25412541
fee: 5.into(),
2542-
action: Action::ChangeShardOwners {
2542+
action: Action::SetShardOwners {
25432543
shard_id,
25442544
owners,
25452545
},
@@ -2557,7 +2557,7 @@ mod tests_parcel {
25572557
}
25582558

25592559
#[test]
2560-
fn change_shard_owners_fail_on_invalid_shard_id() {
2560+
fn set_shard_owners_fail_on_invalid_shard_id() {
25612561
let (sender, sender_public) = address();
25622562

25632563
let mut state = get_temp_state();
@@ -2573,7 +2573,7 @@ mod tests_parcel {
25732573

25742574
let parcel = Parcel {
25752575
fee: 5.into(),
2576-
action: Action::ChangeShardOwners {
2576+
action: Action::SetShardOwners {
25772577
shard_id,
25782578
owners: owners.clone(),
25792579
},
@@ -2593,7 +2593,7 @@ mod tests_parcel {
25932593
}
25942594

25952595
#[test]
2596-
fn user_cannot_change_owners() {
2596+
fn user_cannot_set_owners() {
25972597
let (original_owner, _) = address();
25982598
let (sender, sender_public) = address();
25992599

@@ -2623,7 +2623,7 @@ mod tests_parcel {
26232623

26242624
let parcel = Parcel {
26252625
fee: 5.into(),
2626-
action: Action::ChangeShardOwners {
2626+
action: Action::SetShardOwners {
26272627
shard_id,
26282628
owners,
26292629
},
@@ -2717,7 +2717,7 @@ mod tests_parcel {
27172717
}
27182718

27192719
#[test]
2720-
fn change_shard_users() {
2720+
fn set_shard_users() {
27212721
let network_id = "a2".into();
27222722
let shard_id = 0;
27232723

@@ -2736,7 +2736,7 @@ mod tests_parcel {
27362736

27372737
let parcel = Parcel {
27382738
fee: 5.into(),
2739-
action: Action::ChangeShardUsers {
2739+
action: Action::SetShardUsers {
27402740
shard_id,
27412741
users: new_users.clone(),
27422742
},
@@ -2754,7 +2754,7 @@ mod tests_parcel {
27542754

27552755

27562756
#[test]
2757-
fn user_cannot_change_shard_users() {
2757+
fn user_cannot_set_shard_users() {
27582758
let network_id = "a2".into();
27592759
let shard_id = 0;
27602760

@@ -2774,7 +2774,7 @@ mod tests_parcel {
27742774

27752775
let parcel = Parcel {
27762776
fee: 5.into(),
2777-
action: Action::ChangeShardUsers {
2777+
action: Action::SetShardUsers {
27782778
shard_id,
27792779
users: new_users.clone(),
27802780
},

types/src/parcel/action.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const CHANGE_SHARD_STATE: u8 = 1;
2626
const PAYMENT: u8 = 2;
2727
const SET_REGULAR_KEY: u8 = 3;
2828
const CREATE_SHARD: u8 = 4;
29-
const CHANGE_SHARD_OWNERS: u8 = 5;
30-
const CHANGE_SHARD_USERS: u8 = 6;
29+
const SET_SHARD_OWNERS: u8 = 5;
30+
const SET_SHARD_USERS: u8 = 6;
3131
const CUSTOM: u8 = 0xFF;
3232

3333
#[derive(Debug, Clone, PartialEq, Eq, RlpDecodable, RlpEncodable)]
@@ -54,11 +54,11 @@ pub enum Action {
5454
key: Public,
5555
},
5656
CreateShard,
57-
ChangeShardOwners {
57+
SetShardOwners {
5858
shard_id: ShardId,
5959
owners: Vec<Address>,
6060
},
61-
ChangeShardUsers {
61+
SetShardUsers {
6262
shard_id: ShardId,
6363
users: Vec<Address>,
6464
},
@@ -106,21 +106,21 @@ impl Encodable for Action {
106106
s.begin_list(1);
107107
s.append(&CREATE_SHARD);
108108
}
109-
Action::ChangeShardOwners {
109+
Action::SetShardOwners {
110110
shard_id,
111111
owners,
112112
} => {
113113
s.begin_list(3);
114-
s.append(&CHANGE_SHARD_OWNERS);
114+
s.append(&SET_SHARD_OWNERS);
115115
s.append(shard_id);
116116
s.append_list(owners);
117117
}
118-
Action::ChangeShardUsers {
118+
Action::SetShardUsers {
119119
shard_id,
120120
users,
121121
} => {
122122
s.begin_list(3);
123-
s.append(&CHANGE_SHARD_USERS);
123+
s.append(&SET_SHARD_USERS);
124124
s.append(shard_id);
125125
s.append_list(users);
126126
}
@@ -169,20 +169,20 @@ impl Decodable for Action {
169169
}
170170
Ok(Action::CreateShard)
171171
}
172-
CHANGE_SHARD_OWNERS => {
172+
SET_SHARD_OWNERS => {
173173
if rlp.item_count()? != 3 {
174174
return Err(DecoderError::RlpIncorrectListLen)
175175
}
176-
Ok(Action::ChangeShardOwners {
176+
Ok(Action::SetShardOwners {
177177
shard_id: rlp.val_at(1)?,
178178
owners: rlp.list_at(2)?,
179179
})
180180
}
181-
CHANGE_SHARD_USERS => {
181+
SET_SHARD_USERS => {
182182
if rlp.item_count()? != 3 {
183183
return Err(DecoderError::RlpIncorrectListLen)
184184
}
185-
Ok(Action::ChangeShardUsers {
185+
Ok(Action::SetShardUsers {
186186
shard_id: rlp.val_at(1)?,
187187
users: rlp.list_at(2)?,
188188
})
@@ -203,16 +203,16 @@ mod tests {
203203
use super::*;
204204

205205
#[test]
206-
fn encode_and_decode_change_shard_owners() {
207-
rlp_encode_and_decode_test!(Action::ChangeShardOwners {
206+
fn encode_and_decode_set_shard_owners() {
207+
rlp_encode_and_decode_test!(Action::SetShardOwners {
208208
shard_id: 1,
209209
owners: vec![Address::random(), Address::random()],
210210
});
211211
}
212212

213213
#[test]
214-
fn encode_and_decode_change_shard_users() {
215-
rlp_encode_and_decode_test!(Action::ChangeShardUsers {
214+
fn encode_and_decode_set_shard_users() {
215+
rlp_encode_and_decode_test!(Action::SetShardUsers {
216216
shard_id: 1,
217217
users: vec![Address::random(), Address::random()],
218218
});

0 commit comments

Comments
 (0)