Skip to content

Commit

Permalink
[chore] Reduced dependencies for various near_* crates (near#11639)
Browse files Browse the repository at this point in the history
Compilation unit reduction:
* near-jsonrpc-primitives: 324 -> **181**
* near-chain-configs:  321 -> **170**
* near-chain-primitives: 325 -> **170**
* near-client-primitives: 325 -> **215**
* near-store: 414 -> **407** (this is actually not that great, but still
an improvement. Also, I think we can extract metrics into a feature to
improve compile time :)
  • Loading branch information
akorchyn authored Jun 28, 2024
1 parent e5d0444 commit 89fad46
Show file tree
Hide file tree
Showing 54 changed files with 236 additions and 204 deletions.
30 changes: 16 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chain/chain-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ thiserror.workspace = true
time.workspace = true
tracing.workspace = true

near-async.workspace = true
near-time.workspace = true
near-primitives.workspace = true
near-crypto.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion chain/chain-primitives/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use near_async::time::Utc;
use near_primitives::block::BlockValidityError;
use near_primitives::challenge::{ChunkProofs, ChunkState};
use near_primitives::errors::{EpochError, StorageError};
use near_primitives::shard_layout::ShardLayoutError;
use near_primitives::sharding::{ChunkHash, ShardChunkHeader};
use near_primitives::types::{BlockHeight, EpochId, ShardId};
use near_time::Utc;
use std::io;

#[derive(thiserror::Error, Debug)]
Expand Down
8 changes: 2 additions & 6 deletions chain/client-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ time.workspace = true
tracing.workspace = true
yansi.workspace = true

near-async.workspace = true
near-time.workspace = true
near-chain-primitives.workspace = true
near-chain-configs.workspace = true
near-chunks-primitives.workspace = true
Expand All @@ -31,17 +31,13 @@ near-primitives.workspace = true

[features]
nightly_protocol = [
"near-async/nightly_protocol",
"near-chain-configs/nightly_protocol",
"near-primitives/nightly_protocol",
]
nightly = [
"near-async/nightly",
"near-chain-configs/nightly",
"near-primitives/nightly",
"nightly_protocol",
]
sandbox = []
test_features = [
"near-primitives/test_features",
]
test_features = ["near-primitives/test_features"]
2 changes: 1 addition & 1 deletion chain/client-primitives/src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Structs in this module are used for debug purposes, and might change at any time
//! without backwards compatibility of JSON encoding.
use crate::types::StatusError;
use near_async::time::Utc;
use near_primitives::congestion_info::CongestionInfo;
use near_primitives::types::EpochId;
use near_primitives::views::{
Expand All @@ -15,6 +14,7 @@ use near_primitives::{
types::{AccountId, BlockHeight},
views::ValidatorInfo,
};
use near_time::Utc;
use std::collections::HashMap;

#[derive(serde::Serialize, serde::Deserialize, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion chain/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ near-parameters.workspace = true
near-performance-metrics-macros.workspace = true
near-performance-metrics.workspace = true
near-pool.workspace = true
near-primitives.workspace = true
near-primitives = { workspace = true, features = ["clock"] }
near-store.workspace = true
near-telemetry.workspace = true
near-vm-runner.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion chain/jsonrpc/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ serde.workspace = true
serde_json.workspace = true
tokio.workspace = true

near-async.workspace = true
near-time.workspace = true
near-jsonrpc.workspace = true
near-jsonrpc-primitives.workspace = true
near-jsonrpc-tests.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion chain/jsonrpc/fuzz/fuzz_targets_disabled/fuzz_target_1.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]
use actix::System;
use libfuzzer_sys::{arbitrary, fuzz_target};
use near_async::time::Clock;
use near_time::Clock;
use serde::ser::{Serialize, Serializer};
use serde_json::json;
use tokio;
Expand Down
5 changes: 2 additions & 3 deletions chain/jsonrpc/jsonrpc-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ borsh.workspace = true
serde.workspace = true
serde_json.workspace = true

near-time.workspace = true
near-async.workspace = true
near-chain-configs.workspace = true
near-crypto.workspace = true
Expand Down Expand Up @@ -61,7 +62,5 @@ nightly_protocol = [
"near-primitives/nightly_protocol",
"near-store/nightly_protocol",
]
statelessnet_protocol = [
"near-primitives/statelessnet_protocol",
]
statelessnet_protocol = ["near-primitives/statelessnet_protocol"]
sandbox = ["near-jsonrpc/sandbox", "near-o11y/sandbox"]
4 changes: 2 additions & 2 deletions chain/jsonrpc/jsonrpc-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::sync::Arc;

use actix::Addr;
use futures::{future, future::LocalBoxFuture, FutureExt, TryFutureExt};
use near_async::time::Clock;
use near_async::{
actix::AddrWithAutoSpanContextExt,
messaging::{noop, IntoMultiSender},
Expand All @@ -17,6 +16,7 @@ use near_jsonrpc_primitives::{
};
use near_network::tcp;
use near_primitives::types::NumBlocks;
use near_time::Clock;
use once_cell::sync::Lazy;
use serde_json::json;

Expand Down Expand Up @@ -72,7 +72,7 @@ macro_rules! test_with_client {

near_actix_test_utils::run_actix(async {
let (_view_client_addr, addr) =
test_utils::start_all(near_async::time::Clock::real(), $node_type);
test_utils::start_all(near_time::Clock::real(), $node_type);

let $client = new_client(&format!("http://{}", addr));

Expand Down
2 changes: 1 addition & 1 deletion chain/jsonrpc/jsonrpc-tests/tests/http_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use actix::System;
use futures::{future, FutureExt};

use near_actix_test_utils::run_actix;
use near_async::time::Clock;
use near_jsonrpc::client::new_http_client;
use near_o11y::testonly::init_test_logger;
use near_time::Clock;

use near_jsonrpc_tests as test_utils;

Expand Down
2 changes: 1 addition & 1 deletion chain/jsonrpc/jsonrpc-tests/tests/rpc_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use futures::{future, FutureExt};
use serde_json::json;

use near_actix_test_utils::run_actix;
use near_async::time::Clock;
use near_crypto::{KeyType, PublicKey, Signature};
use near_jsonrpc::client::{new_client, ChunkId};
use near_jsonrpc_primitives::types::query::QueryResponseKind;
Expand All @@ -17,6 +16,7 @@ use near_primitives::account::{AccessKey, AccessKeyPermission};
use near_primitives::hash::CryptoHash;
use near_primitives::types::{BlockId, BlockReference, EpochId, SyncCheckpoint};
use near_primitives::views::QueryRequest;
use near_time::Clock;

use near_jsonrpc_tests::{self as test_utils, test_with_client};

Expand Down
2 changes: 1 addition & 1 deletion chain/jsonrpc/jsonrpc-tests/tests/rpc_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use actix::{Actor, System};
use futures::{future, FutureExt, TryFutureExt};

use near_actix_test_utils::run_actix;
use near_async::time::Clock;
use near_crypto::{InMemorySigner, KeyType};
use near_jsonrpc::client::new_client;
use near_jsonrpc_primitives::types::transactions::{RpcTransactionStatusRequest, TransactionInfo};
Expand All @@ -16,6 +15,7 @@ use near_primitives::serialize::to_base64;
use near_primitives::transaction::SignedTransaction;
use near_primitives::types::BlockReference;
use near_primitives::views::{FinalExecutionStatus, TxExecutionStatus};
use near_time::Clock;

use near_jsonrpc_tests::{self as test_utils, test_with_client};

Expand Down
Loading

0 comments on commit 89fad46

Please sign in to comment.