Skip to content

Commit 36ab9ab

Browse files
authored
Merge branch 'develop' into feat/consensus-hash-in-events
2 parents 5a006d3 + 11823df commit 36ab9ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1816
-1050
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ jobs:
136136
- tests::signer::v0::block_proposal_max_age_rejections
137137
- tests::signer::v0::global_acceptance_depends_on_block_announcement
138138
- tests::signer::v0::no_reorg_due_to_successive_block_validation_ok
139+
- tests::signer::v0::incoming_signers_ignore_block_proposals
140+
- tests::signer::v0::outgoing_signers_ignore_block_proposals
141+
- tests::signer::v0::injected_signatures_are_ignored_across_boundaries
139142
- tests::nakamoto_integrations::burn_ops_integration_test
140143
- tests::nakamoto_integrations::check_block_heights
141144
- tests::nakamoto_integrations::clarity_burn_state

.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

clarity/src/vm/representations.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ guarded_string!(
8484
);
8585

8686
impl StacksMessageCodec for ClarityName {
87+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
8788
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), codec_error> {
8889
// ClarityName can't be longer than vm::representations::MAX_STRING_LEN, which itself is
8990
// a u8, so we should be good here.
@@ -124,6 +125,7 @@ impl StacksMessageCodec for ClarityName {
124125
}
125126

126127
impl StacksMessageCodec for ContractName {
128+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
127129
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), codec_error> {
128130
if self.as_bytes().len() < CONTRACT_MIN_NAME_LENGTH
129131
|| self.as_bytes().len() > CONTRACT_MAX_NAME_LENGTH

libsigner/src/v0/messages.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ pub struct PeerInfo {
283283
}
284284

285285
impl StacksMessageCodec for PeerInfo {
286+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
286287
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), CodecError> {
287288
write_next(fd, &self.burn_block_height)?;
288289
write_next(fd, self.stacks_tip_consensus_hash.as_bytes())?;

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 = []

pox-locking/src/events.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use clarity::vm::costs::LimitedCostTracker;
2020
use clarity::vm::errors::Error as ClarityError;
2121
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier, ResponseData, TupleData};
2222
use clarity::vm::Value;
23-
#[cfg(test)]
23+
#[cfg(any(test, feature = "testing"))]
2424
use slog::slog_debug;
2525
use slog::slog_error;
26-
#[cfg(test)]
26+
#[cfg(any(test, feature = "testing"))]
2727
use stacks_common::debug;
2828
use stacks_common::types::StacksEpochId;
2929
use stacks_common::{error, test_debug};

pox-locking/src/events_24.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use clarity::vm::contexts::GlobalContext;
1919
use clarity::vm::errors::Error as ClarityError;
2020
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier, TupleData};
2121
use clarity::vm::Value;
22-
#[cfg(test)]
22+
#[cfg(any(test, feature = "testing"))]
2323
use slog::slog_debug;
2424
use slog::slog_error;
25-
#[cfg(test)]
25+
#[cfg(any(test, feature = "testing"))]
2626
use stacks_common::debug;
2727
use stacks_common::{error, test_debug};
2828

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>,

0 commit comments

Comments
 (0)