diff --git a/.changelog/v4.1.0/dependencies/000-ftf.md b/.changelog/v4.1.0/dependencies/000-ftf.md new file mode 100644 index 00000000..8a2210ca --- /dev/null +++ b/.changelog/v4.1.0/dependencies/000-ftf.md @@ -0,0 +1 @@ +- Bump FiatTokenFactory to [`0a7385d`](https://github.com/circlefin/noble-fiattokenfactory/commit/0a7385d9a37744ced1e4d61eae10de2b117f482b) for various blocklist and paused check improvements. diff --git a/.changelog/v4.1.0/dependencies/000-ibc.md b/.changelog/v4.1.0/dependencies/000-ibc.md new file mode 100644 index 00000000..17c21e65 --- /dev/null +++ b/.changelog/v4.1.0/dependencies/000-ibc.md @@ -0,0 +1 @@ +- Bump IBC to [`v4.6.0`](https://github.com/cosmos/ibc-go/releases/tag/v4.6.0) to resolve [ASA-2024-007](https://github.com/cosmos/ibc-go/security/advisories/GHSA-j496-crgh-34mx) security advisory. diff --git a/.changelog/v4.1.0/dependencies/000-pfm.md b/.changelog/v4.1.0/dependencies/000-pfm.md new file mode 100644 index 00000000..f0f819ad --- /dev/null +++ b/.changelog/v4.1.0/dependencies/000-pfm.md @@ -0,0 +1 @@ +- Bump PFM from Mandrake patch commit ([`455757b`](https://github.com/cosmos/ibc-apps/commit/455757bb5771c29cf2f83b59e37f6513e07c92be)) to release tag ([`v4.1.2`](https://github.com/cosmos/ibc-apps/releases/tag/middleware%2Fpacket-forward-middleware%2Fv4.1.2)). diff --git a/.changelog/v4.1.0/dependencies/000-sdk.md b/.changelog/v4.1.0/dependencies/000-sdk.md new file mode 100644 index 00000000..ecc1b0e2 --- /dev/null +++ b/.changelog/v4.1.0/dependencies/000-sdk.md @@ -0,0 +1 @@ +- Switch to Noble's Cosmos SDK fork ([`v0.45.16-noble`](https://github.com/noble-assets/cosmos-sdk/releases/tag/v0.45.16-noble)), allowing `DeliverTx` to be extended. diff --git a/.changelog/v4.1.0/improvements/249-283-module-path.md b/.changelog/v4.1.0/improvements/249-283-module-path.md new file mode 100644 index 00000000..ab8aeea8 --- /dev/null +++ b/.changelog/v4.1.0/improvements/249-283-module-path.md @@ -0,0 +1 @@ +- Align module path with Go's [naming convention](https://go.dev/doc/modules/version-numbers#major-version). ([#249](https://github.com/noble-assets/noble/pull/249), [#283](https://github.com/noble-assets/noble/pull/283)) diff --git a/.changelog/v4.1.0/improvements/346-migrate-blockibc.md b/.changelog/v4.1.0/improvements/346-migrate-blockibc.md new file mode 100644 index 00000000..ae307f14 --- /dev/null +++ b/.changelog/v4.1.0/improvements/346-migrate-blockibc.md @@ -0,0 +1 @@ +- Switch to migrated `x/blockibc` under [`circlefin/noble-fiattokenfactory`](https://github.com/circlefin/noble-fiattokenfactory). ([#346](https://github.com/noble-assets/noble/pull/346)) diff --git a/.changelog/v4.1.0/summary.md b/.changelog/v4.1.0/summary.md new file mode 100644 index 00000000..3c0584a5 --- /dev/null +++ b/.changelog/v4.1.0/summary.md @@ -0,0 +1,15 @@ +*Apr 15, 2024* + +This is a minor release to the v4 Argon line, codenamed Fusion. + +The main part of this release is the introduction of the `x/forwarding` module. +It allows users to create a new account type, where the receipt of funds into +that account triggers an automatic IBC transfer over a specified channel to a +recipient address. This allows for one-click transfers to any IBC-enabled chain, +and can be used in tandem with, for example, the receipt of funds from a +[Circle Mint][mint] account or via [CCTP]. + +Other notable changes include are documented below. + +[cctp]: https://www.circle.com/en/cross-chain-transfer-protocol +[mint]: https://www.circle.com/en/circle-mint diff --git a/.changelog/v4.1.1/bug-fixes/353-abci.md b/.changelog/v4.1.1/bug-fixes/353-abci.md new file mode 100644 index 00000000..df58a692 --- /dev/null +++ b/.changelog/v4.1.1/bug-fixes/353-abci.md @@ -0,0 +1 @@ +- Remove custom ABCI logic inside `DeliverTx` that causes consensus failures. ([#353](https://github.com/noble-assets/noble/pull/353)) diff --git a/.changelog/v4.1.1/summary.md b/.changelog/v4.1.1/summary.md new file mode 100644 index 00000000..860883ff --- /dev/null +++ b/.changelog/v4.1.1/summary.md @@ -0,0 +1,3 @@ +*Apr 16, 2024* + +This is a consensus breaking patch release to the v4.1 Fusion line. diff --git a/.changelog/v4.1.2/dependencies/357-bump-forwarding.md b/.changelog/v4.1.2/dependencies/357-bump-forwarding.md new file mode 100644 index 00000000..6d0cbd01 --- /dev/null +++ b/.changelog/v4.1.2/dependencies/357-bump-forwarding.md @@ -0,0 +1 @@ +- Bump `x/forwarding` module to [`v1.1.0`](https://github.com/noble-assets/forwarding/releases/tag/v1.1.0) ([#357](https://github.com/noble-assets/noble/pull/357)) diff --git a/.changelog/v4.1.2/dependencies/359-bump-cctp.md b/.changelog/v4.1.2/dependencies/359-bump-cctp.md new file mode 100644 index 00000000..4980b90e --- /dev/null +++ b/.changelog/v4.1.2/dependencies/359-bump-cctp.md @@ -0,0 +1 @@ +- Bump CCTP to [`69ee090`](https://github.com/circlefin/noble-cctp/commit/69ee090808c05987c504b383939e71ad491594e7) ([#359](https://github.com/noble-assets/noble/pull/359)) diff --git a/.changelog/v4.1.2/dependencies/359-bump-ftf.md b/.changelog/v4.1.2/dependencies/359-bump-ftf.md new file mode 100644 index 00000000..c602e136 --- /dev/null +++ b/.changelog/v4.1.2/dependencies/359-bump-ftf.md @@ -0,0 +1 @@ +- Bump FiatTokenFactory to [`738932c`](https://github.com/circlefin/noble-fiattokenfactory/commit/738932cb316d06f587c49dfb11a50515cce657d9) ([#359](https://github.com/noble-assets/noble/pull/359)) diff --git a/.changelog/v4.1.2/improvements/357-migrate-forwarding.md b/.changelog/v4.1.2/improvements/357-migrate-forwarding.md new file mode 100644 index 00000000..72dbe714 --- /dev/null +++ b/.changelog/v4.1.2/improvements/357-migrate-forwarding.md @@ -0,0 +1 @@ +- Switch to [migrated](https://github.com/noble-assets/forwarding) version of `x/forwarding` module. ([#357](https://github.com/noble-assets/noble/pull/357)) diff --git a/.changelog/v4.1.2/summary.md b/.changelog/v4.1.2/summary.md new file mode 100644 index 00000000..5407527b --- /dev/null +++ b/.changelog/v4.1.2/summary.md @@ -0,0 +1,3 @@ +*May 2, 2024* + +This is a consensus breaking patch release to the v4.1 Fusion line. diff --git a/.changelog/v4.1.3/dependencies/363-bump-cctp.md b/.changelog/v4.1.3/dependencies/363-bump-cctp.md new file mode 100644 index 00000000..5f5c60d8 --- /dev/null +++ b/.changelog/v4.1.3/dependencies/363-bump-cctp.md @@ -0,0 +1 @@ +- Bump CCTP to [`253cf7e`](https://github.com/circlefin/noble-cctp/commit/253cf7eb943669e283b4dcb25f83c7096080e67a) ([#363](https://github.com/noble-assets/noble/pull/363)) diff --git a/.changelog/v4.1.3/summary.md b/.changelog/v4.1.3/summary.md new file mode 100644 index 00000000..d0b88c75 --- /dev/null +++ b/.changelog/v4.1.3/summary.md @@ -0,0 +1,3 @@ +*May 10, 2024* + +This is a consensus breaking patch release to the v4.1 Fusion line. diff --git a/.github/workflows/simulation-tests.yaml b/.github/workflows/simulation-tests.yaml index 2e1c9dbe..9f784653 100644 --- a/.github/workflows/simulation-tests.yaml +++ b/.github/workflows/simulation-tests.yaml @@ -1,7 +1,7 @@ name: Simulation Tests on: - pull_request: + workflow_dispatch: jobs: simulation-tests: diff --git a/CHANGELOG.md b/CHANGELOG.md index 44dd5f55..5d3ff44f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,71 @@ # CHANGELOG +## v4.1.3 + +*May 10, 2024* + +This is a consensus breaking patch release to the v4.1 Fusion line. + +### DEPENDENCIES + +- Bump CCTP to [`253cf7e`](https://github.com/circlefin/noble-cctp/commit/253cf7eb943669e283b4dcb25f83c7096080e67a) ([#363](https://github.com/noble-assets/noble/pull/363)) + +## v4.1.2 + +*May 2, 2024* + +This is a consensus breaking patch release to the v4.1 Fusion line. + +### DEPENDENCIES + +- Bump `x/forwarding` module to [`v1.1.0`](https://github.com/noble-assets/forwarding/releases/tag/v1.1.0) ([#357](https://github.com/noble-assets/noble/pull/357)) +- Bump FiatTokenFactory to [`738932c`](https://github.com/circlefin/noble-fiattokenfactory/commit/738932cb316d06f587c49dfb11a50515cce657d9) ([#359](https://github.com/noble-assets/noble/pull/359)) +- Bump CCTP to [`69ee090`](https://github.com/circlefin/noble-cctp/commit/69ee090808c05987c504b383939e71ad491594e7) ([#359](https://github.com/noble-assets/noble/pull/359)) + +### IMPROVEMENTS + +- Switch to [migrated](https://github.com/noble-assets/forwarding) version of `x/forwarding` module. ([#357](https://github.com/noble-assets/noble/pull/357)) + +## v4.1.1 + +*Apr 16, 2024* + +This is a consensus breaking patch release to the v4.1 Fusion line. + +### BUG FIXES + +- Remove custom ABCI logic inside `DeliverTx` that causes consensus failures. ([#353](https://github.com/noble-assets/noble/pull/353)) + +## v4.1.0 + +*Apr 15, 2024* + +This is a minor release to the v4 Argon line, codenamed Fusion. + +The main part of this release is the introduction of the `x/forwarding` module. +It allows users to create a new account type, where the receipt of funds into +that account triggers an automatic IBC transfer over a specified channel to a +recipient address. This allows for one-click transfers to any IBC-enabled chain, +and can be used in tandem with, for example, the receipt of funds from a +[Circle Mint][mint] account or via [CCTP]. + +Other notable changes include are documented below. + +[cctp]: https://www.circle.com/en/cross-chain-transfer-protocol +[mint]: https://www.circle.com/en/circle-mint + +### DEPENDENCIES + +- Switch to Noble's Cosmos SDK fork ([`v0.45.16-noble`](https://github.com/noble-assets/cosmos-sdk/releases/tag/v0.45.16-noble)), allowing `DeliverTx` to be extended. +- Bump PFM from Mandrake patch commit ([`455757b`](https://github.com/cosmos/ibc-apps/commit/455757bb5771c29cf2f83b59e37f6513e07c92be)) to release tag ([`v4.1.2`](https://github.com/cosmos/ibc-apps/releases/tag/middleware%2Fpacket-forward-middleware%2Fv4.1.2)). +- Bump IBC to [`v4.6.0`](https://github.com/cosmos/ibc-go/releases/tag/v4.6.0) to resolve [ASA-2024-007](https://github.com/cosmos/ibc-go/security/advisories/GHSA-j496-crgh-34mx) security advisory. +- Bump FiatTokenFactory to [`0a7385d`](https://github.com/circlefin/noble-fiattokenfactory/commit/0a7385d9a37744ced1e4d61eae10de2b117f482b) for various blocklist and paused check improvements. + +### IMPROVEMENTS + +- Align module path with Go's [naming convention](https://go.dev/doc/modules/version-numbers#major-version). ([#249](https://github.com/noble-assets/noble/pull/249), [#283](https://github.com/noble-assets/noble/pull/283)) +- Switch to migrated `x/blockibc` under [`circlefin/noble-fiattokenfactory`](https://github.com/circlefin/noble-fiattokenfactory). ([#346](https://github.com/noble-assets/noble/pull/346)) + ## v4.0.3 *Mar 11, 2024* diff --git a/app/ante.go b/app/ante.go index bb6e6d84..2c40a385 100644 --- a/app/ante.go +++ b/app/ante.go @@ -3,6 +3,7 @@ package app import ( "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory" fiattokenfactorykeeper "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/keeper" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -16,6 +17,7 @@ import ( type HandlerOptions struct { ante.HandlerOptions + cdc codec.Codec fiatTokenFactoryKeeper *fiattokenfactorykeeper.Keeper IBCKeeper *ibckeeper.Keeper GlobalFeeSubspace paramtypes.Subspace @@ -52,7 +54,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first ante.NewRejectExtensionOptionsDecorator(), fiattokenfactory.NewIsBlacklistedDecorator(options.fiatTokenFactoryKeeper), - fiattokenfactory.NewIsPausedDecorator(options.fiatTokenFactoryKeeper), + fiattokenfactory.NewIsPausedDecorator(options.cdc, options.fiatTokenFactoryKeeper), forwarding.NewAnteDecorator(options.ForwardingKeeper, options.AccountKeeper), ante.NewMempoolFeeDecorator(), ante.NewValidateBasicDecorator(), diff --git a/app/app.go b/app/app.go index 1c245172..b30cc5a3 100644 --- a/app/app.go +++ b/app/app.go @@ -87,6 +87,7 @@ import ( tmos "github.com/tendermint/tendermint/libs/os" dbm "github.com/tendermint/tm-db" + "github.com/circlefin/noble-fiattokenfactory/x/blockibc" fiattokenfactorymodule "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory" fiattokenfactorymodulekeeper "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/keeper" fiattokenfactorymoduletypes "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/types" @@ -95,7 +96,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/noble-assets/noble/v5/cmd" "github.com/noble-assets/noble/v5/docs" - "github.com/noble-assets/noble/v5/x/blockibc" "github.com/noble-assets/noble/v5/x/globalfee" tariff "github.com/noble-assets/noble/v5/x/tariff" tariffkeeper "github.com/noble-assets/noble/v5/x/tariff/keeper" @@ -384,9 +384,7 @@ func New( // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.StakingKeeper = *app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), - ) + app.StakingKeeper = *app.StakingKeeper.SetHooks(app.SlashingKeeper.Hooks()) // ... other modules keepers @@ -503,7 +501,7 @@ func New( packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, ) - transferStack = blockibc.NewIBCMiddleware(transferStack, app.TokenFactoryKeeper, app.FiatTokenFactoryKeeper) + transferStack = blockibc.NewIBCMiddleware(transferStack, app.FiatTokenFactoryKeeper) // Create static IBC router, add transfer route, then set and seal it ibcRouter := ibcporttypes.NewRouter() @@ -682,6 +680,7 @@ func New( SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, + cdc: appCodec, fiatTokenFactoryKeeper: app.FiatTokenFactoryKeeper, IBCKeeper: app.IBCKeeper, diff --git a/go.mod b/go.mod index f8629dff..0fd27b9f 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,11 @@ go 1.21 require ( cosmossdk.io/errors v1.0.0 - github.com/circlefin/noble-cctp v0.0.0-20231108011259-7c5206df02dc - github.com/circlefin/noble-fiattokenfactory v0.0.0-20240311150858-14edf83ee1c9 + github.com/circlefin/noble-cctp v0.0.0-20240510135541-253cf7eb9436 + github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d github.com/cosmos/cosmos-sdk v0.45.16 - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.2-0.20240228222021-455757bb5771 - github.com/cosmos/ibc-go/v4 v4.5.1 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.2 + github.com/cosmos/ibc-go/v4 v4.6.0 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 diff --git a/go.sum b/go.sum index 1443c294..dc79c1bf 100644 --- a/go.sum +++ b/go.sum @@ -183,10 +183,10 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circlefin/noble-cctp v0.0.0-20231108011259-7c5206df02dc h1:vm2CZfO8sjxPFKzguuZl1FjHHdbgRUWvF3x2lw6NyEU= -github.com/circlefin/noble-cctp v0.0.0-20231108011259-7c5206df02dc/go.mod h1:ssEHJqFI1f4a5sLtZ7qeYJ7/75LzDgzbBv4C9as3y3w= -github.com/circlefin/noble-fiattokenfactory v0.0.0-20240311150858-14edf83ee1c9 h1:zos4B3act5oqjkWJ20iBOX0mHINcEQ6wdqtHdcmAiqE= -github.com/circlefin/noble-fiattokenfactory v0.0.0-20240311150858-14edf83ee1c9/go.mod h1:pWbZhxq9IBFK9d24ZdmSKdG3LgFbp97r18IbF56QwnE= +github.com/circlefin/noble-cctp v0.0.0-20240510135541-253cf7eb9436 h1:Yyh9oaVOIzSgbQISm7BJ0iCnSLolGYzrM7W4PeT+Zt0= +github.com/circlefin/noble-cctp v0.0.0-20240510135541-253cf7eb9436/go.mod h1:ssEHJqFI1f4a5sLtZ7qeYJ7/75LzDgzbBv4C9as3y3w= +github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d h1:fjoPjY5XAEuppXXf86zstq35B+87tUA94aRUkX9lQNk= +github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d/go.mod h1:0Imc1/GSaR8Ic2ssKJGN4EmNbyDGuTGY8AEvmWeao7w= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -244,10 +244,10 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.2-0.20240228222021-455757bb5771 h1:f59vE1bhd2HvZJmDyxcGHXnk18H5BtL0GZtw0ED8gUA= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.2-0.20240228222021-455757bb5771/go.mod h1:0g4hau4zO12tpvyiOcyEpcmcsXbBAN4WX+BhTO6xZVg= -github.com/cosmos/ibc-go/v4 v4.5.1 h1:+P73X7aIikGAXBUJ9vP9rEbvdSuekt3KGXmAWCSYets= -github.com/cosmos/ibc-go/v4 v4.5.1/go.mod h1:2EOi40Bx/j6rJrtP1ui8k8yUAMpGybmL1EjakYqYv5U= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.2 h1:id4ozlsqpX6J19NVYQ5NhqyDzb48JT0VsceqArym1ks= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.2/go.mod h1:0g4hau4zO12tpvyiOcyEpcmcsXbBAN4WX+BhTO6xZVg= +github.com/cosmos/ibc-go/v4 v4.6.0 h1:G7kiD4Zf8Wrxc8BXWIKuFnzI0W4wpvRPrl5HwdfTIsA= +github.com/cosmos/ibc-go/v4 v4.6.0/go.mod h1:ksiZHUypws0NVP50E3ea0ivVFO/bfS8q8yLg8yZ2ATQ= github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= diff --git a/interchaintest/cctp_receive_message_test.go b/interchaintest/cctp_receive_message_test.go index a72e9884..90e102d2 100644 --- a/interchaintest/cctp_receive_message_test.go +++ b/interchaintest/cctp_receive_message_test.go @@ -105,8 +105,6 @@ func TestCCTP_ReceiveMessage(t *testing.T) { burnToken := make([]byte, 32) copy(burnToken[12:], common.FromHex("0x07865c6E87B9F70255377e024ace6630C1Eaa37F")) - - // maps remote token on remote domain to a local token -- used for minting msgs = append(msgs, &cctptypes.MsgLinkTokenPair{ From: gw.fiatTfRoles.Owner.FormattedAddress(), RemoteDomain: 0, @@ -114,6 +112,14 @@ func TestCCTP_ReceiveMessage(t *testing.T) { LocalToken: denomMetadataUsdc.Base, }) + tokenMessenger := make([]byte, 32) + copy(tokenMessenger[12:], common.FromHex("0xBd3fa81B58Ba92a82136038B25aDec7066af3155")) + msgs = append(msgs, &cctptypes.MsgAddRemoteTokenMessenger{ + From: gw.fiatTfRoles.Owner.FormattedAddress(), + DomainId: 0, + Address: tokenMessenger, + }) + bCtx, bCancel := context.WithTimeout(ctx, 20*time.Second) defer bCancel() @@ -166,8 +172,6 @@ func TestCCTP_ReceiveMessage(t *testing.T) { depositForBurnBz, err := depositForBurn.Bytes() require.NoError(t, err) - var senderBurn = []byte("12345678901234567890123456789012") - emptyDestinationCaller := make([]byte, 32) wrappedDepositForBurn := cctptypes.Message{ @@ -175,7 +179,7 @@ func TestCCTP_ReceiveMessage(t *testing.T) { SourceDomain: 0, DestinationDomain: 4, // Noble is 4 Nonce: 0, // dif per message - Sender: senderBurn, + Sender: tokenMessenger, Recipient: cctptypes.PaddedModuleAddress, DestinationCaller: emptyDestinationCaller, MessageBody: depositForBurnBz, diff --git a/interchaintest/cctp_receive_message_with_caller_test.go b/interchaintest/cctp_receive_message_with_caller_test.go index a85cfdcf..d3813871 100644 --- a/interchaintest/cctp_receive_message_with_caller_test.go +++ b/interchaintest/cctp_receive_message_with_caller_test.go @@ -105,8 +105,6 @@ func TestCCTP_ReceiveMessageWithCaller(t *testing.T) { burnToken := make([]byte, 32) copy(burnToken[12:], common.FromHex("0x07865c6E87B9F70255377e024ace6630C1Eaa37F")) - - // maps remote token on remote domain to a local token -- used for minting msgs = append(msgs, &cctptypes.MsgLinkTokenPair{ From: gw.fiatTfRoles.Owner.FormattedAddress(), RemoteDomain: 0, @@ -114,6 +112,14 @@ func TestCCTP_ReceiveMessageWithCaller(t *testing.T) { LocalToken: denomMetadataUsdc.Base, }) + tokenMessenger := make([]byte, 32) + copy(tokenMessenger[12:], common.FromHex("0xBd3fa81B58Ba92a82136038B25aDec7066af3155")) + msgs = append(msgs, &cctptypes.MsgAddRemoteTokenMessenger{ + From: gw.fiatTfRoles.Owner.FormattedAddress(), + DomainId: 0, + Address: tokenMessenger, + }) + bCtx, bCancel := context.WithTimeout(ctx, 20*time.Second) defer bCancel() @@ -166,8 +172,6 @@ func TestCCTP_ReceiveMessageWithCaller(t *testing.T) { depositForBurnBz, err := depositForBurn.Bytes() require.NoError(t, err) - var senderBurn = []byte("12345678901234567890123456789012") - destinationCaller := make([]byte, 32) copy(destinationCaller[12:], gw.fiatTfRoles.Owner.Address()) @@ -176,7 +180,7 @@ func TestCCTP_ReceiveMessageWithCaller(t *testing.T) { SourceDomain: 0, DestinationDomain: 4, // Noble is 4 Nonce: 0, // dif per message - Sender: senderBurn, + Sender: tokenMessenger, Recipient: cctptypes.PaddedModuleAddress, DestinationCaller: destinationCaller, MessageBody: depositForBurnBz, diff --git a/interchaintest/go.mod b/interchaintest/go.mod index e6eff005..87ffb15b 100644 --- a/interchaintest/go.mod +++ b/interchaintest/go.mod @@ -4,10 +4,10 @@ go 1.21 require ( cosmossdk.io/math v1.0.1 - github.com/circlefin/noble-cctp v0.0.0-20231108011259-7c5206df02dc - github.com/circlefin/noble-fiattokenfactory v0.0.0-20240311150858-14edf83ee1c9 + github.com/circlefin/noble-cctp v0.0.0-20240510135541-253cf7eb9436 + github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d github.com/cosmos/cosmos-sdk v0.45.16 - github.com/cosmos/ibc-go/v4 v4.5.1 + github.com/cosmos/ibc-go/v4 v4.6.0 github.com/ethereum/go-ethereum v1.12.2 github.com/gogo/protobuf v1.3.3 github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 diff --git a/interchaintest/go.sum b/interchaintest/go.sum index 257f4e3b..c9ecb685 100644 --- a/interchaintest/go.sum +++ b/interchaintest/go.sum @@ -189,10 +189,10 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circlefin/noble-cctp v0.0.0-20231108011259-7c5206df02dc h1:vm2CZfO8sjxPFKzguuZl1FjHHdbgRUWvF3x2lw6NyEU= -github.com/circlefin/noble-cctp v0.0.0-20231108011259-7c5206df02dc/go.mod h1:ssEHJqFI1f4a5sLtZ7qeYJ7/75LzDgzbBv4C9as3y3w= -github.com/circlefin/noble-fiattokenfactory v0.0.0-20240311150858-14edf83ee1c9 h1:zos4B3act5oqjkWJ20iBOX0mHINcEQ6wdqtHdcmAiqE= -github.com/circlefin/noble-fiattokenfactory v0.0.0-20240311150858-14edf83ee1c9/go.mod h1:pWbZhxq9IBFK9d24ZdmSKdG3LgFbp97r18IbF56QwnE= +github.com/circlefin/noble-cctp v0.0.0-20240510135541-253cf7eb9436 h1:Yyh9oaVOIzSgbQISm7BJ0iCnSLolGYzrM7W4PeT+Zt0= +github.com/circlefin/noble-cctp v0.0.0-20240510135541-253cf7eb9436/go.mod h1:ssEHJqFI1f4a5sLtZ7qeYJ7/75LzDgzbBv4C9as3y3w= +github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d h1:fjoPjY5XAEuppXXf86zstq35B+87tUA94aRUkX9lQNk= +github.com/circlefin/noble-fiattokenfactory v0.0.0-20240502160322-738932cb316d/go.mod h1:0Imc1/GSaR8Ic2ssKJGN4EmNbyDGuTGY8AEvmWeao7w= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -253,8 +253,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v4 v4.5.1 h1:+P73X7aIikGAXBUJ9vP9rEbvdSuekt3KGXmAWCSYets= -github.com/cosmos/ibc-go/v4 v4.5.1/go.mod h1:2EOi40Bx/j6rJrtP1ui8k8yUAMpGybmL1EjakYqYv5U= +github.com/cosmos/ibc-go/v4 v4.6.0 h1:G7kiD4Zf8Wrxc8BXWIKuFnzI0W4wpvRPrl5HwdfTIsA= +github.com/cosmos/ibc-go/v4 v4.6.0/go.mod h1:ksiZHUypws0NVP50E3ea0ivVFO/bfS8q8yLg8yZ2ATQ= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= diff --git a/interchaintest/upgrade_argon_test.go b/interchaintest/upgrade_argon_test.go index 6ddf8755..b0c31272 100644 --- a/interchaintest/upgrade_argon_test.go +++ b/interchaintest/upgrade_argon_test.go @@ -140,6 +140,9 @@ func testPostArgonUpgrade( burnToken := make([]byte, 32) copy(burnToken[12:], common.FromHex("0x07865c6E87B9F70255377e024ace6630C1Eaa37F")) + tokenMessenger := make([]byte, 32) + copy(tokenMessenger[12:], common.FromHex("0xBd3fa81B58Ba92a82136038B25aDec7066af3155")) + bCtx, bCancel := context.WithTimeout(ctx, 20*time.Second) defer bCancel() @@ -171,6 +174,21 @@ func testPostArgonUpgrade( t.Logf("Submitted add token pair tx: %s", tx.TxHash) + tx, err = cosmos.BroadcastTx( + bCtx, + broadcaster, + paramAuthority, + &cctptypes.MsgAddRemoteTokenMessenger{ + From: paramAuthority.FormattedAddress(), + DomainId: 0, + Address: tokenMessenger, + }, + ) + require.NoError(t, err, "error submitting add remote token messenger tx") + require.Zero(t, tx.Code, "cctp add remote token messenger transaction failed: %s - %s - %s", tx.Codespace, tx.RawLog, tx.Data) + + t.Logf("Submitted add remote token messenger tx: %s", tx.TxHash) + cctpModuleAccount := authtypes.NewModuleAddress(cctptypes.ModuleName).String() // by using mock images `mock-v2.0.0` or `mock-v0.4.2`, we have access to the fiat-tokenfactory owner accout @@ -209,8 +227,6 @@ func testPostArgonUpgrade( depositForBurnBz, err := depositForBurn.Bytes() require.NoError(t, err) - var sender = []byte("12345678901234567890123456789012") - const destinationCallerKeyName = "destination-caller" destinationCallerUser := interchaintest.GetAndFundTestUsers(t, ctx, destinationCallerKeyName, 1, noble) @@ -222,7 +238,7 @@ func testPostArgonUpgrade( SourceDomain: 0, DestinationDomain: 4, // Noble is 4 Nonce: 0, // dif per message - Sender: sender, + Sender: tokenMessenger, Recipient: cctptypes.PaddedModuleAddress, DestinationCaller: destinationCaller, MessageBody: depositForBurnBz, diff --git a/x/blockibc/blockibc.go b/x/blockibc/blockibc.go deleted file mode 100644 index 64ebd499..00000000 --- a/x/blockibc/blockibc.go +++ /dev/null @@ -1,186 +0,0 @@ -package blockibc - -import ( - fiatKeeper "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/keeper" - fiat_types "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/bech32" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported" - "github.com/noble-assets/noble/v5/x/tokenfactory/keeper" - "github.com/noble-assets/noble/v5/x/tokenfactory/types" -) - -var _ porttypes.IBCModule = &IBCMiddleware{} - -// IBCMiddleware implements the tokenfactory keeper in order to check against blacklisted addresses. -type IBCMiddleware struct { - app porttypes.IBCModule - keeper *keeper.Keeper - fiatKeeper *fiatKeeper.Keeper -} - -// NewIBCMiddleware creates a new IBCMiddleware given the keeper and underlying application. -func NewIBCMiddleware(app porttypes.IBCModule, k *keeper.Keeper, ck *fiatKeeper.Keeper) IBCMiddleware { - return IBCMiddleware{ - app: app, - keeper: k, - fiatKeeper: ck, - } -} - -// OnChanOpenInit implements the IBCModule interface. -func (im IBCMiddleware) OnChanOpenInit( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID string, - channelID string, - channelCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - version string, -) (string, error) { - return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, channelCap, counterparty, version) -} - -// OnChanOpenTry implements the IBCModule interface. -func (im IBCMiddleware) OnChanOpenTry( - ctx sdk.Context, - order channeltypes.Order, - connectionHops []string, - portID, channelID string, - chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, - counterpartyVersion string, -) (version string, err error) { - return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) -} - -// OnChanOpenAck implements the IBCModule interface. -func (im IBCMiddleware) OnChanOpenAck( - ctx sdk.Context, - portID, channelID string, - counterpartyChannelID string, - counterpartyVersion string, -) error { - return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) -} - -// OnChanOpenConfirm implements the IBCModule interface. -func (im IBCMiddleware) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error { - return im.app.OnChanOpenConfirm(ctx, portID, channelID) -} - -// OnChanCloseInit implements the IBCModule interface. -func (im IBCMiddleware) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error { - return im.app.OnChanCloseInit(ctx, portID, channelID) -} - -// OnChanCloseConfirm implements the IBCModule interface. -func (im IBCMiddleware) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string) error { - return im.app.OnChanCloseConfirm(ctx, portID, channelID) -} - -// OnRecvPacket intercepts the packet data and checks the sender and receiver address against -// the blacklisted addresses held in the tokenfactory keeper. If the address is found in the blacklist, an -// acknowledgment error is returned. -func (im IBCMiddleware) OnRecvPacket( - ctx sdk.Context, - packet channeltypes.Packet, - relayer sdk.AccAddress, -) ibcexported.Acknowledgement { - - var data transfertypes.FungibleTokenPacketData - var ackErr error - if err := types.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err != nil { - ackErr = sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "cannot unmarshal ICS-20 transfer packet data") - return channeltypes.NewErrorAcknowledgement(ackErr) - } - - denomTrace := transfertypes.ParseDenomTrace(data.Denom) - - tfMintingDenom := im.keeper.GetMintingDenom(ctx) - ctfMintingDenom := im.fiatKeeper.GetMintingDenom(ctx) - - switch { - // denom is not tokenfactory denom - case denomTrace.BaseDenom != tfMintingDenom.Denom && denomTrace.BaseDenom != ctfMintingDenom.Denom: - return im.app.OnRecvPacket(ctx, packet, relayer) - // denom is tokenfactory asset - case denomTrace.BaseDenom == tfMintingDenom.Denom: - if im.keeper.GetPaused(ctx).Paused { - return channeltypes.NewErrorAcknowledgement(types.ErrPaused) - } - - _, addressBz, err := bech32.DecodeAndConvert(data.Receiver) - if err != nil { - return channeltypes.NewErrorAcknowledgement(err) - } - - _, found := im.keeper.GetBlacklisted(ctx, addressBz) - if found { - ackErr = sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "receiver address is blacklisted") - return channeltypes.NewErrorAcknowledgement(ackErr) - } - - _, addressBz, err = bech32.DecodeAndConvert(data.Sender) - if err != nil { - return channeltypes.NewErrorAcknowledgement(err) - } - - _, found = im.keeper.GetBlacklisted(ctx, addressBz) - if found { - ackErr = sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "sender address is blacklisted") - return channeltypes.NewErrorAcknowledgement(ackErr) - } - // denom is fiat-tokenfactory asset - case denomTrace.BaseDenom == ctfMintingDenom.Denom: - if im.fiatKeeper.GetPaused(ctx).Paused { - return channeltypes.NewErrorAcknowledgement(fiat_types.ErrPaused) - } - - _, addressBz, err := bech32.DecodeAndConvert(data.Receiver) - if err != nil { - return channeltypes.NewErrorAcknowledgement(err) - } - - _, found := im.fiatKeeper.GetBlacklisted(ctx, addressBz) - if found { - ackErr = sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "receiver address is blacklisted") - return channeltypes.NewErrorAcknowledgement(ackErr) - } - - _, addressBz, err = bech32.DecodeAndConvert(data.Sender) - if err != nil { - return channeltypes.NewErrorAcknowledgement(err) - } - - _, found = im.fiatKeeper.GetBlacklisted(ctx, addressBz) - if found { - ackErr = sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "sender address is blacklisted") - return channeltypes.NewErrorAcknowledgement(ackErr) - } - - } - return im.app.OnRecvPacket(ctx, packet, relayer) - -} - -// OnAcknowledgementPacket implements the IBCModule interface. -func (im IBCMiddleware) OnAcknowledgementPacket( - ctx sdk.Context, - packet channeltypes.Packet, - acknowledgement []byte, - relayer sdk.AccAddress, -) error { - return im.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) -} - -// OnTimeoutPacket implements the IBCModule interface. -func (im IBCMiddleware) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error { - return im.app.OnTimeoutPacket(ctx, packet, relayer) -}