-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix: add attribute nil verifications in chainReader #448
fix: add attribute nil verifications in chainReader #448
Conversation
The structure is taken from this other PR that tests invalid config: Layr-Labs#447. This is done this way to make easier future merges
We should use errors.Wrap |
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.
LGTM! Just left some comments
|
||
_ = contractAddrs | ||
_ = operator | ||
_ = chainReader |
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.
Are we going to use these variables? Otherwise we can remove them
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.
assert.Zero(t, strategy) | ||
assert.Zero(t, undToken) | ||
assert.Error(t, err) | ||
assert.Equal(t, err.Error(), "Failed to fetch token contract: no contract code at given address") |
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.
If we know that this function will throw an error, is it necessary to check the strategy
and undToken
?
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.
No, done in Remove unnecesary asserts
assert.Zero(t, strategy) | ||
assert.Zero(t, methods) | ||
assert.Zero(t, undToken) | ||
assert.Error(t, err) | ||
assert.Equal(t, err.Error(), "Failed to fetch token contract: no contract code at given address") |
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.
ditto
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.
Done in Remove unnecesary asserts
What Changed?
Some
chainReader
methods currently does not verify that some attributes are not nil before accessing them. This PR aims to fix this and add some test cases covering it.Also renames a variable that had a generic name for a more proper one.
Note: This PR respects structure from #447 and it's recommended to merge after it.
Reviewer Checklist