Skip to content

Commit

Permalink
chore: remove changes related to revoke
Browse files Browse the repository at this point in the history
  • Loading branch information
friedger committed Dec 12, 2023
1 parent c068795 commit ff2c499
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 56 deletions.
22 changes: 5 additions & 17 deletions pox-locking/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ use stacks_common::{error, test_debug};
/// - for delegate stacking functions, it's the first argument
fn get_stacker(sender: &PrincipalData, function_name: &str, args: &[Value]) -> Value {
match function_name {
"stack-stx"
| "stack-increase"
| "stack-extend"
| "delegate-stx"
| "revoke-delegate-stx" => Value::Principal(sender.clone()),
"stack-stx" | "stack-increase" | "stack-extend" | "delegate-stx" => {
Value::Principal(sender.clone())
}
_ => args[0].clone(),
}
}
Expand Down Expand Up @@ -337,20 +335,11 @@ fn create_event_info_data_code(function_name: &str, args: &[Value]) -> String {
pox_addr = &args[3],
)
}
"revoke-delegate-stx" => {
format!(
r#"
{{
data: {{ }}
}}
"#,
)
}
_ => "{{ data: {{ unimplemented: true }} }}".into(),
}
}

/// Synthesize an events data tuple to return on the successful execution of a pox-2 or pox-3 or pox-4 stacking
/// Synthesize an events data tuple to return on the successful execution of a pox-2 or pox-3 stacking
/// function. It runs a series of Clarity queries against the PoX contract's data space (including
/// calling PoX functions).
pub fn synthesize_pox_event_info(
Expand All @@ -373,8 +362,7 @@ pub fn synthesize_pox_event_info(
| "delegate-stack-extend"
| "stack-increase"
| "delegate-stack-increase"
| "delegate-stx"
| "revoke-delegate-stx" => Some(create_event_info_stack_or_delegate_code(
| "delegate-stx" => Some(create_event_info_stack_or_delegate_code(
sender,
function_name,
args,
Expand Down
42 changes: 3 additions & 39 deletions stackslib/src/chainstate/stacks/boot/pox_3_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,12 +1284,6 @@ fn delegate_stack_increase() {

let tip = get_tip(peer.sortdb.as_ref());

// submit revoke delegation tx
let alice_revoke_elegation =
make_pox_3_contract_call(&alice, alice_nonce, "revoke-delegate-stx", vec![]);
let alice_revoke_delegation_pox_3_nonce = alice_nonce;
alice_nonce += 1;

// submit delegation tx
let alice_delegation_1 = make_pox_3_contract_call(
&alice,
Expand Down Expand Up @@ -1321,11 +1315,7 @@ fn delegate_stack_increase() {
bob_nonce += 1;

latest_block = peer.tenure_with_txs(
&[
alice_revoke_elegation,
alice_delegation_1,
delegate_stack_tx,
],
&[alice_delegation_1, delegate_stack_tx],
&mut coinbase_nonce,
);

Expand Down Expand Up @@ -1501,7 +1491,7 @@ fn delegate_stack_increase() {
}
}

assert_eq!(alice_txs.len() as u64, 5);
assert_eq!(alice_txs.len() as u64, 4);
assert_eq!(bob_txs.len() as u64, 10);

// transaction should fail because Alice cannot increase her own stacking amount while delegating
Expand Down Expand Up @@ -1557,32 +1547,6 @@ fn delegate_stack_increase() {
"(err 18)"
);

// check event for revoke delegation tx
let revoke_delegation_tx_events = &alice_txs
.get(&alice_revoke_delegation_pox_3_nonce)
.unwrap()
.clone()
.events;
assert_eq!(revoke_delegation_tx_events.len() as u64, 1);
let revoke_delegation_tx = &revoke_delegation_tx_events[0];
let revoke_delegate_stx_op_data = HashMap::from([]);
let common_data = PoxPrintFields {
op_name: "revoke-delegate-stx".to_string(),
stacker: Value::Principal(
StacksAddress::from_string("ST2Q1B4S2DY2Y96KYNZTVCCZZD1V9AGWCS5MFXM4C")
.unwrap()
.to_account_principal(),
),
balance: Value::UInt(10240000000000),
locked: Value::UInt(0),
burnchain_unlock_height: Value::UInt(0),
};
check_pox_print_event(
revoke_delegation_tx,
common_data,
revoke_delegate_stx_op_data,
);

for delegation_nonce in [alice_delegation_pox_2_nonce, alice_delegation_pox_3_nonce] {
let delegate_stx_tx = &alice_txs.get(&delegation_nonce).unwrap().clone().events[0];
let delegate_stx_op_data = HashMap::from([
Expand Down Expand Up @@ -3142,7 +3106,7 @@ fn pox_3_getters() {
tip.block_height,
);

// bob delegates to charlie
// bob deleates to charlie
let bob_delegate_tx = make_pox_3_contract_call(
&bob,
0,
Expand Down

0 comments on commit ff2c499

Please sign in to comment.