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

Fix/utxo chaining #3110

Merged
merged 18 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c5d1c9b
chore: add `testing` feature
jcnelson Apr 21, 2022
8294118
chore: add a method to connect to the sortition DB with a particular …
jcnelson Apr 21, 2022
930be96
fix: fix #2358 for good. In epoch 2.1, we correctly deduce and store …
jcnelson Apr 21, 2022
8a3ebd9
chore: add Stacks 2.1 block-commit epoch marker
jcnelson Apr 21, 2022
a358c30
chore: sync API to pass PoxConstants now
jcnelson Apr 21, 2022
95b9553
chore: when building integration tests, activate `testing` features i…
jcnelson Apr 21, 2022
8c15ede
refactor: separate tx construction from broadcast, and add a test-onl…
jcnelson Apr 21, 2022
a4a1244
feat: add fault injection for forcing a block-commit to be late. To …
jcnelson Apr 21, 2022
96048fb
chore: move some common test methods to mod.rs
jcnelson Apr 21, 2022
f0aa5e7
chore: mvoe some common test methods to mod.rs
jcnelson Apr 21, 2022
f2ebed7
chore: remove some warnings and expose `get_contract_src()` to the mo…
jcnelson Apr 21, 2022
a814968
feat: add integration test to verify (a) that epoch 2.1 transitions, …
jcnelson Apr 21, 2022
ea0f0db
Merge branch 'chore/merge-develop-to-next' into fix/utxo-chaining
jcnelson Apr 21, 2022
69920aa
chore: add #[cfg(not(test))] no-op implementations of some functions …
jcnelson Apr 21, 2022
30fc809
Merge branch 'next' into fix/utxo-chaining
jcnelson Apr 26, 2022
a02a984
refactor: put transaction delay fault injection into its own function…
jcnelson Apr 26, 2022
578f9eb
chore: use idiomatic checks to avoid subtraction with overflow
jcnelson Apr 26, 2022
e9f7949
fix: typo and wrong non-test return value for fault injection
jcnelson Apr 26, 2022
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ default = ["developer-mode"]
developer-mode = []
monitoring_prom = ["prometheus"]
slog_json = ["slog-json", "stacks_common/slog_json", "clarity/slog_json"]

testing = []

[profile.dev.package.regex]
opt-level = 2
Expand Down
20 changes: 17 additions & 3 deletions src/chainstate/burn/db/sortdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2151,7 +2151,21 @@ impl SortitionDB {
first_burn_hash: &BurnchainHeaderHash,
) -> Result<SortitionDB, db_error> {
use crate::core::StacksEpochExtension;
SortitionDB::connect_test_with_epochs(
first_block_height,
first_burn_hash,
StacksEpoch::unit_test(StacksEpochId::Epoch20, first_block_height),
)
}

/// Open a burn database at random tmp dir (used for testing)
/// But, take a particular epoch configuration
#[cfg(test)]
pub fn connect_test_with_epochs(
first_block_height: u64,
first_burn_hash: &BurnchainHeaderHash,
epochs: Vec<StacksEpoch>,
) -> Result<SortitionDB, db_error> {
let mut rng = rand::thread_rng();
let mut buf = [0u8; 32];
rng.fill_bytes(&mut buf);
Expand All @@ -2165,7 +2179,7 @@ impl SortitionDB {
first_block_height,
first_burn_hash,
get_epoch_time_secs(),
&StacksEpoch::unit_test(StacksEpochId::Epoch20, first_block_height),
&epochs,
PoxConstants::test_default(),
true,
)
Expand Down Expand Up @@ -3726,7 +3740,7 @@ impl<'a> SortitionHandleTx<'a> {
.map(|s| s.parse().expect("BUG: bad mining bonus stored in DB")))
}

#[cfg(test)]
#[cfg(any(test, feature = "testing"))]
fn store_burn_distribution(
&mut self,
new_sortition: &SortitionId,
Expand All @@ -3742,7 +3756,7 @@ impl<'a> SortitionHandleTx<'a> {
self.execute(sql, args).unwrap();
}

#[cfg(not(test))]
#[cfg(not(any(test, feature = "testing")))]
fn store_burn_distribution(
&mut self,
_new_sortition: &SortitionId,
Expand Down
Loading