Skip to content

Commit cbd2037

Browse files
committed
fix: add signer-key to synthetic stack-aggregation-increase event
1 parent 927e824 commit cbd2037

File tree

2 files changed

+59
-11
lines changed

2 files changed

+59
-11
lines changed

pox-locking/src/events.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,25 @@ fn create_event_info_data_code(
467467
end-cycle-id: (some (+ {reward_cycle} u1)),
468468
;; Get start cycle ID
469469
start-cycle-id: start-cycle,
470+
;; equal to args[3]
471+
signer-sig: {signer_sig},
472+
;; equal to args[4]
473+
signer-key: {signer_key},
474+
;; equal to args[5]
475+
max-amount: {max_amount},
476+
;; equal to args[6]
477+
auth-id: {auth_id},
470478
}}
471479
}})
472480
"#,
473481
pox_addr = &args[0],
474482
reward_cycle = &args[1],
475483
reward_cycle_index = &args.get(2).unwrap_or(&Value::none()),
476484
pox_set_offset = pox_set_offset.replace("%height%", "burn-block-height"),
485+
signer_sig = &args.get(3).unwrap_or(&Value::none()),
486+
signer_key = &args.get(4).unwrap_or(&Value::none()),
487+
max_amount = &args.get(5).unwrap_or(&Value::none()),
488+
auth_id = &args.get(6).unwrap_or(&Value::none()),
477489
)
478490
}
479491
"delegate-stx" => {

stackslib/src/chainstate/stacks/boot/pox_4_tests.rs

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4393,7 +4393,7 @@ fn stack_agg_increase() {
43934393
.clone()
43944394
.expect_u128()
43954395
.unwrap(),
4396-
Some(alice_signature_increase),
4396+
Some(alice_signature_increase.clone()),
43974397
&alice.public_key,
43984398
u128::MAX,
43994399
1,
@@ -4491,16 +4491,52 @@ fn stack_agg_increase() {
44914491
&bob_err_increase_result_expected
44924492
);
44934493

4494+
let bob_aggregate_increase_tx = &tx_block.receipts.get(4).unwrap();
4495+
44944496
// Fetch the aggregate increase result & check that value is true
4495-
let bob_aggregate_increase_result = &tx_block
4496-
.receipts
4497-
.get(4)
4498-
.unwrap()
4497+
let bob_aggregate_increase_result = bob_aggregate_increase_tx
44994498
.result
45004499
.clone()
45014500
.expect_result_ok()
45024501
.unwrap();
4503-
assert_eq!(bob_aggregate_increase_result, &Value::Bool(true));
4502+
assert_eq!(bob_aggregate_increase_result, Value::Bool(true));
4503+
4504+
let aggregation_increase_event = &bob_aggregate_increase_tx.events[0];
4505+
4506+
let expected_result = Value::okay(Value::Tuple(
4507+
TupleData::from_data(vec![
4508+
(
4509+
"stacker".into(),
4510+
Value::Principal(PrincipalData::from(bob.address.clone())),
4511+
),
4512+
("total-locked".into(), Value::UInt(min_ustx * 2)),
4513+
])
4514+
.unwrap(),
4515+
))
4516+
.unwrap();
4517+
4518+
let increase_op_data = HashMap::from([
4519+
(
4520+
"signer-sig",
4521+
Value::some(Value::buff_from(alice_signature_increase).unwrap()).unwrap(),
4522+
),
4523+
(
4524+
"signer-key",
4525+
Value::buff_from(alice.public_key.to_bytes_compressed()).unwrap(),
4526+
),
4527+
("max-amount", Value::UInt(u128::MAX)),
4528+
("auth-id", Value::UInt(1)),
4529+
]);
4530+
4531+
let common_data = PoxPrintFields {
4532+
op_name: "stack-aggregation-increase".to_string(),
4533+
stacker: Value::Principal(PrincipalData::from(bob.address.clone())),
4534+
balance: Value::UInt(1000000000000000000),
4535+
locked: Value::UInt(0),
4536+
burnchain_unlock_height: Value::UInt(0),
4537+
};
4538+
4539+
check_pox_print_event(&aggregation_increase_event, common_data, increase_op_data);
45044540

45054541
// Check that Bob's second pool has an assigned reward index of 1
45064542
let bob_aggregate_commit_reward_index = &tx_block
@@ -6397,7 +6433,7 @@ fn test_scenario_one() {
63976433
// Bob solo stacker-signer setup
63986434
let mut bob = StackerSignerInfo::new();
63996435
let default_initial_balances: u64 = 1_000_000_000_000_000_000;
6400-
let mut initial_balances = vec![
6436+
let initial_balances = vec![
64016437
(alice.principal.clone(), default_initial_balances),
64026438
(bob.principal.clone(), default_initial_balances),
64036439
];
@@ -6806,7 +6842,7 @@ fn test_scenario_two() {
68066842
let mut dave = StackerSignerInfo::new();
68076843

68086844
let default_initial_balances = 1_000_000_000_000_000_000;
6809-
let mut initial_balances = vec![
6845+
let initial_balances = vec![
68106846
(alice.principal.clone(), default_initial_balances),
68116847
(bob.principal.clone(), default_initial_balances),
68126848
(carl.principal.clone(), default_initial_balances),
@@ -7147,7 +7183,7 @@ fn test_scenario_three() {
71477183
// Bob stacker signer setup
71487184
let mut bob = StackerSignerInfo::new();
71497185
// Carl service signer setup
7150-
let mut carl = StackerSignerInfo::new();
7186+
let carl = StackerSignerInfo::new();
71517187
// David stacking pool operator setup
71527188
let mut david = StackerSignerInfo::new();
71537189
// Eve pool stacker setup
@@ -7624,7 +7660,7 @@ fn test_scenario_four() {
76247660
let mut bob = StackerSignerInfo::new();
76257661

76267662
let default_initial_balances = 1_000_000_000_000_000_000;
7627-
let mut initial_balances = vec![
7663+
let initial_balances = vec![
76287664
(alice.principal.clone(), default_initial_balances),
76297665
(bob.principal.clone(), default_initial_balances),
76307666
];
@@ -8564,7 +8600,7 @@ fn test_scenario_five() {
85648600
let mut mallory = StackerSignerInfo::new();
85658601

85668602
let default_initial_balances = 1_000_000_000_000_000_000;
8567-
let mut initial_balances = vec![
8603+
let initial_balances = vec![
85688604
(alice.principal.clone(), default_initial_balances),
85698605
(bob.principal.clone(), default_initial_balances),
85708606
(carl.principal.clone(), default_initial_balances),

0 commit comments

Comments
 (0)