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

Integrated/Scenario Tests In Rust #4586

Merged
merged 39 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5062e3d
first test progress
setzeus Mar 22, 2024
82b1f39
solo signing progress
setzeus Mar 22, 2024
d18cc7c
latest changes
setzeus Mar 22, 2024
410081a
updated scenario one
setzeus Mar 22, 2024
4236575
format update
setzeus Mar 23, 2024
9cc8084
progress on second scenario
setzeus Mar 23, 2024
e45e45a
WIP: initial stab at getting peer node to work for scenario 5
jferrant Mar 25, 2024
6263739
WIP: update balances to force reward slot calculations to work
jferrant Mar 26, 2024
23e3217
WIP: check aggregate key vote is successful
jferrant Mar 26, 2024
3019e21
Fix aggregate commit and until burn height calculations
jferrant Mar 27, 2024
b23faf7
WIP: something up with first nakamoto tenure
jferrant Mar 27, 2024
13bd31f
Update signers to be a bit more obvious in order of operations
jferrant Mar 27, 2024
db449cd
Do not use nakamoto reward cycles since we aren't testing that
jferrant Mar 27, 2024
01ab9f6
Add check that frank's delegation expired
jferrant Mar 27, 2024
95a1baf
Add an advance to target height function
jferrant Mar 27, 2024
18e3cf0
Add lock period to stacker verification
jferrant Mar 27, 2024
995925c
scenario test 1 local
setzeus Mar 31, 2024
2e2ca56
scenario one & five completed
setzeus Mar 31, 2024
1521cad
fixed tests
setzeus Mar 31, 2024
7ed0656
scenario two polished
setzeus Apr 1, 2024
2ad7924
updated error message
setzeus Apr 1, 2024
969f0ba
scenario three passing, writing asserts
setzeus Apr 1, 2024
921fd27
scenario three completed
setzeus Apr 1, 2024
69a2fd6
test scenario four complete
setzeus Apr 1, 2024
30f93b5
fixed assert
setzeus Apr 2, 2024
bbf8df1
begone, logs
setzeus Apr 2, 2024
de721d5
undo err update
setzeus Apr 2, 2024
a5456c9
removed epoch vars
setzeus Apr 11, 2024
0851ce0
removed comments
setzeus Apr 11, 2024
3a2a715
refactored test, stacking issues
setzeus Apr 11, 2024
040f2b1
refactored setup
setzeus Apr 15, 2024
0dcbd25
remove debugs
setzeus Apr 15, 2024
406d9e8
added scenario five comments
setzeus Apr 15, 2024
1316ac8
formatting
setzeus Apr 15, 2024
57d3311
Merge branch 'develop' into chore/rust-scenario-test
obycode Apr 16, 2024
b33ce47
Merge branch 'develop' into chore/rust-scenario-test
obycode Apr 16, 2024
6a758f5
Merge branch 'develop' into chore/rust-scenario-test
obycode Apr 16, 2024
c8932a2
Merge branch 'develop' into chore/rust-scenario-test
setzeus Apr 18, 2024
9b51ccc
updated comments
setzeus Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stackslib/src/chainstate/nakamoto/coordinator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use crate::chainstate::nakamoto::tests::get_account;
use crate::chainstate::nakamoto::tests::node::TestStacker;
use crate::chainstate::nakamoto::{NakamotoBlock, NakamotoChainState};
use crate::chainstate::stacks::address::PoxAddress;
use crate::chainstate::stacks::boot::pox_4_tests::{get_stacking_minimum, get_tip};
use crate::chainstate::stacks::boot::signers_tests::{readonly_call, readonly_call_with_sortdb};
use crate::chainstate::stacks::boot::test::{
key_to_stacks_addr, make_pox_4_lockup, make_signer_key_signature,
Expand Down
74 changes: 74 additions & 0 deletions stackslib/src/chainstate/stacks/boot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,7 @@ pub mod test {
use stacks_common::util::secp256k1::Secp256k1PublicKey;
use stacks_common::util::*;

use self::signers_tests::readonly_call;
use super::*;
use crate::burnchains::{Address, PublicKey};
use crate::chainstate::burn::db::sortdb::*;
Expand Down Expand Up @@ -1728,6 +1729,58 @@ pub mod test {
}
}

pub fn get_stacker_info_pox_4(
peer: &mut TestPeer,
addr: &PrincipalData,
) -> Option<(PoxAddress, u128, u128, Vec<u128>)> {
let value_opt = eval_at_tip(
peer,
"pox-4",
&format!("(get-stacker-info '{})", addr.to_string()),
);
let data = if let Some(d) = value_opt.expect_optional().unwrap() {
d
} else {
return None;
};

let data = data.expect_tuple().unwrap();
let pox_addr = tuple_to_pox_addr(
data.get("pox-addr")
.unwrap()
.to_owned()
.expect_tuple()
.unwrap(),
);
let first_reward_cycle = data
.get("first-reward-cycle")
.unwrap()
.to_owned()
.expect_u128()
.unwrap();
let lock_period = data
.get("lock-period")
.unwrap()
.to_owned()
.expect_u128()
.unwrap();
let reward_set_indices = data
.get("reward-set-indexes")
.unwrap()
.to_owned()
.expect_list()
.unwrap()
.iter()
.map(|v| v.to_owned().expect_u128().unwrap())
.collect();
Some((
pox_addr,
first_reward_cycle,
lock_period,
reward_set_indices,
))
}

pub fn get_stacker_info(
peer: &mut TestPeer,
addr: &PrincipalData,
Expand Down Expand Up @@ -1987,6 +2040,27 @@ pub mod test {
make_tx(key, nonce, 1, payload)
}

pub fn get_approved_aggregate_key(
peer: &mut TestPeer<'_>,
latest_block_id: StacksBlockId,
reward_cycle: u128,
) -> Option<Point> {
let key_opt = readonly_call(
peer,
&latest_block_id,
SIGNERS_VOTING_NAME.into(),
"get-approved-aggregate-key".into(),
vec![Value::UInt(reward_cycle)],
)
.expect_optional()
.unwrap();
key_opt.map(|key_value| {
let data = key_value.expect_buff(33).unwrap();
let compressed_data = Compressed::try_from(data.as_slice()).unwrap();
Point::try_from(&compressed_data).unwrap()
})
}

pub fn make_pox_2_increase(
key: &StacksPrivateKey,
nonce: u64,
Expand Down
Loading