Skip to content
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

Merged
merged 140 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 138 commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
f39df3a
WIP: Separate client and server commands
red-0ne Sep 15, 2023
707abb5
fix: re-generation artifacts
bryanchriswhite Sep 18, 2023
b119ce3
chore: update `Proof` and `Claim` types
bryanchriswhite Sep 18, 2023
de6d5ac
chore: update SMT dep with go.mod replace
bryanchriswhite Sep 18, 2023
be3fa80
feat: implement `ServicerClient#SubmitProof()` & `#SubmitClaim()`
bryanchriswhite Sep 18, 2023
5dc911b
Merge remote-tracking branch 'pokt/main' into relayminer
bryanchriswhite Sep 18, 2023
5844282
chore: refactor relayer & new blocks WS client
red-0ne Sep 18, 2023
249f41c
refactor: relayer session type as interface
bryanchriswhite Sep 18, 2023
d7d946a
debug: newBlocks observable
bryanchriswhite Sep 18, 2023
6fefe10
feat: Add new block event constructor
red-0ne Sep 18, 2023
d5265ab
feat: Source servicer params from viper flags
red-0ne Sep 18, 2023
48c9a35
fix: Observable relying on nil channel
red-0ne Sep 18, 2023
9705345
fix: New blocks not getting reacted to
red-0ne Sep 18, 2023
d4dad85
fix: handle websocket closed error in servicer client listener
bryanchriswhite Sep 19, 2023
6967f7d
fix: update defalut websocket URL port to poktrolld (not celestia)
bryanchriswhite Sep 19, 2023
3c7b53c
fix: restructure `tendermintBlockEvent` to match
bryanchriswhite Sep 19, 2023
191d01e
chore: close servicer client websocket conn on teardown
bryanchriswhite Sep 19, 2023
c6cbabc
refactor: relayer command
bryanchriswhite Sep 19, 2023
e8666c6
WIP: proxy sign replies
red-0ne Sep 19, 2023
c027161
Merge remote-tracking branch 'pokt/relayer-with-ws' into relayminer
bryanchriswhite Sep 19, 2023
ecfa7fb
refactor: `Proxy#ServeHTTP()`
bryanchriswhite Sep 19, 2023
9d1c664
chore: add `keyring-backend` flag to relayer cmd
bryanchriswhite Sep 19, 2023
31185fd
chore: add node flag to relayer subcommand
bryanchriswhite Sep 19, 2023
37dec27
chore: add "regenesis" make target
bryanchriswhite Sep 19, 2023
f263635
chore: add mnemonics to test accounts
bryanchriswhite Sep 19, 2023
10c182f
chore: update localnet genesis
bryanchriswhite Sep 19, 2023
946633f
wip: add debug & error logging
bryanchriswhite Sep 19, 2023
a89c474
refactor: update `MsgProof#ProofBz` to `#Proof` & use protobuf type
bryanchriswhite Sep 19, 2023
8d53bd1
chore: add `Block` runtime interface assertion
bryanchriswhite Sep 19, 2023
91e80e8
chore: remove duplicate AddCommand
red-0ne Sep 19, 2023
a9bc3f2
fixup: update proof types
bryanchriswhite Sep 19, 2023
384f7a6
chore: remove unused interface type
bryanchriswhite Sep 19, 2023
d3cdef1
chore: add godoc comment
bryanchriswhite Sep 19, 2023
6e3adfe
refactor: `Proxy#ServeHTTP()`
bryanchriswhite Sep 19, 2023
0dcda55
chore: add/update TODOs
bryanchriswhite Sep 19, 2023
5cb5f09
chore: cleanup
bryanchriswhite Sep 19, 2023
b2c7a97
chore: more TODOs
bryanchriswhite Sep 19, 2023
757c8ab
chore: cleanup & add error log
bryanchriswhite Sep 19, 2023
8cb5a36
fix: github commit fail
bryanchriswhite Sep 20, 2023
2c05cfe
chore: untrack ts-client dir
bryanchriswhite Sep 20, 2023
c42fd33
Merge branch 'main' into relayminer
bryanchriswhite Sep 20, 2023
16f7a23
chore: regenerate openapi.yml (on build)
bryanchriswhite Sep 20, 2023
8c3fd44
wip: recover from panic to demo relaying
bryanchriswhite Sep 20, 2023
6b5b2ee
chore: update config.yml to include necessary actors
bryanchriswhite Sep 20, 2023
030131a
chore: `make regenesis` replaces entire poktrolld home dir contents
bryanchriswhite Sep 20, 2023
13e78f6
chore: regenesis
bryanchriswhite Sep 20, 2023
62479ce
chore: rename regenesis make target to localnet_regenesis
bryanchriswhite Sep 20, 2023
d7d444b
Revert "chore: regenesis"
bryanchriswhite Sep 20, 2023
b61002c
chore: update localnet keyring post regenesis
bryanchriswhite Sep 20, 2023
3b39a50
chore: regenesis
bryanchriswhite Sep 20, 2023
597f78f
fix: `make localnet_regenesis` should not modify configs
bryanchriswhite Sep 20, 2023
7fe742f
fix: update app addresses in make targets
bryanchriswhite Sep 20, 2023
cd20cca
fixup: use the hasher the correct way
red-0ne Sep 19, 2023
daf0127
chore: stub genesis params in config.yml
red-0ne Sep 20, 2023
67eb2e7
fixup: use smt (un)marshal for proof serialization
red-0ne Sep 20, 2023
6cf12b0
Merge pull request #26 from pokt-network/proof-serialization
red-0ne Sep 20, 2023
6d02ad7
fixup: argSum should be uint64
red-0ne Sep 20, 2023
feb5cef
refactor: websocket message handling & listen for committed claims
red-0ne Sep 21, 2023
3d00926
chore: add `EventClaimed` type to servicer module
bryanchriswhite Sep 21, 2023
c38cfac
chore: update `ServicerClient` interface
bryanchriswhite Sep 21, 2023
463e0a0
fix: initialize `committedClaims` map
bryanchriswhite Sep 21, 2023
3624d25
chore: regenerate openapi.yml
bryanchriswhite Sep 21, 2023
a761ed8
chore: refactor rename `EventClaimed#root` to `EventClaimed#smd_root_…
bryanchriswhite Sep 21, 2023
2e7f7ba
refactor: reorganize servicer client implementation across multiple f…
bryanchriswhite Sep 21, 2023
928d0d1
refactor: rename relayer/client/block.go to blocks.go
bryanchriswhite Sep 21, 2023
3bfb918
refactor: move unexported helpers below methods
bryanchriswhite Sep 21, 2023
d3ec69f
chore: add `committedClaimsMutex` to protect from concurrent reads/wr…
bryanchriswhite Sep 21, 2023
893aaab
chore: factor out smt root hash string key
bryanchriswhite Sep 21, 2023
23074c6
refactor: client block impl./usage
bryanchriswhite Sep 22, 2023
a4bd536
chore: remove unnecessary token balanes
bryanchriswhite Sep 22, 2023
e1f9203
WIP: implement websockets and claim/proof lifecycle
red-0ne Sep 23, 2023
a865cef
chore: add named return args to `ServicerClient` interface
bryanchriswhite Sep 23, 2023
f20087f
refactor: rename `servicerClient#broadcastMessageTx()` to `#signAndBr…
bryanchriswhite Sep 23, 2023
b8646b6
fix: websocket error handling
bryanchriswhite Sep 23, 2023
90983a2
fix: empty ws msg error check
bryanchriswhite Sep 23, 2023
ce0d0b9
chore: add `ServicerClient#LatestBlock()`
bryanchriswhite Sep 23, 2023
47b06cb
chore: listen for txs by hash instead of claim events
bryanchriswhite Sep 23, 2023
6a1a1f1
chore: add logs
bryanchriswhite Sep 23, 2023
00e0023
chore: cleanup
bryanchriswhite Sep 23, 2023
3fd26fc
fix: move goroutine calls to appropriate method
bryanchriswhite Sep 23, 2023
26c23b6
fix: call tx `#ValidateBasic()` method
bryanchriswhite Sep 23, 2023
8ee27ab
chore: add godoc comments
bryanchriswhite Sep 23, 2023
5c4fe0b
refactor: simplify servicer client txs err channel usage
bryanchriswhite Sep 23, 2023
a2862b7
Merge branch 'ws-relay-tree-mgmt' into fix/servicer-client-txs
bryanchriswhite Sep 24, 2023
9761013
fix: interrupt signal not exiting
bryanchriswhite Sep 24, 2023
b5d5887
fix: rename post-merge
bryanchriswhite Sep 24, 2023
22ab472
fix: post-merge
bryanchriswhite Sep 24, 2023
99e4947
fix: app2 & app3 addresses in make targets
bryanchriswhite Sep 25, 2023
f1de953
chore: validate endpoint URLs on servicer staking
bryanchriswhite Sep 25, 2023
5aca45d
refactor: working http proxy
red-0ne Sep 25, 2023
17fb277
chore: add comment, log, lower-case tx hash consistently, & add `come…
bryanchriswhite Sep 25, 2023
78603f4
fix: block until latestBlock is initially populated
red-0ne Sep 25, 2023
5529083
feat: add GetSessionEndHeight method to Session
red-0ne Sep 25, 2023
3aadba4
refactor: sessionmanager's session cleanup
red-0ne Sep 25, 2023
b7a059f
feat: store claim on-chain
bryanchriswhite Sep 25, 2023
69502de
feat: generate claims query & persist claims in `MsgClaim` handler
bryanchriswhite Sep 25, 2023
a7321e6
chore: rename proof & claim msg `smstRootHash` fields
bryanchriswhite Sep 25, 2023
69c2fbb
fix: some proto field names to conform to convention
bryanchriswhite Sep 25, 2023
be84c79
chore: add TODOs for `MsgClaim` handling validation
bryanchriswhite Sep 25, 2023
4ac4001
refactro: rename `servicerClient` local var
bryanchriswhite Sep 25, 2023
4ba4ce9
chore: break observable subscription loops on context cancellation
bryanchriswhite Sep 25, 2023
31da353
chore: use http request context
bryanchriswhite Sep 25, 2023
fcbaae7
chore: remove redundant error logs
bryanchriswhite Sep 25, 2023
d47c8da
chore: tidy up after review
bryanchriswhite Sep 25, 2023
872b133
Merge pull request #28 from pokt-network/fix/servicer-client-txs
bryanchriswhite Sep 25, 2023
712bf46
fixup: rename missing MsgClaim ServicerAddress references
red-0ne Sep 25, 2023
a3fbd96
chore: add comment
bryanchriswhite Sep 26, 2023
57f7c51
refactor: rename events.proto to event.proto & its `smt_root_hash` fi…
bryanchriswhite Sep 26, 2023
b99a47b
refactor: `EventClaim` usage
bryanchriswhite Sep 26, 2023
4c032bb
refactor: rename `sessionWithTree#removeFromSessionMap` to `#onDelete`
bryanchriswhite Sep 26, 2023
e7586eb
refactor: rename `MsgProof#Sum` to `#SmstSum`
bryanchriswhite Sep 26, 2023
855d2c4
chore: add `MsgClaim#ExpirationHeight` & comment
bryanchriswhite Sep 26, 2023
13d8267
chore: cleanup imports & aliases
bryanchriswhite Sep 26, 2023
8e67f78
refactor: move `WaitGroupContextKey` into client pkg
bryanchriswhite Sep 26, 2023
5313afc
refactor: move ServicerClient interface to relayer pkg
bryanchriswhite Sep 26, 2023
c769173
refactor: rename `ServicerClient#Blocks()` to `#BlocksNotifee()`
bryanchriswhite Sep 26, 2023
fffe75b
chore: add comments
bryanchriswhite Sep 26, 2023
c00daf7
chore: remove unused blocks-per-session flag
bryanchriswhite Sep 26, 2023
89db148
chore: add comments
bryanchriswhite Sep 26, 2023
a9c5fc3
feat: stub out on-chain proof verification & msg handling
bryanchriswhite Sep 26, 2023
6516f68
refactor: simplify claim keys & claims query pagination filter
bryanchriswhite Sep 26, 2023
bb01047
chore: add incomplete comment
bryanchriswhite Sep 26, 2023
731afe0
chore: add `SessionWithTree#GetSessionId()`
bryanchriswhite Sep 26, 2023
6c31aa5
fix: include session ID in claim msg
bryanchriswhite Sep 26, 2023
42e3a92
chore: add TODO comment
bryanchriswhite Sep 26, 2023
8f02bc9
chore: protect session writes with mutexs
red-0ne Sep 26, 2023
805c3de
Merge pull request #32 from pokt-network/relay-sockets
red-0ne Sep 26, 2023
f7afa36
Added TODO in relay.proto
Olshansk Sep 26, 2023
e0c7de7
fixup: remove useless mutex
red-0ne Sep 27, 2023
f069034
Added helpers from the PR description to the Makefile
Olshansk Sep 26, 2023
52f022a
Minor nits and TODOs
Olshansk Sep 27, 2023
4406c32
s/handleBlocksFactory/blocksFactorHandler
Olshansk Sep 27, 2023
b039f9f
s/handleTxsFactory/txsFactoryHandler
Olshansk Sep 27, 2023
a1f9877
Finished reviewing relayer/client subdirectory
Olshansk Sep 27, 2023
89bd295
Reviewed relayer/miner/miner.go
Olshansk Sep 27, 2023
d944ee8
s/signResponse/signResponseFn
Olshansk Sep 27, 2023
68e6883
Trying to get things working
Olshansk Sep 27, 2023
aad716d
Autoformat
Olshansk Sep 27, 2023
43687b6
Remove fallthrough
Olshansk Sep 27, 2023
1e7105f
update claims_query
Olshansk Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,38 @@ session_get: ## Queries the poktroll node for session data

