Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,22 @@ jobs:
run: make check
- name: Diff check
run: git diff --exit-code

check-features:
name: check all feature combinations
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Cleanup large tools for build space
uses: ./.github/actions/cleanup-runner
- name: Install RocksDB
uses: ./.github/actions/install-rocksdb
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- name: Install rust
run: rustup update --no-self-update
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check all feature combinations
run: make check-features
1 change: 0 additions & 1 deletion .github/workflows/publish-dry-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y jq
- name: Update Rust toolchain
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-binstall@1.16.6
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
- Fix race condition at DB shutdown in tests ([#1503](https://github.com/0xMiden/miden-node/pull/1503)).
- [BREAKING] Updated to new miden-base protocol: removed `aux` and `execution_hint` from `NoteMetadata`, removed `NoteExecutionMode`, and `NoteMetadata::new()` is now infallible ([#1526](https://github.com/0xMiden/miden-node/pull/1526)).
- [BREAKING] Network note queries now use full account ID instead of 30-bit prefix ([#1572](https://github.com/0xMiden/miden-node/pull/1572)).
- [BREAKING] Renamed `SyncStorageMaps` RPC endpoint to `SyncAccountStorageMaps` for consistency ([#1581](https://github.com/0xMiden/miden-node/pull/1581)).
- Removed git information from node's `--version` CLI as it was often incorrect ([#1576](https://github.com/0xMiden/miden-node/pull/1576)).
- [BREAKING] Renamed `GetNetworkAccountDetailsByPrefix` endpoint to `GetNetworkAccountDetailsById` which now accepts full account ID instead of 30-bit prefix ([#1580](https://github.com/0xMiden/miden-node/pull/1580)).

### Fixes

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ test: ## Runs all tests
check: ## Check all targets and features for errors without code generation
${BUILD_PROTO} cargo check --all-features --all-targets --locked --workspace

.PHONY: check-features
check-features: ## Checks all feature combinations compile without warnings using cargo-hack
@scripts/check-features.sh

# --- building ------------------------------------------------------------------------------------

.PHONY: build
Expand Down
4 changes: 2 additions & 2 deletions crates/ntx-builder/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ impl StoreClient {
&self,
account_id: NetworkAccountId,
) -> Result<Option<Account>, StoreError> {
let request = proto::store::AccountIdPrefix { account_id_prefix: account_id.prefix() };
let request = proto::account::AccountId::from(account_id.inner());

let store_response = self
.inner
.clone()
.get_network_account_details_by_prefix(request)
.get_network_account_details_by_id(request)
.await?
.into_inner()
.details;
Expand Down
16 changes: 2 additions & 14 deletions crates/proto/src/domain/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,12 @@ pub struct AccountStorageMapDetails {
///
/// When a storage map contains many entries (> [`AccountStorageMapDetails::MAX_RETURN_ENTRIES`]),
/// returning all entries in a single RPC response creates performance issues. In such cases,
/// the `LimitExceeded` variant indicates to the client to use the `SyncStorageMaps` endpoint
/// the `LimitExceeded` variant indicates to the client to use the `SyncAccountStorageMaps` endpoint
/// instead.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StorageMapEntries {
/// The map has too many entries to return inline.
/// Clients must use `SyncStorageMaps` endpoint instead.
/// Clients must use `SyncAccountStorageMaps` endpoint instead.
LimitExceeded,

/// All storage map entries (key-value pairs) without proofs.
Expand Down Expand Up @@ -1098,18 +1098,6 @@ pub enum NetworkAccountError {
NotNetworkAccount(AccountId),
#[error("invalid network account attachment: {0}")]
InvalidAttachment(#[source] NetworkAccountTargetError),
#[error("invalid network account prefix: {0}")]
InvalidPrefix(u32),
}

/// Validates that a u32 represents a valid network account prefix.
///
/// Network accounts have a 30-bit prefix (top 2 bits must be 0).
pub fn validate_network_account_prefix(prefix: u32) -> Result<u32, NetworkAccountError> {
if prefix >> 30 != 0 {
return Err(NetworkAccountError::InvalidPrefix(prefix));
}
Ok(prefix)
}

/// Gets the 30-bit prefix of the account ID.
Expand Down
41 changes: 22 additions & 19 deletions crates/proto/src/generated/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ pub mod account_storage_details {
#[prost(string, tag = "1")]
pub slot_name: ::prost::alloc::string::String,
/// True when the number of entries exceeds the response limit.
/// When set, clients should use the `SyncStorageMaps` endpoint.
/// When set, clients should use the `SyncAccountStorageMaps` endpoint.
#[prost(bool, tag = "2")]
pub too_many_entries: bool,
/// The map entries (with or without proofs). Empty when too_many_entries is true.
Expand Down Expand Up @@ -479,7 +479,7 @@ pub struct SyncStateResponse {
/// Allows requesters to sync storage map values for specific public accounts within a block range,
/// with support for cursor-based pagination to handle large storage maps.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SyncStorageMapsRequest {
pub struct SyncAccountStorageMapsRequest {
/// Block range from which to start synchronizing.
///
/// If the `block_to` is specified, this block must be close to the chain tip (i.e., within 30 blocks),
Expand All @@ -491,7 +491,7 @@ pub struct SyncStorageMapsRequest {
pub account_id: ::core::option::Option<super::account::AccountId>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncStorageMapsResponse {
pub struct SyncAccountStorageMapsResponse {
/// Pagination information.
#[prost(message, optional, tag = "1")]
pub pagination_info: ::core::option::Option<PaginationInfo>,
Expand Down Expand Up @@ -1041,11 +1041,11 @@ pub mod api_client {
self.inner.unary(req, path, codec).await
}
/// Returns storage map updates for specified account and storage slots within a block range.
pub async fn sync_storage_maps(
pub async fn sync_account_storage_maps(
&mut self,
request: impl tonic::IntoRequest<super::SyncStorageMapsRequest>,
request: impl tonic::IntoRequest<super::SyncAccountStorageMapsRequest>,
) -> std::result::Result<
tonic::Response<super::SyncStorageMapsResponse>,
tonic::Response<super::SyncAccountStorageMapsResponse>,
tonic::Status,
> {
self.inner
Expand All @@ -1057,9 +1057,12 @@ pub mod api_client {
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpc.Api/SyncStorageMaps");
let path = http::uri::PathAndQuery::from_static(
"/rpc.Api/SyncAccountStorageMaps",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "SyncStorageMaps"));
req.extensions_mut()
.insert(GrpcMethod::new("rpc.Api", "SyncAccountStorageMaps"));
self.inner.unary(req, path, codec).await
}
/// Returns transactions records for specific accounts within a block range.
Expand Down Expand Up @@ -1266,11 +1269,11 @@ pub mod api_server {
tonic::Status,
>;
/// Returns storage map updates for specified account and storage slots within a block range.
async fn sync_storage_maps(
async fn sync_account_storage_maps(
&self,
request: tonic::Request<super::SyncStorageMapsRequest>,
request: tonic::Request<super::SyncAccountStorageMapsRequest>,
) -> std::result::Result<
tonic::Response<super::SyncStorageMapsResponse>,
tonic::Response<super::SyncAccountStorageMapsResponse>,
tonic::Status,
>;
/// Returns transactions records for specific accounts within a block range.
Expand Down Expand Up @@ -1948,25 +1951,25 @@ pub mod api_server {
};
Box::pin(fut)
}
"/rpc.Api/SyncStorageMaps" => {
"/rpc.Api/SyncAccountStorageMaps" => {
#[allow(non_camel_case_types)]
struct SyncStorageMapsSvc<T: Api>(pub Arc<T>);
struct SyncAccountStorageMapsSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<super::SyncStorageMapsRequest>
for SyncStorageMapsSvc<T> {
type Response = super::SyncStorageMapsResponse;
> tonic::server::UnaryService<super::SyncAccountStorageMapsRequest>
for SyncAccountStorageMapsSvc<T> {
type Response = super::SyncAccountStorageMapsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SyncStorageMapsRequest>,
request: tonic::Request<super::SyncAccountStorageMapsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::sync_storage_maps(&inner, request).await
<T as Api>::sync_account_storage_maps(&inner, request).await
};
Box::pin(fut)
}
Expand All @@ -1977,7 +1980,7 @@ pub mod api_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SyncStorageMapsSvc(inner);
let method = SyncAccountStorageMapsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
Expand Down
Loading
Loading