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

Chore/merge 2.4.0.1.0 to develop #4317

Merged
merged 63 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ababc91
use pull_request to trigger ci runs
wileyj Dec 12, 2023
62c7e4d
Merge pull request #4160 from stacks-network/ci/fix-pr-target-master
wileyj Dec 13, 2023
879b9db
Update CODE_OF_CONDUCT.md
cuevasm Dec 15, 2023
dbca59e
change the wording around the signature description
tippenein Dec 11, 2023
30f3b42
use @obycode copy
tippenein Dec 12, 2023
8461714
'list of functions'
tippenein Dec 12, 2023
dac754a
Merge branch 'master' into define-trait-wording-change
tippenein Dec 20, 2023
130220b
Merge pull request #4144 from tippenein/define-trait-wording-change
obycode Dec 20, 2023
ab88a77
Merge branch 'master' into cuevasm-patch-2
wileyj Jan 2, 2024
b218f29
Merge pull request #4181 from stacks-network/cuevasm-patch-2
saralab Jan 2, 2024
ec24364
chore: update default testnet hiro bootstrap node
CharlieC3 Jan 9, 2024
37ad927
Merge pull request #4238 from CharlieC3/master
wileyj Jan 16, 2024
40207d3
feat: miner behavior improvements (squashed; see CHANGELOG)
jcnelson Jan 17, 2024
924ac90
fix: input_index, not input_vout
jcnelson Jan 17, 2024
8c70e98
fix: reset `consider_no_estimate_tx_prob` to 5 in `zero`
obycode Jan 17, 2024
524b0e1
Merge pull request #4250 from stacks-network/feat/miner-improvements
wileyj Jan 17, 2024
4389499
chore: cargo fmt
jcnelson Jan 18, 2024
b6be517
chore: cargo fmt
jcnelson Jan 18, 2024
8508c38
Revert "Address clippy complaints in src/vm/"
jcnelson Jan 18, 2024
18d0d15
Merge branch 'fix/develop-revert-clippy' into feat/cargo-fmt
jcnelson Jan 18, 2024
598d4bf
chore: merge change log
jcnelson Jan 18, 2024
d99bc2f
change --config= to --config
wileyj Jan 18, 2024
a7cf645
chore: cargo fmt
jcnelson Jan 18, 2024
e42195e
chore: a few fixes to neighbor lifecycle to make the node less chatty
jcnelson Jan 18, 2024
3907d7e
chore: move repetative info! to debug!
jcnelson Jan 19, 2024
43c91b2
feat: optionally ignore neighbors on private networks
jcnelson Jan 19, 2024
71355c5
fix: expose private_neighbors via config.rs
jcnelson Jan 20, 2024
ff7c549
feat: add /v2/stackerdb/{contract-addr}/{contract-name}/replicas API …
jcnelson Jan 22, 2024
44b6aa7
chore: don't connect to unroutable neighbors if private_neighbors is …
jcnelson Jan 22, 2024
c32ad7a
chore: debug, not info
jcnelson Jan 22, 2024
806de84
fix: repair connection network handle flush logic, and add a helper t…
jcnelson Jan 22, 2024
210c746
fix: update local peer to indicate that we support stackerdb
jcnelson Jan 22, 2024
69bdbe8
chore: cargo fmt
jcnelson Jan 22, 2024
3c65785
chore: get stackerdb tests passing again; fix a couple bugs in the st…
jcnelson Jan 23, 2024
f747b00
Merge pull request #4270 from stacks-network/chore/stackerdb-replica-…
jcnelson Jan 23, 2024
cfb1b6d
chore: throttle stackerdb sync to be at least one second
jcnelson Jan 23, 2024
7021752
Merge branch 'release/2.5.0.1.0' of https://github.com/stacks-network…
jcnelson Jan 23, 2024
c0355b2
fix: if we hit message EOF, then return so that the caller can refill…
jcnelson Jan 23, 2024
d0c111a
fix: if walk step times out, then error out
jcnelson Jan 23, 2024
653a116
fix: blocked condition is true regardless of internal buffer contents
jcnelson Jan 23, 2024
23acbf1
chore: reset stackerdb sync state on reset
jcnelson Jan 23, 2024
3c8ec8f
fix: don't buffer zero-length buffers; expand test coverage
jcnelson Jan 23, 2024
b289659
fix: don't partially-buffer p2p messages; send them all at once so if…
jcnelson Jan 24, 2024
b736aaa
fix: compile error
jcnelson Jan 24, 2024
ed24b97
fix: it's not a problem if we don't make any new requests for stacker…
jcnelson Jan 24, 2024
63a7548
chore: log specifically what messages get nacked in stackerdb replica…
jcnelson Jan 24, 2024
401edeb
chore: don't re-send getchunksinv messages
jcnelson Jan 24, 2024
dd2a8a2
chore: coalesce replicas by ipaddr
jcnelson Jan 25, 2024
e6ae325
fix: count always-allowed nodes by pubkey, not port (which can omit i…
jcnelson Jan 25, 2024
cc8f86d
fix: walk to always-allowed if we aren't connected to one yet
jcnelson Jan 25, 2024
b6ea099
fix: if we have private_neighbors = false, then don't bother selectin…
jcnelson Jan 25, 2024
5794ee8
fix: missing !
jcnelson Jan 25, 2024
7b7067b
fix: only return routable replicas, and include localpeer if needed
jcnelson Jan 26, 2024
683931c
feat: helper to get neighbor address of local peer, given its public …
jcnelson Jan 26, 2024
7b597c3
fix: don't stop an ongoing walk just because we don't yet have a conn…
jcnelson Jan 26, 2024
4c461c2
refactor: query old neighbors for stackerdbs if we dont' have new ones
jcnelson Jan 26, 2024
67d5711
chore: cargo fmt
jcnelson Jan 26, 2024
40ecd03
fix: ::1 and 127.0.0.0/8 are private range addresses
jcnelson Jan 26, 2024
a8be048
fix: fix failing unit test
jcnelson Jan 29, 2024
1d8920e
Merge pull request #4262 from stacks-network/release/2.5.0.1.0
wileyj Jan 29, 2024
893a7c6
Target specific binaries for release builds
wileyj Jan 30, 2024
c659fca
Merge pull request #4312 from stacks-network/ci/fix-release-builds
wileyj Jan 31, 2024
c98b404
Merge branch 'master' into chore/merge-2.4.0.1.0-to-develop
jcnelson Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 33 additions & 37 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the versioning scheme outlined in the [README.md](README.md).

## [2.4.0.0.5]
## [2.4.0.1.0]

This introduces a set of improvements to the Stacks miner behavior. In
### Added

- When the Clarity library is built with feature flag `developer-mode`, comments
from the source code are now attached to the `SymbolicExpression` nodes. This
will be useful for tools that use the Clarity library to analyze and
manipulate Clarity source code, e.g. a formatter.
- New RPC endpoint at /v2/constant_val to fetch a constant from a contract.
- A new subsystem, called StackerDB, has been added, which allows a set of
Stacks nodes to store off-chain data on behalf of a specially-crafter smart
contract. This is an opt-in feature; Stacks nodes explicitly subscribe to
StackerDB replicas in their config files.
- Message definitions and codecs for Stacker DB, a replicated off-chain DB
hosted by subscribed Stacks nodes and controlled by smart contracts
- Added 3 new public and regionally diverse bootstrap nodes: est.stacksnodes.org, cet.stacksnodes.org, sgt.stacksnodes.org

In addition, this introduces a set of improvements to the Stacks miner behavior. In
particular:
* The VRF public key can be re-used across node restarts.
* Settings that affect mining are hot-reloaded from the config file. They take
Expand All @@ -26,6 +41,22 @@ contract-calls).
* When configured, the node will optionally only RBF block-commits if it can
produce a block with strictly more transactions.

