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

fix(neard): fixed failed CI tests due to features mismatches #4339

Merged
merged 12 commits into from
Jun 2, 2021

Conversation

miraclx
Copy link
Contributor

@miraclx miraclx commented May 29, 2021

We're sort of in a weird spot as it is, we have features within nearcore that are required but can't be enabled if they depend on crates listed under dev-dependencies (bug in cargo: rust-lang/cargo#6915). Temporarily listing them under dependencies, fixed the CI testing failures we had while working on #4292 (same error @ailisp highlighted: #4333 (comment)), but as pointed out in #4331 (comment), this method should be out of the question. If we remove it, however, we can't work with the tests that depend on those features.

This PR moves the previously top-level tests into a new crate to have better dependency and feature handling as @matklad suggested

This would ensure we have dependencies like testlib, runtime-params-estimator and restored-receipts-verifier that are only needed for testing and depend on nearcore without cyclic dependency issues while having all features relevant to testing in order.

The features within neard have been reduced to proxies to nearcore features, which partially resolves #4325 (though the intent for that has morphed a bit). This also makes for a cleaner dependency graph from neard perspective, removing extraneous dependencies that were previously required.

I also noticed removed the old_tests feature that should've been removed along with the rest of it in #928.

Updated some docs and code comments referencing the old neard path too.

@miraclx miraclx changed the title Post decouple patch post-decouple patch May 29, 2021
@miraclx
Copy link
Contributor Author

miraclx commented May 29, 2021

All required CI checks pass so far ✔️ except the untested runtime-params-estimator which hasn't passed in a while anyways, I see the issues with this are as follows:

@miraclx miraclx requested review from ailisp and olonho as code owners May 30, 2021 04:40
@chefsale
Copy link
Contributor

chefsale commented May 30, 2021

The only thing I believe we can remove performance stats feature flag from all the binaries except neard in the makefile like I proposed in #4338 @bowenwang1996 @frol

@frol frol changed the title post-decouple patch fix(neard): fixed failed CI tests due to features mismatches May 31, 2021
neard/Cargo.toml Show resolved Hide resolved
nearcore/Cargo.toml Outdated Show resolved Hide resolved
nearcore/Cargo.toml Outdated Show resolved Hide resolved
neard/Cargo.toml Show resolved Hide resolved
integration-tests/Cargo.toml Outdated Show resolved Hide resolved
neard/Cargo.toml Outdated Show resolved Hide resolved
integration-tests/Cargo.toml Outdated Show resolved Hide resolved
cargo $(RUST_OPTIONS) build -p store-validator --features performance_stats,memory_stats
cargo $(RUST_OPTIONS) build -p near-vm-runner-standalone
cargo $(RUST_OPTIONS) build -p state-viewer --features nearcore/performance_stats,nearcore/memory_stats
cargo $(RUST_OPTIONS) build -p store-validator --features nearcore/performance_stats,nearcore/memory_stats
Copy link
Member

Choose a reason for hiding this comment

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

we probably should check these build in .buildkite/pipeline.yml:

cargo check -p state-viewer --features nearcore/performance_stats,nearcore/memory_stats
cargo check -p store-validator --features nearcore/performance_stats,nearcore/memory_stats

because existing check doesn't check these feature combinations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aren't these covered by this?

RUSTFLAGS='-D warnings' cargo check --workspace --all-targets --all-features

And @chefsale, what do you think? Regarding your remark in #4338 (comment), if those lines aren't necessary, checks for them might not as well.

Copy link
Member

Choose a reason for hiding this comment

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

No it doesn't because there's no workspace features, see this two commits' buildkite:
1a1256c
08e7e31

So the first one only checks

       RUSTFLAGS='-D warnings' cargo check --workspace --all-targets --all-features 

It passed. The second commit add a cargo check -p neard --features sandbox feature and it failed. This means sandbox feature of neard was not checked by cargo check --workspace --all-targets --all-features

Copy link
Member

Choose a reason for hiding this comment

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

@miraclx I think you're correct, all-features do include all features, mine case was failing because it's missing some features instead of --all-features didn't work. So the ci doesn't check all feature combinations. cargo check --workspace --all-targets --all-features ensures when all features are included, all packages can compile. But real build includes package build with no feature, or a subset of features, and they can fail if feature dependency wasn't correctly specified.

So for example this one from Makefile

cargo build -p state-viewer --features nearcore/performance_stats,nearcore/memory_stats

since we don't do make on ci, it makes sense to cargo check these compile, not introduced by your PR, but a thing we probably should do to gurantee make works on master commits.

cargo $(RUST_OPTIONS) build -p store-validator --features nightly_protocol,nightly_protocol_features,performance_stats,memory_stats
cargo $(RUST_OPTIONS) build -p near-vm-runner-standalone --features nightly_protocol,nightly_protocol_features
cargo $(RUST_OPTIONS) build -p state-viewer --features nearcore/nightly_protocol,nearcore/nightly_protocol_features,nearcore/performance_stats,nearcore/memory_stats
cargo $(RUST_OPTIONS) build -p store-validator --features nearcore/nightly_protocol,nearcore/nightly_protocol_features,nearcore/performance_stats,nearcore/memory_stats
Copy link
Member

Choose a reason for hiding this comment

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

Same check in buildkite here

Comment on lines +43 to +51
protocol_feature_evm = ["near-primitives/protocol_feature_evm"]
protocol_feature_block_header_v3 = ["near-primitives/protocol_feature_block_header_v3"]
protocol_feature_add_account_versions = ["near-primitives/protocol_feature_add_account_versions"]
protocol_feature_tx_size_limit = ["near-primitives/protocol_feature_tx_size_limit"]
protocol_feature_fix_storage_usage = ["near-primitives/protocol_feature_fix_storage_usage"]
nightly_protocol_features = ["nightly_protocol", "near-primitives/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_fix_storage_usage", "protocol_feature_restore_receipts_after_fix", "protocol_feature_cap_max_gas_price"]
protocol_feature_restore_receipts_after_fix = ["near-primitives/protocol_feature_restore_receipts_after_fix"]
protocol_feature_cap_max_gas_price = ["near-primitives/protocol_feature_cap_max_gas_price"]
nightly_protocol = ["near-primitives/nightly_protocol"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need all these features?

Copy link
Contributor Author

@miraclx miraclx Jun 2, 2021

Choose a reason for hiding this comment

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

Before now, lines like these enabled features that prior to the decoupling, existed in the workspace.

cargo $(RUST_OPTIONS) build -p near-vm-runner-standalone --release --features nightly_protocol,nightly_protocol_features,performance_stats,memory_stats

Now those features are defined in nearcore. This crate, however, doesn't directly depend on nearcore. So we have to adapt the needed features to directly match the available dependencies.

@near-bulldozer near-bulldozer bot merged commit 7c1080c into near:master Jun 2, 2021
@matklad
Copy link
Contributor

matklad commented Jun 2, 2021

Added auto-merge -- feels like the faster we do this, the better )

@miraclx miraclx deleted the post-decouple-patch branch June 2, 2021 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove nearcore features from neard Cargo.toml
7 participants