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

[Supplier] Scaffold the Proof type and adjust some of the defaults #197

Merged
merged 20 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
269 changes: 269 additions & 0 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47669,6 +47669,193 @@ paths:
additionalProperties: {}
tags:
- Query
/pocket/supplier/proof:
get:
operationId: PocketSupplierAllProofs
responses:
'200':
description: A successful response.
schema:
type: object
properties:
proof:
type: array
items:
type: object
properties:
index:
type: string
supplier_address:
type: string
session_id:
type: string
merkle_proof:
type: string
description: >-
TODO_UPNEXT(@Olshansk): The structure below is the default
(untouched) scaffolded type. Update

and productionize it for our use case.
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
description: >-
PageResponse is to be embedded in gRPC response messages where
the

corresponding request message has used PageRequest.

message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.

It is less efficient than using key. Only one of offset or key
should

be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.

If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include

a count of the total number of items available for pagination in
UIs.

count_total is only respected when offset is used. It is ignored
when key

is set.
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
/pocket/supplier/proof/{index}:
get:
summary: >-
TODO_UPNEXT(@Olshansk): Update these endpoints after implementing proof
persistence

Queries a list of Proof items.
operationId: PocketSupplierProof
responses:
'200':
description: A successful response.
schema:
type: object
properties:
proof:
type: object
properties:
index:
type: string
supplier_address:
type: string
session_id:
type: string
merkle_proof:
type: string
description: >-
TODO_UPNEXT(@Olshansk): The structure below is the default
(untouched) scaffolded type. Update

and productionize it for our use case.
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: index
in: path
required: true
type: string
tags:
- Query
/pocket/supplier/supplier/{address}:
get:
summary: Queries a list of Supplier items.
Expand Down Expand Up @@ -78078,6 +78265,22 @@ definitions:
pocket.supplier.Params:
type: object
description: Params defines the parameters for the module.
pocket.supplier.Proof:
type: object
properties:
index:
type: string
supplier_address:
type: string
session_id:
type: string
merkle_proof:
type: string
description: >-
TODO_UPNEXT(@Olshansk): The structure below is the default (untouched)
scaffolded type. Update

and productionize it for our use case.
pocket.supplier.QueryAllClaimsResponse:
type: object
properties:
Expand Down Expand Up @@ -78129,6 +78332,53 @@ definitions:
repeated Bar results = 1;
PageResponse page = 2;
}
pocket.supplier.QueryAllProofsResponse:
type: object
properties:
proof:
type: array
items:
type: object
properties:
index:
type: string
supplier_address:
type: string
session_id:
type: string
merkle_proof:
type: string
description: >-
TODO_UPNEXT(@Olshansk): The structure below is the default
(untouched) scaffolded type. Update

and productionize it for our use case.
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
description: |-
PageResponse is to be embedded in gRPC response messages where the
corresponding request message has used PageRequest.

message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
pocket.supplier.QueryAllSupplierResponse:
type: object
properties:
Expand Down Expand Up @@ -78296,6 +78546,25 @@ definitions:
title: >-
Claim is the serialized object stored on-chain for claims pending to
be proven
pocket.supplier.QueryGetProofResponse:
type: object
properties:
proof:
type: object
properties:
index:
type: string
supplier_address:
type: string
session_id:
type: string
merkle_proof:
type: string
description: >-
TODO_UPNEXT(@Olshansk): The structure below is the default (untouched)
scaffolded type. Update

and productionize it for our use case.
pocket.supplier.QueryGetSupplierResponse:
type: object
properties:
Expand Down
14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// NB: Since this repostiory was scaffolded using `ignite s chain pocket`

Check warning on line 1 in go.mod

View workflow job for this annotation

GitHub Actions / misspell

[misspell] go.mod#L1

"repostiory" is a misspelling of "repository"
Raw output
./go.mod:1:18: "repostiory" is a misspelling of "repository"
// but the module was later renamed to github.com/pokt-network/poktroll, we
// need to swap the two lines below only during the scaffolding operation.
// NOTE that the operation is expected to error out but all the necesary

Check warning on line 4 in go.mod

View workflow job for this annotation

GitHub Actions / misspell

[misspell] go.mod#L4

"necesary" is a misspelling of "necessary"
Raw output
./go.mod:4:64: "necesary" is a misspelling of "necessary"
// types and functions will be scaffolded correctly.
// Ref: https://github.com/ignite/cli/issues/3737
//
// The following will need to be done manually after the scaffold:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good time for a bash script IMO

Copy link
Contributor

@bryanchriswhite bryanchriswhite Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat tangential: I would like to propose that we entertain the idea of preferring to write scripts in go. I think the stdlib is more than capable on it's own to accomplish most scripting needs. While it may be verbose in some cases, I think minimizing the number of languages in the repo is worth it on the whole.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pantani responded to it, so I want to see if we can solve it via the ignite path first before investing time into it writing proprietary scripts.

// - Reverting the module name in go.mod (this file)
// - Manually updating imports in .go files: "pocket/x/" => "github.com/pokt-network/pocket/x/"
// - Manually `option go_package` in .proto files: `option go_package = "pocket` => `option go_package = "github.com/pokt-network/poktroll`
// - If an empty `service Msg {}` is generated in a `tx.proto` file, remove it

// module pocket
module github.com/pokt-network/poktroll

go 1.20
Expand Down
1 change: 1 addition & 0 deletions pkg/relayer/proxy/rings.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types"
ring "github.com/noot/ring-go"

apptypes "github.com/pokt-network/poktroll/x/application/types"
)

Expand Down
14 changes: 14 additions & 0 deletions proto/pocket/supplier/proof.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";
package pocket.supplier;

option go_package = "github.com/pokt-network/poktroll/x/supplier/types";

// TODO_UPNEXT(@Olshansk): The structure below is the default (untouched) scaffolded type. Update
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
// and productionize it for our use case.
message Proof {
string index = 1;
string supplier_address = 2;
string session_id = 3;
string merkle_proof = 4;
}

Loading