-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[move] Disable debug printing on nodes #8795
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
4add03e
to
5f14fcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I've done the necessary fixes with hakari to eliminate the testing feature from being turned on by workspace-hack packages. One thing to note is that if sui-node is built together with another target that does enabling the testing feature, then it'll get turned on in the final build but at least now it wont be enabled if its built by itself.
Move cost-calibration and unit testing code to `sui-move`.
Despite trying to disable printing using feature flags in #8795, it came back because of the additive nature of `feature`s. This time, disable debug printing on validators and full nodes for good, by controlling their inclusion using a flag passed in during native function creation, that controls whether to link against a silent version of the debug print functions or not. Unit tests, and other CLI usages of the VM typically link against the unsilenced native functions, and the version used by validators is silenced. Test Plan: Run all existing tests: ``` $ cargo simtest $ env SUI_SKIP_SIMTESTS=1 cargo nextest run ``` Create a test move package with the following content: ``` module test::test { struct ImALittleTeapot has copy, drop, store {} public entry fun print() { std::debug::print(&ImALittleTeapot {}); } #[test] fun test_printing() { print(); } } ``` And confirm that the following does print debug output ``` sui$ cargo build --bin sui --release sui$ cargo build --bin sui-node --release sui$ ./target/release/sui move test -p $PKG ``` While publishing to a local network and repeatedly calling `print` does not pollute the validator or fullnode logs.
## Description Despite trying to disable printing using feature flags in #8795, it came back because of the additive nature of `feature`s. This time, disable debug printing on validators and full nodes for good, by controlling their inclusion using a flag passed in during native function creation, that controls whether to link against a silent version of the debug print functions or not. Unit tests, and other CLI usages of the VM typically link against the unsilenced native functions, and the version used by validators is silenced. ## Test Plan Run all existing tests: ``` $ cargo simtest $ env SUI_SKIP_SIMTESTS=1 cargo nextest run ``` Create a test move package with the following content: ``` module test::test { struct ImALittleTeapot has copy, drop, store {} public entry fun print() { std::debug::print(&ImALittleTeapot {}); } #[test] fun test_printing() { print(); } } ``` And confirm that the following does print debug output ``` sui$ cargo build --bin sui --release sui$ cargo build --bin sui-node --release sui$ ./target/release/sui move test -p $PKG ``` While publishing to a local network and repeatedly calling `print` does not pollute the validator or fullnode logs.
## Description Despite trying to disable printing using feature flags in MystenLabs#8795, it came back because of the additive nature of `feature`s. This time, disable debug printing on validators and full nodes for good, by controlling their inclusion using a flag passed in during native function creation, that controls whether to link against a silent version of the debug print functions or not. Unit tests, and other CLI usages of the VM typically link against the unsilenced native functions, and the version used by validators is silenced. ## Test Plan Run all existing tests: ``` $ cargo simtest $ env SUI_SKIP_SIMTESTS=1 cargo nextest run ``` Create a test move package with the following content: ``` module test::test { struct ImALittleTeapot has copy, drop, store {} public entry fun print() { std::debug::print(&ImALittleTeapot {}); } #[test] fun test_printing() { print(); } } ``` And confirm that the following does print debug output ``` sui$ cargo build --bin sui --release sui$ cargo build --bin sui-node --release sui$ ./target/release/sui move test -p $PKG ``` While publishing to a local network and repeatedly calling `print` does not pollute the validator or fullnode logs.
Description
Disable outputting
debug::print
to stderr on full nodes and validators, to prevent user code from spamming our logs, while still enabling output for calls via CLI (e.g. tosui move test
). Removes a dependency fromsui-framework
tomove-unit-test
to make this work, by:cost_calib
module tosui-move
.Test Plan
With the following Move package:
Build
sui
CLI andsui-node
separately so that Cargo does not unify features, and start-up the validators embedded in the CLI, and a separate fullnode (in separate terminal sessions):Running the tests will print the debug output, and publishing and running transactions will produce debug output in the embedded validator, but not the dedicated fullnode: