aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug] mainnet aptos-node can not pass "assert_no_test_natives"

Open stopWarByWar opened this issue 3 years ago • 5 comments

🐛 Bug mainnet aptos-node can not pass "assert_no_test_natives"

To reproduce

When i switch to the mainnet commit and run the aptos-node, it showed :

thread 'main' panicked at 'assertion failed: aptos_natives(NativeGasParameters::zeros(),\n            AbstractValueSizeGasParameters::zeros(),\n            LATEST_GAS_FEATURE_VERSION).into_iter().all(|(_, module_name,\n            func_name, _)|\n        module_name.as_str() != \"unit_test\" &&\n            func_name.as_str() != \"create_signers_for_testing\")', aptos-move/aptos-vm/src/natives.rs:55:5

And when i print all native move module and function I fould

image

System information

Please complete the following information:

  • branch: mainnet
  • commit: 86b29874ff68bece908494a8c54ea35ac2cb0c43

stopWarByWar avatar Oct 18 '22 08:10 stopWarByWar

I ran into this as well. Looks like when you run cargo build --release it's build default is to build some test packages (into the "release" bin??) so you have to build the bin explicitly. See: https://github.com/aptos-labs/aptos-core/issues/5063

If you run cargo build -p aptos-node --release it will produce the production bin at: target/release/aptos-node

Not sure of the reasoning, but generally the convention most rust software projects follow is just to run cargo build --release and it should produce all the production-ready binaries... If it isn't a huge lift, aptos should consider using this convention for producing the production binaries.

DaveWK avatar Oct 18 '22 15:10 DaveWK

Yea this also happens if you import aptos-sdk into aptos-node and then build it...

ghost avatar Oct 20 '22 09:10 ghost

same issue here - no chance to get the indexer working with cargo run --bin aptos-node --features "indexer" -- --config

flofi-dev avatar Oct 26 '22 21:10 flofi-dev

As a temporary measure you can do git checkout 79009d61de776ac6f096634dd545be5730818c16 and then cargo run --release --bin aptos-node --features "indexer" -- --config meanwhile I will try to figure out what was the cause why testing modules happened to appear in prod release.

Another option is to clean your target folder (rm -rf target) and then manually exclude other packages (works on origin/main): cargo run --release --bin aptos-node -p aptos-node --features "indexer" -- --config ./fullnode.yaml

unordered-set avatar Oct 26 '22 22:10 unordered-set

One thing to note -- I am doing cargo build --release not cargo run --release -- I make my own docker images for deploys (I have a strong preference for RHEL/Fedora) and am copying the bins out to /opt/bin rather than running the app inside the source folder directly. This seems a bit safer to ensure I am running a static build with less potential for unexpected side effects.

DaveWK avatar Nov 03 '22 15:11 DaveWK

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Dec 23 '22 01:12 github-actions[bot]