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

[Discuss] Is it common sense to set vec![0u8; 8] as the default value of Hex? #1388

Closed
yangby-cryptape opened this issue Aug 30, 2023 · 0 comments · Fixed by #1482
Closed
Assignees
Labels
t:bug Something isn't working

Comments

@yangby-cryptape
Copy link
Collaborator

yangby-cryptape commented Aug 30, 2023

What happened

Is it common sense to set vec![0u8; 8] as the default value of Hex?

impl Default for Hex {
fn default() -> Self {
Hex(vec![0u8; 8].into())
}
}

In other words, let's pick 5 non-Axon developers randomly and ask them what is the default value of a hex string they think.
I don't think 8 zero bytes was the answer of most people.

An uncommon sense default value is very dangerous.
When we use an open-source type, have we checked their default values carefully before use?
Image that, we import an open-source U256, that it has set 1 as default value, what will happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants