-
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
Add PoE staking query plugin #170
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.
Nice work, a few comments to polish it off.
twasmKeeper := twasmkeeper.NewKeeper( | ||
|
||
var twasmKeeper twasmkeeper.Keeper | ||
handler := wasmkeeper.WithMessageHandlerDecorator(func(nested wasmkeeper.Messenger) wasmkeeper.Messenger { |
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 want to ensure this is in sync with the version in app/wasm.go, then maybe we just pull this decoration into a function in app/wasm.go and call the same wrapping function from the test code.
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 see your point but we would have cyclic dependencies in app.
We don't need the full set of custom queries/messages here but only the twasm ones for genesis/ boostrap tests in this module.
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.
Okay. Cyclic dependencies are annoying and Go is not terribly good at handling them,
@@ -257,7 +261,24 @@ func createTestInput( | |||
stakingtypes.RegisterQueryServer(querier, stakingkeeper.Querier{Keeper: stakingKeeper}) | |||
distributiontypes.RegisterQueryServer(querier, distKeeper) | |||
|
|||
keeper := NewKeeper( | |||
var keeper Keeper | |||
handler := wasmkeeper.WithMessageHandlerDecorator(func(nested wasmkeeper.Messenger) wasmkeeper.Messenger { |
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.
Again, good to reuse a function from app/wasm.go
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.
nice fixes
example.BankKeeper.SetBalances(ctx, myOperatorAddr, sdk.NewCoins(sdk.NewCoin(types.DefaultBondDenom, sdk.NewInt(100)))) | ||
|
||
var oneInt = sdk.OneInt() | ||
specs := map[string]struct { |
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 set of queries and high-level integration test for the contracts
reward, err := poeKeeper.DistributionContract(ctx).ValidatorOutstandingReward(ctx, delegator) | ||
if err != nil { | ||
return nil, err | ||
CanRedelegate: wasmvmtypes.NewCoin(0, bondDenom), |
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.
looks good
Resolves #96
Wasm query plugin to communicates with PoE contracts.
With this PR the wasm query setup moves into the app level so that different modules can provide their own extensions without creating dependency issues. Similar to the ante setup