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

[Application] Scaffolded the Application type (without CRUD messages) and nothing else #47

Merged
merged 3 commits into from
Oct 10, 2023

Conversation

Olshansk
Copy link
Member

@Olshansk Olshansk commented Oct 10, 2023

Summary

Ran the following command:

ignite scaffold map application --module application --signer address --no-message --index address --yes

Summary generated by Reviewpad on 10 Oct 23 21:04 UTC

This pull request introduces various changes:

  1. In the file "query.proto", it imports the file "pocket/application/application.proto" and adds two new RPC methods: "Application" and "ApplicationAll". It also updates the RPC method "Params" by adding an additional space before the parentheses. Additionally, it adds request and response message types for the new RPC methods.

  2. In the file "genesis_test.go", it adds two new test cases to validate the GenesisState. The first test case checks if the GenesisState contains a valid list of applications, while the second test case checks if the GenesisState contains a duplicate application, which is considered invalid.

  3. In the file "x/application/keeper/application.go", it implements several functions for managing applications, including "SetApplication", "GetApplication", "RemoveApplication", and "GetAllApplication". These functions utilize packages such as "prefix" from "cosmos-sdk/store", "types" from "pocket/x/application", and "sdk" from "cosmos/cosmos-sdk/types".

  4. In the file "proto/pocket/application/query.proto", it imports the "pocket/application/application.proto" file, adds two new RPC methods ("Application" and "ApplicationAll"), updates the RPC method "Params" by adding an additional space before the parentheses, and adds request and response message types for the new RPC methods.

  5. In the file "genesis_test.go", it adds an import statement for the "fmt" package, modifies the "ApplicationList" field in the "GenesisState" struct by adding an empty slice of type "Application" in the "DefaultGenesis" function, and adds validation logic to the "Validate" function to check for duplicated index in the "ApplicationList" field.

  6. In the file "x/application/client/cli/query_application.go", it adds two new commands to the application CLI: "CmdListApplication" and "CmdShowApplication". "CmdListApplication" lists all applications by making a query to the blockchain and printing the result, while "CmdShowApplication" takes an application address as input and shows the details of that application by making a query to the blockchain and printing the result.

  7. In the file "pocket/application/application.proto", it introduces a new file with a single message named "Application" that has a field named "address" of type "string". It specifies that the Go package for this file should be "pocket/x/application/types".

  8. In the file "genesis_test.go", it adds two new "Application" objects to the "ApplicationList" in the "GenesisState" and adds an assertion using "require.ElementsMatch" to compare the "ApplicationList" in "genesisState" with "got".

  9. In the file "x/application/types/key_application.go", it adds a new file that defines a constant named "ApplicationKeyPrefix" and a function named "ApplicationKey", which returns a store key to retrieve an application from the index fields based on the given address.

  10. In the file "x/application/keeper/query.go", it includes the implementation of two functions: "ApplicationAll" and "Application" in the "keeper" package. "ApplicationAll" retrieves all applications stored in the key-value store associated with the "keeper" instance, while "Application" retrieves a specific application from the store based on the given address.

  11. In the file "x/application/keeper/query_application_test.go", it adds a new file that contains test functions for querying application data. The test functions cover different scenarios such as querying for specific applications, testing pagination functionality, and testing error handling.

  12. In the file "genesis.go", there are changes related to initializing and exporting the genesis state of the module. In the "InitGenesis" function, code is added to set all the applications in the "genState.ApplicationList". In the "ExportGenesis" function, code is added to set the "genesis.ApplicationList" by getting all applications from the context.

  13. In the file "query.go", two new commands, "CmdListApplication" and "CmdShowApplication", have been added to the existing "GetQueryCmd" function.

  14. In the file "cli_test/query_application_test.go", a new test file is introduced that contains test functions for querying and listing applications in a CLI client for a Pocket network. The test functions cover different scenarios and ensure the correct behavior of application querying and listing functionalities.

  15. In the file "x/application/keeper/application_test.go", a new test file is introduced that contains test functions for the application keeper in the "x/application/keeper" package. The test functions cover the retrieval, removal, and retrieval of all applications using the keeper's functions.

Please review these changes and ensure they are correct and meet the required specifications.

Issue

Part of #8

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

@Olshansk Olshansk added the application Changes related to the Application actor label Oct 10, 2023
@Olshansk Olshansk added this to the Shannon TestNet milestone Oct 10, 2023
@Olshansk Olshansk self-assigned this Oct 10, 2023
@Olshansk Olshansk merged commit d55c15b into main Oct 10, 2023
3 checks passed
@Olshansk Olshansk deleted the issues/8/application_base branch October 10, 2023 21:12
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)
  ...
okdas pushed a commit that referenced this pull request Nov 14, 2024
… and nothing else (#47)

Ran the following command:

```
ignite scaffold map application --module application --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
application Changes related to the Application actor
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants