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

[Gateway] Add the Gateway type definition #57

Merged
merged 3 commits into from
Oct 13, 2023
Merged

[Gateway] Add the Gateway type definition #57

merged 3 commits into from
Oct 13, 2023

Conversation

h5law
Copy link
Contributor

@h5law h5law commented Oct 11, 2023

Summary

Ran ignite scaffold map gateway --module gateway --signer address --no-message --index address --yes

Summary generated by Reviewpad on 12 Oct 23 12:28 UTC

This pull request includes various changes to multiple files. Here is a summary of the diff:

  • Changes to the file x/gateway/gateway_test.go:

    • Added test cases to validate the GatewayList field in the GenesisState struct.
    • Assertion added to verify the consistency of the GatewayList in the genesisState and got.GatewayList.
  • Changes to the file genesis_test.go:

    • Added new test cases to validate the genesis state for the gateway module.
    • Added gateway addresses in the test cases to ensure proper validation.
  • Changes to the file query_gateway_test.go:

    • Added two new test functions to test gateway queries (single and paginated).
    • The functions test various scenarios such as valid requests, key not found, and invalid requests.
  • Changes to the file query_gateway.go:

    • Added a new file to the keeper package with two functions: GatewayAll and Gateway.
    • The functions retrieve gateway information based on the provided address and return the response.
    • They handle invalid requests and return appropriate error messages.
    • Dependencies include packages from cosmos-sdk and the query package.
  • Changes to the file gateway.go:

    • Added functions for managing gateways in the store (set, get, remove, get all).
    • Included necessary imports and the definition of the Gateway struct.
  • Changes to the file gateway.proto:

    • Added a new file defining a protocol buffer message named Gateway with an address field of type string.
    • Located in the proto/pocket/gateway directory and belongs to the pocket.gateway package.
    • Specifies the Go package as pocket/x/gateway/types.
  • Changes to the file genesis.go:

    • Added a loop in the InitGenesis function to set gateway elements from the provided genesis state.
    • Modified the ExportGenesis function to set the gatewayList field by calling k.GetAllGateway(ctx).
  • Changes to the file gateway_test.go:

    • Added test functions to test the Gateway struct's operations.
    • Includes tests for getting, removing, and getting all gateway items.
  • Changes to the file types/key_gateway.go:

    • Added a new file defining the key prefix and key generation function for gateways.
  • Changes to the openapi.yml file:

    • Added new API endpoints for retrieving gateway information and querying specific gateways.
    • Added request parameters and response schemas for the new endpoints.
  • Changes to the x/gateway/types/genesis.go file:

    • Added import statements and made changes to the GatewayList field initialization.
  • Changes to the file x/gateway/client/cli/query_gateway_test.go:

    • Added unit test functions for the CLI query commands related to the gateway module.
  • Changes to the file x/gateway/types/genesis.go:

    • Added import statements and made changes to the genesis state initialization.
  • Changes to the file query.go:

    • Added new commands for listing and showing gateway information.

These changes aim to enhance various aspects of the gateway module's functionality, including testing, querying, and validation.

Issue

Fixes (in part) 19

[ ] A single PR that defines & updates the Gateway type with required (MVP) fields to support business logic in future work

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Run all unit tests: make test_all_unit
  • Verify Localnet manually: See the instructions [here](TODO: add link to instructions)

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have performed a self-review of my own code
  • I have commented my code, updated documentation and left TODOs throughout the codebase

@h5law h5law added gateway Changes related to the Gateway actor protocol General core protocol related changes on-chain On-chain business logic labels Oct 11, 2023
@h5law h5law added this to the Shannon TestNet milestone Oct 11, 2023
@h5law h5law requested a review from Olshansk October 11, 2023 16:35
@h5law h5law self-assigned this Oct 11, 2023
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

You need two PRs:

  1. Scaffold the type (see [1] as an example)
  2. In a later PR, we add the types (which will require updating a lot of tests)

[1] #48

Base automatically changed from scaffold_gateway to main October 12, 2023 12:05
@h5law h5law requested a review from Olshansk October 12, 2023 12:10
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

@h5law Another friendly reminder to please update the PR metadata. I did it in this one again.

Screenshot 2023-10-12 at 7 48 37 PM

@h5law h5law merged commit 0ec3f58 into main Oct 13, 2023
3 checks passed
@h5law h5law deleted the gateway_proto branch October 13, 2023 11:45
bryanchriswhite added a commit that referenced this pull request Oct 13, 2023
* main:
  [Gateway] Scaffold the Gateway type (#57)
  [Gateway] Scaffold Gateway module and nothing else
  fix: post-merge imports
  [Session] Adding the Session type (#54)
  [WIP][Session] Adding the Relay type (#53)
bryanchriswhite added a commit that referenced this pull request Oct 13, 2023
* pokt/main:
  [Gateway] Scaffold the Gateway type (#57)
  [Gateway] Scaffold Gateway module and nothing else
  fix: post-merge imports
  [Session] Adding the Session type (#54)
  [WIP][Session] Adding the Relay type (#53)
bryanchriswhite added a commit that referenced this pull request Oct 13, 2023
* pokt/main: (25 commits)
  [Gateway] Scaffold the Gateway type (#57)
  [Gateway] Scaffold Gateway module and nothing else
  fix: post-merge imports
  [Session] Adding the Session type (#54)
  [WIP][Session] Adding the Relay type (#53)
  refactor: move `Supplier` protobuf type to `pocket.shared` package (x/shared/types/)
  Reply to final comments and make things compile
  WIP - Adding an alternative session implementation
  Updated comments
  Regenerate openapi.yml
  Updated session.proto
  Added session examples from all the places
  Ran ignite scaffold type session --module session --yes
  [Supplier] Scaffolded the UnstakeSupplier message and nothing else (#50)
  [Supplier] Scaffolded the UnstakeSupplier message and nothing else (#52)
  [Application] Scaffolded the Application type (without CRUD messages) and nothing else (#47)
  [Supplier] Scaffolded the Supplier type (without CRUD messages) and nothing else (#48)
  [Service] Just scaffold the Service module without any params (#37)
  [Supplier] Scaffolded the StakeSupplier message and nothing else (#51)
  [Supplier] Scaffolded the StakeSupplier message and nothing else (#49)
  ...
Olshansk pushed a commit that referenced this pull request Oct 16, 2023
Simply ran 
```
ignite scaffold map gateway --module gateway --signer address --no-message --index address --yes
```
okdas pushed a commit that referenced this pull request Nov 14, 2024
Simply ran 
```
ignite scaffold map gateway --module gateway --signer address --no-message --index address --yes
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gateway Changes related to the Gateway actor on-chain On-chain business logic protocol General core protocol related changes
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants