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

Time based tenure extend #5530

Merged
merged 141 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 136 commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
8fe3394
test: add test for tenure-extend upon failed miner
obycode Nov 9, 2024
311ad50
feat: implement tenure-extend after bad sortition winner
obycode Nov 12, 2024
2a4a09b
feat: make signer accept tenure extend on bad sortition
obycode Nov 13, 2024
c294617
Merge branch 'develop' into feat/tenure-extend-no-blocks
obycode Nov 13, 2024
a56a73c
test: add `tenure_extend_after_bad_commit` to yaml file
obycode Nov 14, 2024
6438551
refactor: move the `StackerDBChannel` into the `EventDispatcher`
obycode Nov 14, 2024
4420c82
feat: add an index for block state
obycode Nov 14, 2024
3fa8116
docs: update changelogs
obycode Nov 14, 2024
0b3a2c1
Merge branch 'develop' into feat/tenure-extend-no-blocks
obycode Nov 14, 2024
df8f240
chore: improve comment about checking the parent tenure
obycode Nov 14, 2024
44769cf
test: add unit test for `SignerDb::get_canonical_tip`
obycode Nov 14, 2024
4c7c5aa
chore: remove unnecessary log
obycode Nov 14, 2024
a9acfa0
feat: simplify signerdb migration
obycode Nov 14, 2024
58fda00
chore: cleanup unused
obycode Nov 15, 2024
2178846
refactor: clean up `continue_tenure`
obycode Nov 15, 2024
d8140e0
refactor: `last_block_contains_tenure_change_tx`
obycode Nov 15, 2024
54c88c6
test: additional checks requested in PR review
obycode Nov 15, 2024
ba2faf7
feat: add ability to disable tenure-extend for tests
obycode Nov 15, 2024
965f58b
fix: fix import for test-only feature
obycode Nov 15, 2024
cd5e7cc
refactor: add comments and improve naming
obycode Nov 15, 2024
52e0d1f
Add tenure_extend_timestamp to Block Response Reject and Accept messages
jferrant Nov 15, 2024
9a327c4
Change to use u64::MAX in default value of tenure_extend_timestamp
jferrant Nov 15, 2024
9b4b89c
Fix failing test
jferrant Nov 15, 2024
4de3da9
Add timestamp calculation to all block responses
jferrant Nov 16, 2024
91be5cc
wip: integration tests for tenure extends
hstove Nov 16, 2024
012ed87
feat: add validation time to block proposal response
obycode Nov 18, 2024
de7b677
chore: make `validation_time_ms` a `u64`
obycode Nov 18, 2024
a8c09a1
Merge pull request #5466 from stacks-network/chore/add-timestamp-to-b…
aldur Nov 18, 2024
9308df9
Merge pull request #5474 from stacks-network/feat/update-block-valida…
obycode Nov 18, 2024
f1c442a
Merge branch 'feat/time-based-tenure-extend' of https://github.com/st…
jferrant Nov 18, 2024
510a12f
Use timestamp of known globally accepted blocks to determine tenure s…
jferrant Nov 18, 2024
132b759
Do not use sortition state when responding to a specific block proposal
jferrant Nov 18, 2024
ca8f4e3
Update testing directive rejection to use correct tenure extend times…
jferrant Nov 18, 2024
32d7808
Fix comment on validaiton_time_ms
jferrant Nov 18, 2024
7f6e5fc
Merge branch 'feat/tenure-extend-no-blocks' into feat/miner-tenure-ex…
obycode Nov 18, 2024
562982c
Use tenure extend timestamp to determine if enough time has passed fo…
jferrant Nov 18, 2024
89eaa85
Test: add extra logging for help with CI
jferrant Nov 18, 2024
0075c40
Merge remote-tracking branch 'origin/chore/calc-tenure-idle-timestamp…
hstove Nov 18, 2024
9eeb3e8
CRC: add comment about get globally accepted blocks in descending order
jferrant Nov 18, 2024
e138c37
Merge pull request #5470 from stacks-network/chore/calc-tenure-idle-t…
jferrant Nov 18, 2024
bbbbed6
Merge branch 'feat/time-based-tenure-extend' of https://github.com/st…
jferrant Nov 19, 2024
1665a1a
CRC: fix typo in comment
jferrant Nov 19, 2024
4b77c10
Miner forking test fix attempt
jferrant Nov 19, 2024
4b60084
Merge pull request #5478 from stacks-network/feat/signers-allow-time-…
jferrant Nov 19, 2024
5c7ab3a
Merge branch 'feat/time-based-tenure-extend' of https://github.com/st…
jferrant Nov 19, 2024
c361f1d
Merge branch 'develop' into feat/time-based-tenure-extend
obycode Nov 20, 2024
3297863
Merge branch 'feat/time-based-tenure-extend' into feat/miner-tenure-e…
obycode Nov 20, 2024
3519c7f
feat: add artificial delay to block validation processing time
hstove Nov 20, 2024
2c28e16
Ignore bootcode contract call and stx transfer only blocks in process…
jferrant Nov 20, 2024
4311015
feat: use versioned signer message data
hstove Nov 21, 2024
b6cf238
CRC: small optimization to 0 out the validation time of ignored blocks
jferrant Nov 21, 2024
f0228c9
feat: move sign coordinator logic into its own thread
obycode Nov 21, 2024
e13ba06
make a smaller table for easier retrieval of the timestamp calculation
jferrant Nov 21, 2024
f305147
Only migrate the most recent reward cycle data (from the current and …
jferrant Nov 21, 2024
71dd856
Make tenure_blocks insertion a trigger for blocks
jferrant Nov 21, 2024
4896d70
fix: max possible size for deserializing block response data
hstove Nov 22, 2024
38e3ef0
feat: unit test using older version of BlockAccepted to verify deseri…
hstove Nov 22, 2024
59e74ac
Merge pull request #5488 from stacks-network/chore/ignore-stx-transfe…
obycode Nov 22, 2024
bec947a
Merge branch 'feat/time-based-tenure-extend' of https://github.com/st…
jferrant Nov 22, 2024
c8a0f95
CRC: fix broken test build and add is_zero helper fn and check for ex…
jferrant Nov 22, 2024
78bcf0a
Merge pull request #5489 from stacks-network/feat/block-response-data…
hstove Nov 22, 2024
8d9cd35
Merge remote-tracking branch 'origin/feat/time-based-tenure-extend' i…
hstove Nov 22, 2024
6a848e3
chore: add wip tests to bitcoin-tests
hstove Nov 22, 2024
04270d7
feat: add timeout and additional checks in `get_block_status`
obycode Nov 22, 2024
eddada4
Merge branch 'feat/time-based-tenure-extend' into feat/miner-tenure-e…
obycode Nov 22, 2024
f92c819
chore: `SignerDBListener` -> `StackerDBListener`
obycode Nov 22, 2024
cf540a5
ifix: resolve merge errors
obycode Nov 22, 2024
aea205b
chore: finish rename
obycode Nov 22, 2024
d173d98
fix: replace the channel receiver when the listener stops
obycode Nov 22, 2024
a21fa4d
feat: shutdown stacker db listener with miner
obycode Nov 25, 2024
ab0807e
chore: return okay when exit is requested
obycode Nov 25, 2024
5d516a8
fix: drop lock in `propose_block`
obycode Nov 26, 2024
1a67a1c
feat: extend tenure based on time
obycode Nov 26, 2024
48c8a10
chore: cleanup
obycode Nov 26, 2024
ecb92c4
Merge branch 'develop' into feat/time-based-tenure-extend
obycode Nov 26, 2024
31b9c0b
Merge branch 'feat/time-based-tenure-extend' into feat/miner-tenure-e…
obycode Nov 26, 2024
8929537
fix: resolve errors after merge
obycode Nov 26, 2024
65c5b70
chore: remove duplicates in CHANGELOGs due to merge
obycode Nov 26, 2024
280d536
fix: merge artifact
obycode Nov 26, 2024
a4d378f
fix: merge artifacts
obycode Nov 26, 2024
0ad8751
Merge branch 'feat/miner-tenure-extend' into feat/tenure-idle-tests
obycode Nov 26, 2024
3c373e0
Merge branch 'feat/time-based-tenure-extend' of https://github.com/st…
jferrant Nov 26, 2024
379ce66
chore: upgrade debug log to info
obycode Nov 26, 2024
09ea89b
CRC: delete old blocks table and migrate data over to new one with bl…
jferrant Nov 26, 2024
a03e985
Merge branch 'feat/miner-tenure-extend' into feat/tenure-idle-tests
obycode Nov 26, 2024
6ae5408
CRC: fix typo and use the block validation
jferrant Nov 26, 2024
47460a7
CRC: update test to account for state properly and fix broken query g…
jferrant Nov 26, 2024
1011e21
CRC: remove data migration specific scalar functions
jferrant Nov 26, 2024
cef0dd4
refactor: move synchronization details into `StackerDBListenerComms`
obycode Nov 27, 2024
e3f31b3
Merge branch 'feat/miner-tenure-extend' into feat/tenure-idle-tests
obycode Nov 27, 2024
efe2ab4
Fix signer db set_block_broadcasted typo and update test to catch
jferrant Nov 27, 2024
96f1a59
Increase idle timeout and make sure that the blocks are globally acce…
jferrant Nov 27, 2024
2920032
Merge pull request #5494 from stacks-network/chore/cache-timestamp-calc
jferrant Nov 27, 2024
0674bf5
Merge branch 'feat/time-based-tenure-extend' into feat/miner-tenure-e…
obycode Nov 27, 2024
1b78589
Fix CREATE_INDEXES_5
jferrant Nov 28, 2024
ec8b83e
Merge branch 'feat/time-based-tenure-extend' of https://github.com/st…
jferrant Nov 28, 2024
ae9383a
chore: downgrade log to debug
obycode Dec 2, 2024
1e520b9
Fix math in tenure extend timestamp calculation to ADD not SUB block …
jferrant Dec 3, 2024
61911ef
chore: add debug log for stackerdb listener timeout
obycode Dec 3, 2024
69759d4
Merge branch 'feat/time-based-tenure-extend' into feat/miner-tenure-e…
obycode Dec 3, 2024
040ef2d
Merge branch 'develop' into feat/time-based-tenure-extend
obycode Dec 3, 2024
4d075fe
Merge branch 'feat/time-based-tenure-extend' into feat/miner-tenure-e…
obycode Dec 3, 2024
17cd395
Merge remote-tracking branch 'origin/feat/time-based-tenure-extend' i…
hstove Dec 3, 2024
6e4bcc8
refactor: pass `reward_set` instead of re-loading it
obycode Dec 3, 2024
f2ce342
chore: improve comment on `mined_blocks`
obycode Dec 3, 2024
fdb05d1
fix: missing change for previous refactor
obycode Dec 3, 2024
de1881b
refactor: use `TestFlag`
obycode Dec 3, 2024
061da00
Merge pull request #5493 from stacks-network/feat/miner-tenure-extend
obycode Dec 3, 2024
b4a668c
Merge remote-tracking branch 'origin/feat/time-based-tenure-extend' i…
hstove Dec 3, 2024
e9fc1a1
Merge pull request #5471 from stacks-network/feat/tenure-idle-tests
hstove Dec 3, 2024
257a412
Merge branch 'develop' into feat/time-based-tenure-extend
obycode Dec 4, 2024
e4551b9
feat: test for idle extend with active mining
hstove Dec 4, 2024
f4188b2
fix: add new test to bitcoin-tests
hstove Dec 4, 2024
6cb70e8
fix: pr comments
hstove Dec 4, 2024
92d8b29
fix: mine a few naka blocks after tenure extend
hstove Dec 4, 2024
805a379
Merge pull request #5531 from stacks-network/feat/active-mining-idle-…
obycode Dec 4, 2024
2e266a2
refactor: add `ExecutionCost::ZERO`
obycode Dec 4, 2024
2548c56
chore: Rust improvements
obycode Dec 4, 2024
6e06712
refactor: use `Instant` for timing block validation
obycode Dec 4, 2024
674d517
chore: change `%-full` to `percent_full` in log
obycode Dec 5, 2024
ff66b68
chore: better rustiness
obycode Dec 5, 2024
b9d36a1
refactor: better Rustiness
obycode Dec 5, 2024
c195c68
refactor: more suggestions from PR review
obycode Dec 5, 2024
fdd78c5
Merge branch 'develop' into feat/time-based-tenure-extend
obycode Dec 5, 2024
484f417
docs: more info in tenure extend debug log
obycode Dec 6, 2024
3bccb23
docs: clarify changelog comment
obycode Dec 6, 2024
92b1a3d
Add some debug logs to tenure extend timestamp calc and roundup the p…
jferrant Dec 6, 2024
7a7549c
chore: set nakamoto block version to 2
jcnelson Dec 6, 2024
c0da03e
Fix tenure timestamp check to be consistent with signers, only accept…
jferrant Dec 6, 2024
19e4d42
chore: more logging when rejecting time-based extend
hstove Dec 6, 2024
e2bc798
Merge branch 'develop' into feat/time-based-tenure-extend
obycode Dec 6, 2024
d828159
chore: allow negative in `tenure_extend_in` log
obycode Dec 6, 2024
7b265f7
feat: make tenure idle timestamps monotonically increase
obycode Dec 6, 2024
761ae4d
Rollover tenure extend timestamp for tenure change blocks that are ac…
jferrant Dec 7, 2024
8156b54
fix: revert change to block version
obycode Dec 7, 2024
98d35ba
Merge branch 'develop' into feat/time-based-tenure-extend
obycode Dec 8, 2024
565ad2a
fix: do not propose block if mock-mining
obycode Dec 9, 2024
1f79b52
fix: do not broadcast block when mock-mining
obycode Dec 9, 2024
5bedd6e
refactor: move checks early in `broadcast`
obycode Dec 9, 2024
b201dcd
refactor: clean up mock-mining changes for readability
obycode Dec 9, 2024
0e8d40f
Merge branch 'develop' into feat/time-based-tenure-extend
jcnelson Dec 9, 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
3 changes: 3 additions & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ jobs:
- tests::signer::v0::signer_set_rollover
- tests::signer::v0::signing_in_0th_tenure_of_reward_cycle
- tests::signer::v0::continue_after_tenure_extend
- tests::signer::v0::tenure_extend_after_idle
- tests::signer::v0::stx_transfers_dont_effect_idle_timeout
- tests::signer::v0::idle_tenure_extend_active_mining
- tests::signer::v0::multiple_miners_with_custom_chain_id
- tests::signer::v0::block_commit_delay
- tests::signer::v0::continue_after_fast_block_no_sortition
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ mod test {
) -> std::result::Result<ExecutionCost, CostErrors> {
self.invoked_functions.push((cost_f, input.to_vec()));
self.invocation_count += 1;
Ok(ExecutionCost::zero())
Ok(ExecutionCost::ZERO)
}
fn add_cost(&mut self, _cost: ExecutionCost) -> std::result::Result<(), CostErrors> {
self.cost_addition_count += 1;
Expand Down
30 changes: 16 additions & 14 deletions clarity/src/vm/costs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl CostTracker for () {
_cost_function: ClarityCostFunction,
_input: &[u64],
) -> std::result::Result<ExecutionCost, CostErrors> {
Ok(ExecutionCost::zero())
Ok(ExecutionCost::ZERO)
}
fn add_cost(&mut self, _cost: ExecutionCost) -> std::result::Result<(), CostErrors> {
Ok(())
Expand Down Expand Up @@ -707,7 +707,7 @@ impl LimitedCostTracker {
contract_call_circuits: HashMap::new(),
limit,
memory_limit: CLARITY_MEMORY_LIMIT,
total: ExecutionCost::zero(),
total: ExecutionCost::ZERO,
memory: 0,
epoch,
mainnet,
Expand All @@ -731,7 +731,7 @@ impl LimitedCostTracker {
contract_call_circuits: HashMap::new(),
limit,
memory_limit: CLARITY_MEMORY_LIMIT,
total: ExecutionCost::zero(),
total: ExecutionCost::ZERO,
memory: 0,
epoch,
mainnet,
Expand Down Expand Up @@ -880,7 +880,7 @@ impl LimitedCostTracker {
pub fn get_total(&self) -> ExecutionCost {
match self {
Self::Limited(TrackerData { total, .. }) => total.clone(),
Self::Free => ExecutionCost::zero(),
Self::Free => ExecutionCost::ZERO,
}
}
#[allow(clippy::panic)]
Expand Down Expand Up @@ -1050,7 +1050,7 @@ impl CostTracker for LimitedCostTracker {
match self {
Self::Free => {
// tracker is free, return zero!
return Ok(ExecutionCost::zero());
return Ok(ExecutionCost::ZERO);
}
Self::Limited(ref mut data) => {
if cost_function == ClarityCostFunction::Unimplemented {
Expand Down Expand Up @@ -1195,15 +1195,13 @@ impl CostOverflowingMath<u64> for u64 {
}

impl ExecutionCost {
pub fn zero() -> ExecutionCost {
Self {
runtime: 0,
write_length: 0,
read_count: 0,
write_count: 0,
read_length: 0,
}
}
pub const ZERO: Self = Self {
runtime: 0,
write_length: 0,
read_count: 0,
write_count: 0,
read_length: 0,
};

/// Returns the percentage of self consumed in `numerator`'s largest proportion dimension.
pub fn proportion_largest_dimension(&self, numerator: &ExecutionCost) -> u64 {
Expand Down Expand Up @@ -1328,6 +1326,10 @@ impl ExecutionCost {
read_length: first.read_length.max(second.read_length),
}
}

pub fn is_zero(&self) -> bool {
*self == Self::ZERO
}
}

// ONLY WORKS IF INPUT IS u64
Expand Down
Loading
Loading