Skip to content

Commit

Permalink
[Supplier] Updating the scaffolded Claim type (#151)
Browse files Browse the repository at this point in the history
- Removed `Claim`s from the genesis file
- Indexing Claims by height & address in addition to its primary composite key upon insertion
- Added the ability to query claims by `session-id`, `session-end-height` and `supplier address`
- Added some `claim` makefile helpers to create and view them

---------

Co-authored-by: Bryan White <[email protected]>
Co-authored-by: harry <[email protected]>
  • Loading branch information
3 people authored Nov 17, 2023
1 parent dd8f35a commit 0338cc2
Show file tree
Hide file tree
Showing 31 changed files with 1,226 additions and 467 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ localnet_config.yaml
# Relase artifacts produced by `ignite chain build --release`
release

# Only keep one go module in our codebase
go.work.sum

# Avoid accidentally committing gomock artifacts
**/gomock_reflect_*

# SMT KVStore files
# TODO_TECHDEBT(#126, @red-0ne): Rename `smt` to `smt_stores` and make it configurable so it can be stored anywhere on this
smt
Expand Down
41 changes: 40 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,45 @@ acc_balance_query_app1: ## Query the balance of app1
acc_balance_total_supply: ## Query the total supply of the network
poktrolld --home=$(POKTROLLD_HOME) q bank total --node $(POCKET_NODE)

##############
### Claims ###
##############

# These encoded values were generated using the `encodeSessionHeader` helpers in `query_claim_test.go` as dummy values.
ENCODED_SESSION_HEADER = "eyJhcHBsaWNhdGlvbl9hZGRyZXNzIjoicG9rdDFleXJuNDUwa3JoZnpycmVyemd0djd2c3J4bDA5NDN0dXN4azRhayIsInNlcnZpY2UiOnsiaWQiOiJhbnZpbCIsIm5hbWUiOiIifSwic2Vzc2lvbl9zdGFydF9ibG9ja19oZWlnaHQiOiI1Iiwic2Vzc2lvbl9pZCI6InNlc3Npb25faWQxIiwic2Vzc2lvbl9lbmRfYmxvY2tfaGVpZ2h0IjoiOSJ9"
ENCODED_ROOT_HASH = "cm9vdF9oYXNo"
.PHONY: claim_create_dummy
claim_create_dummy: ## Create a dummy claim by supplier1
poktrolld --home=$(POKTROLLD_HOME) tx supplier create-claim \
$(ENCODED_SESSION_HEADER) \
$(ENCODED_ROOT_HASH) \
--from supplier1 --node $(POCKET_NODE)

.PHONY: claims_list
claim_list: ## List all the claims
poktrolld --home=$(POKTROLLD_HOME) q supplier list-claims --node $(POCKET_NODE)

.PHONY: claims_list_address
claim_list_address: ## List all the claims for a specific address (specified via ADDR variable)
poktrolld --home=$(POKTROLLD_HOME) q supplier list-claims --supplier-address $(ADDR) --node $(POCKET_NODE)

.PHONY: claims_list_address_supplier1
claim_list_address_supplier1: ## List all the claims for supplier1
SUPPLIER1=$$(make poktrolld_addr ACC_NAME=supplier1) && \
ADDR=$$SUPPLIER1 make claim_list_address

.PHONY: claim_list_height
claim_list_height: ## List all the claims ending at a specific height (specified via HEIGHT variable)
poktrolld --home=$(POKTROLLD_HOME) q supplier list-claims --session-end-height $(HEIGHT) --node $(POCKET_NODE)

.PHONY: claim_list_height_5
claim_list_height_5: ## List all the claims at height 5
HEIGHT=5 make claim_list_height

.PHONY: claim_list_session
claim_list_session: ## List all the claims ending at a specific session (specified via SESSION variable)
poktrolld --home=$(POKTROLLD_HOME) q supplier list-claims --session-id $(SESSION) --node $(POCKET_NODE)

######################
### Ignite Helpers ###
######################
Expand Down Expand Up @@ -487,4 +526,4 @@ openapi_gen: ## Generate the OpenAPI spec for the Ignite API

.PHONY: poktrolld_addr
poktrolld_addr: ## Retrieve the address for an account by ACC_NAME
@echo $(shell poktrolld keys show -a $(ACC_NAME))
@echo $(shell poktrolld --home=$(POKTROLLD_HOME) keys show -a $(ACC_NAME))
Loading

0 comments on commit 0338cc2

Please sign in to comment.