Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cycle-id ranges to synthetic pox events #4414

Merged
merged 12 commits into from
Mar 14, 2024
Prev Previous commit
Next Next commit
fix: update revoke pox event
  • Loading branch information
janniks committed Mar 13, 2024
commit d499381042613136e65b5556bbe3214a2647b9ef
2 changes: 1 addition & 1 deletion pox-locking/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ fn create_event_info_data_code(
data: {{
delegate-to: '{delegate_to},
;; Get end cycle ID
end-cycle-id: (some (+ (current-pox-reward-cycle) u1)),
end-cycle-id: none,
;; Get start cycle ID
start-cycle-id: (+ (current-pox-reward-cycle) u1),
}},
Expand Down
6 changes: 4 additions & 2 deletions stackslib/src/chainstate/stacks/boot/pox_4_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,6 @@ fn pox_4_check_cycle_id_range_in_print_events_in_prepare_phase() {
let steph_stacking_receipt = txs.get(&steph_stacking.txid()).unwrap().clone();
assert_eq!(steph_stacking_receipt.events.len(), 2);
let steph_stacking_op_data = HashMap::from([
("prep", Value::UInt(1)), // DEBUG
("start-cycle-id", Value::UInt(next_cycle + 1)), // +1 because steph stacked during the prepare phase
(
"end-cycle-id",
Expand Down Expand Up @@ -1861,7 +1860,10 @@ fn pox_4_revoke_delegate_stx_events() {
get_tip(peer.sortdb.as_ref()).block_height
);
let block_height = get_tip(peer.sortdb.as_ref()).block_height;
let current_cycle = get_current_reward_cycle(&peer, &burnchain);
let next_cycle = current_cycle + 1;
let min_ustx = get_stacking_minimum(&mut peer, &latest_block.unwrap());

let steph_stacking = make_pox_4_contract_call(
&steph,
0,
Expand Down Expand Up @@ -1954,7 +1956,7 @@ fn pox_4_revoke_delegate_stx_events() {
assert_eq!(revoke_delegation_tx_events.len() as u64, 1);
let revoke_delegation_tx_event = &revoke_delegation_tx_events[0];
let revoke_delegate_stx_op_data = HashMap::from([
("start-cycle-id", Value::UInt(22)),
("start-cycle-id", Value::UInt(next_cycle)),
("end-cycle-id", Optional(OptionalData { data: None })),
(
"delegate-to",
Expand Down