-
Notifications
You must be signed in to change notification settings - Fork 10
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
PoE contract address query #192
Conversation
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.
This should work already. Awesome start. I have added some comments and nits to help with idiomatic Go.
Please run make format
btw the |
I still have to extend |
Improve error messages
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.
Good refactorings
49296fd
to
f9b7a90
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.
Almost perfect. Very good test coverage 💐
src: []byte(`{ "poe_contract_address": { "contract_type": "staking"} }`), | ||
mock: ViewKeeperMock{ | ||
GetPoEContractAddressFn: func(ctx sdk.Context, contractType poetypes.PoEContractType) (sdk.AccAddress, error) { | ||
if contractType == poetypes.PoEContractTypeStaking { |
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.
👍 good to have the switch here.
you can also use require.Equals(t, types.PoEContractTypeStaking, got)
instead but it is lacking the right instance of t
so that the whole test fails and not the single case
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.
Yes, I cannot do that here easily, because of table tests.
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 meant the following mock function would do the same as here or L318 but may be more readable
GetPoEContractAddressFn: func(ctx sdk.Context, contractType poetypes.PoEContractType) (sdk.AccAddress, error) {
assert.Equal(t, poetypes.PoEContractTypeUndefined, contractType)
return nil, sdkerrors.Wrap(wasmtypes.ErrInvalid, "contract type")
}},
Closes #168.