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!: support for metaprotocol types #2960

Merged
merged 13 commits into from
Feb 27, 2024
Merged

Conversation

MSalopek
Copy link
Contributor

@MSalopek MSalopek commented Feb 22, 2024

The x/metaprotocol module adds support for encoding and decoding additional fields attached to transactions.

extension_options and non_critical_extension_options are optional fields that can be used to attach data to valid transactions. The fields are validated by the blockchain, but they are not used in any way. The fields pass validation if they are provided as empty lists ([ ]) or they use a list of ExtensionData types.

The application does not use the attached data but it does ensure that the correct type is provided and that it can be successfully unmarshalled. The attached data will be part of a block.

Here is an example of a correctly formed non_critical_extension_options field:

{
  "@type": "/gaia.metaprotocols.ExtensionData", // must be this exact string
  "protocol_id": "some-protocol",
  "protocol_version": "1",
  "data": "<base64 encoded bytes>"
}

Here is an example of a correctly populated non_critical_extension_options on a bank.MsgSend transaction:

{
  "body": {
    "messages": [
      {
        "@type": "/cosmos.bank.v1beta1.MsgSend",
        "from_address": "cosmos1ehpqg9sj09037uhe56sqktk30asn47asthyr22",
        "to_address": "cosmos1ehpqg9sj09037uhe56sqktk30asn47asthyr22",
        "amount": [
          {
            "denom": "uatom",
            "amount": "100"
          }
        ]
      }
    ],
    "memo": "memo_smaller_than_512_bytes",
    "timeout_height": "0",
    "extension_options": [],
    "non_critical_extension_options": [
      {
        "@type": "/gaia.metaprotocols.ExtensionData",
        "protocol_id": "some-protocol",
        "protocol_version": "1",
        "data": "<base64 encoded bytes>"
      }
    ]
  },
  "auth_info": {
    "signer_infos": [],
    "fee": {
      "amount": [],
      "gas_limit": "200000",
      "payer": "",
      "granter": ""
    },
    "tip": null
  },
  "signatures": []
}

@MSalopek MSalopek marked this pull request as ready for review February 23, 2024 15:46
x/metaprotocols/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@sainoe sainoe left a comment

Choose a reason for hiding this comment

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

LGTM. Great work!

MSalopek and others added 2 commits February 26, 2024 11:05
Co-authored-by: Philip Offtermatt <[email protected]>
Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

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

Great work @MSalopek. Add changelog entry.

@MSalopek MSalopek merged commit 3ae75ed into main Feb 27, 2024
17 checks passed
@MSalopek MSalopek deleted the experimental/metaprotocol-types branch February 27, 2024 16:05
mergify bot pushed a commit that referenced this pull request Feb 27, 2024
* experimental: add message types for metaprotocols

* experimental: refine multiprotocols support

* Update x/metaprotocols/types/keys.go

Co-authored-by: Simon Noetzlin <[email protected]>

* appease linter

* add docs and rebuild protos

* add docs, tests, readme

* update docs

* update e2e - enable all

* appease linter

* Update tests/e2e/e2e_bank_test.go

Co-authored-by: Philip Offtermatt <[email protected]>

* Update x/metaprotocols/README.md

Co-authored-by: Simon Noetzlin <[email protected]>

* docs: update changelog files

---------

Co-authored-by: Simon Noetzlin <[email protected]>
Co-authored-by: Philip Offtermatt <[email protected]>
(cherry picked from commit 3ae75ed)

# Conflicts:
#	.changelog/v15.0.0/dependencies/2960-add-metaprotocols-support.md
MSalopek added a commit that referenced this pull request Feb 27, 2024
* feat!: support for metaprotocol types (#2960)

* experimental: add message types for metaprotocols

* experimental: refine multiprotocols support

* Update x/metaprotocols/types/keys.go

Co-authored-by: Simon Noetzlin <[email protected]>

* appease linter

* add docs and rebuild protos

* add docs, tests, readme

* update docs

* update e2e - enable all

* appease linter

* Update tests/e2e/e2e_bank_test.go

Co-authored-by: Philip Offtermatt <[email protected]>

* Update x/metaprotocols/README.md

Co-authored-by: Simon Noetzlin <[email protected]>

* docs: update changelog files

---------

Co-authored-by: Simon Noetzlin <[email protected]>
Co-authored-by: Philip Offtermatt <[email protected]>
(cherry picked from commit 3ae75ed)

# Conflicts:
#	.changelog/v15.0.0/dependencies/2960-add-metaprotocols-support.md

* chore: manually add files in the correct places

* chore: manually mv file to correct place

---------

Co-authored-by: MSalopek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants