Skip to content

Commit c504a33

Browse files
committed
CRC: Remove StateMachineUpdateContentBase and cleanup SignerDb
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 7b68a6d commit c504a33

File tree

7 files changed

+270
-294
lines changed

7 files changed

+270
-294
lines changed

libsigner/src/tests/signer_state.rs

Lines changed: 39 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use clarity::util::hash::Hash160;
2525

2626
use crate::v0::messages::{
2727
StateMachineUpdate as StateMachineUpdateMessage, StateMachineUpdateContent,
28-
StateMachineUpdateContentBase, StateMachineUpdateMinerState,
28+
StateMachineUpdateMinerState,
2929
};
3030
use crate::v0::signer_state::{
3131
GlobalStateEvaluator, ReplayTransactionSet, SignerStateMachine, UpdateTime,
@@ -40,16 +40,14 @@ fn generate_global_state_evaluator(num_addresses: u32) -> GlobalStateEvaluator {
4040
active_protocol_version,
4141
local_supported_signer_protocol_version,
4242
StateMachineUpdateContent::V0 {
43-
base: StateMachineUpdateContentBase {
44-
burn_block: ConsensusHash([0x55; 20]),
45-
burn_block_height: 100,
46-
current_miner: StateMachineUpdateMinerState::ActiveMiner {
47-
current_miner_pkh: Hash160([0xab; 20]),
48-
tenure_id: ConsensusHash([0x44; 20]),
49-
parent_tenure_id: ConsensusHash([0x22; 20]),
50-
parent_tenure_last_block: StacksBlockId([0x33; 32]),
51-
parent_tenure_last_block_height: 1,
52-
},
43+
burn_block: ConsensusHash([0x55; 20]),
44+
burn_block_height: 100,
45+
current_miner: StateMachineUpdateMinerState::ActiveMiner {
46+
current_miner_pkh: Hash160([0xab; 20]),
47+
tenure_id: ConsensusHash([0x44; 20]),
48+
parent_tenure_id: ConsensusHash([0x22; 20]),
49+
parent_tenure_last_block: StacksBlockId([0x33; 32]),
50+
parent_tenure_last_block_height: 1,
5351
},
5452
},
5553
)
@@ -95,12 +93,9 @@ fn determine_latest_supported_signer_protocol_versions() {
9593
local_supported_signer_protocol_version,
9694
content:
9795
StateMachineUpdateContent::V0 {
98-
base:
99-
StateMachineUpdateContentBase {
100-
burn_block,
101-
burn_block_height,
102-
current_miner,
103-
},
96+
burn_block,
97+
burn_block_height,
98+
current_miner,
10499
},
105100
..
106101
} = local_update.clone()
@@ -115,11 +110,9 @@ fn determine_latest_supported_signer_protocol_versions() {
115110
active_signer_protocol_version,
116111
new_version,
117112
StateMachineUpdateContent::V0 {
118-
base: StateMachineUpdateContentBase {
119-
burn_block,
120-
burn_block_height,
121-
current_miner: current_miner.clone(),
122-
},
113+
burn_block,
114+
burn_block_height,
115+
current_miner: current_miner.clone(),
123116
},
124117
)
125118
.unwrap();
@@ -139,11 +132,9 @@ fn determine_latest_supported_signer_protocol_versions() {
139132
active_signer_protocol_version,
140133
3,
141134
StateMachineUpdateContent::V0 {
142-
base: StateMachineUpdateContentBase {
143-
burn_block,
144-
burn_block_height,
145-
current_miner,
146-
},
135+
burn_block,
136+
burn_block_height,
137+
current_miner,
147138
},
148139
)
149140
.unwrap();
@@ -174,12 +165,9 @@ fn determine_global_burn_views() {
174165
local_supported_signer_protocol_version,
175166
content:
176167
StateMachineUpdateContent::V0 {
177-
base:
178-
StateMachineUpdateContentBase {
179-
burn_block,
180-
burn_block_height,
181-
current_miner,
182-
},
168+
burn_block,
169+
burn_block_height,
170+
current_miner,
183171
},
184172
..
185173
} = local_update.clone()
@@ -197,11 +185,9 @@ fn determine_global_burn_views() {
197185
active_signer_protocol_version,
198186
local_supported_signer_protocol_version,
199187
StateMachineUpdateContent::V0 {
200-
base: StateMachineUpdateContentBase {
201-
burn_block,
202-
burn_block_height: burn_block_height.wrapping_add(1),
203-
current_miner: current_miner.clone(),
204-
},
188+
burn_block,
189+
burn_block_height: burn_block_height.wrapping_add(1),
190+
current_miner: current_miner.clone(),
205191
},
206192
)
207193
.unwrap();
@@ -238,12 +224,9 @@ fn determine_global_states() {
238224
local_supported_signer_protocol_version,
239225
content:
240226
StateMachineUpdateContent::V0 {
241-
base:
242-
StateMachineUpdateContentBase {
243-
burn_block,
244-
burn_block_height,
245-
current_miner,
246-
},
227+
burn_block,
228+
burn_block_height,
229+
current_miner,
247230
},
248231
..
249232
} = local_update.clone()
@@ -274,11 +257,9 @@ fn determine_global_states() {
274257
active_signer_protocol_version,
275258
local_supported_signer_protocol_version,
276259
StateMachineUpdateContent::V0 {
277-
base: StateMachineUpdateContentBase {
278-
burn_block,
279-
burn_block_height,
280-
current_miner: new_miner.clone(),
281-
},
260+
burn_block,
261+
burn_block_height,
262+
current_miner: new_miner.clone(),
282263
},
283264
)
284265
.unwrap();
@@ -321,12 +302,9 @@ fn determine_global_states_with_tx_replay_set() {
321302
let StateMachineUpdateMessage {
322303
content:
323304
StateMachineUpdateContent::V0 {
324-
base:
325-
StateMachineUpdateContentBase {
326-
burn_block,
327-
burn_block_height,
328-
current_miner,
329-
},
305+
burn_block,
306+
burn_block_height,
307+
current_miner,
330308
},
331309
..
332310
} = local_update.clone()
@@ -354,11 +332,9 @@ fn determine_global_states_with_tx_replay_set() {
354332
active_signer_protocol_version,
355333
local_supported_signer_protocol_version,
356334
StateMachineUpdateContent::V1 {
357-
base: StateMachineUpdateContentBase {
358-
burn_block: ConsensusHash([20u8; 20]),
359-
burn_block_height,
360-
current_miner: current_miner.clone(),
361-
},
335+
burn_block: ConsensusHash([20u8; 20]),
336+
burn_block_height,
337+
current_miner: current_miner.clone(),
362338
replay_transactions: vec![],
363339
},
364340
)
@@ -412,11 +388,9 @@ fn determine_global_states_with_tx_replay_set() {
412388
active_signer_protocol_version,
413389
local_supported_signer_protocol_version,
414390
StateMachineUpdateContent::V1 {
415-
base: StateMachineUpdateContentBase {
416-
burn_block,
417-
burn_block_height,
418-
current_miner: current_miner.clone(),
419-
},
391+
burn_block,
392+
burn_block_height,
393+
current_miner: current_miner.clone(),
420394
replay_transactions: vec![tx.clone()],
421395
},
422396
)

0 commit comments

Comments
 (0)