Skip to content

Commit

Permalink
ICS 29: Fee Middleware (#276)
Browse files Browse the repository at this point in the history
* scaffolding for 29-fee (#274)

* scaffolding for 29-fee

* fix build

* update keeper test

* remove module test

* feat: adding proto files for fee payment middleware (#272)

* feat: adding proto files for fee payment middleware

* grammar

* fix: remove generated .pb files

* fix: comment

* feat: adding PacketId type

* refactor: fee / genesis

* refactor: escrowed fees map

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update proto/ibc/applications/middleware/fee/v1/tx.proto

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update proto/ibc/applications/middleware/fee/v1/tx.proto

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update proto/ibc/applications/middleware/fee/v1/tx.proto

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* refactor: use packetID + minor changes

* feat: adding query for all incentivized packets + some fixes

* feat: adding pagination to incentivized query

* fix: removing generated ibc directory + adding import/yaml

* fix: naming

* increase max depth for proto file searching and make proto all

* Update proto/ibc/applications/middleware/fee/v1/fee.proto

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* refactor: remove file imports/add yaml/add argument for requests

* refactor: updating IdentifiedPacketFee

* fix: remove hidden file

* removing middleware dir & adding query

* remove junk file and update query rpcs

* Apply suggestions from code review

* Apply suggestions from code review

* remove query yaml, make proto-all

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Aditya Sripal <adityasripal@gmail.com>

* fix: removing unncessary fields MsgEscrow & adding query params (#300)

* fix: removing unncessary fields MsgEscrow & adding query params

* fix: grammar

* fix: add yaml

* feat: #258 Register Counterparty Address (#376)

* feat: adding MsgServer for RegisterCounterPartyAddress &
EscrowPacketFree

* test: adding test for ValidateBasic

* fix: removing validate basic check

* fix: removing empty file

* Update modules/apps/29-fee/keeper/msg_server.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update modules/apps/29-fee/types/msgs.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update modules/apps/29-fee/types/keys.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update modules/apps/29-fee/keeper/keeper.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* fix: fixing typos, variable names, comments

* fix: updating import comments

* test: adding test for KeyRelayerAddress

* update: comments & key_test

* Update modules/apps/29-fee/keeper/msg_server.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* fix: error message

* docs: updating RegisterCounterpartyAddress fn description

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Aditya <adityasripal@gmail.com>

* fix: remove comments for imports (#385)

* feat: Add handshake logic to ics29 (#307)

* do handshake logic, create test file

* do cap logic and fix build

* open handshake implementation and tests

* remove prints

* Update modules/apps/29-fee/module.go

Co-authored-by: Sean King <seantking@users.noreply.github.com>

* debugging progress

* fee enabled flag

* cleanup handshake logic

* fix tests

* much cleaner simapp

* split module.go file

* cleanup and docs

* assert IBC interfaces are fulfilled in middleware

* Update modules/apps/transfer/module.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* fix unnecessary crossing hello logic

* fix version negotiation bugs and improve tests

* cleanup tests

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* address rest of colin comments

Co-authored-by: Sean King <seantking@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Fee Middleware: Escrow logic (#465)

* fix: adding second endpoint for async pay fee + renaming types

* feat: adding escrow logic

* feat: updating proto types & escrow logic

* fix: stub fn & proto comment

* feat: adding PayFee & PayFeeTimeout & escrow_test

* test: adding happy path for EscrowPacketFee

* fix: comments, error handling

* fix: comments & grammar

* test: adding unhappy path for escrow

* tests(escrow): adding hasBalance check for module acc

* test(PayFee): adding happy path for PayFee tests

* tests(PayFee, PayFeeTimeout): adding tests

* fix: adding relayers back to IdentifiedPacket

* fix: removing refund acc from key

* fix: storing IdentifiedPacketFee in state instead of Fee

* feat: adding msg_server test for registerCPAddr, wiring for codec + stubs for sdk.Msg interface

* test: adding msg_server test for PayPacketFee

* test: adding PayPacketFeeAsync msg_server test

* chore: updating PayFee -> DistributeFee & minor nits

* nit: removing unnecessary nil check

* refactor: add portId to store key & use packetId as param

* fix: add DeleteFeeInEscrow & remove fee on successful distribution

* tests: adding validation & signer tests for PayFee/Async & updating proto to use Signer sdk standard

* chore: adding NewIdentifiedPacketFee fn

* fix: getter/setter for counterparty address + fix NewIdentifiedPacketFee

* fix: updating EscrowPacketFee with correct usage of coins api

* test: adding balance check for refund acc after escrow

* fix: remove unncessary errors

* test: updating escrow tests + miscellaneous fixes

* nit: updating var names

* docs: godoc

* refactor: IdentifiedPacketFee & Fee no longer pointers

* fixes: small fixes

* Update modules/apps/29-fee/keeper/escrow.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update modules/apps/29-fee/keeper/escrow.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update modules/apps/29-fee/keeper/keeper.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update modules/apps/29-fee/keeper/msg_server.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update modules/apps/29-fee/keeper/msg_server.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update modules/apps/29-fee/types/msgs.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* nit: proto doc & error fix

* fix: escrow test

* test: updating distribute fee tests

* test: adding validation check for fee and updating tests

* test: allow counterparty address to be arbitrary string

* fix: message validation should pass if one fee is valid

* Update modules/apps/29-fee/keeper/escrow.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update modules/apps/29-fee/keeper/escrow.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* fix: nits

* Update modules/apps/29-fee/keeper/escrow.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* test: adding isZero check for msgs

Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* feat: update protos, grpc queries (#488)

* store refund address in IdentifiedPacketFee (#546)

* 29-Fee: Genesis (#557)

* proto: adding genesis state

* feat: add GetAllIdentifiedPacketFees

* feat: adding genesis.go & updating proto + app.go

* fix: removing PortId from genesis

* feat: adding GetAll for relayer addr/fee enabled chan + update genesis

* test: TestExportGenesis

* feat: update type + hook up to module.go

* fix: remove PortKey

* fix: imports + remove scoped keeper

* nit: using NewPacketId helper and updating helper def to have correct params

* feat: adding genesis validation + tests (#561)

* feat: adding genesis validation + tests

* fix: imports

* Update modules/apps/29-fee/types/genesis.go

* fix: nit

* Update modules/apps/29-fee/types/genesis_test.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* nit: imporve default gen val test

* chore: move packetId + val to channeltypes and use validate fn

Co-authored-by: Aditya <adityasripal@gmail.com>

* feat: add incentivised ack proto (#564)

* proto file

* incentivized ack proto

* Fee Closing Handshake (#551)

* add iterate logic

* add closing logic with tests

* add comments for panic

* change invariant breaking recovery to disabling middleware rather than panicing

* docs, tests, minor refactor

* Fee Middleware: Add ICS4 wrapper (#562)

* chore: add ICS4 wrapper

* fix: remove channelKeeper sender packet

* chore: add WriteAck

* feat: ics 29 packet callbacks (#357)

* update imports to v3

* regenerate proto files

* fix build

* fix: event caching for fee distribution (#661)

* proto file

* initial impl

* apply self review suggestions

Deduplicate fee distribution code.
Rename DistributeFee to DistributePacketFees.
Rename DistributeFeeTimeout to DistributePacketFeesOnTimeout

* fixup tests

rename validCoins.
DistributePacketFeesOnTimeout no longer has a valid error case
Add test case for invalid forward relayer address on DistributePacketFees.

* partially fix tests

timeout fee is still being distributed depsite WriteFn() not being called

* fix tests

* address code nit

Co-authored-by: Colin Axnér <25233464+colin-axner@users.noreply.github.com>

* ics4 callbacks fee middleware (#580)

* feat: adding WriteAcknowledgement

* updating genesis & relayer prefix

* fix: comment

* fix: comments

* Update modules/apps/29-fee/keeper/relay.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* feat: add DeleteForwardRelayerAddr helper + use Set in ack

* fix: SetForwardAddr

* chore: add panic

* fix: remove fmt

* test: add WriteAcknowledgement test

* Update modules/apps/29-fee/ibc_module.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* fix: remove print

* fix: WriteAck

* fix: use constructor

* Update modules/apps/29-fee/keeper/keeper.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* fix: nits

* fix: remove found var not used

* test: adding check that forward relayer address is successfully deleted if set

* fix: merge issues

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Aditya <adityasripal@gmail.com>

* chore: making PacketId non nullable (#737)

* nits: proto spacing + naming (#739)

* nits: proto spacing + naming

* nit: update comment

* fix: go.mod

* nit: option above import proto

* fix: spacing

* sean/fix-proto-identified-fee-not-null (#746)

* nits: more ics29 nits (#741)

* nits: remove capital from error + add godoc

* nit: add Wrapf

* nit: use strings.TrimSpace

* nit: add err type for MsgPayPacketFee

* refactor: app version + add comment (#750)

* chore: remove error

* test: add test for whitespaced empty string

* nit: update err syntax (#747)

* nit: update err syntax

* nit: more

* nit: err syntax

* feat: adding Route, Type, GetSignBytes for all messages (#743)

* feat: adding Route, Type, GetSignBytes for all messages

* tests: adding tests for Route/Type/GetSignBytes

* hygiene: add validate fn for Fee (#748)

* hygiene: add validate fn for Fee

* Update modules/apps/29-fee/types/msgs.go

Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* fix: error message

* test: move Validate to fee.go & abstract out test

* chore: remove test cases

Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* fix: app.go (#789)

* refactor: ics29 json encoded version metadata (#883)

* adding metadata type to ics29 protos

* updating ics29 handshake handlers to support json encoded metadata

* updating tests to support json encoded metadata

* Update modules/apps/29-fee/ibc_module.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update modules/apps/29-fee/ibc_module.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* renaming metadata version to fee_version

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* fix: return nil on OnRecvPacket for async pay (#911)

* nit: ics29 comments (#910)

* fix: comments

* Update modules/apps/29-fee/keeper/escrow.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* chore: Add transfer test for ics29 (#901)

* begin writing transfer test for ics29

* finish writing transfer test

* refactor: ics29 OnChanOpenInit callback tests now use mock module (#924)

* refactor: OnChanOpenInit callback tests now use mock module

* Update modules/apps/29-fee/fee_test.go

* feat: allow multiple addrs to incentivize packets (#915)

* [WIP] allow multiple addresses to incentivize a packet

* distribute multiple fees, fix broken tests

* use NewIdentifiedPacketFees in EscrowPacketFee

* cleanup var naming

* removing commented out code and adding test case

* Update modules/apps/29-fee/ibc_module.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* fix: refund RecvFee if ForwardAddr is invalid

* test: update tests to distribute multiple identified fees

* refactor: clean up DistrPacketFees

* refactor: using .Empty() helper func for code hygiene

Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: Sean King <sean@seking.dev>
Co-authored-by: Sean King <seantking@users.noreply.github.com>

* chore: remove spec directory from ics29 (#934)

* refactor: use mock module for ics29 closing handshakes (#926)

* refactor: use mock module for closing handshakes in ics29

* self-review fix

* refactor: use mock module for ics29 grpc_query_test.go (#933)

* refactor: readjust keeper_test.go to use mock module (#930)

* fix: fields for genesis should be non nullable (#938)

* refactor: use mock module for ics29 escrow_test.go (#932)

* refactor: use mock module for ics29 genesis_test.go (#931)

* ics29:feat: emit event escrow (#914)

* feat: emit EventTypeSendIncentivizedPacket event on EscrowPacket

* fix: string conversion

* refactor: add helper fn for emit event

* chore: godoc

* nit: use .String())

* refactor: OnRecvPacket to use mock module (#927)

Co-authored-by: Sean King <seantking@users.noreply.github.com>

* refactor: ics29 OnChanOpenTry/Ack use mock module for testing instead of ics20 (#925)

Co-authored-by: Sean King <seantking@users.noreply.github.com>

* refactor: use mock module for OnAcknowledgePacket callback testing (#929)

Co-authored-by: Sean King <seantking@users.noreply.github.com>

* refactor: OnTimeoutPacket to use mock module (#928)

Co-authored-by: Sean King <seantking@users.noreply.github.com>

* chore: add packet id arg to EscrowPacketFee (#951)

* adding packet id arg to EscrowPacketFee

* updating tests

* review adaptations

* chore: remove legacy testing functions (#954)

* fix:ics29: WriteAck update + adding success bool to IncentivizedAck (#952)

* fix: updating WriteAck & adding Success boolean to IncentivizedAcknowledgement

* feat: adding check of is fee enabled

* nit: change successful to underlying_application_success

* test: adding seperate test for fee disabled write async

* Update modules/apps/29-fee/ibc_module_test.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* test: adding check to compare hash of acks

* fix: var name

Co-authored-by: Aditya <adityasripal@gmail.com>

* chore: add cli cmd to incentivize existing packet (async) (#965)

* chore: add cli to incentivize existing packets

* Update modules/apps/29-fee/client/cli/cli.go

* Update modules/apps/29-fee/client/cli/cli.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* chore: update cli example

Co-authored-by: Aditya <adityasripal@gmail.com>

* ics29:fix: counterparty addr must contain channelID (#937)

* fix: counterparty address must chain channelID

* nit: updating var name

* test: adding validation check for channelID

* nit: fn names

* chore: fix err msg (#971)

* ics29:fix: store source address for query later on WriteAck (#912)

* fix: for async WriteAck store source address for query later

* ics29:fix: update genesis type (#913)

* fix: adding ForwardRelayerAddresses to genesis

* fix: trimspace on string check

* nit: err + trimspace error case

* refactor: updating WriteAck + keeper fn name

* Update modules/apps/29-fee/keeper/relay.go

Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* chore: remove legacy testing functions (#954)

* fix:ics29: WriteAck update + adding success bool to IncentivizedAck (#952)

* fix: updating WriteAck & adding Success boolean to IncentivizedAcknowledgement

* feat: adding check of is fee enabled

* nit: change successful to underlying_application_success

* test: adding seperate test for fee disabled write async

* Update modules/apps/29-fee/ibc_module_test.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* test: adding check to compare hash of acks

* fix: var name

Co-authored-by: Aditya <adityasripal@gmail.com>

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Aditya <adityasripal@gmail.com>

* refactor: make fee storage more efficient (#956)

* adding new proto types and codegen

* refactoring ics29 fees for more efficient storage

* updating tests

* fixing typo in protodoc comments

* chore: update ics29 genesis state to support multiple packet fees (#957)

* adding new proto types and codegen

* refactoring ics29 fees for more efficient storage

* updating tests

* updating genesis protos to use IdentifiedPacketFees

* updating init/export genesis state functionality and tests

* chore: update MsgPayPacketFeeAsync fields (#979)

* adding new proto types and codegen

* refactoring ics29 fees for more efficient storage

* updating tests

* fixing typo in protodoc comments

* updating protos and codegen

* updating MsgPayPacketFeeAsync handler and tests

* chore: add ParseKeyFeesInEscrow helper function (#998)

* chore: update grpc queries to handle multiple fees (#967)

* adding new proto types and codegen

* refactoring ics29 fees for more efficient storage

* updating tests

* updating protos and existing queries

* updating grpc queries and refactoring tests

* format error correct in favour of proto string() method

* leveraging ParseKeyFeesInEscrow to obtain  packet id in query

* feat: CLI cmd for MsgRegisterCounterpartyAddress (#987)

* feat: CLI cmd for MsgRegisterCounterpartyAddress

* fix: examples

* Update modules/apps/29-fee/client/cli/tx.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update modules/apps/29-fee/client/cli/tx.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* chore: remove print

* nit: update address for counterparty

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* fix: ics29: switch source with destintion for chan/port IDs (#961)

* fix: switch source with destintion for chan/port IDs

* fix: blunder

* test: adding tests in case of incorrect channel/port id

* test: moving check to WriteAcknowledgement

* add test case for Get/Set counterparty address

* nit: path name

* Update modules/apps/29-fee/keeper/msg_server_test.go

* test: cleanup 29-fee/types tests (#1006)

* feat: grpc query total recv packet fees (#1015)

* adding query for total packet recv fees to proto query server

* adding total packet recv fee query impl and tests

* updating doc comments

* chore: switch code ordering (#1025)

* feat: Add ParseKeyFeeEnabled and rename FeeEnabledKey -> KeyFeeEnabled (#1023)

* chore: add ParseKeyFeesInEscrow helper function

* feat: add ParseKeyFeeEnabled function and rename FeeEnabledKey to KeyFeeEnabled

* feat: ics29 cli for query total recv fees (#1035)

* feat: grpc query total ack fees (#1032)

* adding query for total packet recv fees to proto query server

* adding total packet recv fee query impl and tests

* updating doc comments

* adding protos and codegen

* adding total ack fees query and tests

* fixing protodoc comment

* feat: grpc query total timeout fees (#1033)

* adding query for total packet recv fees to proto query server

* adding total packet recv fee query impl and tests

* updating doc comments

* adding protos and codegen

* adding total ack fees query and tests

* adding protos and codegen

* adding query total timeout fees and tests

* fixing protodoc comment

* fixing protodoc comment

* feat: adding clis for total ack and timeout queries (#1043)

* add ParseKeyForwardRelayerAddress function + test (#1046)

* chore: remove unused ics29 keeper funcs (#1044)

* removing keys, adding additional test, moving event attribute keys

* removing unused code and updating tests

* removing unused IdentifiedPacketFee type

* chore: add gRPC for querying incentivized packets for a specific channel (#983)

* generate proto files

* feat: add gRPC for querying incentivized packets for a specific channel

* test: add gRPC test for incentivized packets for channel query

* fix build

* partially fix tests

* chore: fix tests

* deduplicate code

* chore: code cleanup

* fix build

* remove changes from merge conflict

* nit: rename c to goCtx

* add function EscrowAccountHasBalance (#1042)

* add function EscrowAccountHasBalance

* change API to use sdk.Coins

* feat: ParseKeyCounterpartyRelayer function (#1047)

* chore: adding queries to cmd builder (#1057)

* chore: update ics29 protodocs (#1055)

* updating protodocs comments and regen code/docs

* Update proto/ibc/applications/fee/v1/tx.proto

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* updating incentivized ack doc

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* add counter party channel ID to argument list of on channel open ack (#1159)

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>

* ADR 004: Fee module locking in the presence of severe bugs (#1060)

* add adr 004

* add to README

* Update docs/architecture/adr-004-ics29-lock-fee-module.md

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update docs/architecture/adr-004-ics29-lock-fee-module.md

Co-authored-by: Aditya <adityasripal@gmail.com>

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Aditya <adityasripal@gmail.com>

* nit: packetID var name (#1214)

* ics29: update with changes from main (#1221)

* add banner image (#1158)

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>

* Add alpha, beta, and rc release definitions (#1151)

## Description

The proposed definitions for each phase of our release cycle. Please feel free to adjust my wording

closes: #881 


---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing)
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [ ] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Review `Codecov Report` in the comment section below once CI passes

* build(deps): bump google.golang.org/protobuf from 1.27.1 to 1.28.0 (#1164)

Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.27.1 to 1.28.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/protocolbuffers/protobuf-go/releases">google.golang.org/protobuf's releases</a>.</em></p>
<blockquote>
<h2>v1.28.0</h2>
<ul>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.28-overview">Overview</a></li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.28-notable-changes">Notable changes</a>
<ul>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.28-recursion-limit">UnmarshalOption RecursionLimit</a></li>
</ul>
</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.28-breaking-changes">Upcoming breakage changes</a></li>
</ul>
<h2>Overview </h2>
<p>The release provides a new unmarshal option for limiting the recursion depth when unmarshalling nested messages to prevent stack overflows. (<a href="https://pkg.go.dev/google.golang.org/protobuf/proto#UnmarshalOptions.RecursionLimit"><code>UnmarshalOptions.RecursionLimit</code></a>).</p>
<h2>Notable changes </h2>
<p><strong>New features:</strong></p>
<ul>
<li><a href="https://go.dev/cl/340489">CL/340489</a>: testing/protocmp: add Message.Unwrap</li>
</ul>
<p><strong>Documentation improvements:</strong></p>
<ul>
<li><a href="https://go.dev/cl/339569">CL/339569</a>: reflect/protoreflect: add more docs on Value aliasing</li>
</ul>
<p><strong>Updated supported versions:</strong></p>
<ul>
<li><a href="https://go.dev/cl/370055">CL/370055</a>: all: update supported versions</li>
</ul>
<h3>UnmarshalOption RecursionLimit </h3>
<ul>
<li><a href="https://golang.org/cl/385854">CL/385854</a>: all: implement depth limit for unmarshalling</li>
</ul>
<p>The new <a href="https://pkg.go.dev/google.golang.org/protobuf/proto#UnmarshalOptions.RecursionLimit"><code>UnmarshalOptions.RecursionLimit</code></a> limits the maximum recursion depth when unmarshalling messages. The limit is applied for nested messages. When messages are nested deeper than the specified limit the unmarshalling will fail. If unspecified, a default limit of 10,000 is applied.</p>
<p>In addition to the configurable limit for message nesting a non-configurable recursion limit for <a href="https://developers.google.com/protocol-buffers/docs/proto#groups">group</a> nesting of 10,000 was introduced.</p>
<h2>Upcoming breakage changes </h2>
<p>The default recursion limit of 10,000 introduced in the release is subject to change. We want to align this limit with implementations for other languages in the long term. C++ and Java use a limit of 100 which is also the target for the Go implementation.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/32051b4f86e54c2142c7c05362c6e96ae3454a1c"><code>32051b4</code></a> all: release v1.28.0</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/3992ea83a23c00882339f33511074d251e19822c"><code>3992ea8</code></a> all: implement depth limit for unmarshaling</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/e5db2960ed1380681b571cdf4648230beefaf58b"><code>e5db296</code></a> all: update supported versions</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/3a9e1dc314e2cb57d6cb054df513f17586295fc7"><code>3a9e1dc</code></a> all: gofmt all</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/26e8bcb3c743193558d1a0ff540c9e05f999267d"><code>26e8bcb</code></a> all: remove unnecessary string([]byte) conversion in fmt.Sprintf with %s</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/5aec41b4809b9822a34e17acd06ae9ae9f41c13d"><code>5aec41b</code></a> testing/protocmp: add Message.Unwrap</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/05be61fde35dcaa3502f4430edee444a294d41c3"><code>05be61f</code></a> reflect/protoreflect: add more docs on Value aliasing</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/b03064a95cacfede187231741d9918a75653057d"><code>b03064a</code></a> all: start v1.27.1-devel</li>
<li>See full diff in <a href="https://github.com/protocolbuffers/protobuf-go/compare/v1.27.1...v1.28.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google.golang.org/protobuf&package-manager=go_modules&previous-version=1.27.1&new-version=1.28.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

* fix typos in the controller params (#1172)

## Description



closes: #XXXX

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing)
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Review `Codecov Report` in the comment section below once CI passes

* add versions for new releases (#1175)

## Description



closes: #XXXX

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing)
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Review `Codecov Report` in the comment section below once CI passes

* fix: link checker reporting broken milestone link (#1200)

* update roadmap for q2 2022 and deleted history roadmap (don't think we'll need it)

* requirements document for ICA (#1173)

* add requirements document for interchain accounts

* fix branch

* added number in tittle.

* apply suggestions from review

Co-authored-by: Aditya <adityasripal@gmail.com>

* review comment

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: Aditya <adityasripal@gmail.com>

* imp: improve Logger performance (#1160)

* fix: Logger marshal errors

* changelog

* update

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Sean King <seantking@users.noreply.github.com>
Co-authored-by: Charly <charly@interchain.berlin>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos Rodriguez <crodveg@yahoo.es>
Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: Luke Rhoads <51463884+lukerhoads@users.noreply.github.com>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Leo Pang <34628052+allthatjazzleo@users.noreply.github.com>
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
Co-authored-by: Barrie Byron <barriebyron.barriebyron@gmail.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Marko Baricevic <markobaricevic3778@gmail.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: nir1218 <nir1218@users.noreply.github.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Assaf Morami <assaf.morami@gmail.com>
Co-authored-by: Dan McCandless <dkmccandless@users.noreply.github.com>
Co-authored-by: Ramiro Carlucho <ramirocarlucho@gmail.com>
Co-authored-by: frog power 4000 <rigel.rozanski@gmail.com>
Co-authored-by: Sean King <sean@seking.dev>
  • Loading branch information
1 parent ffa9896 commit 4271027
Show file tree
Hide file tree
Showing 58 changed files with 15,865 additions and 447 deletions.
1 change: 1 addition & 0 deletions docs/architecture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ To suggest an ADR, please make use of the [ADR template](./adr-template.md) prov
| [001](./adr-001-coin-source-tracing.md) | ICS-20 coin denomination format | Accepted, Implemented |
| [002](./adr-002-go-module-versioning.md) | Go module versioning | Accepted |
| [003](./adr-003-ics27-acknowledgement.md) | ICS27 acknowledgement format | Accepted |
| [004](./adr-004-ics29-lock-fee-module.md) | ICS29 module locking upon escrow out of balance | Accepted |
| [015](./adr-015-ibc-packet-receiver.md) | IBC Packet Routing | Accepted |
| [025](./adr-025-ibc-passive-channels.md) | IBC passive channels | Deprecated |
| [026](./adr-026-ibc-client-recovery-mechanisms.md) | IBC client recovery mechansisms | Accepted |
Expand Down
55 changes: 55 additions & 0 deletions docs/architecture/adr-004-ics29-lock-fee-module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ADR 004: Lock fee module upon escrow out of balance

## Changelog
* 03/03/2022: initial draft

## Status

Accepted

## Context

The fee module maintains an escrow account for all fees escrowed to incentivize packet relays.
It also tracks each packet fee escrowed separately from the escrow account. This is because the escrow account only maintains a total balance. It has no reference for which coins belonged to which packet fee.
In the presence of a severe bug, it is possible the escrow balance will become out of sync with the packet fees marked as escrowed.
The ICS29 module should be capable of elegantly handling such a scenario.

## Decision

We will allow for the ICS29 module to become "locked" if the escrow balance is determined to be out of sync with the packet fees marked as escrowed.
A "locked" fee module will not allow for packet escrows to occur nor will it distribute fees. All IBC callbacks will skip performing fee logic, similar to fee disabled channels.

Manual intervention will be needed to unlock the fee module.

### Sending side

Special behaviour will have to be accounted for in `OnAcknowledgementPacket`. Since the counterparty will continue to send incentivized acknowledgements for fee enabled channels, the acknowledgement will still need to be unmarshalled into an incentivized acknowledgement before calling the underlying application `OnAcknowledgePacket` callback.

When distributing fees, a cached context should be used. If the escrow account balance would become negative, the current state changes should be discarded and the fee module should be locked using the uncached context. This prevents fees from being partially distributed for a given packetID.

### Receiving side

`OnRecvPacket` should remain unaffected by the fee module becoming locked since escrow accounts only affect the sending side.

## Consequences

### Positive

The fee module can be elegantly disabled in the presence of severe bugs.

### Negative

Extra logic is added to account for edge cases which are only possible in the presence of bugs.

### Neutral

## References

Issues:
- [#821](https://github.com/cosmos/ibc-go/issues/821)
- [#860](https://github.com/cosmos/ibc-go/issues/860)

PR's:
- [#1031](https://github.com/cosmos/ibc-go/pull/1031)
- [#1029](https://github.com/cosmos/ibc-go/pull/1029)
- [#1056](https://github.com/cosmos/ibc-go/pull/1056)
1,551 changes: 1,180 additions & 371 deletions docs/ibc/proto-docs.md

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions modules/apps/29-fee/client/cli/cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package cli

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
)

// GetQueryCmd returns the query commands for 29-fee
func GetQueryCmd() *cobra.Command {
queryCmd := &cobra.Command{
Use: "ibc-fee",
Short: "", // TODO
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
}

queryCmd.AddCommand(
GetCmdTotalRecvFees(),
GetCmdTotalAckFees(),
GetCmdTotalTimeoutFees(),
)

return queryCmd
}

// NewTxCmd returns the transaction commands for 29-fee
func NewTxCmd() *cobra.Command {
txCmd := &cobra.Command{
Use: "ibc-fee",
Short: "Transaction subcommand for IBC relayer incentivization",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

txCmd.AddCommand(
NewPayPacketFeeAsyncTxCmd(),
NewRegisterCounterpartyAddress(),
)

return txCmd
}
151 changes: 151 additions & 0 deletions modules/apps/29-fee/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
package cli

import (
"fmt"
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
"github.com/spf13/cobra"
)

// GetCmdTotalRecvFees returns the command handler for the Query/TotalRecvFees rpc.
func GetCmdTotalRecvFees() *cobra.Command {
cmd := &cobra.Command{
Use: "total-recv-fees [port-id] [channel-id] [sequence]",
Short: "Query the total receive fees for a packet",
Long: "Query the total receive fees for a packet",
Args: cobra.ExactArgs(3),
Example: fmt.Sprintf("%s query ibc-fee total-recv-fees transfer channel-5 100", version.AppName),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

portID, channelID := args[0], args[1]
seq, err := strconv.ParseUint(args[2], 10, 64)
if err != nil {
return err
}

packetID := channeltypes.NewPacketId(channelID, portID, seq)

if err := packetID.Validate(); err != nil {
return err
}

queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryTotalRecvFeesRequest{
PacketId: packetID,
}

res, err := queryClient.TotalRecvFees(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

// GetCmdTotalAckFees returns the command handler for the Query/TotalAckFees rpc.
func GetCmdTotalAckFees() *cobra.Command {
cmd := &cobra.Command{
Use: "total-ack-fees [port-id] [channel-id] [sequence]",
Short: "Query the total acknowledgement fees for a packet",
Long: "Query the total acknowledgement fees for a packet",
Args: cobra.ExactArgs(3),
Example: fmt.Sprintf("%s query ibc-fee total-ack-fees transfer channel-5 100", version.AppName),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

portID, channelID := args[0], args[1]
seq, err := strconv.ParseUint(args[2], 10, 64)
if err != nil {
return err
}

packetID := channeltypes.NewPacketId(channelID, portID, seq)

if err := packetID.Validate(); err != nil {
return err
}

queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryTotalAckFeesRequest{
PacketId: packetID,
}

res, err := queryClient.TotalAckFees(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

// GetCmdTotalTimeoutFees returns the command handler for the Query/TotalTimeoutFees rpc.
func GetCmdTotalTimeoutFees() *cobra.Command {
cmd := &cobra.Command{
Use: "total-timeout-fees [port-id] [channel-id] [sequence]",
Short: "Query the total timeout fees for a packet",
Long: "Query the total timeout fees for a packet",
Args: cobra.ExactArgs(3),
Example: fmt.Sprintf("%s query ibc-fee total-timeout-fees transfer channel-5 100", version.AppName),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

portID, channelID := args[0], args[1]
seq, err := strconv.ParseUint(args[2], 10, 64)
if err != nil {
return err
}

packetID := channeltypes.NewPacketId(channelID, portID, seq)

if err := packetID.Validate(); err != nil {
return err
}

queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryTotalTimeoutFeesRequest{
PacketId: packetID,
}

res, err := queryClient.TotalTimeoutFees(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}
124 changes: 124 additions & 0 deletions modules/apps/29-fee/client/cli/tx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package cli

import (
"fmt"
"strconv"
"strings"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra"

"github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
)

const (
flagRecvFee = "recv-fee"
flagAckFee = "ack-fee"
flagTimeoutFee = "timeout-fee"
)

// NewPayPacketFeeAsyncTxCmd returns the command to create a MsgPayPacketFeeAsync
func NewPayPacketFeeAsyncTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "pay-packet-fee [src-port] [src-channel] [sequence]",
Short: "Pay a fee to incentivize an existing IBC packet",
Long: strings.TrimSpace(`Pay a fee to incentivize an existing IBC packet.`),
Example: fmt.Sprintf("%s tx ibc-fee pay-packet-fee transfer channel-0 1 --recv-fee 10stake --ack-fee 10stake --timeout-fee 10stake", version.AppName),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

// NOTE: specifying non-nil relayers is currently unsupported
var relayers []string

sender := clientCtx.GetFromAddress().String()
seq, err := strconv.ParseUint(args[2], 10, 64)
if err != nil {
return err
}

packetID := channeltypes.NewPacketId(args[1], args[0], seq)

recvFeeStr, err := cmd.Flags().GetString(flagRecvFee)
if err != nil {
return err
}

recvFee, err := sdk.ParseCoinsNormalized(recvFeeStr)
if err != nil {
return err
}

ackFeeStr, err := cmd.Flags().GetString(flagAckFee)
if err != nil {
return err
}

ackFee, err := sdk.ParseCoinsNormalized(ackFeeStr)
if err != nil {
return err
}

timeoutFeeStr, err := cmd.Flags().GetString(flagTimeoutFee)
if err != nil {
return err
}

timeoutFee, err := sdk.ParseCoinsNormalized(timeoutFeeStr)
if err != nil {
return err
}

fee := types.Fee{
RecvFee: recvFee,
AckFee: ackFee,
TimeoutFee: timeoutFee,
}

packetFee := types.NewPacketFee(fee, sender, relayers)
msg := types.NewMsgPayPacketFeeAsync(packetID, packetFee)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

cmd.Flags().String(flagRecvFee, "", "Fee paid to a relayer for relaying a packet receive.")
cmd.Flags().String(flagAckFee, "", "Fee paid to a relayer for relaying a packet acknowledgement.")
cmd.Flags().String(flagTimeoutFee, "", "Fee paid to a relayer for relaying a packet timeout.")
flags.AddTxFlagsToCmd(cmd)

return cmd
}

// NewRegisterCounterpartyAddress returns the command to create a MsgRegisterCounterpartyAddress
func NewRegisterCounterpartyAddress() *cobra.Command {
cmd := &cobra.Command{
Use: "register-counterparty [address] [counterparty-address] [channel-id]",
Short: "Register a counterparty relayer address on a given channel.",
Long: strings.TrimSpace(`Register a counterparty relayer address on a given channel.`),
Example: fmt.Sprintf("%s tx ibc-fee register-counterparty cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh osmo1v5y0tz01llxzf4c2afml8s3awue0ymju22wxx2 channel-0", version.AppName),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

msg := types.NewMsgRegisterCounterpartyAddress(args[0], args[1], args[2])

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)

return cmd
}
Loading

0 comments on commit 4271027

Please sign in to comment.