.PHONY: session_get_app1_svc1
session_get_app1_svc1: ## Getting the session for app1 and svc1 and height1
APP=pokt1aj5m44gpvdmqcr3q0fm24vtff8g8j78004wn43 SVC=svc1 HEIGHT=$(SESSION_HEIGHT) make session_get
APP=pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 SVC=svc1 HEIGHT=$(SESSION_HEIGHT) make session_get

.PHONY: session_get_app2_svc2
session_get_app2_svc2: ## Getting the session for app2 and svc2 and height1
APP=pokt1c0aal6vmfh094v7xuk3ynkfexep3txdpjk6xhz SVC=svc2 HEIGHT=$(SESSION_HEIGHT) make session_get
APP=pokt184zvylazwu4queyzpl0gyz9yf5yxm2kdhh9hpm SVC=svc2 HEIGHT=$(SESSION_HEIGHT) make session_get

.PHONY: session_get_app3_svc3
session_get_app3_svc3: ## Getting the session for app3 and svc3 and height1
APP=pokt1c0aal6vmfh094v7xuk3ynkfexep3txdpjk6xhz SVC=svc3 HEIGHT=$(SESSION_HEIGHT) make session_get
APP=pokt1lqyu4v88vp8tzc86eaqr4lq8rwhssyn6rfwzex SVC=svc3 HEIGHT=$(SESSION_HEIGHT) make session_get

.PHONY: relayer_start
relayer_start: ## Start the relayer
poktrolld relayer \
--node $(POKTROLLD_NODE) \
--signing-key servicer1 \
--keyring-backend test

.PHONY: claims_query
claims_query: ## Query the poktroll node for claims data
poktrolld query servicer claims $(poktrolld keys show servicer1 -a --keyring-backend test)

.PHONY: anvil_start
anvil_start: ## Start the anvil
anvil -p 8547 -b 5

.PHONY: cast_relay
cast_relay: ## Cast a relay
cast block

.PHONY: ws_subscribe
ws_subscribe: ## Subscribe to the websocket for new blocks
wscat --connect ws://localhost:8546

.PHONY: localnet_up
localnet_up: ## Starts localnet
Expand Down Expand Up @@ -313,3 +336,12 @@ ignite_regenerate: ## Regenerate the ignite boilerplate
.PHONY: ignite_acc_list
ignite_acc_list: ## List all the accounts in the ignite boilerplate
ignite account list --keyring-dir $(POKTROLLD_HOME) --keyring-backend test

.PHONY: localnet_regenesis
localnet_regenesis:
# NOTE: intentionally not using --home <dir> flag to avoid overwriting the test keyring
Copy link
Member

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

ignite chain init --skip-proto
rm -rf $(POKTROLLD_HOME)/keyring-test
cp -r ${HOME}/.poktroll/keyring-test $(POKTROLLD_HOME)
cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/
cp ${HOME}/.poktroll/config/genesis.json ./localnet/
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This is an alpha version of trying to build Pocket on top of RollKit.
- [Getting a session](#getting-a-session)
- [App=app1 \<\> Servicer=svc1 \<\> Height=1](#appapp1--servicersvc1--height1)
- [Other apps \& servicers](#other-apps--servicers)
- [Send a Relay](#send-a-relay)
- [AUTOGENERATED README BELOW](#autogenerated-readme-below)
- [Get started](#get-started)
- [Configure](#configure)
Expand Down Expand Up @@ -211,6 +212,25 @@ You can repeat the steps above for `servicer` 2&3, with `apps` 2&3 for `services
make session_get_app3_svc3
```

## Send a Relay

```bash
# Console 1
make localnet_regenesis
make localnet_up

# Console 2
make app1_stake && make servicer1_stake
make relayer_start

# Console 3
make anvil_start

# Console 4
make cast_relay

```

## AUTOGENERATED README BELOW

## Get started
Expand Down
3 changes: 3 additions & 0 deletions cmd/poktrolld/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (

"poktroll/app"
appparams "poktroll/app/params"
relayer "poktroll/relayer/cmd"
)

// NewRootCmd creates a new root command for a Cosmos SDK application
Expand Down Expand Up @@ -120,6 +121,8 @@ func initRootCmd(
),
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
AddGenesisAccountCmd(app.DefaultNodeHome),
// Adding the relayer cobra command via a command factory function
relayer.RelayerCmd(),
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
bryanchriswhite marked this conversation as resolved.
Show resolved Hide resolved
tmcli.NewCompletionCmd(rootCmd, true),
debug.Cmd(),
config.Cmd(),
Expand Down
48 changes: 38 additions & 10 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
version: 1
accounts:
- name: alice
- name: faucet
mnemonic: "baby advance work soap slow exclude blur humble lucky rough teach wide chuckle captain rack laundry butter main very cannon donate armor dress follow"
coins:
- 20000token
- 200000000stake
- name: bob
- 999999999999999999stake
- name: validator1
mnemonic: "creek path rule retire evolve vehicle bargain champion roof whisper prize endorse unknown anchor fashion energy club sauce elder parent cotton old affair visa"
coins:
- 900000000stake
- name: app1
mnemonic: "mention spy involve verb exercise fiction catalog order agent envelope mystery text defy sing royal fringe return face alpha knife wonder vocal virus drum"
coins:
- 10000token
- 100000000stake
- name: app2
mnemonic: "material little labor strong search device trick amateur action crouch invite glide provide elite mango now paper sense found hamster neglect work install bulk"
coins:
- 200000000stake
- name: app3
mnemonic: "involve clean slab term real human green immune valid swing protect talk silent unique cart few ice era right thunder again drop among bounce"
coins:
- 300000000stake
- name: servicer1
mnemonic: "cool industry busy tumble funny relax error state height like board wing goat emerge visual idle never unveil announce hill primary okay spatial frog"
coins:
- 110000000stake
- name: servicer2
mnemonic: "peanut hen enroll meat legal have error input bulk later correct denial onion fossil wing excuse elephant object apology switch claim rare decide surface"
coins:
- 220000000stake
- name: servicer3
mnemonic: "client city senior tenant source soda spread buffalo shaft amused bar carbon keen off feel coral easily announce metal orphan sustain maple expand loop"
coins:
- 330000000stake
faucet:
name: bob
name: faucet
coins:
- 5token
- 100000stake
- 10000stake
client:
typescript:
path: ts-client
Expand All @@ -21,5 +44,10 @@ client:
openapi:
path: docs/static/openapi.yml
validators:
- name: alice
bonded: 100000000stake
- name: validator1
bonded: 900000000stake
config:
moniker: "validator1"
# We can persist arbitrary genesis values via 1 to 1 mapping to genesis.json
genesis:
# genesis_time: "2023-09-20T07:37:07.239355799Z"
Loading