Skip to content

Commit a0e13b2

Browse files
committed
Merge branch 'develop' of https://github.com/stacks-network/stacks-core into fix/signers-verify-reward-cycle
2 parents 7f9b0e0 + f5934db commit a0e13b2

File tree

7 files changed

+103
-2
lines changed

7 files changed

+103
-2
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,38 @@ jobs:
164164
- check-release
165165
uses: ./.github/workflows/stacks-core-tests.yml
166166

167+
## Checks to run on built binaries
168+
##
169+
## Runs when:
170+
## - it is a release run
171+
## or:
172+
## - it is not a release run
173+
## and any of:
174+
## - this workflow is called manually
175+
## - PR is opened
176+
## - PR added to merge queue
177+
## - commit to either (development, next, master) branch
178+
stacks-core-build-tests:
179+
if: |
180+
needs.check-release.outputs.is_release == 'true' || (
181+
github.event_name == 'workflow_dispatch' ||
182+
github.event_name == 'pull_request' ||
183+
github.event_name == 'merge_group' ||
184+
(
185+
contains('
186+
refs/heads/master
187+
refs/heads/develop
188+
refs/heads/next
189+
', github.event.pull_request.head.ref) &&
190+
github.event_name == 'push'
191+
)
192+
)
193+
name: Stacks Core Build Tests
194+
needs:
195+
- rustfmt
196+
- check-release
197+
uses: ./.github/workflows/core-build-tests.yml
198+
167199
bitcoin-tests:
168200
if: |
169201
needs.check-release.outputs.is_release == 'true' || (
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Core build tests
2+
3+
# Only run when:
4+
# - PRs are (re)opened against develop branch
5+
on:
6+
workflow_call:
7+
8+
jobs:
9+
check-consts:
10+
name: Check the constants from stacks-inspect
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout the latest code
14+
id: git_checkout
15+
uses: actions/checkout@v3
16+
- name: Define Rust Toolchain
17+
id: define_rust_toolchain
18+
run: echo "RUST_TOOLCHAIN=$(cat ./rust-toolchain)" >> $GITHUB_ENV
19+
- name: Setup Rust Toolchain
20+
id: setup_rust_toolchain
21+
uses: actions-rust-lang/setup-rust-toolchain@v1
22+
with:
23+
toolchain: ${{ env.RUST_TOOLCHAIN }}
24+
- name: Build the binaries
25+
id: build
26+
run: |
27+
cargo build
28+
- name: Dump constants JSON
29+
id: consts-dump
30+
run: cargo run --bin stacks-inspect -- dump-consts | tee out.json
31+
- name: Set expected constants JSON
32+
id: expects-json
33+
run: diff out.json ./sample/expected_consts.json

pox-locking/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ mutants = "0.0.3"
2828

2929
[features]
3030
slog_json = ["stacks_common/slog_json", "clarity/slog_json"]
31+
testing = []

sample/expected_consts.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"chain_id_mainnet": 1,
3+
"chain_id_testnet": 2147483648,
4+
"microstacks_per_stacks": 1000000,
5+
"miner_reward_maturity": 100,
6+
"network_id_mainnet": 385875968,
7+
"network_id_testnet": 4278190080,
8+
"peer_version_mainnet_major": 402653184,
9+
"peer_version_testnet_major": 4207599104,
10+
"signer_slots_per_user": 13,
11+
"stacks_epoch_max": 9223372036854775807
12+
}

stacks-common/src/util/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use std::time::{SystemTime, UNIX_EPOCH};
3636
use std::{error, fmt, thread, time};
3737

3838
/// Given a relative path inside the Cargo workspace, return the absolute path
39-
#[cfg(any(test, feature = "testing"))]
4039
pub fn cargo_workspace<P>(relative_path: P) -> PathBuf
4140
where
4241
P: AsRef<Path>,

stacks-signer/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ serde_stacker = "0.1"
3636
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
3737
slog-json = { version = "2.3.0", optional = true }
3838
slog-term = "2.6.0"
39-
stacks-common = { path = "../stacks-common", features = ["testing"] }
39+
stacks-common = { path = "../stacks-common" }
4040
stackslib = { path = "../stackslib" }
4141
thiserror = { workspace = true }
4242
tiny_http = { version = "0.12", optional = true }
@@ -49,6 +49,7 @@ rusqlite = { workspace = true, features = ["functions"] }
4949

5050
[dev-dependencies]
5151
clarity = { path = "../clarity", features = ["testing"] }
52+
stacks-common = { path = "../stacks-common", features = ["testing"] }
5253
num-traits = "0.2.18"
5354

5455
[dependencies.serde_json]

stackslib/src/main.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,12 +1614,35 @@ check if the associated microblocks can be downloaded
16141614
process::exit(0);
16151615
}
16161616

1617+
if argv[1] == "dump-consts" {
1618+
dump_consts();
1619+
}
1620+
16171621
if argv.len() < 4 {
16181622
eprintln!("Usage: {} blockchain network working_dir", argv[0]);
16191623
process::exit(1);
16201624
}
16211625
}
16221626

1627+
#[cfg_attr(test, mutants::skip)]
1628+
pub fn dump_consts() {
1629+
use stacks_common::consts;
1630+
let json_out = json!({
1631+
"miner_reward_maturity": consts::MINER_REWARD_MATURITY,
1632+
"chain_id_mainnet": consts::CHAIN_ID_MAINNET,
1633+
"chain_id_testnet": consts::CHAIN_ID_TESTNET,
1634+
"signer_slots_per_user": consts::SIGNER_SLOTS_PER_USER,
1635+
"network_id_mainnet": consts::NETWORK_ID_MAINNET,
1636+
"network_id_testnet": consts::NETWORK_ID_TESTNET,
1637+
"microstacks_per_stacks": consts::MICROSTACKS_PER_STACKS,
1638+
"stacks_epoch_max": consts::STACKS_EPOCH_MAX,
1639+
"peer_version_mainnet_major": consts::PEER_VERSION_MAINNET_MAJOR,
1640+
"peer_version_testnet_major": consts::PEER_VERSION_TESTNET_MAJOR,
1641+
});
1642+
println!("{}", serde_json::to_string_pretty(&json_out).unwrap());
1643+
process::exit(0);
1644+
}
1645+
16231646
#[cfg_attr(test, mutants::skip)]
16241647
pub fn tip_mine() {
16251648
let argv: Vec<String> = env::args().collect();

0 commit comments

Comments
 (0)