-
Notifications
You must be signed in to change notification settings - Fork 0
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
Servicer & PocketNetworkClient #9
Conversation
* main: fix: add -s nested make calls which populate vars Standardised RPC port across localnet and testnet
adds relay worker tests and relay proto messages
* pokt/miner: removes outdated comment removes unnecessary break in session manager Start adds logger to relayer module relay worker tests passing [wip] relay tests failed successfully [wip] go mod tidy [wip] more protobuf error fixes and cleanup [wip] protobuf fixes moving mining logic to miner module add relay mining logic chore: stub out `rollkitPocketNetworkClient` impl. refactor: move servicer client to client pkg wip - adding in types and harness wip: port cmt-pokt servicer & deps test: update hardcoded test keypairs to secp256k1 chore: adapt keys to cosmos secp256k1 chore: port V1 crypto pkg
clientCtx cosmosClient.Context | ||
} | ||
|
||
func NewLocalCosmosPocketClient() modules.PocketNetworkClient { |
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.
@Olshansk #ReviewMe This is the PocketNetworkClient
implementation that would be used by the servicer command (i.e. pokrolld "internal" servicer).
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 at a high level.
I think that all internal business logic that requires access to state or leads to state transitions should tie into the keeper: #19 (comment)
client/pokt/cosmos/local.go
Outdated
) <-chan types.Maybe[*types.TxResult] { | ||
resultCh := make(chan types.Maybe[*types.TxResult], 1) | ||
|
||
// TODO_THIS_COMMIT: provide encoding config via DI (?) |
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.
// TODO_THIS_COMMIT: provide encoding config via DI (?) |
client/pokt/cosmos/local.go
Outdated
msg cosmosTypes.Msg, | ||
) <-chan types.Maybe[*types.TxResult] { | ||
// construct tx | ||
// TODO_THIS_COMMIT: use DI to get updated client context! |
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.
// TODO_THIS_COMMIT: use DI to get updated client context! |
|
||
var _ modules.ServicerClient = &servicerClient{} | ||
|
||
type servicerClient 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.
@Olshansk #ReviewMe Not much to review here but wanted to call it out regardless. This is a stub for the implementation of the servicer's RPC client. This would be used by the end client (or test) to request relays from the servicer.
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 "RPC client" is fundamentally an "off-chain". In other words a "read" in the context of the query/message server.
I think it should be scaffolded as a query using ignite.
The Query Server [1] has access to the keeper, which can in turn update the SMT.
[1] https://docs.cosmos.network/main/building-modules/query-services
cmd/poktrolld/cmd/root.go
Outdated
ctx := context.WithValue(cmd.Context(), PoktrollDepInjectorContextKey, injector) | ||
cmd.SetContext(ctx) | ||
|
||
// get key name from clientCtx |
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.
// get key name from clientCtx |
- remove irrelevant comment - add comment re: ensuring key exists - rename `servicer` to `srvcr` to avoid collision with imported package name
servicer/cmd.go
Outdated
} | ||
|
||
func servicerCmd(cmd *cobra.Command, args []string) error { | ||
injector := di.NewInjector() |
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.
@Olshansk #ReviewMe Here we're initializing our dependency injection and subsequently providing the cosmos-sdk dependencies for the localCosmosPocketClient
implementation of PocketNetworkClient
:
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 believe the injector is now deprecated :)
"poktroll/runtime/di" | ||
) | ||
|
||
type servicer 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.
@Olshansk #ReviewMe This is the servicer module implementation.
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.
ACK.
No need to have a logger, but the other types should be embedded in the servicer module's keeper struct.
"poktroll/x/poktroll/types" | ||
) | ||
|
||
type sessionManager 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.
@Olshansk #ReviewMe This is the SessionManager
which is used in the Servicer
to pass an observable which emits closed sessions to the Miner
.
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.
There will be some iterating we'll be doing here that I think will simplify it quite a bit and make it a lot more stateless.
See the session module
I just merged to main.
@@ -0,0 +1,77 @@ | |||
package utils |
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.
All file_utils functions seem be be unused (i.e. it's save to remove them if we want).
closestKey []byte, | ||
closestValueHash []byte, | ||
closestSum uint64, | ||
// TODO: what type should `claim` be? |
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.
// TODO: what type should `claim` be? |
closestSum uint64, | ||
// TODO: what type should `claim` be? | ||
proof *smt.SparseMerkleProof, | ||
err error, |
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.
@red-0ne why does this receive an error?
) | ||
|
||
type remoteCosmosPocketClient struct { | ||
//privateKey *secp256k1.PrivKey |
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.
//privateKey *secp256k1.PrivKey |
_ modules.PocketNetworkClient = &remoteCosmosPocketClient{} | ||
) | ||
|
||
type remoteCosmosPocketClient 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.
This is unused at the moment but is an example of what would be required after the servicer becomes external.
closestKey []byte, | ||
closestValueHash []byte, | ||
closestSum uint64, | ||
// TODO: what type should `claim` be? |
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.
// TODO: what type should `claim` be? |
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 I realize this is now deprecated but just left comments in the places you asked to review. I think it was a great first iteration and #19 is getting even closer.
The newer PR is pretty close to a first iteration and I think even the leakage of the txconfig and context can be cleaned up after we get the first version into main.
NOTE: This will be superseded by #19