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

feat: Incur fixed cost for each x/ssi message #365

Merged
merged 13 commits into from
Nov 25, 2023
Merged

Conversation

arnabghose997
Copy link
Contributor

@arnabghose997 arnabghose997 commented Jul 25, 2023

Description

This PR aims to make x/ssi message incur fixed fees. Fees for each message is distinct and parameterised under x/ssi module. The rationale behind this has been described in HIP-9.

Implementation

Rules

  • If a transaction contains one SSI message (e.g. MsgCreateDID), then it will incur the exact cost as the current CreateDID fee. This is irrespective of the size of the message
  • If there are 2 or more SSI messages, the required fees would be the total sum of all fixed-fee cost of each SSI message. For example, lets say MsgCreateDID costs 4000uhid and MsgCreateSchema costs 2000uhid, the required fees would be 6000uhid
  • It should be noted that the user provided fees MUST MATCH with the required fees. For instance, if the required fees for a SSI transaction is 7500uhid, the user must provide 7500uhid as fee. Any value above or below 7500uhid is treated as invalid.
  • Since, SSI messages incur fixed cost and thus independent of gas consumption, they are NOT allowed to be grouped together with transaction messages of other SDK modules.

Ante Handlers

The x/ssi ante handlers SSITxDecorator, MempoolFeeDecorator and DeductFeeDecorator come together to perform the necessary verification to filter fixed-fee SSI messages and nominal non-SSI messages, and meter fixed charge for SSI messages. Order of calling ante handlers is crucial, and hence the position of these handlers should not be changed, unless a logic change is needed.

Governance Proposal

Any change of fee parameters of SSI transactions can be done by submitting a Param Change Governance Proposal. This type of Governance Proposal requires a JSON file (if done through CLI), describing the new values for consensus parameter(s), to be provided. Following is the format for changing the fixed-fee value of MsgCreateDID to 4578uhid

{
  "title": "Change CreateDID Fee to 4578uhid",
  "description": "Change CreateDID Fee to 4578uhid",
  "changes": [
    {
      "subspace": "ssi",
      "key": "CreateDidFee",
      "value": {"denom": "uhid","amount": "4578"}
    }
  ],
  "deposit": "10000000uhid"
}

Querying current fixed fee

Querying the current fixed-fee for SSI transactions can be done through following methods:

  1. CLI
$ hid-noded q ssi list-fees
create_did_fee:
  amount: "4000"
  denom: uhid
create_schema_fee:
  amount: "2000"
  denom: uhid
deactivate_did_fee:
  amount: "1000"
  denom: uhid
register_credential_status_fee:
  amount: "2000"
  denom: uhid
update_did_fee:
  amount: "1000"
  denom: uhid
  1. API
GET: <API_HOST>/hypersign-protocol/hidnode/ssi/fixedfee
{
  "create_did_fee": {
    "denom": "uhid",
    "amount": "4000"
  },
  "update_did_fee": {
    "denom": "uhid",
    "amount": "1000"
  },
  "deactivate_did_fee": {
    "denom": "uhid",
    "amount": "1000"
  },
  "create_schema_fee": {
    "denom": "uhid",
    "amount": "2000"
  },
  "register_credential_status_fee": {
    "denom": "uhid",
    "amount": "2000"
  }
}

@arnabghose997 arnabghose997 added enhancement New feature or request ssi labels Jul 25, 2023
@arnabghose997 arnabghose997 self-assigned this Jul 25, 2023
@arnabghose997 arnabghose997 changed the title Added x/identityfee module to make SSI transaction incur fixed cost feat: Incur fixed cost for each SSI message Aug 12, 2023
@arnabghose997 arnabghose997 changed the title feat: Incur fixed cost for each SSI message feat: Incur fixed cost for each x/ssi message Aug 12, 2023
@arnabghose997 arnabghose997 marked this pull request as ready for review August 14, 2023 04:17
@arnabghose997 arnabghose997 requested a review from Vishwas1 August 14, 2023 04:17
@arnabghose997 arnabghose997 merged commit e821c4d into develop Nov 25, 2023
2 checks passed
@arnabghose997 arnabghose997 deleted the ssi-fixed-fee branch November 25, 2023 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ssi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants