mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-05-30 15:55:04 +08:00
updated test_set_signer_key_auth passing again, still work remaining
This commit is contained in:
@@ -2642,6 +2642,7 @@ fn test_set_signer_key_auth() {
|
||||
let mut signer_nonce = 0;
|
||||
let signer_key = &keys[1];
|
||||
let signer_public_key = StacksPublicKey::from_private(signer_key);
|
||||
let signer_addr = key_to_stacks_addr(&signer_key);
|
||||
let pox_addr = pox_addr_from(&signer_key);
|
||||
|
||||
// Only the address associated with `signer-key` can enable auth for that key
|
||||
@@ -2657,21 +2658,38 @@ fn test_set_signer_key_auth() {
|
||||
Some(&alice_key),
|
||||
);
|
||||
|
||||
let current_cycle = get_current_reward_cycle(&peer, &burnchain);
|
||||
println!("Current cycle: {}", current_cycle);
|
||||
|
||||
// Test that period is at least u1
|
||||
let invalid_auth_tx_period: StacksTransaction = make_pox_4_set_signer_key_auth(
|
||||
&pox_addr,
|
||||
&signer_key,
|
||||
22,
|
||||
&Pox4SignatureTopic::StackStx,
|
||||
0,
|
||||
false,
|
||||
signer_nonce,
|
||||
Some(&signer_key),
|
||||
);
|
||||
|
||||
// Test that confirmed reward cycle is at least current reward cycle
|
||||
|
||||
// Disable auth for `signer-key`
|
||||
let disable_auth_nonce = signer_nonce;
|
||||
signer_nonce += 1;
|
||||
let disable_auth_tx: StacksTransaction = make_pox_4_set_signer_key_auth(
|
||||
&pox_addr,
|
||||
&signer_key,
|
||||
1,
|
||||
22,
|
||||
&Pox4SignatureTopic::StackStx,
|
||||
lock_period,
|
||||
false,
|
||||
disable_auth_nonce,
|
||||
signer_nonce,
|
||||
None,
|
||||
);
|
||||
|
||||
let latest_block =
|
||||
peer.tenure_with_txs(&[invalid_enable_tx, disable_auth_tx], &mut coinbase_nonce);
|
||||
peer.tenure_with_txs(&[invalid_enable_tx, invalid_auth_tx_period, disable_auth_tx], &mut coinbase_nonce);
|
||||
|
||||
let alice_txs = get_last_block_sender_transactions(&observer, alice_addr);
|
||||
let invalid_enable_tx_result = alice_txs
|
||||
@@ -2682,11 +2700,18 @@ fn test_set_signer_key_auth() {
|
||||
let expected_error = Value::error(Value::Int(19)).unwrap();
|
||||
assert_eq!(invalid_enable_tx_result, expected_error);
|
||||
|
||||
let signer_txs = get_last_block_sender_transactions(&observer, signer_addr);
|
||||
|
||||
// // Print all signer transaction receipts
|
||||
println!("signer_txs: {:?}", signer_txs);
|
||||
for tx in signer_txs {
|
||||
println!("txs in signer_tx? {:?}", tx.result);
|
||||
}
|
||||
let signer_key_enabled = get_signer_key_authorization_pox_4(
|
||||
&mut peer,
|
||||
&latest_block,
|
||||
&pox_addr,
|
||||
1,
|
||||
22,
|
||||
&Pox4SignatureTopic::StackStx,
|
||||
lock_period.try_into().unwrap(),
|
||||
&signer_public_key,
|
||||
@@ -2700,7 +2725,7 @@ fn test_set_signer_key_auth() {
|
||||
let enable_auth_tx = make_pox_4_set_signer_key_auth(
|
||||
&pox_addr,
|
||||
&signer_key,
|
||||
1,
|
||||
22,
|
||||
&Pox4SignatureTopic::StackStx,
|
||||
lock_period,
|
||||
true,
|
||||
@@ -2714,7 +2739,7 @@ fn test_set_signer_key_auth() {
|
||||
&mut peer,
|
||||
&latest_block,
|
||||
&pox_addr,
|
||||
1,
|
||||
22,
|
||||
&Pox4SignatureTopic::StackStx,
|
||||
lock_period.try_into().unwrap(),
|
||||
&signer_public_key,
|
||||
@@ -2728,7 +2753,7 @@ fn test_set_signer_key_auth() {
|
||||
let disable_auth_tx = make_pox_4_set_signer_key_auth(
|
||||
&pox_addr,
|
||||
&signer_key,
|
||||
1,
|
||||
22,
|
||||
&Pox4SignatureTopic::StackStx,
|
||||
lock_period,
|
||||
false,
|
||||
@@ -2742,7 +2767,7 @@ fn test_set_signer_key_auth() {
|
||||
&mut peer,
|
||||
&latest_block,
|
||||
&pox_addr,
|
||||
1,
|
||||
22,
|
||||
&Pox4SignatureTopic::StackStx,
|
||||
lock_period.try_into().unwrap(),
|
||||
&signer_public_key,
|
||||
|
||||
Reference in New Issue
Block a user