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

Feature/add stake entities and params #26

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Alann27
Copy link
Contributor

@Alann27 Alann27 commented Oct 29, 2024

Summary

  • Added the following entities that can be staked and their related messages/events:
    • Application
    • Supplier
    • Gateway.

The functionality to save the this entities from the genesis were added too.

  • Added functionality to parse params from genesis and update the parameters that came in an authz exec transaction.

Details

  • The following entities related to Service were added:
    • Service: This entity represents a specific service with their current state.
    • AddServiceMsg: message emitted when a service is added.
  • The following entities related to Application were added:
    • Application: This entity represents a specific application with their current state.
    • ApplicationDelegatedToGateway: many-to-many relationship between Application and Gateway representing the delegation of an application to a gateway.
    • ApplicationService: many-to-many relationship between Application and Service representing the service staked to an application.
    • TransferApplicationBeginEvent: event emitted when an application started their transfer process.
    • TransferApplicationEndEvent: event emitted when an application ended their transfer process.
    • TransferApplicationErrorEvent: event emitted when an application failed to be transferred.
    • EventApplicationUnbondingBegin: event emitted when an application started their unbonding process.
    • EventApplicationUnbondingEnd: event emitted when an application ended their unbonding process.
    • AppMsgStake: message emitted when an application its staked (or re-staked).
    • AppMsgStakeService: many-to-many relationship between AppMsgStake and Service representing the service staked to an application in a specific AppMsgStake.
    • AppMsgUnstake: message emitted when an application its unstaked.
    • MsgDelegateToGateway: message emitted when an application its delegated to a gateway.
    • MsgUndelegateToGateway: message emitted when an application it's undelegated from a gateway.
    • MsgTransferApplication: message emitted when an application its transferred to another address.
  • The following entities related to Supplier were added:
    • Supplier: This entity represents a specific supplier with their current state.
    • SupplierMsgStake: message emitted when a supplier its staked (or re-staked).
    • SupplierMsgStakeService: many-to-many relationship between SupplierMsgStake and Service representing the service staked to a supplier in a specific SupplierMsgStake.
    • SupplierMsgUnstake: message emitted when a supplier its unstaked.
    • SupplierService: many-to-many relationship between Supplier and Service representing the service staked to a supplier.
    • SupplierUnbondingBeginEvent: event emitted when a supplier started their unbonding process.
    • SupplierUnbondingEndEvent: event emitted when a supplier ended their unbonding process.
  • The following entities related to Gateway were added:
    • Gateway: This entity represents a specific gateway with their current state.
    • GatewayStakeMsg: message emitted when a gateway its staked (or re-staked).
    • GatewayUnstakeMsg: message emitted when a gateway its unstaked.
    • GatewayUnstakedEvent: event emitted when a gateway its unstaked.

To be able to handle the parameters update, we added a new handler called handleAuthzExec. This is a message handler that is called when a message is executed by the authz module and inside of it, it has encoded messages like MsgUpdateParams. We are decoding those MsgUpdateParams and updating the parameters accordingly.

  • The following entities related to parameters were added:
    • AuthzExec: authz module execution message.
    • AuthzExecMessage: many-to-many relationship between AuthzExec and Message representing the message that was executed by the authz module.
    • AppParams: application module parameters.
    • AuthParam: auth module parameters.
    • BankParam: bank module parameters.
    • DistributionParam: distribution module parameters.
    • GatewayParam: gateway module parameters.
    • GovParam: gov module parameters.
    • MintParam: mint module parameters.
    • ProofParam: proof module parameters.
    • ServiceParam: service module parameters.
    • SessionParam: session module parameters.
    • SharedParams: shared module parameters.
    • SlashingParam: slashing module parameters.
    • StakingParam: staking module parameters.
    • SupplierParam: supplier module parameters.
    • TokenomicsParam: tokenomics module parameters.
    • ConsensusParam: consensus module parameters.

Other changes

  • Created genesis.ts file to handle the genesis parsing.
  • Updated import of GeneratedType inside src/cosmjs directory to add type to the import statement.
  • Updated version of @subql/node-cosmos to ^4.1.4. This version includes the fix to the block events not being emitted.
  • Updated version of @subql/cli to ^5.3.0 and @subql/types-cosmos to ^4.0.0.
  • Added global.ts file to fix an issue with the method getFieldsBy of store.
  • Updated code where events were being handled because block events not include msg and tx fields.

Issue

  • Update @subql/node-cosmos to ^4.1.4 so we can handle the block events.
  • Add functionality to save Applications, Suppliers, Gateways, and Services.
  • ADd functionality to parse params from genesis and update the parameters that came in an authz exec transaction.

Type of change

Select one or more:

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

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have commented my code
  • I have performed a self-review of my own code; both comments & source code
  • I create and reference any new tickets, if applicable
  • I have left TODOs throughout the codebase, if applicable

…s, added global.ts file to fix an issue caused via the new version of `@subql/types-cosmos` dependency, changed type of computeUnitsPerRelay to BigInt
@Alann27 Alann27 marked this pull request as ready for review November 6, 2024 16:49
@jorgecuesta jorgecuesta added the enhancement New feature or request label Nov 6, 2024
@Olshansk Olshansk removed their request for review November 6, 2024 19:08
@Olshansk
Copy link
Member

Olshansk commented Nov 6, 2024

@bryanchriswhite PTAL when you have a chance.

…he fields of the entities, changed enums for int, added missing params to block
@Alann27 Alann27 force-pushed the feature/add-stake-entities-and-params branch from 5838bd8 to 3609a42 Compare November 7, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

3 participants