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

Feat/stackerdb #3534

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
92fb122
feat: BurnchainView now commits to the consensus hash of the start of…
jcnelson Jan 27, 2023
cb28555
feat: calculate the burnchain view to include the consensus hash from…
jcnelson Jan 27, 2023
0c5fbfa
chore: API sync
jcnelson Jan 27, 2023
8faa560
feat: FromRow<u32> and FromRow<StacksAddress>
jcnelson Jan 27, 2023
3c14e57
feat: top-level data structures for the StackerDB system
jcnelson Jan 27, 2023
6881944
feat: chunk and metadata database for stacker DBs
jcnelson Jan 27, 2023
5b95856
feat: cryptographic operations on chunks and chunk metadata
jcnelson Jan 27, 2023
2cb4cce
feat: basic configuration defaults for stacker DBs. Much of this is …
jcnelson Jan 27, 2023
b74dc25
chore: stub unimplemented trait implementations for StackerDBSelectors
jcnelson Jan 27, 2023
102290c
feat: first attempt at a synchronization state machine for stacker DBs
jcnelson Jan 27, 2023
34190ea
chore: tests on crypgraphic operations
jcnelson Jan 27, 2023
24c5c74
chore: tests on database operations
jcnelson Jan 27, 2023
6e3d2bc
chore: test module
jcnelson Jan 27, 2023
f311f11
chore: initial stab at replica synchronization tests
jcnelson Jan 27, 2023
c557cf6
feat: implement handlers for stacker DB handshakes, chunk inventory r…
jcnelson Jan 27, 2023
9d424da
chore: codec implementations for all stacker DB messages
jcnelson Jan 27, 2023
da7e9f1
chore: bandwidth cap on stacker DB chunks
jcnelson Jan 27, 2023
a5dde6a
feat: peer DB now tracks which stacker DB instances are replicated by…
jcnelson Jan 27, 2023
7fc3d35
chore: API sync
jcnelson Jan 27, 2023
09a531f
feat: new stacker DB message definitions, and unit test framework exp…
jcnelson Jan 27, 2023
67523ef
feat: support stacker DB handshakes, and extract out p2p neighbor set…
jcnelson Jan 27, 2023
534c9ff
chore: patch in stacker DB state machines and DB connection to the Pe…
jcnelson Jan 27, 2023
215fdb4
chore: test-gate verbose debug output
jcnelson Jan 27, 2023
9203eec
feat: relayer now consuems and stores stacker db chunks
jcnelson Jan 27, 2023
b15e1b8
chore: add a way to get the stacker DB path
jcnelson Jan 27, 2023
6720adb
chore: API sync
jcnelson Jan 27, 2023
305ce1d
feat: allow tests to disable edge-trigger torture test
jcnelson Jan 27, 2023
c5f0adb
feat: disable edge-trigger torture test so these tests run quickly
jcnelson Jan 27, 2023
9fb35ff
fix: fix failing unit test because it can now accept a StackerDBHands…
jcnelson Jan 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/burnchains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ pub struct BurnchainView {
pub burn_block_hash: BurnchainHeaderHash, // last-seen burn block hash
pub burn_stable_block_height: u64, // latest stable block height (e.g. chain tip minus 7)
pub burn_stable_block_hash: BurnchainHeaderHash, // latest stable burn block hash
pub last_burn_block_hashes: HashMap<u64, BurnchainHeaderHash>, // map all block heights from burn_block_height back to the oldest one we'll take for considering the peer a neighbor
pub last_burn_block_hashes: HashMap<u64, BurnchainHeaderHash>, // map all block heights from burn_block_height back to the oldest one we'll take for considering the peer a neighbor,
pub rc_consensus_hash: ConsensusHash, // consensus hash of the current reward cycle's start block
}

/// The burnchain block's encoded state transition:
Expand Down
21 changes: 18 additions & 3 deletions src/chainstate/burn/db/sortdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3661,7 +3661,7 @@ impl SortitionDB {
/// Get a burn blockchain snapshot, given a burnchain configuration struct.
/// Used mainly by the network code to determine what the chain tip currently looks like.
pub fn get_burnchain_view(
conn: &DBConn,
conn: &SortitionDBConn,
burnchain: &Burnchain,
chain_tip: &BlockSnapshot,
) -> Result<BurnchainView, db_error> {
Expand Down Expand Up @@ -3733,19 +3733,34 @@ impl SortitionDB {
.unwrap_or(&burnchain.first_block_hash)
.clone();

let rc = burnchain
.block_height_to_reward_cycle(chain_tip.block_height)
.expect("FATAL: block height does not have a reward cycle");

let rc_height = burnchain.reward_cycle_to_block_height(rc);
let rc_consensus_hash = SortitionDB::get_ancestor_snapshot(
conn,
cmp::min(chain_tip.block_height, rc_height),
&chain_tip.sortition_id,
)?
.map(|sn| sn.consensus_hash)
.ok_or(db_error::NotFoundError)?;

test_debug!(
"Chain view: {},{}-{},{}",
"Chain view: {},{}-{},{},{}",
chain_tip.block_height,
chain_tip.burn_header_hash,
stable_block_height,
&burn_stable_block_hash
&burn_stable_block_hash,
&rc_consensus_hash,
);
Ok(BurnchainView {
burn_block_height: chain_tip.block_height,
burn_block_hash: chain_tip.burn_header_hash,
burn_stable_block_height: stable_block_height,
burn_stable_block_hash: burn_stable_block_hash,
last_burn_block_hashes: last_burn_block_hashes,
rc_consensus_hash,
})
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ check if the associated microblocks can be downloaded
None,
0,
UrlString::try_from("abc").unwrap(),
vec![],
);

let header_hashes = {
Expand Down