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

Format RawBytes debug as hex string rather than array of decimals #883

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

anorth
Copy link
Member

@anorth anorth commented Sep 16, 2022

The derived representation of a list of decimals is very unhelpful when debugging, e.g. CBOR-encoded values. The hex string will at least be usable in an CBOR inspector, and I think usually not less useful for cases when the bytes are representing something else (tho since this is the CBOR library, that'll be uncommon).

FYI @ZenGround0 when debugging actors.

@anorth anorth requested a review from Stebalien September 16, 2022 09:34
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.

Yeah, this is much more usable.

@anorth
Copy link
Member Author

anorth commented Sep 18, 2022

I'm having trouble landing this due to:

error: unused import: `crate::RawBytes`
   --> ipld/encoding/src/cbor.rs:102:9
    |
102 |     use crate::RawBytes;
    |         ^^^^^^^^^^^^^^^

My local environment

active toolchain
----------------

nightly-2022-05-09-x86_64-apple-darwin (overridden by '/Users/me/plabs/filecoin-project/ref-fvm/rust-toolchain')
rustc 1.62.0-nightly (cb1219871 2022-05-08)

replicates this warning, but if I remove the import then build fails with failed to resolve: use of undeclared type RawBytes` at the obvious places, and a recommendation to import it.

My IDE (1.63) also requires the import.

This may be related to the discussion in filecoin-project/builtin-actors#660, but I can't see how to straightforwardly apply the same technique here. @mriise can you help?

@mriise
Copy link
Contributor

mriise commented Sep 19, 2022

yeah! its a pretty simple fix :)

}
}

mod test {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
mod test {
#[cfg(test)]
mod test {

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks 🤦

@anorth anorth enabled auto-merge (squash) September 19, 2022 21:58
@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2022

Codecov Report

Merging #883 (4dbe9df) into master (d24b86f) will increase coverage by 0.06%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
+ Coverage   52.01%   52.08%   +0.06%     
==========================================
  Files         124      124              
  Lines       10191    10218      +27     
==========================================
+ Hits         5301     5322      +21     
- Misses       4890     4896       +6     
Impacted Files Coverage Δ
ipld/encoding/src/cbor.rs 40.67% <93.75%> (+31.30%) ⬆️

@anorth anorth merged commit 1dcb84d into master Sep 19, 2022
@anorth anorth deleted the anorth/bytes branch September 19, 2022 23:00
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.

4 participants