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

refactor(neard): decouple into individual crates #4292

Merged
merged 20 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from 16 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
5 changes: 3 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ steps:
# artifact_paths:
# - "rainbow-bridge/logs/**/*.log"

- label: "cargo release check"
- label: "cargo check nearcore library (without Cargo.lock)"
frol marked this conversation as resolved.
Show resolved Hide resolved
command: |
source ~/.cargo/env
rm Cargo.lock
RUSTFLAGS='-D warnings' cargo build
cd nearcore
RUSTFLAGS='-D warnings' cargo check

timeout: 30
agents:
Expand Down
3 changes: 2 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
/tools/indexer/ @khorolets @frol

/core/ @bowenwang1996 @frol @evgenykuzyakov @nearmax @SkidanovAlex
/neard/ @bowenwang1996 @frol @evgenykuzyakov @nearmax @SkidanovAlex
/neard/ @bowenwang1996 @frol
/nearcore/ @bowenwang1996 @frol @evgenykuzyakov @SkidanovAlex

/.buildkite/ @chefsale @mhalambek
/scripts/ @chefsale @mhalambek
76 changes: 40 additions & 36 deletions Cargo.lock

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

71 changes: 4 additions & 67 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
[package]
name = "nearcore"
version = "0.1.0"
authors = ["Near Inc <hello@nearprotocol.com>"]
edition = "2018"

