-
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
feat: claim/proof messages, relayer, & genesis #24
Conversation
* Implemented a servicer client * Relayminer aka Off-chain servicer as poktrolld sub-command * Generated Claim and Proof messages
- use `bytes` for binary data - update CLI usages to use hex-encoded input args
* pokt/main: chore: remove .pb.go & .pb.gw.go files from version control (already gitignored)
679a617
to
191d01e
Compare
- move signal handling to cmd code - use cancellable context - add waitgroup to track goroutines
* pokt/relayer-with-ws: WIP: proxy sign replies
7ae099c
to
6516f68
Compare
chore: protect session writes with mutexs
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.
|
||
.PHONY: localnet_regenesis | ||
localnet_regenesis: | ||
# NOTE: intentionally not using --home <dir> flag to avoid overwriting the test keyring |
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.
Consider using --home=$(POKTROLLD_HOME)
like we do in other places
"pub_key": null, | ||
"account_number": "1", | ||
"sequence": "0" | ||
}, |
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've not looked into ignite accounts yet but ignite chain init will generate all the accounts and genesis to match all the accounts in config.yml. It seems more straightforward and conventional to me to use it for this purpose.
Ccing @okdas who will likely be looking closer at best practices here.
Also, I was under the impression that after poktrolld add-genesis-account one would also have to run poktrolld gentx followed by poktrolld collect-gentxs.
My gut says no (an account is just a balance) but I haven't looked into it.
|
||
option go_package = "poktroll/x/servicer/types"; | ||
|
||
message EventClaim { |
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.
- Can you leave a comment on what/how/where this is used?
- Can you link me to where this naming convention / pattern is the best practice?
keyName string | ||
// wsURL is the URL of the websocket endpoint to connect to for RPC | ||
// service over websocket transport (with /subscribe support). | ||
wsURL string |
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.
Is this a cometbft endpoint? It's unclear from the comment as to who is providing this endpoint.
// getNextRequestId increments and returns the JSON-RPC request ID which should | ||
// be used for the next request. These IDs are expected to be unique (per request). | ||
func (client *servicerClient) getNextRequestId() uint64 { | ||
client.nextRequestId++ |
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.
Two comments:
-
Does it have to be monotonically increasing or will random work as well? Jargon: entropy, distributed tracing, etc...
-
Do you think we need a lock around this to where we defer the unlock?
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.
Overall, pretty good and clean. A few things for the main repo:
- Need more comments related to the structs and the fields
- Will need to spend more time on the types (protos & structs). We should:
- Look at what was done in v0 (e.g. their version of the session manager)
- Look at what we designed in v1 (e.g. the relay types)
- Need a diagram showing the relationship in the components under
relayer
- The most confusing part right now is definitely the proxy and the session manager. Will take closer looks at those when we review them in smaller pieces.
relayer/sessionmanager/session.go
Outdated
type sessionWithTree struct { | ||
sessionInfo *types.Session | ||
tree *smt.SMST | ||
treeStore smt.KVStore |
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.
Why do we need to keep references to the store, the path AND the tree?
relayer/sessionmanager/session.go
Outdated
|
||
func (s *sessionWithTree) SessionTree() *smt.SMST { | ||
// if the tree is closed, we need to re-open it from disk | ||
if s.closed { |
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'm a bit confused on when it's okay or not okay to reopen a tree. My assumption is that if it's closed, it's closed forever.
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.
Changes
Dependencies
Until pokt-network/smt#19 and pokt-network/smt#18 are merged, the go.mod needs to use a
replace
to point to a temporary version (poktroll-needs
branch) of thesmt
package which includes ~~support for serialization ofSparseMerkelTree
s as well as implementation of the KV store and#ProveClosest()
.On-chain servicer logic (module)
Claim
andProof
messagesstring
to[]byte
due to ignite limitations (see: supported types)Off-chain servicer logic (aka relayer)
relayer
subcommand (i.e.poktrolld relayer -h
) to isolate client-side / off-chain servicer logicServiceClient
to listen (via websocket) for new blocksGenesis
localnet_regenesis
make target which regenerates the localnet genesis.json, node_key.json, priv_validator_key.json, & test keyringignite chain init
(see: docs) to populate genesis & keyring according to config.yml (see: ignite docs)Running
Start celestia and the sequencer:
Stake app1 & servicer1
Start the relayer:
Start anvil (mock relay-chain node):
(see:
anvil
docs)Request a relay via
cast
(on the default port:8545
):(see:
cast
docs)Subscribe for new blocks:
Query for servicer1 claims: