Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/stacks-network/stacks-core
Browse files Browse the repository at this point in the history
… into fix/signers-verify-reward-cycle
  • Loading branch information
jferrant committed Jan 9, 2025
2 parents 7f9b0e0 + f5934db commit a0e13b2
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,38 @@ jobs:
- check-release
uses: ./.github/workflows/stacks-core-tests.yml

## Checks to run on built binaries
##
## Runs when:
## - it is a release run
## or:
## - it is not a release run
## and any of:
## - this workflow is called manually
## - PR is opened
## - PR added to merge queue
## - commit to either (development, next, master) branch
stacks-core-build-tests:
if: |
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
name: Stacks Core Build Tests
needs:
- rustfmt
- check-release
uses: ./.github/workflows/core-build-tests.yml

bitcoin-tests:
if: |
needs.check-release.outputs.is_release == 'true' || (
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/core-build-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Core build tests

# Only run when:
# - PRs are (re)opened against develop branch
on:
workflow_call:

jobs:
check-consts:
name: Check the constants from stacks-inspect
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Define Rust Toolchain
id: define_rust_toolchain
run: echo "RUST_TOOLCHAIN=$(cat ./rust-toolchain)" >> $GITHUB_ENV
- name: Setup Rust Toolchain
id: setup_rust_toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Build the binaries
id: build
run: |
cargo build
- name: Dump constants JSON
id: consts-dump
run: cargo run --bin stacks-inspect -- dump-consts | tee out.json
- name: Set expected constants JSON
id: expects-json
run: diff out.json ./sample/expected_consts.json
1 change: 1 addition & 0 deletions pox-locking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ mutants = "0.0.3"

[features]
slog_json = ["stacks_common/slog_json", "clarity/slog_json"]
testing = []
12 changes: 12 additions & 0 deletions sample/expected_consts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"chain_id_mainnet": 1,
"chain_id_testnet": 2147483648,
"microstacks_per_stacks": 1000000,
"miner_reward_maturity": 100,
"network_id_mainnet": 385875968,
"network_id_testnet": 4278190080,
"peer_version_mainnet_major": 402653184,
"peer_version_testnet_major": 4207599104,
"signer_slots_per_user": 13,
"stacks_epoch_max": 9223372036854775807
}
1 change: 0 additions & 1 deletion stacks-common/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ use std::time::{SystemTime, UNIX_EPOCH};
use std::{error, fmt, thread, time};

/// Given a relative path inside the Cargo workspace, return the absolute path
#[cfg(any(test, feature = "testing"))]
pub fn cargo_workspace<P>(relative_path: P) -> PathBuf
where
P: AsRef<Path>,
Expand Down
3 changes: 2 additions & 1 deletion stacks-signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ serde_stacker = "0.1"
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
slog-json = { version = "2.3.0", optional = true }
slog-term = "2.6.0"
stacks-common = { path = "../stacks-common", features = ["testing"] }
stacks-common = { path = "../stacks-common" }
stackslib = { path = "../stackslib" }
thiserror = { workspace = true }
tiny_http = { version = "0.12", optional = true }
Expand All @@ -49,6 +49,7 @@ rusqlite = { workspace = true, features = ["functions"] }

[dev-dependencies]
clarity = { path = "../clarity", features = ["testing"] }
stacks-common = { path = "../stacks-common", features = ["testing"] }
num-traits = "0.2.18"

[dependencies.serde_json]
Expand Down
23 changes: 23 additions & 0 deletions stackslib/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,12 +1614,35 @@ check if the associated microblocks can be downloaded
process::exit(0);
}

if argv[1] == "dump-consts" {
dump_consts();
}

if argv.len() < 4 {
eprintln!("Usage: {} blockchain network working_dir", argv[0]);
process::exit(1);
}
}

#[cfg_attr(test, mutants::skip)]
pub fn dump_consts() {
use stacks_common::consts;
let json_out = json!({
"miner_reward_maturity": consts::MINER_REWARD_MATURITY,
"chain_id_mainnet": consts::CHAIN_ID_MAINNET,
"chain_id_testnet": consts::CHAIN_ID_TESTNET,
"signer_slots_per_user": consts::SIGNER_SLOTS_PER_USER,
"network_id_mainnet": consts::NETWORK_ID_MAINNET,
"network_id_testnet": consts::NETWORK_ID_TESTNET,
"microstacks_per_stacks": consts::MICROSTACKS_PER_STACKS,
"stacks_epoch_max": consts::STACKS_EPOCH_MAX,
"peer_version_mainnet_major": consts::PEER_VERSION_MAINNET_MAJOR,
"peer_version_testnet_major": consts::PEER_VERSION_TESTNET_MAJOR,
});
println!("{}", serde_json::to_string_pretty(&json_out).unwrap());
process::exit(0);
}

#[cfg_attr(test, mutants::skip)]
pub fn tip_mine() {
let argv: Vec<String> = env::args().collect();
Expand Down

0 comments on commit a0e13b2

Please sign in to comment.