[workspace]
resolver = "2"
members = [
"core/chain-configs",
"core/crypto",
Expand Down Expand Up @@ -36,7 +31,8 @@ members = [
"test-utils/loadtester",
"test-utils/state-viewer",
"test-utils/store-validator",
"neard/",
"neard",
"nearcore",
"tools/rpctypegen/core",
"tools/rpctypegen/macro",
"genesis-tools/genesis-csv-to-json",
Expand All @@ -49,36 +45,12 @@ members = [
"tools/restored-receipts-verifier"
]

[dev-dependencies]
# Pin dependency to avoid compilation errors
funty = "=1.1.0"

rand = "0.7"

near-logger-utils = { path = "./test-utils/logger" }
near-chain-configs = { path = "./core/chain-configs" }
near-crypto = { path = "./core/crypto" }
near-primitives = { path = "./core/primitives" }
near-store = { path = "./core/store" }
runtime-params-estimator = { path = "./runtime/runtime-params-estimator", default_features = false }
restored-receipts-verifier = { path = "./tools/restored-receipts-verifier"}
near-chain = { path = "./chain/chain" }

node-runtime = { path = "./runtime/runtime" }

near-jsonrpc = { path = "./chain/jsonrpc" }
near-network = { path = "./chain/network" }

neard = { path = "./neard"}

testlib = { path = "./test-utils/testlib" }

[patch.crates-io]
ethereum-types = { path = "./patches/ethereum-types-0.10.0-to-0.11.0" }
# Temporary wasmer fork which disables rayon (parallel compilation)
# https://github.com/wasmerio/wasmer/pull/2262
# Revome this when the new version of wasmer is published.
wasmer-compiler-singlepass = { git = "https://github.com/near/wasmer", branch = "1.0.2-single-threaded"}
wasmer-compiler-singlepass = { git = "https://github.com/near/wasmer", branch = "1.0.2-single-threaded" }

[profile.release]
lto = true # Enable full link-time optimization.
Expand All @@ -101,38 +73,3 @@ opt-level = 3 # BLS library is too slow to use in debug

[profile.dev.package.bs58]
opt-level = 3 # bs58 library is too slow to use in debug

[features]
performance_stats = ["neard/performance_stats", "near-network/performance_stats"]
memory_stats = ["neard/memory_stats"]
c_memory_stats = ["neard/c_memory_stats"]
expensive_tests = ["neard/expensive_tests"]
regression_tests = []
old_tests = []
adversarial = ["neard/adversarial", "near-jsonrpc/adversarial", "near-store/adversarial"]
no_cache = ["neard/no_cache"]
metric_recorder = ["neard/metric_recorder"]
delay_detector = ["neard/delay_detector"]
rosetta_rpc = ["neard/rosetta_rpc"]
nightly_protocol = ["near-primitives/nightly_protocol", "near-jsonrpc/nightly_protocol", "testlib/nightly_protocol", "neard/nightly_protocol"]
nightly_protocol_features = ["nightly_protocol", "neard/nightly_protocol_features", "protocol_feature_evm", "protocol_feature_block_header_v3", "protocol_feature_alt_bn128", "protocol_feature_add_account_versions", "protocol_feature_tx_size_limit", "protocol_feature_allow_create_account_on_delete", "testlib/nightly_protocol_features", "protocol_feature_fix_storage_usage", "protocol_feature_restore_receipts_after_fix", "protocol_feature_cap_max_gas_price"]
protocol_feature_evm = ["neard/protocol_feature_evm", "testlib/protocol_feature_evm", "runtime-params-estimator/protocol_feature_evm"]
protocol_feature_alt_bn128 = ["neard/protocol_feature_alt_bn128", "testlib/protocol_feature_alt_bn128", "runtime-params-estimator/protocol_feature_alt_bn128"]
protocol_feature_block_header_v3 = ["near-primitives/protocol_feature_block_header_v3", "near-chain/protocol_feature_block_header_v3", "neard/protocol_feature_block_header_v3"]
protocol_feature_tx_size_limit = ["near-primitives/protocol_feature_tx_size_limit", "node-runtime/protocol_feature_tx_size_limit", "neard/protocol_feature_tx_size_limit"]
protocol_feature_allow_create_account_on_delete = ["testlib/protocol_feature_allow_create_account_on_delete", "near-primitives/protocol_feature_allow_create_account_on_delete", "node-runtime/protocol_feature_allow_create_account_on_delete", "neard/protocol_feature_allow_create_account_on_delete"]
protocol_feature_add_account_versions = ["near-primitives/protocol_feature_add_account_versions"]
protocol_feature_fix_storage_usage = ["near-primitives/protocol_feature_fix_storage_usage", "neard/protocol_feature_fix_storage_usage", "node-runtime/protocol_feature_fix_storage_usage"]
protocol_feature_restore_receipts_after_fix = ["near-primitives/protocol_feature_restore_receipts_after_fix", "near-chain/protocol_feature_restore_receipts_after_fix", "neard/protocol_feature_restore_receipts_after_fix", "node-runtime/protocol_feature_restore_receipts_after_fix", "restored-receipts-verifier/protocol_feature_restore_receipts_after_fix"]
protocol_feature_cap_max_gas_price = ["near-primitives/protocol_feature_cap_max_gas_price", "neard/protocol_feature_cap_max_gas_price", "near-chain/protocol_feature_cap_max_gas_price"]

# enable this to build neard with wasmer 1.0 runner
# now if none of wasmer0_default, wasmer1_default or wasmtime_default is enabled, wasmer0 would be default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those features are needed, why they are removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I didn't notice that! I think it'd be good indeed to move this over to neard/Cargo.toml instead of just deleting.

That being said, I wouldn't block on that, as the following now works without feature forwarding:

cargo build -p neard --features node-runtime/wasmer1_default

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olonho Great catch!

It seems it should be in both nearcore (defined as node-runtime/wasmer1_default) and in neard (defined as nearcore/wasmer1_default).

wasmer1_default = ["node-runtime/wasmer1_default"]
wasmer0_default = ["node-runtime/wasmer0_default"]
wasmtime_default = ["node-runtime/wasmtime_default"]
# enable some of these to run runtime tests with wasmer 1.0, 0.x and wasmtime vm enabled
# but would not change default runner used by neard
wasmer1_vm = ["node-runtime/wasmer1_vm"]
wasmer0_vm = ["node-runtime/wasmer0_vm"]
wasmtime_vm = ["node-runtime/wasmtime_vm"]
2 changes: 1 addition & 1 deletion chain/chunks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Near Inc <hello@nearprotocol.com>"]
edition = "2018"

[dependencies]
actix = "0.11.0-beta.2"
actix = "=0.11.0-beta.2"
futures = "0.3"
rand = "0.7"
chrono = "0.4.6"
Expand Down
2 changes: 1 addition & 1 deletion chain/client-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
actix = "0.11.0-beta.2"
actix = "=0.11.0-beta.2"
chrono = { version = "0.4.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
strum = { version = "0.20", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions chain/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"

[dependencies]
ansi_term = "0.12"
actix = "0.11.0-beta.2"
actix = "=0.11.0-beta.2"
frol marked this conversation as resolved.
Show resolved Hide resolved
actix-rt = "2"
futures = "0.3"
chrono = { version = "0.4.4", features = ["serde"] }
Expand Down Expand Up @@ -45,7 +45,7 @@ delay-detector = { path = "../../tools/delay_detector", optional = true }
near-logger-utils = { path = "../../test-utils/logger" }
near-actix-test-utils = { path = "../../test-utils/actix-test-utils" }
testlib = { path = "../../test-utils/testlib" }
neard = { path = "../../neard" }
nearcore = { path = "../../nearcore" }
near-test-contracts = { path = "../../runtime/near-test-contracts" }

[features]
Expand Down
4 changes: 2 additions & 2 deletions chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ mod test {
use near_primitives::version::ProtocolFeature;
use near_primitives::version::PROTOCOL_VERSION;
use near_store::test_utils::create_test_store;
use neard::config::GenesisExt;
use nearcore::config::GenesisExt;

use crate::test_utils::TestEnv;
use near_network::test_utils::MockNetworkAdapter;
Expand All @@ -1700,7 +1700,7 @@ mod test {
pub fn create_nightshade_runtimes(genesis: &Genesis, n: usize) -> Vec<Arc<dyn RuntimeAdapter>> {
(0..n)
.map(|_| {
Arc::new(neard::NightshadeRuntime::new(
Arc::new(nearcore::NightshadeRuntime::new(
Path::new("."),
create_test_store(),
&genesis,
Expand Down
Loading