### Changed

- `developer-mode` is no longer enabled in the default feature set. This is the correct default behavior, since the stacks-node should NOT build with developer-mode enabled by default. Tools that need to use developer-mode should enable it explicitly.

### Fixed

- The transaction receipts for smart contract publish transactions now indicate
a result of `(err none)` if the top-level code of the smart contract contained
runtime error and include details about the error in the `vm_error` field of
the receipt. Fixes issues #3154, #3328.
- Added config setting `burnchain.wallet_name` which addresses blank wallets no
longer being created by default in recent bitcoin versions. Fixes issue #3596
- Use the current burnchain tip to lookup UTXOs (Issue #3733)
- The node now gracefully shuts down even if it is in the middle of a handshake with
bitcoind. Fixes issue #3734.

## [2.4.0.0.4]

This is a high-priority hotfix that addresses a bug in transaction processing which
Expand Down Expand Up @@ -56,41 +87,6 @@ could impact miner availability.
This is a hotfix that changes the logging failure behavior from panicking to dropping
the log message (PR #3784).

## [Unreleased]

### Added

- When the Clarity library is built with feature flag `developer-mode`, comments
from the source code are now attached to the `SymbolicExpression` nodes. This
will be useful for tools that use the Clarity library to analyze and
manipulate Clarity source code, e.g. a formatter.
- New RPC endpoint at /v2/constant_val to fetch a constant from a contract.
- A new subsystem, called StackerDB, has been added, which allows a set of
Stacks nodes to store off-chain data on behalf of a specially-crafter smart
contract. This is an opt-in feature; Stacks nodes explicitly subscribe to
StackerDB replicas in their config files.
- Message definitions and codecs for Stacker DB, a replicated off-chain DB
hosted by subscribed Stacks nodes and controlled by smart contracts
- Added 3 new public and regionally diverse bootstrap nodes: est.stacksnodes.org, cet.stacksnodes.org, sgt.stacksnodes.org
- satoshis_per_byte can be changed in the config file and miners will always use
the most up to date value

### Changed

- `developer-mode` is no longer enabled in the default feature set. This is the correct default behavior, since the stacks-node should NOT build with developer-mode enabled by default. Tools that need to use developer-mode should enable it explicitly.

### Fixed

- The transaction receipts for smart contract publish transactions now indicate
a result of `(err none)` if the top-level code of the smart contract contained
runtime error and include details about the error in the `vm_error` field of
the receipt. Fixes issues #3154, #3328.
- Added config setting `burnchain.wallet_name` which addresses blank wallets no
longer being created by default in recent bitcoin versions. Fixes issue #3596
- Use the current burnchain tip to lookup UTXOs (Issue #3733)
- The node now gracefully shuts down even if it is in the middle of a handshake with
bitcoind. Fixes issue #3734.

## [2.4.0.0.1]

This is a minor change to add `txid` fields into the log messages from failing
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/Dockerfile.linux-glibc-arm64
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& CC=aarch64-linux-gnu-gcc \
CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

Expand Down
4 changes: 2 additions & 2 deletions build-scripts/Dockerfile.linux-glibc-armv7
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& CC=arm-linux-gnueabihf-gcc \
CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /
2 changes: 1 addition & 1 deletion build-scripts/Dockerfile.linux-glibc-x64
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y git
RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

Expand Down
3 changes: 2 additions & 1 deletion build-scripts/Dockerfile.linux-musl-arm64
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ COPY . .
RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /

4 changes: 2 additions & 2 deletions build-scripts/Dockerfile.linux-musl-armv7
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ COPY . .
RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /
3 changes: 2 additions & 1 deletion build-scripts/Dockerfile.linux-musl-x64
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ RUN apk update && apk add git musl-dev
RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /

3 changes: 2 additions & 1 deletion build-scripts/Dockerfile.macos-arm64
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& . /opt/osxcross/env-macos-aarch64 \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /

3 changes: 2 additions & 1 deletion build-scripts/Dockerfile.macos-x64
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& cd ${BUILD_DIR} \
&& rustup target add ${TARGET} \
&& . /opt/osxcross/env-macos-x86_64 \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
&& cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect /out/blockstack-cli /out/clarity-cli /out/stacks-node /

4 changes: 2 additions & 2 deletions build-scripts/Dockerfile.windows-x64
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ RUN --mount=type=tmpfs,target=${BUILD_DIR} cp -R /src/. ${BUILD_DIR}/ \
&& rustup target add ${TARGET} \
&& CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc \
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \
cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} \
cargo build --features monitoring_prom,slog_json --release --workspace --target ${TARGET} --bin stacks-node --bin stacks-inspect --bin clarity-cli --bin blockstack-cli \
&& mkdir -p /out \
&& cp -R ${BUILD_DIR}/target/${TARGET}/release/. /out

FROM scratch AS export-stage
COPY --from=build /out/stacks-inspect.exe /out/blockstack-cli.exe /out/clarity-cli.exe /out/stacks-node.exe /
COPY --from=build /out/stacks-inspect.exe /out/blockstack-cli.exe /out/clarity-cli.exe /out/stacks-node.exe /
4 changes: 3 additions & 1 deletion clarity/src/libclarity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ pub mod boot_util {
use crate::vm::representations::ContractName;
use crate::vm::types::QualifiedContractIdentifier;

#[allow(clippy::expect_used)]
pub fn boot_code_id(name: &str, mainnet: bool) -> QualifiedContractIdentifier {
let addr = boot_code_addr(mainnet);
QualifiedContractIdentifier::new(
addr.into(),
ContractName::try_from(name.to_string()).unwrap(),
ContractName::try_from(name.to_string())
.expect("FATAL: boot contract name is not a legal ContractName"),
)
}

Expand Down
71 changes: 46 additions & 25 deletions clarity/src/vm/analysis/analysis_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,33 @@ impl<'a> AnalysisDatabase<'a> {
pub fn execute<F, T, E>(&mut self, f: F) -> Result<T, E>
where
F: FnOnce(&mut Self) -> Result<T, E>,
E: From<CheckErrors>,
{
self.begin();
let result = f(self).map_err(|e| {
self.roll_back();
e
let result = f(self).or_else(|e| {
self.roll_back()
.map_err(|e| CheckErrors::Expects(format!("{e:?}")).into())?;
Err(e)
})?;
self.commit();
self.commit()
.map_err(|e| CheckErrors::Expects(format!("{e:?}")).into())?;
Ok(result)
}

pub fn begin(&mut self) {
self.store.nest();
}

pub fn commit(&mut self) {
self.store.commit();
pub fn commit(&mut self) -> CheckResult<()> {
self.store
.commit()
.map_err(|e| CheckErrors::Expects(format!("{e:?}")).into())
}

pub fn roll_back(&mut self) {
self.store.rollback();
pub fn roll_back(&mut self) -> CheckResult<()> {
self.store
.rollback()
.map_err(|e| CheckErrors::Expects(format!("{e:?}")).into())
}

pub fn storage_key() -> &'static str {
Expand All @@ -78,7 +85,8 @@ impl<'a> AnalysisDatabase<'a> {
pub fn test_insert_contract_hash(&mut self, contract_identifier: &QualifiedContractIdentifier) {
use stacks_common::util::hash::Sha512Trunc256Sum;
self.store
.prepare_for_contract_metadata(contract_identifier, Sha512Trunc256Sum([0; 32]));
.prepare_for_contract_metadata(contract_identifier, Sha512Trunc256Sum([0; 32]))
.unwrap();
}

pub fn has_contract(&mut self, contract_identifier: &QualifiedContractIdentifier) -> bool {
Expand All @@ -90,30 +98,42 @@ impl<'a> AnalysisDatabase<'a> {
pub fn load_contract_non_canonical(
&mut self,
contract_identifier: &QualifiedContractIdentifier,
) -> Option<ContractAnalysis> {
) -> CheckResult<Option<ContractAnalysis>> {
self.store
.get_metadata(contract_identifier, AnalysisDatabase::storage_key())
// treat NoSuchContract error thrown by get_metadata as an Option::None --
// the analysis will propagate that as a CheckError anyways.
.ok()?
.map(|x| ContractAnalysis::deserialize(&x))
.ok()
.flatten()
.map(|x| {
ContractAnalysis::deserialize(&x).map_err(|_| {
CheckErrors::Expects("Bad data deserialized from DB".into()).into()
})
})
.transpose()
}

pub fn load_contract(
&mut self,
contract_identifier: &QualifiedContractIdentifier,
epoch: &StacksEpochId,
) -> Option<ContractAnalysis> {
self.store
) -> CheckResult<Option<ContractAnalysis>> {
Ok(self
.store
.get_metadata(contract_identifier, AnalysisDatabase::storage_key())
// treat NoSuchContract error thrown by get_metadata as an Option::None --
// the analysis will propagate that as a CheckError anyways.
.ok()?
.map(|x| ContractAnalysis::deserialize(&x))
.map(|mut x| {
x.canonicalize_types(epoch);
x
.ok()
.flatten()
.map(|x| {
ContractAnalysis::deserialize(&x)
.map_err(|_| CheckErrors::Expects("Bad data deserialized from DB".into()))
})
.transpose()?
.and_then(|mut x| {
x.canonicalize_types(epoch);
Some(x)
}))
}

pub fn insert_contract(
Expand All @@ -127,7 +147,8 @@ impl<'a> AnalysisDatabase<'a> {
}

self.store
.insert_metadata(contract_identifier, key, &contract.serialize());
.insert_metadata(contract_identifier, key, &contract.serialize())
.map_err(|e| CheckErrors::Expects(format!("{e:?}")))?;
Ok(())
}

Expand All @@ -140,7 +161,7 @@ impl<'a> AnalysisDatabase<'a> {
// stored as its own entry. the analysis cost tracking currently only
// charges based on the function type size.
let contract = self
.load_contract_non_canonical(contract_identifier)
.load_contract_non_canonical(contract_identifier)?
.ok_or(CheckErrors::NoSuchContract(contract_identifier.to_string()))?;
Ok(contract.clarity_version)
}
Expand All @@ -156,7 +177,7 @@ impl<'a> AnalysisDatabase<'a> {
// stored as its own entry. the analysis cost tracking currently only
// charges based on the function type size.
let contract = self
.load_contract_non_canonical(contract_identifier)
.load_contract_non_canonical(contract_identifier)?
.ok_or(CheckErrors::NoSuchContract(contract_identifier.to_string()))?;
Ok(contract
.get_public_function_type(function_name)
Expand All @@ -174,7 +195,7 @@ impl<'a> AnalysisDatabase<'a> {
// stored as its own entry. the analysis cost tracking currently only
// charges based on the function type size.
let contract = self
.load_contract_non_canonical(contract_identifier)
.load_contract_non_canonical(contract_identifier)?
.ok_or(CheckErrors::NoSuchContract(contract_identifier.to_string()))?;
Ok(contract
.get_read_only_function_type(function_name)
Expand All @@ -192,7 +213,7 @@ impl<'a> AnalysisDatabase<'a> {
// stored as its own entry. the analysis cost tracking currently only
// charges based on the function type size.
let contract = self
.load_contract_non_canonical(contract_identifier)
.load_contract_non_canonical(contract_identifier)?
.ok_or(CheckErrors::NoSuchContract(contract_identifier.to_string()))?;
Ok(contract.get_defined_trait(trait_name).map(|trait_map| {
trait_map
Expand All @@ -207,7 +228,7 @@ impl<'a> AnalysisDatabase<'a> {
contract_identifier: &QualifiedContractIdentifier,
) -> CheckResult<BTreeSet<TraitIdentifier>> {
let contract = self
.load_contract_non_canonical(contract_identifier)
.load_contract_non_canonical(contract_identifier)?
.ok_or(CheckErrors::NoSuchContract(contract_identifier.to_string()))?;
Ok(contract.implemented_traits)
}
Expand Down