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

Nakamoto Fixes: IssueBlockCommit and Reward Maturity Lookups #4205

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

kantai
Copy link
Member

@kantai kantai commented Dec 20, 2023

Description

This fixes two issues surfaced by the interim blocks mining in nakamoto-node.

  1. The IssueBlock directive should use the tenure block not the chain tip block for the directive. The interim-mining integration test has been updated to deal with this.
  2. calculate_matured_miner_rewards should use the coinbase_height, not the block height. This was caught by running a long-running node with interim mining turned on, rather than an integration test. There's no integration test for this new behavior, but there probably should be. The issue surface from a panicking assertion because the 150th Stacks block had a coinbase height < 100, so the maturity lookup returned an empty list, triggering a panic. In testing mode, the maturity height is 2, which means that it would be hard to surface this exact panic in a test.

use std::collections::VecDeque;
use std::sync::mpsc::Sender;
use std::time::Duration;

use hashbrown::{HashMap, HashSet};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we're still using hashbrown?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear to me. Maybe open an issue for the signer? This changeline just came from running cargo fmt-stacks.

Copy link
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch @zone117x @kantai!

Copy link

codecov bot commented Dec 20, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (4001992) 82.83% compared to head (d0882a7) 82.63%.

Files Patch % Lines
...net/stacks-node/src/tests/nakamoto_integrations.rs 87.50% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #4205      +/-   ##
==========================================
- Coverage   82.83%   82.63%   -0.21%     
==========================================
  Files         429      429              
  Lines      302091   302128      +37     
==========================================
- Hits       250245   249662     -583     
- Misses      51846    52466     +620     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kantai kantai requested a review from zone117x December 20, 2023 21:47
Copy link
Member

@zone117x zone117x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm able to get a deployment running with this PR, but still running into a couple other block processing issues (details shared on Slack).

@kantai kantai merged commit c4ec042 into next Dec 21, 2023
2 checks passed
@kantai kantai deleted the fix/naka-commits branch December 21, 2023 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants