Conversation
linera-base/src/identifiers.rs
Outdated
| /// 20-byte account EVM-compatible address. | ||
| #[debug(with = "hex_debug")] | ||
| Address20([u8; 20]), | ||
| Address20(#[debug(with = "hex_debug")] [u8; 20]), |
There was a problem hiding this comment.
I would add a test for Address20 as well as Address32 (which I assume is correct right now, just unsure because of a lack of test).
There was a problem hiding this comment.
Good idea! Turns out:
- For
Address32we only print 8 bytes because of theDebugimpl forCryptoHash. I guess I should change that, too, and print the whole hash. - For
Reserved, we print it in decimal. I guess that's okay, although I'd prefer hexadecimal there, too.
There was a problem hiding this comment.
For Reserved, we currently have only 0 as a possibility.
This corresponds to CHAIN, so I guess that we can do something here as well.
There was a problem hiding this comment.
Done in c0f8469; but now I'm a bit worried that this will make other log lines more spammy, because now all hashes are four times as long.
(I'll leave changing the representation of Reserved(0) for a later PR; not sure about that.)
There was a problem hiding this comment.
As discussed, let's print only 8 bytes for both variants instead.
## Motivation `AccountOwner::Address20`'s `Debug` impl prints something like: ``` Address20([10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) ``` because the `hex_debug` attribute is in the wrong place. ## Proposal Put the attribute directly on the field, not the enum variant. The `Debug` impl now says: ``` Address20(0a0a0a0a0a0a0a0a..) ``` ## Test Plan Tried it locally. ## Release Plan - Should be backported to testnet and devnet. ## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
## Motivation `AccountOwner::Address20`'s `Debug` impl prints something like: ``` Address20([10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) ``` because the `hex_debug` attribute is in the wrong place. ## Proposal Put the attribute directly on the field, not the enum variant. The `Debug` impl now says: ``` Address20(0a0a0a0a0a0a0a0a..) ``` ## Test Plan Tried it locally. ## Release Plan - Should be backported to testnet and devnet. ## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
## Motivation `AccountOwner::Address20`'s `Debug` impl prints something like: ``` Address20([10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) ``` because the `hex_debug` attribute is in the wrong place. ## Proposal Put the attribute directly on the field, not the enum variant. The `Debug` impl now says: ``` Address20(0a0a0a0a0a0a0a0a..) ``` ## Test Plan Tried it locally. ## Release Plan - Should be backported to testnet and devnet. ## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
Motivation
AccountOwner::Address20'sDebugimpl prints something like:because the
hex_debugattribute is in the wrong place.Proposal
Put the attribute directly on the field, not the enum variant. The
Debugimpl now says:Test Plan
Tried it locally.
Release Plan
Links