-
Notifications
You must be signed in to change notification settings - Fork 224
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 utility traits for tendermint data types #64
Implement utility traits for tendermint data types #64
Conversation
17ce65f
to
5149dfb
Compare
5149dfb
to
2faae0b
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.
I don't think an all-zero hash or a default time makes sense. The rest looks fine.
2faae0b
to
0e7e832
Compare
0e7e832
to
5982f64
Compare
I've changed the format of |
5982f64
to
b231168
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.
Perhaps I'm a bit jaded by (in some cases security) vulnerabilities relating to Go zero values, which it seems is how Default
is being leveraged in the cases I pointed out in this review.
If you're looking for a way to easily construct test fixtures, I think Default
is the wrong tool for the job. Alternatively, in the test suite itself, you can define a trait specifically for test fixtures in the test suite itself, and then impl it however you want!
trait TestFixture {
fn test_fixture() -> Self;
}
impl TestFixture for Hash {
fn test_fixture() -> Hash {
Hash::Null
}
}
In general, I think it's a bad idea for anything that's a testing-related convenience to leak outside of the test context, especially when it could potentially lead to security issues in production.
Is that what most of these are for?
9d903e4
to
bf6f276
Compare
Yeah, actually we've changed the test code to use more properly constructed mocking data now. |
@yihuang looks like this needs a GPG signature |
bf6f276
to
680ea17
Compare
Done. |
I removed the
Default
instances that don't make sense.