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] Just scaffold the Supplier module with a few params #34

Closed
wants to merge 0 commits into from

Conversation

Olshansk
Copy link
Member

@Olshansk Olshansk commented Oct 9, 2023

Summary

Ran the following command:

ignite scaffold module supplier \
	--dep bank \
	--params ClaimSubmissionDelayBlocks:uint,ClaimExpiration:uint,ProofSubmissionDelayBlocks:uint,ProofExpiration:unit

Summary generated by Reviewpad on 09 Oct 23 16:42 UTC

This pull request introduces several changes across multiple files:

  1. A new file has been added that contains code for querying parameters in the supplier module. It imports necessary packages such as context, sdk, codes, status, and types. The Params function takes a context and a request object as parameters and returns a response object and an error. It checks for a valid request and unwraps the SDK context before returning the parameters from the keeper.

  2. A new file "genesis.proto" has been added to the "proto/pocket/supplier" directory. This file is written in proto3 syntax and belongs to the "pocket.supplier" package. It imports "gogoproto/gogo.proto" and "pocket/supplier/params.proto". The go package option is set to "pocket/x/supplier/types". The file defines a message called GenesisState that has a nested message called Params. The Params message is required (not nullable).

  3. A new file called module.go has been added in the supplier package. The file contains the implementation of the supplier module, which is a Cosmos SDK module. It includes methods for registering the module's legacy amino codec, registering interface types, returning the default genesis state, validating the genesis state, registering gRPC Gateway routes, and getting the root Tx and query commands for the module. The file also defines the BeginBlock and EndBlock methods.

  4. A new file named genesis_test.go has been added in the x/supplier package. It defines a test function TestGenesis that tests the genesis state of the supplier module. It initializes a genesis state using types.DefaultParams(), initializes the supplier keeper and context using keepertest.SupplierKeeper(t), and calls supplier.InitGenesis and supplier.ExportGenesis functions. Finally, it asserts that the exported genesis state is not nil using require.NotNil(t, got).

  5. A new file named "params.proto" has been added in the "pocket/supplier" directory. It defines a protocol buffer message named "Params" with several fields and options. The file also imports "gogoproto/gogo.proto" and sets the Go package name to "pocket/x/supplier/types".

  6. A new file named params_test.go has been added. It defines a test function TestGetParams that tests the retrieval of parameters in the supplier module. It sets up a SupplierKeeper and context, calls the GetParams function, and performs assertions to verify the correctness of the returned parameters.

  7. A new file named codec.go has been added to the x/supplier/types package. It defines functions for registering a codec and interfaces, as well as variables for the codec and module CDC.

  8. A new file named query_params.go has been added in the x/supplier/client/cli directory. It contains a command for querying and displaying the parameters of the module.

  9. Changes have been made to various files to integrate the supplier module, including importing the module, adding it to lists of modules, initializing the SupplierKeeper, and defining and implementing specific module functions.

  10. Additional changes include the addition of new files, such as types.go, keys.go, genesis_test.go, helpers.go, msg_server_test.go, params.go, query.go, tx.go, errors.go, and params.go, with various implementations and functionalities specific to the supplier module.

Please review the individual summaries for more details on each file.

Issue

Part of #7

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 supplier Changes related to the Supplier actor label Oct 9, 2023
@Olshansk Olshansk added this to the Shannon TestNet milestone Oct 9, 2023
@Olshansk Olshansk self-assigned this Oct 9, 2023
@Olshansk Olshansk mentioned this pull request Oct 9, 2023
10 tasks
@Olshansk Olshansk changed the title [Supplier] Just scaffold the supplier module with a few params [Supplier] Just scaffold the Supplier module with a few params Oct 9, 2023
@Olshansk Olshansk closed this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
supplier Changes related to the Supplier actor
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

1 participant