-
Notifications
You must be signed in to change notification settings - Fork 12
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
[On-chain, Relayminer] chore: add claim msg validation #236
Conversation
The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks. |
c7e0fdd
to
61c08c7
Compare
61c08c7
to
a74863c
Compare
caa24cd
to
17fb3f1
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.
Posting a partial review and will finish tomorrow.
testutil/testclient/localnet.go
Outdated
// | ||
// TODO_IMPROVE: It would be nice if the value could be set correctly based | ||
// on whether the test using it is running in tilt or not. | ||
const CometLocalWebsocketURL = "ws://sequencer-poktroll-sequencer:36657/websocket" |
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.
@okdas Does this look right to you?
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.
@bryanchriswhite yep! That hostname will now resolve to sequencer on both LocalNet and DevNet!
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.
@okdas Bump
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.
The PR is looking really good overall. Really appreciate both the changes, and comments to set up followup work.
Left a few lingering comments but should be g2g right after!
sessionQueryClient := types2.NewQueryClient(net.Validators[0].ClientCtx) | ||
res, err := sessionQueryClient.GetSession(ctx, &types2.QueryGetSessionRequest{ | ||
ApplicationAddress: appAddr, | ||
Service: &sharedtypes.Service{Id: testServiceId}, |
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.
Thoughts on having the caller pass in this local constant?
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.
Definitely have thoughts 😅. This is related to #236 (comment).
TL;DR, I would hold off for now.
It might be better to take a step back and think about how we would like multi-service integration tests to be designed, and then evaluate if it's compatible with our current direction (i.e. refactor and/or reuse what we have) or if we need to do that in a new test suite with more comprehensive helpers. Wdyt?
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 think holding off and seeing what/when we need from multi-service integration makes sense.
Let's hold off 👍
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.
🙏
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
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. The last round of comments & cleanup really put the on it!
Note that the E2E tests are failing and wanted to make sure you remember the base branch here is not main
(should it be?), but otherwise g2g!
type TxResult struct { | ||
Events []abciTypes.Event `json:"events"` | ||
} | ||
// |
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.
So much cleaner!
@@ -21,6 +21,12 @@ const ( | |||
// application address and the value is the session fixture. | |||
type SessionsByAppAddress map[string]sessiontypes.Session | |||
|
|||
// AppSupplierPair is a pairing of an application and a supplier 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.
Ty for making the change!
sessionQueryClient := types2.NewQueryClient(net.Validators[0].ClientCtx) | ||
res, err := sessionQueryClient.GetSession(ctx, &types2.QueryGetSessionRequest{ | ||
ApplicationAddress: appAddr, | ||
Service: &sharedtypes.Service{Id: testServiceId}, |
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 think holding off and seeing what/when we need from multi-service integration makes sense.
Let's hold off 👍
Thanks for calling this out! I typically intentionally keep the github base of PR branches the same as the git (actual) base until after approval to avoid cluttering the commit list during review. I always take note of the +/- LOC diff before and after re-github-basing (not an actual rebase operation). In the event of discrepancies and/or merge conflict resolutions I double-check everything before merging and would ask for re-review if something unexpected arises or changes since approval. |
…yring * pokt/main: [Off-chain, Polylog] refactor: replace std logger usage in pkg/... with polylog (#219) [Off-chain, Polylog] feat: polylog context integration (#218) [Off-chain, Polylog] chore: add zerolog logger implementation (#211) [Off-chain, Polylog] test: add testutils (#209) [Testing] chore: add testkeyring pkg (#237)
…im-msg-validation * issues/140/chore/testkeyring: [Off-chain, Polylog] refactor: replace std logger usage in pkg/... with polylog (#219) [Off-chain, Polylog] feat: polylog context integration (#218) [Off-chain, Polylog] chore: add zerolog logger implementation (#211) [Off-chain, Polylog] test: add testutils (#209) [Testing] chore: add testkeyring pkg (#237)
(cherry picked from commit 358cb0ae8ffed76a75d83f42ef0a4ea94d185189)
893b9db
to
e58cd33
Compare
* chore: add testkeyring pkg * chore: update go.mod * refactor: add session keeper dependency to supplier keeper * refactor: add mock session keeper to supplier keeper testutil * refactor: supplier keeper testutil usage * chore: add claim session validation * test: claim message validation unit coverage * test: e2e session lifecycle * chore: add `ApplicationModuleGenesisStateWithAccounts` testutil * wip: fix claims show/list tests * fix: bug in session supplier hydration * wip: fixing tests * wip: fixing tests * chore: update mock node flag with in-tilt host * wip: debugging * wip: debugging * chore: self-review improvements * chore: review feedback improvements * chore: add TODO Co-authored-by: Daniel Olshansky <[email protected]> * fixup! chore: update mock node flag with in-tilt host * chore: review feedback improvements * chore: review feedback improvements Co-authored-by: Daniel Olshansky <[email protected]> * wip * chore: chore: review feedback improvements Co-authored-by: Daniel Olshansky <[email protected]> * fix: post-merge * chore: review feedback improvements Co-authored-by: Daniel Olshansky <[email protected]> * chore: remove todo * chore: self-review improvements * chore: re Co-authored-by: Daniel Olshansky <[email protected]> * chore: review feedback improvements Co-authored-by: Daniel Olshansky <[email protected]> * chore: chore: review feedback improvements Co-authored-by: Daniel Olshansky <[email protected]> * fix: test * fix: disambiguate `CometLocalWebsocketURL` & `CometLocalTCPURL` (cherry picked from commit 358cb0ae8ffed76a75d83f42ef0a4ea94d185189) --------- Co-authored-by: Daniel Olshansky <[email protected]>
Summary
Human Summary
Adds validation logic around the claim's session during claim creation. The session ID must match that as determined by an on-chain query of the session given the same inputs. Additionally, the supplier list for the session must contain the supplier whose address is referenced in the claim.
AI Summary
Summary generated by Reviewpad on 07 Dec 23 10:58 UTC
This pull request includes various changes across multiple files. Here is a summary of the changes:
supplier.go
(intestutil/keeper
package):supplier
andsupplier/mocks
packages.sessiontypes
package fromgithub.com/pokt-network/poktroll/x/session/types
.SupplierKeeper
function to accept an additional parametersessionByAppAddr
of typesupplier.SessionsByAppAddress
.GetSession
method of themockSessionKeeper
mock.k.SupplySessionKeeper(mockSessionKeeper)
.relay_verifier.go
(inpkg/relayer/proxy
package):sdkerrors
package.ring_secp256k1
package.github.com/cometbft/cometbft/crypto
package.github.com/pokt-network/poktroll/x/session/types
package.VerifyRelayRequest
function to handle missing application address from the relay request.GetSignableBytesHash
.ringSig
.GetSession
method ofrp.sessionQuerier
.relay_builders.go
:ring_signer.go
:Sign
function to accept an array of 32 bytes for the message argument instead of a byte slice.sessiontypes
package:SessionKeeper
interface which includes theGetSession
method.go:generate mockgen
command to include theSessionKeeper
interface in the mock generation.testqueryclients/appquerier.go
:mockclient
andtypes
packages.GetApplication
function with an underscore.GetApplication
function to use theapptypes
type.GetApplication
function.apptypes.ErrAppNotFound
.app.go
:New
function related to the ordering of code and addition of comments.interface.go
:SupplierQueryClient
interface.SessionQueryClient
interface.session.feature
:simple_signer.go
:Sign
function to accept an array of bytes with a fixed size of 32.logger.go
(inpkg/polylog/polyzero
package):os
package as an import.NewLogger
function to provide default logger configuration.client.go
:cosmossdk.io/api/tendermint/abci
package.abciTypes
package fromgithub.com/cometbft/cometbft/abci/types
.TxEvent
to be an alias for theabci.TxResult
type.proxy.go
:cosmosclient
package.querytypes
package.suppliertypes.QueryClient
withclient.SupplierQueryClient
.sessiontypes.QueryClient
withclient.SessionQueryClient
.clientCtx
.supplierQuerier
withclient.SupplierQueryClient
.sessionQuerier
withclient.SessionQueryClient
.keyring
.proxiedServicesEndpoints
is not empty in thevalidateConfig
method.relayerproxy.go
:Issue
CreateClaim
message handling #140On-chain claim message handling should validate that the claimed session matches the session at the given claimed sesison end height; i.e. given some session inputs, ensure that the ID matches and that the supplier is in the session.
Type of change
Select one or more:
Testing
make go_develop_and_test
Sanity Checklist