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

Implement log initialisation inline in FVM runtime #1019

Merged
merged 1 commit into from
Jan 12, 2023
Merged

Conversation

anorth
Copy link
Member

@anorth anorth commented Jan 12, 2023

I couldn't get logging to result in a syscall with the SDK (even with local patch to include filecoin-project/ref-fvm#1431)

This brings log initialisation for the builtin actors into their repo, which I think is entirely appropriate anyway. And I can verify that logging produces a syscall.

@@ -259,8 +259,6 @@ where
let state_cid = fvm::sself::root()
.map_err(|_| actor_error!(illegal_argument; "failed to get actor root state CID"))?;

log::debug!("getting cid: {}", state_cid);
Copy link
Member Author

Choose a reason for hiding this comment

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

We can bring this kind of thing back as trace, if needed. But it looks like just noisy remnants of early development.

@Stebalien
Copy link
Member

This brings log initialisation for the builtin actors into their repo, which I think is entirely appropriate anyway. And I can verify that logging produces a syscall.

This makes no sense. The SDK already has a shared implementation that can be used by non builtin actors, why are we trying to duplicate this here?

@@ -552,14 +550,13 @@ where
/// 5a. In case of error, aborts the execution with the emitted exit code, or
/// 5b. In case of success, stores the return data as a block and returns the latter.
pub fn trampoline<C: ActorCode>(params: u32) -> u32 {
fvm::debug::init_logging();
Copy link
Member

Choose a reason for hiding this comment

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

If you want to set the max log level to trace, you can do that here. init_logging is designed to be unopinionated and just initialize the logging framework.

Copy link
Member Author

Choose a reason for hiding this comment

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

The v2 SDK initialises it to discard messages! As someone not deeply familiar with Rust logging configuration, this was extremely frustrating to discover. Also it still doesn't work, for reasons I don't understand yet.

The v3 SDK does initialise it to tracing. Maybe it'll work, and maybe we'll want to switch to it when we upgrade.

init_logging is opinionated about the format of the string that is logged, at least. We may well want to change it.

Copy link
Member Author

@anorth anorth left a comment

Choose a reason for hiding this comment

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

This is such a tiny amount of plumbing being pulled in here that I don't understand the motivation for pushback.

@@ -552,14 +550,13 @@ where
/// 5a. In case of error, aborts the execution with the emitted exit code, or
/// 5b. In case of success, stores the return data as a block and returns the latter.
pub fn trampoline<C: ActorCode>(params: u32) -> u32 {
fvm::debug::init_logging();
Copy link
Member Author

Choose a reason for hiding this comment

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

The v2 SDK initialises it to discard messages! As someone not deeply familiar with Rust logging configuration, this was extremely frustrating to discover. Also it still doesn't work, for reasons I don't understand yet.

The v3 SDK does initialise it to tracing. Maybe it'll work, and maybe we'll want to switch to it when we upgrade.

init_logging is opinionated about the format of the string that is logged, at least. We may well want to change it.

@codecov-commenter
Copy link

Codecov Report

Merging #1019 (3724ca7) into master (feaeea1) will decrease coverage by 0.07%.
The diff coverage is 97.21%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1019      +/-   ##
==========================================
- Coverage   89.20%   89.12%   -0.08%     
==========================================
  Files          92       92              
  Lines       19580    19327     -253     
==========================================
- Hits        17466    17226     -240     
+ Misses       2114     2101      -13     
Impacted Files Coverage Δ
actors/power/src/ext.rs 83.33% <ø> (ø)
runtime/src/lib.rs 88.00% <ø> (ø)
actors/verifreg/src/lib.rs 92.51% <90.90%> (-0.27%) ⬇️
test_vm/src/lib.rs 88.80% <92.85%> (-0.14%) ⬇️
actors/miner/src/lib.rs 83.09% <94.73%> (-0.33%) ⬇️
actors/power/src/lib.rs 82.92% <95.00%> (-0.92%) ⬇️
actors/market/src/lib.rs 89.64% <95.23%> (-0.36%) ⬇️
actors/account/src/lib.rs 91.66% <100.00%> (+0.17%) ⬆️
actors/cron/src/lib.rs 88.23% <100.00%> (-4.87%) ⬇️
actors/datacap/src/lib.rs 77.29% <100.00%> (+0.73%) ⬆️
... and 33 more

@anorth anorth force-pushed the anorth/workbench branch 3 times, most recently from 77f5755 to 64f9f6d Compare January 12, 2023 19:31
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

As noted by @anorth, this works around an issue in FVM v2. We'll remove this once we update to v3 (and backport any required bug fixes).

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.

3 participants