diff --git a/.github/compatibility-test-matrices/main/ica-chain-a.json b/.github/compatibility-test-matrices/main/ica-chain-a.json index accc5fb3bd0..eb14648ed4d 100644 --- a/.github/compatibility-test-matrices/main/ica-chain-a.json +++ b/.github/compatibility-test-matrices/main/ica-chain-a.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/ica-chain-b.json b/.github/compatibility-test-matrices/main/ica-chain-b.json index fdcf30e4e82..9bb0c092bff 100644 --- a/.github/compatibility-test-matrices/main/ica-chain-b.json +++ b/.github/compatibility-test-matrices/main/ica-chain-b.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-a.json index d680802bdd6..ba6ec1d32ef 100644 --- a/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-a.json @@ -4,6 +4,7 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0" ], "entrypoint": [ diff --git a/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-b.json b/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-b.json index 659a0cfa58e..e10ff5fcf63 100644 --- a/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-b.json +++ b/.github/compatibility-test-matrices/main/ica-channel-upgrade-chain-b.json @@ -1,6 +1,7 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0" ], "chain-b": [ diff --git a/.github/compatibility-test-matrices/main/ica-gov-chain-a.json b/.github/compatibility-test-matrices/main/ica-gov-chain-a.json index 9827e6bd782..a82db346b9d 100644 --- a/.github/compatibility-test-matrices/main/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/main/ica-gov-chain-a.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/ica-gov-chain-b.json b/.github/compatibility-test-matrices/main/ica-gov-chain-b.json index e289097ceb8..dbbca6d0a15 100644 --- a/.github/compatibility-test-matrices/main/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/main/ica-gov-chain-b.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/ica-groups-chain-a.json b/.github/compatibility-test-matrices/main/ica-groups-chain-a.json index f5f803a2794..b0e6edc047c 100644 --- a/.github/compatibility-test-matrices/main/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/main/ica-groups-chain-a.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/ica-groups-chain-b.json b/.github/compatibility-test-matrices/main/ica-groups-chain-b.json index 84169c8b530..72496c89730 100644 --- a/.github/compatibility-test-matrices/main/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/main/ica-groups-chain-b.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json index 5ebfe9ab01c..fec7bc211d0 100644 --- a/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json @@ -4,6 +4,7 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0" ], "entrypoint": [ diff --git a/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json index 9e0e4bc3d17..0ecac73aef8 100644 --- a/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json @@ -1,6 +1,7 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0" ], "chain-b": [ diff --git a/.github/compatibility-test-matrices/main/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/main/incentivized-ica-chain-a.json index bd896fe9747..7b1d250e4d1 100644 --- a/.github/compatibility-test-matrices/main/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/main/incentivized-ica-chain-a.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/main/incentivized-ica-chain-b.json index 8043b72b296..f964fdc44a3 100644 --- a/.github/compatibility-test-matrices/main/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/main/incentivized-ica-chain-b.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/main/incentivized-transfer-chain-a.json index 236c9bdc99f..ea9c944d149 100644 --- a/.github/compatibility-test-matrices/main/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/main/incentivized-transfer-chain-a.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/main/incentivized-transfer-chain-b.json index 4204f3ced5e..c65742cf2ff 100644 --- a/.github/compatibility-test-matrices/main/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/main/incentivized-transfer-chain-b.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/main/localhost-ica-chain-a.json index fc9607edf03..22eaffb3fa3 100644 --- a/.github/compatibility-test-matrices/main/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/main/localhost-ica-chain-a.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/localhost-ica-chain-b.json b/.github/compatibility-test-matrices/main/localhost-ica-chain-b.json index 0e55effd4ec..31de5da8b65 100644 --- a/.github/compatibility-test-matrices/main/localhost-ica-chain-b.json +++ b/.github/compatibility-test-matrices/main/localhost-ica-chain-b.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/main/localhost-transfer-chain-a.json index 7f787f43e47..2934f7bbdf2 100644 --- a/.github/compatibility-test-matrices/main/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/main/localhost-transfer-chain-a.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/localhost-transfer-chain-b.json b/.github/compatibility-test-matrices/main/localhost-transfer-chain-b.json index c9d763ab440..c6cbecb9739 100644 --- a/.github/compatibility-test-matrices/main/localhost-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/main/localhost-transfer-chain-b.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/main/transfer-authz-chain-a.json index 3c3d3a9c461..1356e01328c 100644 --- a/.github/compatibility-test-matrices/main/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/main/transfer-authz-chain-a.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/main/transfer-authz-chain-b.json index 1e038d5e97e..c20b93d31c2 100644 --- a/.github/compatibility-test-matrices/main/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/main/transfer-authz-chain-b.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/transfer-chain-a.json b/.github/compatibility-test-matrices/main/transfer-chain-a.json index 02472617a05..d67ed6f3679 100644 --- a/.github/compatibility-test-matrices/main/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/main/transfer-chain-a.json @@ -4,7 +4,9 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/transfer-chain-b.json b/.github/compatibility-test-matrices/main/transfer-chain-b.json index 5228dd34b2c..a1020f0f809 100644 --- a/.github/compatibility-test-matrices/main/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/main/transfer-chain-b.json @@ -1,7 +1,9 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-a.json index cc46ed3ee95..7fb9a65276d 100644 --- a/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-a.json @@ -4,6 +4,7 @@ ], "chain-b": [ "main", + "v8.5.0", "v8.4.0" ], "entrypoint": [ diff --git a/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-b.json b/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-b.json index bb8368fdbf5..f0331a1dcea 100644 --- a/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-b.json +++ b/.github/compatibility-test-matrices/main/transfer-channel-upgrade-chain-b.json @@ -1,6 +1,7 @@ { "chain-a": [ "main", + "v8.5.0", "v8.4.0" ], "chain-b": [ diff --git a/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-a.json index 171b0d4da34..2f1b3aaddfd 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-b.json index 4bc1b377c5e..5ae111969a2 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-a.json index d45f55b0484..b12e4355c5c 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-b.json index 886887f3749..28b3716ab70 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-a.json index 116123f9f54..e41b09dab64 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-b.json index de111da2d5d..8600a307e10 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-a.json index 8017a70554f..261d850ea14 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-b.json index 338cc48e7d1..d9d794a1037 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-a.json index ac3548e3223..995efcd8904 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-b.json index ab0cf62a1d2..6bc89899008 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/localhost-ica-chain-a.json index e4dae956161..c9883d2efaa 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/localhost-transfer-chain-a.json index 8ba5dcb65a6..70aa2a8f0b9 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-a.json index a34c853084d..5f3764ef5df 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-b.json index bf2ef4ef3cd..a634081fe1e 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-a.json index efa486a0c30..a7f092a8bb8 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-b.json index 36b6a18144a..62a2b7bb8ae 100644 --- a/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.4.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-a.json index d4bef90e990..df85b58ea20 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-b.json index 05ddccf4f7e..43de7428554 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-a.json index aabeb85f75a..eb031b169ba 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-b.json index fef5082408d..4715e7d3f46 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-a.json index 1c5db8d6d83..d3552b6c85a 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-b.json index b04991c3e3f..91469f4bc74 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-a.json index 64434d9402d..93355e1c560 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-a.json @@ -3,6 +3,7 @@ "release-v7.5.x" ], "chain-b": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-b.json index bff5a855527..8d0b997ee1b 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-queries-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-a.json index 998eedbdb89..7744f41ff75 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-a.json @@ -3,6 +3,7 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v7.5.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-b.json index fe39f5d01a7..e2ee04f9739 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/ica-unordered-channel-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v7.5.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-a.json index bbae3b088a9..e8e0a4dc71d 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-b.json index 78b325637c9..6cb957c3445 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-a.json index 9482adbce8a..119150bf216 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-b.json index 974d0fc0030..043fac58525 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/localhost-ica-chain-a.json index 5d19ffce2ea..3b8625c9a4e 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/localhost-transfer-chain-a.json index f996c77320f..2e04effa1d1 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-a.json index 10897ce83dc..7250610a60d 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-b.json index f05ab4752fc..d153dd4d30d 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-a.json index aec7e763260..2b0e065c972 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-b.json index 917bfa3a036..e8c68b9342e 100644 --- a/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.5.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-a.json index 10b1cc052df..edf38f3cded 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-b.json index 102ceb4bac4..d5c94282d8d 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-a.json index ffe9364edcb..cd55da60534 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-b.json index 2ac62b4b078..cb22e2f185e 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-a.json index 0ea78151c47..763c5ee9b45 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-b.json index 0e2bbde6c68..9bb44d4ea9b 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-a.json index 38aa5a35d17..03e6a93eb51 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-a.json @@ -3,6 +3,7 @@ "release-v7.6.x" ], "chain-b": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-b.json index eb1aac66761..a1cdd78e5a4 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-queries-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-a.json index 8e3867a367b..cf6e450466e 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-a.json @@ -3,6 +3,7 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v7.6.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-b.json index 316e6d0f6b8..5d1506c255f 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/ica-unordered-channel-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v7.6.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-a.json index c8c295d16f6..0e321531563 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-b.json index 0ab23706aab..e39e71cef1b 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-a.json index 2bf9b1258d6..0d8032381a5 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-b.json index 502a7508114..19a46ce636c 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/localhost-ica-chain-a.json index 0ecc112ed2b..9ec9880bc87 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/localhost-transfer-chain-a.json index 549e383cd96..c50336a27e5 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-a.json index daf611e30d8..8dddec5339b 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-b.json index 13e626f0b15..95f4adc423c 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-a.json index 1a2feade5c2..eea91a7afec 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.6.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-b.json index 0f91e8fda80..53d146f37cf 100644 --- a/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.6.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-a.json index f6bad312571..7c2c9f448c0 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-b.json index 78aae8324ac..47d82f0b0b8 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-a.json index e581afe014b..3020ce3ebc2 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-b.json index c35533d0034..a1e585285c4 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-a.json index 5cddc334b48..6cf1e0c5913 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-b.json index 32c4d2053e1..a2d262c0076 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-a.json index 5bbba38e88b..204c732bf96 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-a.json @@ -3,6 +3,7 @@ "release-v7.7.x" ], "chain-b": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-b.json index b9ce2ae0a0b..61d323427e3 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-queries-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-a.json index 48d340878fa..baaf8bab6f9 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-a.json @@ -3,6 +3,7 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v7.7.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-b.json index 826f8ac5162..3d7a2fac3cb 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/ica-unordered-channel-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v7.7.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-a.json index 694d9bb2ab6..6b11a19db50 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-b.json index 91dd3c9c77f..ffc7e16b18e 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-a.json index 22a055d93ea..63ca4f86ac4 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-b.json index 832ccda7314..3f72a4f02a9 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/localhost-ica-chain-a.json index a7fb1c0ebc6..12d246727ef 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/localhost-transfer-chain-a.json index 9d9e73a564f..397c21fb75b 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-a.json index 92ce80eb958..aafffefacb2 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-b.json index 818c5399071..e4bceaff361 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-a.json index fa7e649af74..f832ac61a6e 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.7.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-b.json index 897edf47010..bf1b933a646 100644 --- a/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.7.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-a.json index 8d534690974..ae0b3d9a90f 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-b.json index 7548c5aff2b..a5f69025ec0 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-a.json index 280ff71a44f..8ace4bfe3fe 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-b.json index a3ee5829438..9793fe4b54c 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-a.json index 80af5587210..032ec43173d 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-b.json index cb962863315..0f8f01af088 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-a.json index b8bb98ec266..2aa4874734a 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-a.json @@ -3,6 +3,7 @@ "release-v7.8.x" ], "chain-b": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-b.json index 03695e4d3ec..05d9d480f95 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-queries-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-a.json index 0c725f8c0fd..ccd805c86e1 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-a.json @@ -3,6 +3,7 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v7.8.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-b.json index 632a2bb66ba..d86d0aac81f 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/ica-unordered-channel-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v7.8.x" ], diff --git a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-a.json index 47f4a37be22..3471c955487 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-b.json index 3fc7290b643..9365475a499 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-a.json index 04c5fe9d999..c4c9ca1107e 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-b.json index 07689c63072..5aa8ce2345d 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/localhost-ica-chain-a.json index c6b4dfc7d90..fc7b1491b46 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/localhost-transfer-chain-a.json index 1a341946ebe..6153e674a05 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-a.json index 1b25fe70856..156f8171a27 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-b.json index 06034306cd6..bad34e7e0c6 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-a.json index 7df2f094172..f31a0b07a5b 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v7.8.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-b.json index 5028ea428d6..09693a9c446 100644 --- a/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.8.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-a.json index 2627fb39fb1..1e6f12f6f38 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-b.json index 61daa9093e3..26c040209f9 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-a.json index f21de132994..69a3f5042e7 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-a.json @@ -3,6 +3,7 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v8.4.x" ], diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-b.json index 46f45a76424..fc8ddd2f346 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-channel-upgrade-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v8.4.x" ], diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-a.json index 92b58e5a51d..92a20ef45ad 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-b.json index db5179c5ec2..8a6c409e896 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-a.json index 0beb1becbb3..ceef3795909 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-b.json index c7911a45ae7..d92e890efed 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-a.json index 4ef675e9722..7664b4934e5 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-b.json index 0ca69de04da..3f18bd9b205 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-queries-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-a.json index bf7f084ff12..2ffb5f9e4cc 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-b.json index 98ffb50155d..40623b97af5 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/ica-unordered-channel-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-a.json index 8b21c2803a5..6e7a1744a8d 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-b.json index eee707b65c4..e5a15ea9f8e 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-a.json index df5d2ee73f2..6e6e343d420 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-b.json index 87ee616258c..bb7d5dfe150 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/localhost-ica-chain-a.json index aabb0286551..7f67b18a01b 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/localhost-transfer-chain-a.json index 13628f9a33e..4d1ae7dcf70 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-a.json index c4feda55cfc..11ae7ca039c 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-b.json index 89787270b5f..64641ff3091 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-a.json index 5cfcf05918b..eaed8ad7c77 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-b.json index 946988ce250..83191949c6f 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-a.json index 1e8c03b2371..abd255a88d1 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-a.json @@ -3,6 +3,7 @@ "release-v8.4.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v8.4.x" ], diff --git a/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-b.json b/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-b.json index af6e1012b3d..71d5a676d32 100644 --- a/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.4.x/transfer-channel-upgrade-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v8.4.x" ], diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-a.json index ae684f49435..23e31849731 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-b.json index 7b0f84ef666..7fa55f1fcf4 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-a.json index f2dfd6714f0..248c371e927 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-a.json @@ -3,6 +3,7 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v8.5.x" ], diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-b.json index 94626e60a9a..612eabe143b 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-channel-upgrade-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v8.5.x" ], diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-a.json index e47438d43db..3454076cf71 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-b.json index c3bc5a089cf..93f579f43d9 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-a.json index 4b089c06ec1..89e36bc1f30 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-b.json index 43a3676f195..40b58ea8b8e 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-a.json index 90d6235d137..9a195d9ceb7 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-b.json index 66fd343c508..21b53e65bb0 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-queries-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-a.json index 3c584dd135e..577dae489e5 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-b.json index 0b1430a571d..d9c364fd2a0 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/ica-unordered-channel-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-a.json index 7bc899c4298..330964f3c79 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-b.json index 73307a385cb..9d6412f10af 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-a.json index ebdf7db6835..528821135bb 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-b.json index ee4b931996b..0e87e2c7808 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/localhost-ica-chain-a.json index f93b5ce2584..2cda7657b7d 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/localhost-transfer-chain-a.json index 9ab7023b653..7c36ff7d1a1 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-a.json index 0d2e396eaea..fff34cfb346 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-b.json index 32fe156fcbc..2ec52ff3240 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-a.json index 9a252e67103..bb1176b3ad3 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-b.json index 789ae395b27..5ee0b1f0f6f 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-a.json index 34753a18aa8..e13a5647db4 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-a.json @@ -3,6 +3,7 @@ "release-v8.5.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v8.5.x" ], diff --git a/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-b.json b/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-b.json index 3c1f68985dd..383154fe1eb 100644 --- a/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-b.json +++ b/.github/compatibility-test-matrices/release-v8.5.x/transfer-channel-upgrade-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v8.5.x" ], diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-a.json index 030ef1df5c3..0f1aed472ba 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-b.json index 29f6c00275c..6fd799e238b 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-a.json index 965c1898566..fc9d57f1fed 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-a.json @@ -3,6 +3,7 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v9.0.x" ], diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-b.json index 09042140007..c689a92c791 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-channel-upgrade-chain-b.json @@ -1,5 +1,6 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", "release-v9.0.x" ], diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-a.json index 9ef6b278761..e2f558a7e37 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-b.json index 95fd953e515..8e8e6ed85a2 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-gov-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-a.json index 031db36d393..a9bcb6f5bcf 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-b.json index 1195bdc92a7..86709bca8b8 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-groups-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-a.json index bfdee1a5d43..5976a12e19d 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-b.json index e6efc3f6078..065156d3b35 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-queries-chain-b.json @@ -1,11 +1,13 @@ { "chain-a": [ + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v9.0.x" ], diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-a.json index 09d264544f1..2b9157ce95e 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-b.json index 9614811e045..dd9b990c6c0 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/ica-unordered-channel-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-a.json index aeac0ea229f..5720e7b3378 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-b.json index b3c718b99b6..d946dae389e 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-ica-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-a.json index 225e3f655db..768441d53b1 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-b.json index 3268abecb81..fb6ea5e68fe 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/incentivized-transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/localhost-ica-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/localhost-ica-chain-a.json index 3380570888c..3e3399b0269 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/localhost-ica-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/localhost-ica-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/localhost-transfer-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/localhost-transfer-chain-a.json index 350b6040ac0..9e2671e0c8b 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/localhost-transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/localhost-transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-a.json index a0b77abdd43..8f51caef846 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-b.json index 8b3451a6857..61100e64000 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/transfer-authz-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-a.json index 07af5b96a07..9fbc18b18eb 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-a.json @@ -3,7 +3,9 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-b.json b/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-b.json index 655ffb5101b..497406e4567 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-b.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/transfer-chain-b.json @@ -1,6 +1,8 @@ { "chain-a": [ + "v8.5.0", "v8.4.0", + "v7.8.0", "v7.7.0", "v7.6.0", "v7.5.0", diff --git a/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a copy.json b/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a copy.json index 69808e652f9..ae30c743d7a 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a copy.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a copy.json @@ -3,6 +3,7 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v9.0.x" ], diff --git a/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a.json b/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a.json index 69808e652f9..ae30c743d7a 100644 --- a/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a.json +++ b/.github/compatibility-test-matrices/release-v9.0.x/transfer-channel-upgrade-chain-a.json @@ -3,6 +3,7 @@ "release-v9.0.x" ], "chain-b": [ + "v8.5.0", "v8.4.0", "release-v9.0.x" ], diff --git a/.github/workflows/capability.yml b/.github/workflows/capability.yml deleted file mode 100644 index 720ca0db5bb..00000000000 --- a/.github/workflows/capability.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Capability Module -# This workflow runs when a PR is opened that targets code that is part of the capability module. -on: - merge_group: - pull_request: - paths: - - '.github/workflows/capability.yml' - - 'modules/capability/**' - - 'proto/capability/**' - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - go-arch: ['amd64', 'arm', 'arm64'] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - name: Build capability-module - run: | - cd modules/capability - GOARCH=${{ matrix.go-arch }} go build ./... - - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: '1.22' - - name: Go Test - run: | - cd modules/capability - go test -v -mod=readonly ./... -coverprofile=coverage.out - - code-analysis: - if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' - runs-on: ubuntu-latest - needs: [tests] - steps: - - name: sonarcloud - if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} - uses: SonarSource/sonarcloud-github-action@v3.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - with: - projectBaseDir: modules/capability/ diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 17eda64b9db..25c05965007 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -27,7 +27,7 @@ jobs: run: make build-docs - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.6.3 + uses: JamesIves/github-pages-deploy-action@v4.6.4 with: branch: gh-pages folder: docs/build diff --git a/.github/workflows/e2e-compatibility.yaml b/.github/workflows/e2e-compatibility.yaml index 97572d37da2..bcda60a13e7 100644 --- a/.github/workflows/e2e-compatibility.yaml +++ b/.github/workflows/e2e-compatibility.yaml @@ -58,7 +58,9 @@ jobs: - release/v7.5.x - release/v7.6.x - release/v7.7.x + - release/v7.8.x - release/v8.4.x + - release/v8.5.x - release/v9.0.x - main steps: diff --git a/.github/workflows/e2e-manual-simd.yaml b/.github/workflows/e2e-manual-simd.yaml index b50c813bb46..94aa86aa425 100644 --- a/.github/workflows/e2e-manual-simd.yaml +++ b/.github/workflows/e2e-manual-simd.yaml @@ -35,7 +35,9 @@ on: default: main options: - main + - v8.5.0 - v8.4.0 + - v7.7.0 - v7.6.0 - v7.5.0 - v7.4.0 @@ -50,7 +52,9 @@ on: type: choice options: - main + - v8.5.0 - v8.4.0 + - v7.7.0 - v7.6.0 - v7.5.0 - v7.4.0 diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index 8ddf3cdff36..fbb79644d6d 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -18,7 +18,7 @@ jobs: with: files: '**/*.md' separator: "," - - uses: DavidAnson/markdownlint-cli2-action@v16 + - uses: DavidAnson/markdownlint-cli2-action@v17 if: steps.changed-files.outputs.any_changed == 'true' with: globs: ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/.github/workflows/proto-registry.yml b/.github/workflows/proto-registry.yml index f13c88c584e..3b2ef58e0ed 100644 --- a/.github/workflows/proto-registry.yml +++ b/.github/workflows/proto-registry.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.38.0 + - uses: bufbuild/buf-setup-action@v1.41.0 - uses: bufbuild/buf-push-action@v1 with: input: "proto" diff --git a/.github/workflows/spell-checker.yml b/.github/workflows/spell-checker.yml index e5004288dad..4e000a07a0e 100644 --- a/.github/workflows/spell-checker.yml +++ b/.github/workflows/spell-checker.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: sobolevn/misspell-fixer-action@26173e641ba08255d0c9826b8a873f8b96f76932 - - uses: peter-evans/create-pull-request@v6 + - uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "chore: fixes by misspell-fixer" diff --git a/CHANGELOG.md b/CHANGELOG.md index dd8687a2179..7dc9c417934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,8 +38,21 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Dependencies +* [\#7247](https://github.com/cosmos/ibc-go/pull/7247) Bump CometBFT to v0.38.12. + ### API Breaking +* (core, apps) [\#7213](https://github.com/cosmos/ibc-go/pull/7213) Remove capabilities from `SendPacket`. +* (core, apps) [\#7213](https://github.com/cosmos/ibc-go/pull/7225) Remove capabilities from `WriteAcknowledgement`. +* (core, apps) [\#7232](https://github.com/cosmos/ibc-go/pull/7232) Remove capabilities from channel handshake methods. TODO list all changes +* (core, apps) [\#7270](https://github.com/cosmos/ibc-go/pull/7270) Remove remaining dependencies on capability module. +* (core/04-channel) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) Removed function `LookupModuleByChannel` +* (core/05-port) [\#7252](https://github.com/cosmos/ibc-go/pull/7252) Removed function `LookupModuleByPort` +* (core/24-host) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) Removed function `ChannelCapabilityPath` +* (apps/27-interchain-accounts) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) The following functions have been removed: `AuthenticateCapability`, `ClaimCapability` +* (apps/transfer) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) The following functions have been removed: `BindPort`, `AuthenticateCapability`, `ClaimCapability` +* (capability) [\#7279](https://github.com/cosmos/ibc-go/pull/7279) The module `capability` has been removed + ### State Machine Breaking ### Improvements @@ -48,14 +61,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (apps/27-interchain-accounts) [\#7277](https://github.com/cosmos/ibc-go/pull/7277) Use `GogoResolver` when populating module query safe allow list to avoid panics from unresolvable protobuf dependencies. + ## v9.0.0 (unreleased) ### Dependencies -* [\#6828](https://github.com/cosmos/ibc-go/pull/6828) Bump Cosmos SDK to v0.50.9. * [\#6193](https://github.com/cosmos/ibc-go/pull/6193) Bump `cosmossdk.io/store` to v1.1.0. * [\#7126](https://github.com/cosmos/ibc-go/pull/7126) Bump CometBFT to v0.38.11. * [\#6380](https://github.com/cosmos/ibc-go/pull/6380) Bump go to v1.22. +* [\#7223](https://github.com/cosmos/ibc-go/pull/7223) Update ics23 to v0.11.0. ### API Breaking @@ -113,6 +128,17 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers. +## [v8.5.0](https://github.com/cosmos/ibc-go/releases/tag/v8.5.0) - 2024-08-30 + +### Dependencies + +* [\#6828](https://github.com/cosmos/ibc-go/pull/6828) Bump Cosmos SDK to v0.50.9. +* [\#7222](https://github.com/cosmos/ibc-go/pull/7221) Update ics23 to v0.11.0. + +### State Machine Breaking + +* (core/03-connection) [\#7129](https://github.com/cosmos/ibc-go/pull/7129) Remove verification of self client and consensus state from connection handshake. + ## [v8.4.0](https://github.com/cosmos/ibc-go/releases/tag/v8.4.0) - 2024-07-29 ### Improvements @@ -314,6 +340,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/transfer, apps/29-fee) [\#4570](https://github.com/cosmos/ibc-go/pull/4570) Remove `GetSignBytes` from 29-fee and transfer msgs. * [\#3630](https://github.com/cosmos/ibc-go/pull/3630) Add annotation to Msg service. +## [v7.8.0](https://github.com/cosmos/ibc-go/releases/tag/v7.8.0) - 2024-08-30 + +### State Machine Breaking + +* (core/03-connection) [\#7128](https://github.com/cosmos/ibc-go/pull/7128) Remove verification of self client and consensus state from connection handshake. + ## [v7.7.0](https://github.com/cosmos/ibc-go/releases/tag/v7.7.0) - 2024-07-29 ### Dependencies diff --git a/RELEASES.md b/RELEASES.md index 40970c2d135..61db2b75376 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -75,7 +75,9 @@ We reserve the right to drop support for releases if they are deemed unused (for |`v7.5.x`|March 17, 2025| |`v7.6.x`|March 17, 2025| |`v7.7.x`|March 17, 2025| +|`v7.8.x`|March 17, 2025| |`v8.4.x`|May 10, 2025| +|`v8.5.x`|May 10, 2025| ### Callbacks middleware @@ -128,7 +130,9 @@ Versions of Golang, Cosmos SDK and CometBFT used by ibc-go in the currently acti | 1.19 | v7.5.0 | v0.47.11 | v0.37.5 | | 1.19 | v7.6.0 | v0.47.12 | v0.37.5 | | 1.19 | v7.7.0 | v0.47.13 | v0.37.5 | +| 1.19 | v7.8.0 | v0.47.13 | v0.37.5 | | 1.21 | v8.4.0 | v0.50.7 | v0.38.7 | +| 1.21 | v8.5.0 | v0.50.9 | v0.38.11 | ### Callbacks middleware diff --git a/docs/docs/04-middleware/02-callbacks/01-overview.md b/docs/docs/04-middleware/02-callbacks/01-overview.md index ca469a80e79..eae194b2b96 100644 --- a/docs/docs/04-middleware/02-callbacks/01-overview.md +++ b/docs/docs/04-middleware/02-callbacks/01-overview.md @@ -49,3 +49,7 @@ And the following diagram shows how a typical `SendPacket` and `WriteAcknowledge - Maximum gas limit is hardcoded manually during wiring. It requires a coordinated upgrade to change the maximum gas limit. - The receive packet callback does not pass the relayer address to the secondary application. This is so that we can use the same callback for both synchronous and asynchronous acknowledgements. - The receive packet callback does not pass IBC Actor's address, this is because the IBC Actor lives in the counterparty chain and cannot be trusted. + +:::warning +If the callbacks middleware wraps the transfer application, we strongly discourage the usage of source callbacks if [`MsgTransfer` includes forwarding information](https://github.com/cosmos/ibc-go/blob/v9.0.0-rc.0/proto/ibc/applications/transfer/v1/tx.proto#L54-L55) (which is only supported from ICS20 v2). Source callback information will be executed on the last hop before the destination chain, not on the sending chain. The explanation for this behaviour is that, if the tokens are routed through intermediary chains, then the transfer application on the sending chain will construct a packet data where the [`memo` field](https://github.com/cosmos/ibc-go/blob/v9.0.0-rc.0/proto/ibc/applications/transfer/v2/packet.proto#L38) is empty, and any [memo string](https://github.com/cosmos/ibc-go/blob/v9.0.0-rc.0/proto/ibc/applications/transfer/v1/tx.proto#L51) included in `MsgTransfer` is placed in the [`destination_memo` field](https://github.com/cosmos/ibc-go/blob/v9.0.0-rc.0/proto/ibc/applications/transfer/v2/packet.proto#L48). This makes it impossible to trigger the source callbacks on the sending chain, since the memo string is not available in the `memo` field. Then, on the chain before the final destination chain, the transfer application will construct the packet data with the memo string back in the `memo` field, so that it can be consumed by the callbacks middleware on the destination chain. However, if the `memo` field of `FungibleTokenPacketDataV2` is not empty on the chain before the final destination and the transfer application on that chain is wrapped by callbacks middleware, then the source callbacks would be triggered. Therefore, in order to prevent this unexpected behaviour (i.e. source callbacks triggered not on sending chain, but on the intermediary chain before the final destination) we are strongly recommeding to not include source callbacks information in the `memo` field of `MsgTransfer`. +::: diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index ad93bcb1e06..7b1dc0399db 100644 --- a/docs/docs/05-migrations/13-v8-to-v9.md +++ b/docs/docs/05-migrations/13-v8-to-v9.md @@ -91,8 +91,8 @@ func NewKeeper( ### 03-connection -- The [functions `GetState()`, `GetClientID()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L25-L48) of the `Connection` type have been removed. -- The [functions `GetClientID()`, `GetConnectionID()`, and `GetPrefix()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L79-L92) of the `Counterparty` type have been removed. +- The [functions `GetState()`, `GetClientID()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L25-L48) of the `Connection` type have been removed. Please access the fields directly. +- The [functions `GetClientID()`, `GetConnectionID()`, and `GetPrefix()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L79-L92) of the `Counterparty` type have been removed. Please access the fields directly. #### Removal of self client and consensus state from connection handshake @@ -133,7 +133,7 @@ func NewMsgConnectionOpenAck( ### 04-channel - The utility function [`QueryLatestConsensusState`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/client/utils/utils.go#L130) of the CLI has been removed. -- The [functions `GetState()`, `GetOrdering()`, `GetCounterparty()`, `GetConnectionHops()`, `GetVersion()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L29-L52) of the `Channel` type have been removed. +- The [functions `GetState()`, `GetOrdering()`, `GetCounterparty()`, `GetConnectionHops()`, `GetVersion()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L29-L52) of the `Channel` type have been removed. Please access the fields directly. - The [functions `IsOpen()` and `IsClosed()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L54-L62) of the `Channel` type have been removed. - The [functions `GetPortID()`, `GetChannelID()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L92-L100) of the `CounterpartyChannel` type have been removed. - Functions [`ChanCloseConfirmWithCounterpartyUpgradeSequence`](https://github.com/cosmos/ibc-go/blob/v8.1.0/modules/core/04-channel/keeper/handshake.go#L446) and [`TimeoutOnCloseWithCounterpartyUpgradeSequence`](https://github.com/cosmos/ibc-go/blob/v8.1.0/modules/core/04-channel/keeper/timeout.go#L226) have been removed. Please use `ChanCloseConfirm` and `TimeoutOnClose` with the updated signature that takes the counterparty upgrade sequence as extra argument: @@ -146,7 +146,7 @@ func (k *Keeper) ChanCloseConfirm( chanCap *capabilitytypes.Capability, initProof []byte, proofHeight exported.Height, -+ counterpartyUpgradeSequence uint64, ++ counterpartyUpgradeSequence uint64, ) func (k *Keeper) TimeoutOnClose( @@ -157,7 +157,7 @@ func (k *Keeper) TimeoutOnClose( closedProof []byte, proofHeight exported.Height, nextSequenceRecv uint64, -+ counterpartyUpgradeSequence uint64, ++ counterpartyUpgradeSequence uint64, ) ``` @@ -392,6 +392,51 @@ type ContractKeeper interface { ### IBC testing package +- In the `TestChain` struct the field [`LastHeader`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L59) has been renamed to `LatestCommittedHeader`, the field [`CurrentHeader`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L60) has been renamed to `ProposedHeader` and the [`QueryServer` interface](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L61) has been removed. + +```diff +type TestChain struct { + testing.TB + + Coordinator *Coordinator + App TestingApp + ChainID string +- LastHeader *ibctm.Header // header for last block height committed ++ LatestCommittedHeader *ibctm.Header // header for last block height committed +- CurrentHeader cmtproto.Header // header for current block height ++ ProposedHeader cmtproto.Header // proposed (uncommitted) header for current block height +- QueryServer types.QueryServer + TxConfig client.TxConfig + Codec codec.Codec + + Vals *cmttypes.ValidatorSet + NextVals *cmttypes.ValidatorSet + + // Signers is a map from validator address to the PrivValidator + // The map is converted into an array that is the same order as the validators right before signing commit + // This ensures that signers will always be in correct order even as validator powers change. + // If a test adds a new validator after chain creation, then the signer map must be updated to include + // the new PrivValidator entry. + Signers map[string]cmttypes.PrivValidator + + // autogenerated sender private key + SenderPrivKey cryptotypes.PrivKey + SenderAccount sdk.AccountI + + SenderAccounts []SenderAccount + + // Short-term solution to override the logic of the standard SendMsgs function. + // See issue https://github.com/cosmos/ibc-go/issues/3123 for more information. + SendMsgsOverride func(msgs ...sdk.Msg) (*abci.ExecTxResult, error) +} +``` + +Submodule query servers can be constructed directly by passing their associated keeper to the appropriate constructor function. For example: + +```golang +clientQueryServer := clientkeeper.NewQueryServer(app.IBCKeeper.ClientKeeper) +``` + - The `mock.PV` type has been removed in favour of [`cmttypes.MockPV`](https://github.com/cometbft/cometbft/blob/v0.38.5/types/priv_validator.go#L50) in [#5709](https://github.com/cosmos/ibc-go/pull/5709). - [Functions `ConstructUpdateTMClientHeader` and `ConstructUpdateTMClientHeaderWithTrustedHeight`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L446-L481) of `TestChain` type have been replaced with `IBCClientHeader` function. This function will construct a 07-tendermint header to update the light client on the counterparty chain. The trusted height must be passed in as a non-zero height. - [`GetValsAtHeight`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L401) has been renamed to [`GetTrustedValidators`](https://github.com/cosmos/ibc-go/blob/release/v9.0.x/testing/chain.go#L403). @@ -412,12 +457,6 @@ func AssertEvents( ) ``` -- The [`QueryServer` interface has been removed from the `TestChain` struct](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L61). Submodule query servers can be constructed directly by passing their associated keeper to the appropriate constructor function. For example: - -```golang -clientQueryServer := clientkeeper.NewQueryServer(app.IBCKeeper.ClientKeeper) -``` - - The signature of the function `QueryConnectionHandshakeProof` has changed, since the validation of self client and consensus state has been remove from the connection handshake: ```diff @@ -431,9 +470,10 @@ func (endpoint *Endpoint) QueryConnectionHandshakeProof() ( - The functions [`GenerateClientStateProof` and `GenerateConsensusStateProof`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/solomachine.go#L513-L547) have been removed. -### API deprecation notice +#### API deprecation notice -- The testing package functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, and `CreateChannels` of the `Coordinator` type have been deprecated and will be removed in v10. Please use the new functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, `CreateChannels` of the `Path` type. +- The functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, and `CreateChannels` of the `Coordinator` type have been deprecated and will be removed in v11. Please use the new functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, `CreateChannels` of the `Path` type. +- The function `SetChannelState` of the `Path` type has been deprecated and will be removed in v11. Please use the new function `UpdateChannel` of the `Path` type. ## Relayers @@ -441,6 +481,19 @@ have been removed. #### 02-client +- The function `CreateClient` of the keeper expects now a string for the client type (e.g. `07-tendermint`) and two `[]byte` for the Protobuf-serialized client and consensus states: + +```diff +func (k *Keeper) CreateClient( + ctx sdk.Context, ++ clientType string, +- clientState exported.ClientState, +- consensusState exported.ConsensusState, ++ clientState []byte, ++ consensusState []byte, +) (string, error) +``` + - The [`header` attribute](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/02-client/keeper/events.go#L60) has been removed from the `update_client` event in [\#5110](https://github.com/cosmos/ibc-go/pull/5110). #### 04-channel diff --git a/docs/docs/05-migrations/14-v9-to-v10.md b/docs/docs/05-migrations/14-v9-to-v10.md index f35f15de487..fc00c16f5fc 100644 --- a/docs/docs/05-migrations/14-v9-to-v10.md +++ b/docs/docs/05-migrations/14-v9-to-v10.md @@ -18,6 +18,11 @@ There are four sections based on the four potential user groups of this document ## IBC Apps +- (TODO: expand later) Removal of capabilities in `SendPacket` [\#7213](https://github.com/cosmos/ibc-go/pull/7213). +- (TODO: expand later) Removal of capabilities in `WriteAcknowledgement` [\#7225](https://github.com/cosmos/ibc-go/pull/7213). +- (TODO: expand later) Removal of capabilities in channel handshake methods [\#7232](https://github.com/cosmos/ibc-go/pull/7232). +- (TODO: expand later) More removal of capabilities in [\#7270](https://github.com/cosmos/ibc-go/pull/7270). + ### ICS27 - Interchain Accounts The channel capability migration introduced in v6 has been removed. Chains must upgrade from v6 or higher. diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index e1a81317b2e..0620421a31a 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -49,18 +49,18 @@ const config = { // Exclude template markdown files from the docs exclude: ["**/*.template.md"], // Select the latest version - lastVersion: "v8.4.x", + lastVersion: "v8.5.x", // Assign banners to specific versions versions: { current: { path: "main", banner: "unreleased", }, - "v8.4.x": { + "v8.5.x": { path: "v8", banner: "none", }, - "v7.7.x": { + "v7.8.x": { path: "v7", banner: "none", }, diff --git a/docs/versioned_docs/version-v7.7.x/00-intro.md b/docs/versioned_docs/version-v7.8.x/00-intro.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/00-intro.md rename to docs/versioned_docs/version-v7.8.x/00-intro.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/01-overview.md b/docs/versioned_docs/version-v7.8.x/01-ibc/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/01-overview.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/02-integration.md b/docs/versioned_docs/version-v7.8.x/01-ibc/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/02-integration.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/02-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/01-apps.md b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/01-apps.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/01-apps.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/01-apps.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/02-ibcmodule.md b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/02-ibcmodule.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/02-ibcmodule.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/02-ibcmodule.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/03-bindports.md b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/03-bindports.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/03-bindports.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/03-bindports.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/04-keeper.md b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/04-keeper.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/04-keeper.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/04-keeper.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/05-packets_acks.md b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/05-packets_acks.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/05-packets_acks.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/05-packets_acks.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/06-routing.md b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/06-routing.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/06-routing.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/06-routing.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/_category_.json b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/_category_.json rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/images/packet_flow.png b/docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/images/packet_flow.png similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/03-apps/images/packet_flow.png rename to docs/versioned_docs/version-v7.8.x/01-ibc/03-apps/images/packet_flow.png diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/04-middleware/01-develop.md b/docs/versioned_docs/version-v7.8.x/01-ibc/04-middleware/01-develop.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/04-middleware/01-develop.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/04-middleware/01-develop.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/04-middleware/02-integration.md b/docs/versioned_docs/version-v7.8.x/01-ibc/04-middleware/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/04-middleware/02-integration.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/04-middleware/02-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/04-middleware/_category_.json b/docs/versioned_docs/version-v7.8.x/01-ibc/04-middleware/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/04-middleware/_category_.json rename to docs/versioned_docs/version-v7.8.x/01-ibc/04-middleware/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/00-intro.md b/docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/00-intro.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/00-intro.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/00-intro.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/01-quick-guide.md b/docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/01-quick-guide.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/01-quick-guide.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/01-quick-guide.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/02-developer-guide.md b/docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/02-developer-guide.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/02-developer-guide.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/02-developer-guide.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/03-genesis-restart.md b/docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/03-genesis-restart.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/03-genesis-restart.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/03-genesis-restart.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/_category_.json b/docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/05-upgrades/_category_.json rename to docs/versioned_docs/version-v7.8.x/01-ibc/05-upgrades/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/06-proposals.md b/docs/versioned_docs/version-v7.8.x/01-ibc/06-proposals.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/06-proposals.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/06-proposals.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/07-relayer.md b/docs/versioned_docs/version-v7.8.x/01-ibc/07-relayer.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/07-relayer.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/07-relayer.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/08-proto-docs.md b/docs/versioned_docs/version-v7.8.x/01-ibc/08-proto-docs.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/08-proto-docs.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/08-proto-docs.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/09-roadmap.md b/docs/versioned_docs/version-v7.8.x/01-ibc/09-roadmap.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/09-roadmap.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/09-roadmap.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/10-troubleshooting.md b/docs/versioned_docs/version-v7.8.x/01-ibc/10-troubleshooting.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/10-troubleshooting.md rename to docs/versioned_docs/version-v7.8.x/01-ibc/10-troubleshooting.md diff --git a/docs/versioned_docs/version-v7.7.x/01-ibc/_category_.json b/docs/versioned_docs/version-v7.8.x/01-ibc/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/01-ibc/_category_.json rename to docs/versioned_docs/version-v7.8.x/01-ibc/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/01-overview.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/01-overview.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/02-state.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/02-state.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/02-state.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/02-state.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/03-state-transitions.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/03-state-transitions.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/03-state-transitions.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/03-state-transitions.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/04-messages.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/04-messages.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/04-messages.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/04-messages.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/05-events.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/05-events.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/05-events.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/05-events.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/06-metrics.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/06-metrics.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/06-metrics.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/06-metrics.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/07-params.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/07-params.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/07-params.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/07-params.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/08-authorizations.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/08-authorizations.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/08-authorizations.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/08-authorizations.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/09-client.md b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/09-client.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/09-client.md rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/09-client.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/_category_.json b/docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/01-transfer/_category_.json rename to docs/versioned_docs/version-v7.8.x/02-apps/01-transfer/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/01-overview.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/01-overview.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/02-development.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/02-development.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/02-development.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/02-development.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/03-auth-modules.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/03-auth-modules.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/03-auth-modules.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/03-auth-modules.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/04-integration.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/04-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/04-integration.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/04-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/05-messages.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/05-messages.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/05-messages.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/05-messages.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/06-parameters.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/06-parameters.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/06-parameters.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/06-parameters.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/07-tx-encoding.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/07-tx-encoding.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/07-tx-encoding.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/07-tx-encoding.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/08-client.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/08-client.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/08-client.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/08-client.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/09-active-channels.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/09-active-channels.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/09-active-channels.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/09-active-channels.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/_category_.json b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/_category_.json rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/_category_.json b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/_category_.json rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/images/ica-v6.png b/docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/images/ica-v6.png similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/02-interchain-accounts/images/ica-v6.png rename to docs/versioned_docs/version-v7.8.x/02-apps/02-interchain-accounts/images/ica-v6.png diff --git a/docs/versioned_docs/version-v7.7.x/02-apps/_category_.json b/docs/versioned_docs/version-v7.8.x/02-apps/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/02-apps/_category_.json rename to docs/versioned_docs/version-v7.8.x/02-apps/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/01-overview.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/01-overview.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/02-client-state.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/02-client-state.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/02-client-state.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/02-client-state.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/03-consensus-state.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/03-consensus-state.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/03-consensus-state.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/03-consensus-state.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/05-upgrades.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/05-upgrades.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/05-upgrades.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/05-upgrades.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/06-proofs.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/06-proofs.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/06-proofs.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/06-proofs.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/07-proposals.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/07-proposals.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/07-proposals.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/07-proposals.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/08-genesis.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/08-genesis.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/08-genesis.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/08-genesis.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/09-setup.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/09-setup.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/09-setup.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/09-setup.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/_category_.json b/docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/01-developer-guide/_category_.json rename to docs/versioned_docs/version-v7.8.x/03-light-clients/01-developer-guide/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/01-solomachine.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/01-solomachine.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/01-solomachine.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/01-solomachine.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/02-concepts.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/02-concepts.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/02-concepts.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/02-concepts.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/03-state.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/03-state.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/03-state.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/03-state.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/04-state_transitions.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/04-state_transitions.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/04-state_transitions.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/04-state_transitions.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/_category_.json b/docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/02-solomachine/_category_.json rename to docs/versioned_docs/version-v7.8.x/03-light-clients/02-solomachine/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/01-overview.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/01-overview.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/02-integration.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/02-integration.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/02-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/03-client-state.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/03-client-state.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/03-client-state.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/03-client-state.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/04-connection.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/04-connection.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/04-connection.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/04-connection.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/05-state-verification.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/05-state-verification.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/05-state-verification.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/05-state-verification.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/_category_.json b/docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/03-localhost/_category_.json rename to docs/versioned_docs/version-v7.8.x/03-light-clients/03-localhost/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/01-overview.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/01-overview.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/02-concepts.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/02-concepts.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/02-concepts.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/02-concepts.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/03-integration.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/03-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/03-integration.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/03-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/04-messages.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/04-messages.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/04-messages.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/04-messages.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/05-governance.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/05-governance.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/05-governance.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/05-governance.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/06-events.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/06-events.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/06-events.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/06-events.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/07-contracts.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/07-contracts.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/07-contracts.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/07-contracts.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/08-client.md b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/08-client.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/08-client.md rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/08-client.md diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/_category_.json b/docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/04-wasm/_category_.json rename to docs/versioned_docs/version-v7.8.x/03-light-clients/04-wasm/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/03-light-clients/_category_.json b/docs/versioned_docs/version-v7.8.x/03-light-clients/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/03-light-clients/_category_.json rename to docs/versioned_docs/version-v7.8.x/03-light-clients/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/01-overview.md b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/01-overview.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/02-integration.md b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/02-integration.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/02-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/03-msgs.md b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/03-msgs.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/03-msgs.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/03-msgs.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/04-fee-distribution.md b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/04-fee-distribution.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/04-fee-distribution.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/04-fee-distribution.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/05-events.md b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/05-events.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/05-events.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/05-events.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/06-end-users.md b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/06-end-users.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/06-end-users.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/06-end-users.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/_category_.json b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/_category_.json rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/images/feeflow.png b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/images/feeflow.png similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/images/feeflow.png rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/images/feeflow.png diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/images/msgpaypacket.png b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/images/msgpaypacket.png similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/images/msgpaypacket.png rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/images/msgpaypacket.png diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png b/docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png rename to docs/versioned_docs/version-v7.8.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/01-overview.md b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/01-overview.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/01-overview.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/02-integration.md b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/02-integration.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/02-integration.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/03-interfaces.md b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/03-interfaces.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/03-interfaces.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/03-interfaces.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/04-events.md b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/04-events.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/04-events.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/04-events.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/05-end-users.md b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/05-end-users.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/05-end-users.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/05-end-users.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/06-gas.md b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/06-gas.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/06-gas.md rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/06-gas.md diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/_category_.json b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/_category_.json rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/images/callbackflow.svg b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/images/callbackflow.svg similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/images/callbackflow.svg rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/images/callbackflow.svg diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg b/docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg rename to docs/versioned_docs/version-v7.8.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg diff --git a/docs/versioned_docs/version-v7.7.x/04-middleware/_category_.json b/docs/versioned_docs/version-v7.8.x/04-middleware/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/04-middleware/_category_.json rename to docs/versioned_docs/version-v7.8.x/04-middleware/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/01-support-denoms-with-slashes.md b/docs/versioned_docs/version-v7.8.x/05-migrations/01-support-denoms-with-slashes.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/01-support-denoms-with-slashes.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/01-support-denoms-with-slashes.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/02-sdk-to-v1.md b/docs/versioned_docs/version-v7.8.x/05-migrations/02-sdk-to-v1.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/02-sdk-to-v1.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/02-sdk-to-v1.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/03-v1-to-v2.md b/docs/versioned_docs/version-v7.8.x/05-migrations/03-v1-to-v2.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/03-v1-to-v2.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/03-v1-to-v2.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/04-v2-to-v3.md b/docs/versioned_docs/version-v7.8.x/05-migrations/04-v2-to-v3.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/04-v2-to-v3.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/04-v2-to-v3.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/05-v3-to-v4.md b/docs/versioned_docs/version-v7.8.x/05-migrations/05-v3-to-v4.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/05-v3-to-v4.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/05-v3-to-v4.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/06-v4-to-v5.md b/docs/versioned_docs/version-v7.8.x/05-migrations/06-v4-to-v5.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/06-v4-to-v5.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/06-v4-to-v5.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/07-v5-to-v6.md b/docs/versioned_docs/version-v7.8.x/05-migrations/07-v5-to-v6.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/07-v5-to-v6.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/07-v5-to-v6.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/08-v6-to-v7.md b/docs/versioned_docs/version-v7.8.x/05-migrations/08-v6-to-v7.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/08-v6-to-v7.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/08-v6-to-v7.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/09-v7-to-v7_1.md b/docs/versioned_docs/version-v7.8.x/05-migrations/09-v7-to-v7_1.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/09-v7-to-v7_1.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/09-v7-to-v7_1.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/10-v7_2-to-v7_3.md b/docs/versioned_docs/version-v7.8.x/05-migrations/10-v7_2-to-v7_3.md similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/10-v7_2-to-v7_3.md rename to docs/versioned_docs/version-v7.8.x/05-migrations/10-v7_2-to-v7_3.md diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/_category_.json b/docs/versioned_docs/version-v7.8.x/05-migrations/_category_.json similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/_category_.json rename to docs/versioned_docs/version-v7.8.x/05-migrations/_category_.json diff --git a/docs/versioned_docs/version-v7.7.x/05-migrations/images/auth-module-decision-tree.png b/docs/versioned_docs/version-v7.8.x/05-migrations/images/auth-module-decision-tree.png similarity index 100% rename from docs/versioned_docs/version-v7.7.x/05-migrations/images/auth-module-decision-tree.png rename to docs/versioned_docs/version-v7.8.x/05-migrations/images/auth-module-decision-tree.png diff --git a/docs/versioned_docs/version-v8.4.x/00-intro.md b/docs/versioned_docs/version-v8.5.x/00-intro.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/00-intro.md rename to docs/versioned_docs/version-v8.5.x/00-intro.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/01-overview.md b/docs/versioned_docs/version-v8.5.x/01-ibc/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/01-overview.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/02-integration.md b/docs/versioned_docs/version-v8.5.x/01-ibc/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/02-integration.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/02-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/01-apps.md b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/01-apps.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/01-apps.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/01-apps.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/02-ibcmodule.md b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/02-ibcmodule.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/02-ibcmodule.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/02-ibcmodule.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/03-bindports.md b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/03-bindports.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/03-bindports.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/03-bindports.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/04-keeper.md b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/04-keeper.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/04-keeper.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/04-keeper.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/05-packets_acks.md b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/05-packets_acks.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/05-packets_acks.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/05-packets_acks.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/06-routing.md b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/06-routing.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/06-routing.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/06-routing.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/_category_.json b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/_category_.json rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/images/packet_flow.png b/docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/images/packet_flow.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/03-apps/images/packet_flow.png rename to docs/versioned_docs/version-v8.5.x/01-ibc/03-apps/images/packet_flow.png diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/01-overview.md b/docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/01-overview.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/02-develop.md b/docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/02-develop.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/02-develop.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/02-develop.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/03-integration.md b/docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/03-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/03-integration.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/03-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/_category_.json b/docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/_category_.json rename to docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/images/middleware-stack.png b/docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/images/middleware-stack.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/04-middleware/images/middleware-stack.png rename to docs/versioned_docs/version-v8.5.x/01-ibc/04-middleware/images/middleware-stack.png diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/00-intro.md b/docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/00-intro.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/00-intro.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/00-intro.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/01-quick-guide.md b/docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/01-quick-guide.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/01-quick-guide.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/01-quick-guide.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/02-developer-guide.md b/docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/02-developer-guide.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/02-developer-guide.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/02-developer-guide.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/03-genesis-restart.md b/docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/03-genesis-restart.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/03-genesis-restart.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/03-genesis-restart.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/_category_.json b/docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/05-upgrades/_category_.json rename to docs/versioned_docs/version-v8.5.x/01-ibc/05-upgrades/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/06-channel-upgrades.md b/docs/versioned_docs/version-v8.5.x/01-ibc/06-channel-upgrades.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/06-channel-upgrades.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/06-channel-upgrades.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/07-proposals.md b/docs/versioned_docs/version-v8.5.x/01-ibc/07-proposals.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/07-proposals.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/07-proposals.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/08-relayer.md b/docs/versioned_docs/version-v8.5.x/01-ibc/08-relayer.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/08-relayer.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/08-relayer.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/09-proto-docs.md b/docs/versioned_docs/version-v8.5.x/01-ibc/09-proto-docs.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/09-proto-docs.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/09-proto-docs.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/10-roadmap.md b/docs/versioned_docs/version-v8.5.x/01-ibc/10-roadmap.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/10-roadmap.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/10-roadmap.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/11-troubleshooting.md b/docs/versioned_docs/version-v8.5.x/01-ibc/11-troubleshooting.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/11-troubleshooting.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/11-troubleshooting.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/12-capability-module.md b/docs/versioned_docs/version-v8.5.x/01-ibc/12-capability-module.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/12-capability-module.md rename to docs/versioned_docs/version-v8.5.x/01-ibc/12-capability-module.md diff --git a/docs/versioned_docs/version-v8.4.x/01-ibc/_category_.json b/docs/versioned_docs/version-v8.5.x/01-ibc/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/01-ibc/_category_.json rename to docs/versioned_docs/version-v8.5.x/01-ibc/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/01-overview.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/01-overview.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/02-state.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/02-state.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/02-state.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/02-state.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/03-state-transitions.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/03-state-transitions.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/03-state-transitions.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/03-state-transitions.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/04-messages.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/04-messages.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/04-messages.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/04-messages.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/05-events.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/05-events.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/05-events.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/05-events.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/06-metrics.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/06-metrics.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/06-metrics.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/06-metrics.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/07-params.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/07-params.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/07-params.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/07-params.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/08-authorizations.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/08-authorizations.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/08-authorizations.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/08-authorizations.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/09-client.md b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/09-client.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/09-client.md rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/09-client.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/_category_.json b/docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/01-transfer/_category_.json rename to docs/versioned_docs/version-v8.5.x/02-apps/01-transfer/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/01-overview.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/01-overview.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/02-development.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/02-development.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/02-development.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/02-development.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/03-auth-modules.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/03-auth-modules.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/03-auth-modules.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/03-auth-modules.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/04-integration.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/04-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/04-integration.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/04-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/05-messages.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/05-messages.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/05-messages.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/05-messages.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/06-parameters.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/06-parameters.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/06-parameters.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/06-parameters.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/07-tx-encoding.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/07-tx-encoding.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/07-tx-encoding.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/07-tx-encoding.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/08-client.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/08-client.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/08-client.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/08-client.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/09-active-channels.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/09-active-channels.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/09-active-channels.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/09-active-channels.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/01-auth-modules.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/02-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/03-keeper-api.md diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/_category_.json b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/_category_.json rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/10-legacy/images/ica-pre-v6.png diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/_category_.json b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/_category_.json rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/images/ica-v6.png b/docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/images/ica-v6.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/02-interchain-accounts/images/ica-v6.png rename to docs/versioned_docs/version-v8.5.x/02-apps/02-interchain-accounts/images/ica-v6.png diff --git a/docs/versioned_docs/version-v8.4.x/02-apps/_category_.json b/docs/versioned_docs/version-v8.5.x/02-apps/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/02-apps/_category_.json rename to docs/versioned_docs/version-v8.5.x/02-apps/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/01-overview.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/01-overview.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/02-client-state.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/02-client-state.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/02-client-state.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/02-client-state.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/03-consensus-state.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/03-consensus-state.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/03-consensus-state.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/03-consensus-state.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/04-updates-and-misbehaviour.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/05-upgrades.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/05-upgrades.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/05-upgrades.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/05-upgrades.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/06-proofs.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/06-proofs.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/06-proofs.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/06-proofs.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/07-proposals.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/07-proposals.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/07-proposals.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/07-proposals.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/08-genesis.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/08-genesis.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/08-genesis.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/08-genesis.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/09-setup.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/09-setup.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/09-setup.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/09-setup.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/_category_.json b/docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/01-developer-guide/_category_.json rename to docs/versioned_docs/version-v8.5.x/03-light-clients/01-developer-guide/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/01-overview.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/01-overview.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/02-integration.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/02-integration.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/02-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/03-client-state.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/03-client-state.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/03-client-state.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/03-client-state.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/04-connection.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/04-connection.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/04-connection.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/04-connection.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/05-state-verification.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/05-state-verification.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/05-state-verification.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/05-state-verification.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/_category_.json b/docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/02-localhost/_category_.json rename to docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/01-solomachine.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/01-solomachine.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/01-solomachine.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/01-solomachine.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/02-concepts.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/02-concepts.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/02-concepts.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/02-concepts.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/03-state.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/03-state.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/03-state.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/03-state.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/04-state_transitions.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/04-state_transitions.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/04-state_transitions.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/04-state_transitions.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/_category_.json b/docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/03-solomachine/_category_.json rename to docs/versioned_docs/version-v8.5.x/03-light-clients/03-solomachine/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/01-overview.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/01-overview.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/02-concepts.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/02-concepts.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/02-concepts.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/02-concepts.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/03-integration.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/03-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/03-integration.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/03-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/04-messages.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/04-messages.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/04-messages.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/04-messages.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/05-governance.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/05-governance.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/05-governance.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/05-governance.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/06-events.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/06-events.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/06-events.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/06-events.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/07-contracts.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/07-contracts.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/07-contracts.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/07-contracts.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/08-client.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/08-client.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/08-client.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/08-client.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/09-migrations.md b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/09-migrations.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/09-migrations.md rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/09-migrations.md diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/_category_.json b/docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/04-wasm/_category_.json rename to docs/versioned_docs/version-v8.5.x/03-light-clients/04-wasm/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/03-light-clients/_category_.json b/docs/versioned_docs/version-v8.5.x/03-light-clients/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/03-light-clients/_category_.json rename to docs/versioned_docs/version-v8.5.x/03-light-clients/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/01-overview.md b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/01-overview.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/02-integration.md b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/02-integration.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/02-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/03-msgs.md b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/03-msgs.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/03-msgs.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/03-msgs.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/04-fee-distribution.md b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/04-fee-distribution.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/04-fee-distribution.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/04-fee-distribution.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/05-events.md b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/05-events.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/05-events.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/05-events.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/06-end-users.md b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/06-end-users.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/06-end-users.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/06-end-users.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/_category_.json b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/_category_.json rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/images/feeflow.png b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/images/feeflow.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/images/feeflow.png rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/images/feeflow.png diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/images/msgpaypacket.png b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/images/msgpaypacket.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/images/msgpaypacket.png rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/images/msgpaypacket.png diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png b/docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png rename to docs/versioned_docs/version-v8.5.x/04-middleware/01-ics29-fee/images/paypacketfeeasync.png diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/01-overview.md b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/01-overview.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/01-overview.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/01-overview.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/02-integration.md b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/02-integration.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/02-integration.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/02-integration.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/03-interfaces.md b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/03-interfaces.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/03-interfaces.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/03-interfaces.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/04-events.md b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/04-events.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/04-events.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/04-events.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/05-end-users.md b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/05-end-users.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/05-end-users.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/05-end-users.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/06-gas.md b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/06-gas.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/06-gas.md rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/06-gas.md diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/_category_.json b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/_category_.json rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/images/callbackflow.svg b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/images/callbackflow.svg similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/images/callbackflow.svg rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/images/callbackflow.svg diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg b/docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg rename to docs/versioned_docs/version-v8.5.x/04-middleware/02-callbacks/images/ics4-callbackflow.svg diff --git a/docs/versioned_docs/version-v8.4.x/04-middleware/_category_.json b/docs/versioned_docs/version-v8.5.x/04-middleware/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/04-middleware/_category_.json rename to docs/versioned_docs/version-v8.5.x/04-middleware/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/01-support-denoms-with-slashes.md b/docs/versioned_docs/version-v8.5.x/05-migrations/01-support-denoms-with-slashes.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/01-support-denoms-with-slashes.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/01-support-denoms-with-slashes.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/02-sdk-to-v1.md b/docs/versioned_docs/version-v8.5.x/05-migrations/02-sdk-to-v1.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/02-sdk-to-v1.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/02-sdk-to-v1.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/03-v1-to-v2.md b/docs/versioned_docs/version-v8.5.x/05-migrations/03-v1-to-v2.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/03-v1-to-v2.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/03-v1-to-v2.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/04-v2-to-v3.md b/docs/versioned_docs/version-v8.5.x/05-migrations/04-v2-to-v3.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/04-v2-to-v3.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/04-v2-to-v3.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/05-v3-to-v4.md b/docs/versioned_docs/version-v8.5.x/05-migrations/05-v3-to-v4.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/05-v3-to-v4.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/05-v3-to-v4.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/06-v4-to-v5.md b/docs/versioned_docs/version-v8.5.x/05-migrations/06-v4-to-v5.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/06-v4-to-v5.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/06-v4-to-v5.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/07-v5-to-v6.md b/docs/versioned_docs/version-v8.5.x/05-migrations/07-v5-to-v6.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/07-v5-to-v6.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/07-v5-to-v6.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/08-v6-to-v7.md b/docs/versioned_docs/version-v8.5.x/05-migrations/08-v6-to-v7.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/08-v6-to-v7.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/08-v6-to-v7.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/09-v7-to-v7_1.md b/docs/versioned_docs/version-v8.5.x/05-migrations/09-v7-to-v7_1.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/09-v7-to-v7_1.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/09-v7-to-v7_1.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/10-v7_2-to-v7_3.md b/docs/versioned_docs/version-v8.5.x/05-migrations/10-v7_2-to-v7_3.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/10-v7_2-to-v7_3.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/10-v7_2-to-v7_3.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/11-v7-to-v8.md b/docs/versioned_docs/version-v8.5.x/05-migrations/11-v7-to-v8.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/11-v7-to-v8.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/11-v7-to-v8.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/12-v8-to-v8_1.md b/docs/versioned_docs/version-v8.5.x/05-migrations/12-v8-to-v8_1.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/12-v8-to-v8_1.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/12-v8-to-v8_1.md diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/_category_.json b/docs/versioned_docs/version-v8.5.x/05-migrations/_category_.json similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/_category_.json rename to docs/versioned_docs/version-v8.5.x/05-migrations/_category_.json diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/images/auth-module-decision-tree.png b/docs/versioned_docs/version-v8.5.x/05-migrations/images/auth-module-decision-tree.png similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/images/auth-module-decision-tree.png rename to docs/versioned_docs/version-v8.5.x/05-migrations/images/auth-module-decision-tree.png diff --git a/docs/versioned_docs/version-v8.4.x/05-migrations/migration.template.md b/docs/versioned_docs/version-v8.5.x/05-migrations/migration.template.md similarity index 100% rename from docs/versioned_docs/version-v8.4.x/05-migrations/migration.template.md rename to docs/versioned_docs/version-v8.5.x/05-migrations/migration.template.md diff --git a/docs/versioned_docs/version-v8.4.x/images/ibcoverview-dark.svg b/docs/versioned_docs/version-v8.5.x/images/ibcoverview-dark.svg similarity index 100% rename from docs/versioned_docs/version-v8.4.x/images/ibcoverview-dark.svg rename to docs/versioned_docs/version-v8.5.x/images/ibcoverview-dark.svg diff --git a/docs/versioned_docs/version-v8.4.x/images/ibcoverview-light.svg b/docs/versioned_docs/version-v8.5.x/images/ibcoverview-light.svg similarity index 100% rename from docs/versioned_docs/version-v8.4.x/images/ibcoverview-light.svg rename to docs/versioned_docs/version-v8.5.x/images/ibcoverview-light.svg diff --git a/docs/versioned_sidebars/version-v7.7.x-sidebars.json b/docs/versioned_sidebars/version-v7.8.x-sidebars.json similarity index 100% rename from docs/versioned_sidebars/version-v7.7.x-sidebars.json rename to docs/versioned_sidebars/version-v7.8.x-sidebars.json diff --git a/docs/versioned_sidebars/version-v8.4.x-sidebars.json b/docs/versioned_sidebars/version-v8.5.x-sidebars.json similarity index 100% rename from docs/versioned_sidebars/version-v8.4.x-sidebars.json rename to docs/versioned_sidebars/version-v8.5.x-sidebars.json diff --git a/docs/versions.json b/docs/versions.json index 2e64a75dccc..f97e11f9860 100644 --- a/docs/versions.json +++ b/docs/versions.json @@ -1,6 +1,6 @@ [ - "v8.4.x", - "v7.7.x", + "v8.5.x", + "v7.8.x", "v6.3.x", "v5.4.x", "v4.6.x" diff --git a/e2e/go.mod b/e2e/go.mod index 63ce73e7f7f..c67527f1bbc 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -14,8 +14,8 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 cosmossdk.io/x/upgrade v0.1.4 - github.com/cometbft/cometbft v0.38.11 - github.com/cosmos/cosmos-sdk v0.50.9 + github.com/cometbft/cometbft v0.38.12 + github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.0.0-00010101000000-000000000000 github.com/cosmos/ibc-go/v9 v9.0.0 @@ -24,9 +24,8 @@ require ( github.com/strangelove-ventures/interchaintest/v8 v8.2.1-0.20240419152858-c8b741617cd8 github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 - golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 - golang.org/x/mod v0.20.0 - google.golang.org/grpc v1.65.0 + golang.org/x/mod v0.21.0 + google.golang.org/grpc v1.66.2 gopkg.in/yaml.v2 v2.4.0 ) @@ -38,18 +37,18 @@ require ( cloud.google.com/go/iam v1.1.9 // indirect cloud.google.com/go/storage v1.41.0 // indirect cosmossdk.io/api v0.7.5 // indirect - cosmossdk.io/client/v2 v2.0.0-beta.3 // indirect + cosmossdk.io/client/v2 v2.0.0-beta.4 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.11.1 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/log v1.4.1 // indirect - cosmossdk.io/store v1.1.0 // indirect + cosmossdk.io/store v1.1.1 // indirect cosmossdk.io/x/feegrant v0.1.1 // indirect cosmossdk.io/x/tx v0.13.4 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect - github.com/BurntSushi/toml v1.3.2 // indirect + github.com/BurntSushi/toml v1.4.0 // indirect github.com/ChainSafe/go-schnorrkel v1.1.0 // indirect github.com/ChainSafe/go-schnorrkel/1 v0.0.0-00010101000000-000000000000 // indirect github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420 // indirect @@ -66,7 +65,8 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.12.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect @@ -85,7 +85,7 @@ require ( github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -145,6 +145,7 @@ require ( github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect @@ -192,6 +193,8 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.27.10 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect @@ -199,14 +202,14 @@ require ( github.com/pierrec/xxHash v0.1.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect + github.com/rs/cors v1.11.1 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -237,6 +240,7 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.27.0 // indirect + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -248,7 +252,7 @@ require ( google.golang.org/api v0.186.0 // indirect google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect diff --git a/e2e/go.sum b/e2e/go.sum index 29683521456..59f05a6f07e 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -188,8 +188,8 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= -cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= -cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= +cosmossdk.io/client/v2 v2.0.0-beta.4 h1:LGIzWbVTOof/IHQZeoWwxPX0fq607ONXhsfA7eUrQIg= +cosmossdk.io/client/v2 v2.0.0-beta.4/go.mod h1:c753d0sBv3AQRx6X+BOKL1aGpKjZMTZAHGiLPbVi5TE= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= @@ -202,8 +202,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= cosmossdk.io/x/circuit v0.1.1/go.mod h1:B6f/urRuQH8gjt4eLIXfZJucrbreuYrKh5CSjaOxr+Q= cosmossdk.io/x/evidence v0.1.1 h1:Ks+BLTa3uftFpElLTDp9L76t2b58htjVbSZ86aoK/E4= @@ -224,8 +224,8 @@ github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTB github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= @@ -297,12 +297,12 @@ github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE5 github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA= github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -361,8 +361,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= -github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= +github.com/cometbft/cometbft v0.38.12 h1:OWsLZN2KcSSFe8bet9xCn07VwhBnavPea3VyPnNq1bg= +github.com/cometbft/cometbft v0.38.12/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -377,8 +377,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= -github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef h1:us0dw4egT2k00jnK4JgQ2Su6yJlBnwCfgWnKC7MIwqk= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef/go.mod h1:9l85MGxnejiuiY4gum/RzdRKfkmLZDJh5uOD3m1zxy0= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -391,8 +391,8 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -518,6 +518,7 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -704,8 +705,8 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -790,6 +791,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= @@ -886,6 +889,7 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= @@ -899,13 +903,13 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -958,8 +962,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -998,8 +1002,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -1204,8 +1208,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1362,6 +1366,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1481,6 +1486,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= @@ -1672,8 +1678,8 @@ google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGr google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1715,8 +1721,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/e2e/sample.config.extended.yaml b/e2e/sample.config.extended.yaml index bda285a78d3..034dc396c43 100644 --- a/e2e/sample.config.extended.yaml +++ b/e2e/sample.config.extended.yaml @@ -13,7 +13,7 @@ # | RELAYER_ID | The type of relayer to use (rly/hermes) | hermes | -# see sample.config.yaml for a bare minium configuration example. +# see sample.config.yaml for a bare minimum configuration example. # set env E2E_CONFIG_PATH to point to this file to use it. --- chains: diff --git a/e2e/tests/transfer/base_test.go b/e2e/tests/transfer/base_test.go index 36d77991b6c..09f20ba1b90 100644 --- a/e2e/tests/transfer/base_test.go +++ b/e2e/tests/transfer/base_test.go @@ -78,13 +78,6 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() { chainBAddress := chainBWallet.FormattedAddress() s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA, chainB), "failed to wait for blocks") - // TODO: https://github.com/cosmos/ibc-go/issues/6743 - // t.Run("ensure capability module BeginBlock is executed", func(t *testing.T) { - // // by restarting the chain we ensure that the capability module's BeginBlocker is executed. - // s.Require().NoError(chainA.(*cosmos.CosmosChain).StopAllNodes(ctx)) - // s.Require().NoError(chainA.(*cosmos.CosmosChain).StartAllNodes(ctx)) - // s.Require().NoError(test.WaitForBlocks(ctx, 5, chainA), "failed to wait for blocks") - // }) t.Run("native IBC token transfer from chainA to chainB, sender is source of tokens", func(t *testing.T) { transferTxResp := s.Transfer(ctx, chainA, chainAWallet, channelA.PortID, channelA.ChannelID, testvalues.DefaultTransferCoins(chainADenom), chainAAddress, chainBAddress, s.GetTimeoutHeight(ctx, chainB), 0, "", nil) diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 4237afacbec..cb8ab6ed9c1 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "path" + "slices" "strings" "sync" @@ -17,7 +18,6 @@ import ( test "github.com/strangelove-ventures/interchaintest/v8/testutil" testifysuite "github.com/stretchr/testify/suite" "go.uber.org/zap" - "golang.org/x/exp/slices" sdkmath "cosmossdk.io/math" diff --git a/go.mod b/go.mod index ef5351de673..7737ee796b0 100644 --- a/go.mod +++ b/go.mod @@ -11,16 +11,16 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/store v1.1.0 + cosmossdk.io/store v1.1.1 cosmossdk.io/x/tx v0.13.4 cosmossdk.io/x/upgrade v0.1.4 - github.com/cometbft/cometbft v0.38.11 + github.com/cometbft/cometbft v0.38.12 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.50.9 + github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-go/modules/capability v1.0.1 - github.com/cosmos/ics23/go v0.10.0 + github.com/cosmos/ics23/go v0.11.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-metrics v0.5.3 @@ -28,7 +28,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.2 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v2 v2.4.0 ) @@ -53,7 +53,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect @@ -147,13 +147,13 @@ require ( github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect + github.com/rs/cors v1.11.1 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -178,7 +178,7 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.27.0 // indirect - golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -188,7 +188,7 @@ require ( golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.186.0 // indirect google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/go.sum b/go.sum index c307af1d3c1..5edbbed702e 100644 --- a/go.sum +++ b/go.sum @@ -202,8 +202,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= cosmossdk.io/x/tx v0.13.4 h1:Eg0PbJgeO0gM8p5wx6xa0fKR7hIV6+8lC56UrsvSo0Y= cosmossdk.io/x/tx v0.13.4/go.mod h1:BkFqrnGGgW50Y6cwTy+JvgAhiffbGEKW6KF9ufcDpvk= cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= @@ -267,10 +267,10 @@ github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE5 github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -327,8 +327,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= -github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= +github.com/cometbft/cometbft v0.38.12 h1:OWsLZN2KcSSFe8bet9xCn07VwhBnavPea3VyPnNq1bg= +github.com/cometbft/cometbft v0.38.12/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -343,8 +343,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= -github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef h1:us0dw4egT2k00jnK4JgQ2Su6yJlBnwCfgWnKC7MIwqk= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef/go.mod h1:9l85MGxnejiuiY4gum/RzdRKfkmLZDJh5uOD3m1zxy0= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -356,8 +356,8 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -724,6 +724,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= @@ -857,8 +859,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -893,8 +895,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -1050,8 +1052,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1542,8 +1544,8 @@ google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGr google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1585,8 +1587,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/go.work.example b/go.work.example index 49f317e5c64..c9297b1ace8 100644 --- a/go.work.example +++ b/go.work.example @@ -1,10 +1,9 @@ go 1.22.0 -toolchain go1.22.0 +toolchain go1.22.3 use ( ./ - ./modules/capability ./modules/apps/callbacks ./modules/light-clients/08-wasm ./e2e diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index b3d9f7b5175..44c4fc6bf22 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -43,8 +43,7 @@ func newRegisterInterchainAccountCmd() *cobra.Command { connection id from the source chain. Connection identifier should be for the source chain and the interchain account will be created on the counterparty chain. Callers are expected to provide the appropriate application version string via {version} flag and the desired ordering -via the {ordering} flag. Generates a new port identifier using the provided owner string, binds to the port identifier and claims -the associated capability.`), +via the {ordering} flag. Generates a new port identifier using the provided owner string.`), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go index db7db8bc4e8..e90ebbb723e 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go @@ -1,20 +1,19 @@ package controller import ( + "context" "errors" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -57,12 +56,11 @@ func NewIBCMiddlewareWithAuth(app porttypes.IBCModule, k keeper.Keeper) IBCMiddl // version. They will be allowed to perform custom logic without changing // the parameters stored within a channel struct. func (im IBCMiddleware) OnChanOpenInit( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) { @@ -70,20 +68,16 @@ func (im IBCMiddleware) OnChanOpenInit( return "", types.ErrControllerSubModuleDisabled } - version, err := im.keeper.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version) + version, err := im.keeper.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version) if err != nil { return "", err } - if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } - // call underlying app's OnChanOpenInit callback with the passed in version // the version returned is discarded as the ica-auth module does not have permission to edit the version string. // ics27 will always return the version string containing the Metadata struct which is created during the `RegisterInterchainAccount` call. if im.app != nil && im.keeper.IsMiddlewareEnabled(ctx, portID, connectionHops[0]) { - if _, err := im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, nil, counterparty, version); err != nil { + if _, err := im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version); err != nil { return "", err } } @@ -93,12 +87,11 @@ func (im IBCMiddleware) OnChanOpenInit( // OnChanOpenTry implements the IBCMiddleware interface func (IBCMiddleware) OnChanOpenTry( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { @@ -112,7 +105,7 @@ func (IBCMiddleware) OnChanOpenTry( // version. They will be allowed to perform custom logic without changing // the parameters stored within a channel struct. func (im IBCMiddleware) OnChanOpenAck( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyChannelID string, @@ -141,7 +134,7 @@ func (im IBCMiddleware) OnChanOpenAck( // OnChanOpenConfirm implements the IBCMiddleware interface func (IBCMiddleware) OnChanOpenConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -150,7 +143,7 @@ func (IBCMiddleware) OnChanOpenConfirm( // OnChanCloseInit implements the IBCMiddleware interface func (IBCMiddleware) OnChanCloseInit( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -160,7 +153,7 @@ func (IBCMiddleware) OnChanCloseInit( // OnChanCloseConfirm implements the IBCMiddleware interface func (im IBCMiddleware) OnChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -182,7 +175,7 @@ func (im IBCMiddleware) OnChanCloseConfirm( // OnRecvPacket implements the IBCMiddleware interface func (IBCMiddleware) OnRecvPacket( - ctx sdk.Context, + ctx context.Context, _ string, packet channeltypes.Packet, _ sdk.AccAddress, @@ -195,7 +188,7 @@ func (IBCMiddleware) OnRecvPacket( // OnAcknowledgementPacket implements the IBCMiddleware interface func (im IBCMiddleware) OnAcknowledgementPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, @@ -220,7 +213,7 @@ func (im IBCMiddleware) OnAcknowledgementPacket( // OnTimeoutPacket implements the IBCMiddleware interface func (im IBCMiddleware) OnTimeoutPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -246,7 +239,7 @@ func (im IBCMiddleware) OnTimeoutPacket( } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { +func (im IBCMiddleware) OnChanUpgradeInit(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { if !im.keeper.GetParams(ctx).ControllerEnabled { return "", types.ErrControllerSubModuleDisabled } @@ -274,12 +267,12 @@ func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, portID, channelID str } // OnChanUpgradeTry implements the IBCModule interface -func (IBCMiddleware) OnChanUpgradeTry(_ sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { +func (IBCMiddleware) OnChanUpgradeTry(_ context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { return "", errorsmod.Wrap(icatypes.ErrInvalidChannelFlow, "channel upgrade handshake must be initiated by controller chain") } // OnChanUpgradeAck implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { +func (im IBCMiddleware) OnChanUpgradeAck(ctx context.Context, portID, channelID, counterpartyVersion string) error { if !im.keeper.GetParams(ctx).ControllerEnabled { return types.ErrControllerSubModuleDisabled } @@ -306,7 +299,7 @@ func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, cou } // OnChanUpgradeOpen implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { +func (im IBCMiddleware) OnChanUpgradeOpen(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { connectionID, err := im.keeper.GetConnectionID(ctx, portID, channelID) if err != nil { panic(err) @@ -324,8 +317,7 @@ func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID str // SendPacket implements the ICS4 Wrapper interface func (IBCMiddleware) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, @@ -337,8 +329,7 @@ func (IBCMiddleware) SendPacket( // WriteAcknowledgement implements the ICS4 Wrapper interface func (IBCMiddleware) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet ibcexported.PacketI, ack ibcexported.Acknowledgement, ) error { @@ -346,14 +337,14 @@ func (IBCMiddleware) WriteAcknowledgement( } // GetAppVersion returns the interchain accounts metadata. -func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (im IBCMiddleware) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { return im.keeper.GetAppVersion(ctx, portID, channelID) } // UnmarshalPacketData attempts to unmarshal the provided packet data bytes // into an InterchainAccountPacketData. This function implements the optional // PacketDataUnmarshaler interface required for ADR 008 support. -func (im IBCMiddleware) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { +func (im IBCMiddleware) UnmarshalPacketData(ctx context.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { var data icatypes.InterchainAccountPacketData err := data.UnmarshalJSON(bz) if err != nil { diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index b169e10f284..e8e8a6012fa 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -1,6 +1,7 @@ package controller_test import ( + "context" "fmt" "strconv" "testing" @@ -11,7 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" controllerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" @@ -127,26 +127,12 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { { "success", func() {}, nil, }, - { - "ICA auth module does not claim channel capability", func() { - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, - portID, channelID string, chanCap *capabilitytypes.Capability, - counterparty channeltypes.Counterparty, version string, - ) (string, error) { - if chanCap != nil { - return "", fmt.Errorf("channel capability should be nil") - } - - return version, nil - } - }, nil, - }, { "ICA auth module modification of channel version is ignored", func() { // NOTE: explicitly modify the channel version via the auth module callback, // ensuring the expected JSON encoded metadata is not modified upon return - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, - portID, channelID string, chanCap *capabilitytypes.Capability, + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx context.Context, order channeltypes.Order, connectionHops []string, + portID, channelID string, counterparty channeltypes.Counterparty, version string, ) (string, error) { return "invalid-version", nil @@ -160,8 +146,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { }, { "ICA auth module callback fails", func() { - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, - portID, channelID string, chanCap *capabilitytypes.Capability, + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx context.Context, order channeltypes.Order, connectionHops []string, + portID, channelID string, counterparty channeltypes.Counterparty, version string, ) (string, error) { return "", fmt.Errorf("mock ica auth fails") @@ -177,8 +163,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { "middleware disabled", func() { suite.chainA.GetSimApp().ICAControllerKeeper.DeleteMiddlewareEnabled(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ConnectionID) - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, - portID, channelID string, chanCap *capabilitytypes.Capability, + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenInit = func(ctx context.Context, order channeltypes.Order, connectionHops []string, + portID, channelID string, counterparty channeltypes.Counterparty, version string, ) (string, error) { return "", fmt.Errorf("error should be unreachable") @@ -202,9 +188,6 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { portID, err := icatypes.NewControllerPortID(TestOwnerAddress) suite.Require().NoError(err) - portCap := suite.chainA.GetSimApp().IBCKeeper.PortKeeper.BindPort(suite.chainA.GetContext(), portID) - suite.chainA.GetSimApp().ICAControllerKeeper.ClaimCapability(suite.chainA.GetContext(), portCap, host.PortPath(portID)) //nolint:errcheck // checking this error isn't needed for the test - path.EndpointA.ChannelConfig.PortID = portID path.EndpointA.ChannelID = ibctesting.FirstChannelID @@ -225,13 +208,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { // ensure channel on chainA is set in state suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, *channel) - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - chanCap, err := suite.chainA.App.GetScopedIBCKeeper().NewCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) if isNilApp { @@ -239,7 +216,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() { } version, err := cbs.OnChanOpenInit(suite.chainA.GetContext(), channel.Ordering, channel.ConnectionHops, - path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, chanCap, channel.Counterparty, channel.Version, + path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel.Counterparty, channel.Version, ) if tc.expErr == nil { @@ -285,20 +262,14 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenTry() { suite.Require().Error(err) - // call application callback directly - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) counterparty := channeltypes.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - chanCap, found := suite.chainA.App.GetScopedIBCKeeper().GetCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)) - suite.Require().True(found) version, err := cbs.OnChanOpenTry( suite.chainA.GetContext(), path.EndpointA.ChannelConfig.Order, []string{path.EndpointA.ConnectionID}, - path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, chanCap, + path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, counterparty, path.EndpointB.ChannelConfig.Version, ) suite.Require().Error(err) @@ -333,7 +304,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() { { "ICA auth module callback fails", func() { suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenAck = func( - ctx sdk.Context, portID, channelID string, counterpartyChannelID string, counterpartyVersion string, + ctx context.Context, portID, channelID string, counterpartyChannelID string, counterpartyVersion string, ) error { return fmt.Errorf("mock ica auth fails") } @@ -349,7 +320,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() { suite.chainA.GetSimApp().ICAControllerKeeper.DeleteMiddlewareEnabled(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ConnectionID) suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenAck = func( - ctx sdk.Context, portID, channelID string, counterpartyChannelID string, counterpartyVersion string, + ctx context.Context, portID, channelID string, counterpartyChannelID string, counterpartyVersion string, ) error { return fmt.Errorf("error should be unreachable") } @@ -376,10 +347,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) err = cbs.OnChanOpenAck(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelID, path.EndpointB.ChannelConfig.Version) @@ -436,11 +404,7 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenConfirm() { suite.Require().Error(err) - // call application callback directly - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) err = cbs.OnChanOpenConfirm( @@ -461,10 +425,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseInit() { err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) err = cbs.OnChanCloseInit( @@ -511,10 +472,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() { suite.Require().NoError(err) tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) if isNilApp { @@ -560,10 +519,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) packet := channeltypes.NewPacket( @@ -622,7 +578,7 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() { { "ICA auth module callback fails", func() { suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnAcknowledgementPacket = func( - ctx sdk.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress, ) error { return fmt.Errorf("mock ica auth fails") } @@ -638,7 +594,7 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() { suite.chainA.GetSimApp().ICAControllerKeeper.DeleteMiddlewareEnabled(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ConnectionID) suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnAcknowledgementPacket = func( - ctx sdk.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress, ) error { return fmt.Errorf("error should be unreachable") } @@ -673,10 +629,7 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) if isNilApp { @@ -719,7 +672,7 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { { "ICA auth module callback fails", func() { suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnTimeoutPacket = func( - ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) error { return fmt.Errorf("mock ica auth fails") } @@ -735,7 +688,7 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { suite.chainA.GetSimApp().ICAControllerKeeper.DeleteMiddlewareEnabled(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ConnectionID) suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnTimeoutPacket = func( - ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) error { return fmt.Errorf("error should be unreachable") } @@ -770,10 +723,7 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) if isNilApp { @@ -826,7 +776,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() { }, { "ICA auth module callback fails", func() { - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeInit = func(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeInit = func(ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { return "", ibcmock.MockApplicationCallbackError } }, ibcmock.MockApplicationCallbackError, @@ -834,7 +784,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() { { "middleware disabled", func() { suite.chainA.GetSimApp().ICAControllerKeeper.DeleteMiddlewareEnabled(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ConnectionID) - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeInit = func(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeInit = func(ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { return "", ibcmock.MockApplicationCallbackError } }, nil, @@ -859,10 +809,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) suite.Require().True(ok) @@ -902,10 +849,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeTry() { suite.Require().NoError(err) // call application callback directly - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) suite.Require().True(ok) @@ -954,7 +898,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() { }, { "ICA auth module callback fails", func() { - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeAck = func(ctx sdk.Context, portID, channelID string, counterpartyVersion string) error { + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeAck = func(ctx context.Context, portID, channelID string, counterpartyVersion string) error { return ibcmock.MockApplicationCallbackError } }, ibcmock.MockApplicationCallbackError, @@ -962,7 +906,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() { { "middleware disabled", func() { suite.chainA.GetSimApp().ICAControllerKeeper.DeleteMiddlewareEnabled(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ConnectionID) - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeAck = func(ctx sdk.Context, portID, channelID string, counterpartyVersion string) error { + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeAck = func(ctx context.Context, portID, channelID string, counterpartyVersion string) error { return ibcmock.MockApplicationCallbackError } }, nil, @@ -987,10 +931,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) suite.Require().True(ok) @@ -1039,7 +980,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeOpen() { { "middleware disabled", func() { suite.chainA.GetSimApp().ICAControllerKeeper.DeleteMiddlewareEnabled(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ConnectionID) - suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeAck = func(ctx sdk.Context, portID, channelID string, counterpartyVersion string) error { + suite.chainA.GetSimApp().ICAAuthModule.IBCApp.OnChanUpgradeAck = func(ctx context.Context, portID, channelID string, counterpartyVersion string) error { return ibcmock.MockApplicationCallbackError } }, @@ -1077,10 +1018,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeOpen() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) suite.Require().True(ok) @@ -1097,8 +1035,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeOpen() { } if tc.expPanic != nil { - mockModule := ibcmock.NewAppModule(suite.chainA.App.GetIBCKeeper().PortKeeper) - mockApp := ibcmock.NewIBCApp(path.EndpointA.ChannelConfig.PortID, suite.chainA.App.GetScopedIBCKeeper()) + mockModule := ibcmock.NewAppModule() + mockApp := ibcmock.NewIBCApp(path.EndpointA.ChannelConfig.PortID) cbs = controller.NewIBCMiddlewareWithAuth(ibcmock.NewBlockUpgradeMiddleware(&mockModule, mockApp), suite.chainA.GetSimApp().ICAControllerKeeper) suite.Require().PanicsWithError(tc.expPanic.Error(), func() { upgradeOpenCb(cbs) }) @@ -1195,10 +1133,7 @@ func (suite *InterchainAccountsTestSuite) TestGetAppVersion() { err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) controllerStack, ok := cbs.(porttypes.ICS4Wrapper) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account.go b/modules/apps/27-interchain-accounts/controller/keeper/account.go index 779826dbc94..ae41c756b4c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -9,12 +11,11 @@ import ( "github.com/cosmos/ibc-go/v9/internal/logging" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ) // RegisterInterchainAccount is the entry point to registering an interchain account: -// - It generates a new port identifier using the provided owner string, binds to the port identifier and claims the associated capability. +// - It generates a new port identifier using the provided owner string. // - Callers are expected to provide the appropriate application version string. // - For example, this could be an ICS27 encoded metadata type or an ICS29 encoded metadata type with a nested application version. // - A new MsgChannelOpenInit is routed through the MsgServiceRouter, executing the OnOpenChanInit callback stack as configured. @@ -29,7 +30,7 @@ import ( // Prior to v6.x.x of ibc-go, the controller module was only functional as middleware, with authentication performed // by the underlying application. For a full summary of the changes in v6.x.x, please see ADR009. // This API will be removed in later releases. -func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner, version string, ordering channeltypes.Order) error { +func (k Keeper) RegisterInterchainAccount(ctx context.Context, connectionID, owner, version string, ordering channeltypes.Order) error { portID, err := icatypes.NewControllerPortID(owner) if err != nil { return err @@ -56,27 +57,19 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner, // registerInterchainAccount registers an interchain account, returning the channel id of the MsgChannelOpenInitResponse // and an error if one occurred. -func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID, version string, ordering channeltypes.Order) (string, error) { +func (k Keeper) registerInterchainAccount(ctx context.Context, connectionID, portID, version string, ordering channeltypes.Order) (string, error) { // if there is an active channel for this portID / connectionID return an error activeChannelID, found := k.GetOpenActiveChannel(ctx, connectionID, portID) if found { return "", errorsmod.Wrapf(icatypes.ErrActiveChannelAlreadySet, "existing active channel %s for portID %s on connection %s", activeChannelID, portID, connectionID) } - switch { - case k.portKeeper.IsBound(ctx, portID) && !k.hasCapability(ctx, portID): - return "", errorsmod.Wrapf(icatypes.ErrPortAlreadyBound, "another module has claimed capability for and bound port with portID: %s", portID) - case !k.portKeeper.IsBound(ctx, portID): - k.setPort(ctx, portID) - capability := k.portKeeper.BindPort(ctx, portID) - if err := k.ClaimCapability(ctx, capability, host.PortPath(portID)); err != nil { - return "", errorsmod.Wrapf(err, "unable to bind to newly generated portID: %s", portID) - } - } + k.setPort(ctx, portID) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 msg := channeltypes.NewMsgChannelOpenInit(portID, version, ordering, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) handler := k.msgRouter.Handler(msg) - res, err := handler(ctx, msg) + res, err := handler(sdkCtx, msg) if err != nil { return "", err } @@ -85,7 +78,7 @@ func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID, k.Logger(ctx).Debug("emitting interchain account registration events", logging.SdkEventsToLogArguments(events)) // NOTE: The sdk msg handler creates a new EventManager, so events must be correctly propagated back to the current context - ctx.EventManager().EmitEvents(events) + sdkCtx.EventManager().EmitEvents(events) firstMsgResponse := res.MsgResponses[0] channelOpenInitResponse, ok := firstMsgResponse.GetCachedValue().(*channeltypes.MsgChannelOpenInitResponse) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go index 3366713daab..c6f507428ed 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go @@ -3,7 +3,6 @@ package keeper_test import ( icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -23,15 +22,6 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount() { { "success", func() {}, nil, }, - { - "port is already bound for owner but capability is claimed by another module", - func() { - capability := suite.chainA.GetSimApp().IBCKeeper.PortKeeper.BindPort(suite.chainA.GetContext(), TestPortID) - err := suite.chainA.GetSimApp().TransferKeeper.ClaimCapability(suite.chainA.GetContext(), capability, host.PortPath(TestPortID)) - suite.Require().NoError(err) - }, - icatypes.ErrPortAlreadyBound, - }, { "fails to generate port-id", func() { @@ -45,6 +35,9 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount() { portID, err := icatypes.NewControllerPortID(TestOwnerAddress) suite.Require().NoError(err) + channelID := channeltypes.FormatChannelIdentifier(suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetNextChannelSequence(suite.chainA.GetContext())) + path.EndpointA.ChannelID = channelID + suite.chainA.GetSimApp().ICAControllerKeeper.SetActiveChannelID(suite.chainA.GetContext(), ibctesting.FirstConnectionID, portID, path.EndpointA.ChannelID) counterparty := channeltypes.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/events.go b/modules/apps/27-interchain-accounts/controller/keeper/events.go index 5743253b530..468a1028a5c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/events.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/events.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "strconv" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,7 +13,8 @@ import ( // EmitAcknowledgementEvent emits an event signalling a successful or failed acknowledgement and including the error // details if any. -func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack exported.Acknowledgement, err error) { +func EmitAcknowledgementEvent(ctx context.Context, packet channeltypes.Packet, ack exported.Acknowledgement, err error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 attributes := []sdk.Attribute{ sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName), sdk.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()), @@ -23,7 +25,7 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack e attributes = append(attributes, sdk.NewAttribute(icatypes.AttributeKeyAckError, err.Error())) } - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( icatypes.EventTypePacket, attributes..., diff --git a/modules/apps/27-interchain-accounts/controller/keeper/export_test.go b/modules/apps/27-interchain-accounts/controller/keeper/export_test.go index 154d8d3aee6..c580aa61005 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/export_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/export_test.go @@ -5,12 +5,12 @@ package keeper */ import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" ) // GetAppMetadata is a wrapper around getAppMetadata to allow the function to be directly called in tests. -func (k Keeper) GetAppMetadata(ctx sdk.Context, portID, channelID string) (icatypes.Metadata, error) { +func (k Keeper) GetAppMetadata(ctx context.Context, portID, channelID string) (icatypes.Metadata, error) { return k.getAppMetadata(ctx, portID, channelID) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/genesis.go b/modules/apps/27-interchain-accounts/controller/keeper/genesis.go index acf5f0d33aa..81d9ade6672 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/genesis.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis.go @@ -1,29 +1,15 @@ package keeper import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" + "context" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) // InitGenesis initializes the interchain accounts controller application state from a provided genesis state -func InitGenesis(ctx sdk.Context, keeper Keeper, state genesistypes.ControllerGenesisState) { +func InitGenesis(ctx context.Context, keeper Keeper, state genesistypes.ControllerGenesisState) { for _, portID := range state.Ports { keeper.setPort(ctx, portID) - - // generate port capability if it does not already exist - if !keeper.hasCapability(ctx, portID) { - // use the port keeper to generate a new capability - capability := keeper.portKeeper.BindPort(ctx, portID) - - // use the controller scoped keeper to claim the port capability - if err := keeper.ClaimCapability(ctx, capability, host.PortPath(portID)); err != nil { - panic(fmt.Errorf("could not claim port capability: %v", err)) - } - } } for _, ch := range state.ActiveChannels { @@ -44,7 +30,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, state genesistypes.ControllerGe } // ExportGenesis returns the interchain accounts controller exported genesis -func ExportGenesis(ctx sdk.Context, keeper Keeper) genesistypes.ControllerGenesisState { +func ExportGenesis(ctx context.Context, keeper Keeper) genesistypes.ControllerGenesisState { return genesistypes.NewControllerGenesisState( keeper.GetAllActiveChannels(ctx), keeper.GetAllInterchainAccounts(ctx), diff --git a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go index 4a8e5d19bcb..70ec159d0b0 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go @@ -6,7 +6,6 @@ import ( genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -20,14 +19,6 @@ func (suite *KeeperTestSuite) TestInitGenesis() { { "success", func() {}, }, - { - "success: capabilities already initialized for first port", - func() { - capability := suite.chainA.GetSimApp().IBCKeeper.PortKeeper.BindPort(suite.chainA.GetContext(), ports[0]) - err := suite.chainA.GetSimApp().ICAControllerKeeper.ClaimCapability(suite.chainA.GetContext(), capability, host.PortPath(ports[0])) - suite.Require().NoError(err) - }, - }, } interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, TestPortID) @@ -86,10 +77,6 @@ func (suite *KeeperTestSuite) TestInitGenesis() { for _, port := range ports { store := suite.chainA.GetContext().KVStore(suite.chainA.GetSimApp().GetKey(types.StoreKey)) suite.Require().True(store.Has(icatypes.KeyPort(port))) - - capability, found := suite.chainA.GetSimApp().ScopedICAControllerKeeper.GetCapability(suite.chainA.GetContext(), host.PortPath(port)) - suite.Require().True(found) - suite.Require().NotNil(capability) } }) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index 609e6ae17b3..c7f6d77cf3d 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -1,14 +1,12 @@ package keeper import ( + "context" "fmt" "strings" errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -17,16 +15,13 @@ import ( // OnChanOpenInit performs basic validation of channel initialization. // The counterparty port identifier must be the host chain representation as defined in the types package, // the channel version must be equal to the version in the types package, -// there must not be an active channel for the specified port identifier, -// and the interchain accounts module must be able to claim the channel -// capability. +// there must not be an active channel for the specified port identifier. func (k Keeper) OnChanOpenInit( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) { @@ -91,7 +86,7 @@ func (k Keeper) OnChanOpenInit( // OnChanOpenAck sets the active channel for the interchain account/owner pair // and stores the associated interchain account address in state keyed by it's corresponding port identifier func (k Keeper) OnChanOpenAck( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyVersion string, @@ -133,7 +128,7 @@ func (k Keeper) OnChanOpenAck( // OnChanCloseConfirm removes the active channel stored in state func (Keeper) OnChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -154,7 +149,7 @@ func (Keeper) OnChanCloseConfirm( // - connectionHops (and subsequently host/controller connectionIDs) // - interchain account address // - ICS27 protocol version -func (k Keeper) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedversion string) (string, error) { +func (k Keeper) OnChanUpgradeInit(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedversion string) (string, error) { // verify connection hops has not changed connectionID, err := k.GetConnectionID(ctx, portID, channelID) if err != nil { @@ -217,7 +212,7 @@ func (k Keeper) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, pro // - host connectionID // - interchain account address // - ICS27 protocol version -func (k Keeper) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { +func (k Keeper) OnChanUpgradeAck(ctx context.Context, portID, channelID, counterpartyVersion string) error { if strings.TrimSpace(counterpartyVersion) == "" { return errorsmod.Wrap(channeltypes.ErrInvalidChannelVersion, "counterparty version cannot be empty") } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go index fe9b348f3c5..9ed3dd5a22f 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -1,11 +1,9 @@ package keeper_test import ( - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -19,7 +17,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { var ( channel *channeltypes.Channel path *ibctesting.Path - chanCap *capabilitytypes.Capability metadata icatypes.Metadata expectedVersion string ) @@ -274,8 +271,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { portID, err := icatypes.NewControllerPortID(TestOwnerAddress) suite.Require().NoError(err) - portCap := suite.chainA.GetSimApp().IBCKeeper.PortKeeper.BindPort(suite.chainA.GetContext(), portID) - suite.chainA.GetSimApp().ICAControllerKeeper.ClaimCapability(suite.chainA.GetContext(), portCap, host.PortPath(portID)) //nolint:errcheck // this error check isn't needed for tests path.EndpointA.ChannelConfig.PortID = portID // default values @@ -294,13 +289,13 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { Version: string(versionBytes), } - chanCap, err = suite.chainA.App.GetScopedIBCKeeper().NewCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)) - suite.Require().NoError(err) + channelID := channeltypes.FormatChannelIdentifier(suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetNextChannelSequence(suite.chainA.GetContext())) + path.EndpointA.ChannelID = channelID tc.malleate() // malleate mutates test data version, err := suite.chainA.GetSimApp().ICAControllerKeeper.OnChanOpenInit(suite.chainA.GetContext(), channel.Ordering, channel.ConnectionHops, - path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, chanCap, channel.Counterparty, channel.Version, + path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel.Counterparty, channel.Version, ) expPass := tc.expError == nil diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 09d751b00bb..c30ee44f0a2 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -2,38 +2,36 @@ package keeper import ( "bytes" + "context" "errors" "fmt" "strings" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // Keeper defines the IBC interchain accounts controller keeper type Keeper struct { - storeKey storetypes.StoreKey + storeService corestore.KVStoreService cdc codec.Codec legacySubspace icatypes.ParamSubspace ics4Wrapper porttypes.ICS4Wrapper channelKeeper icatypes.ChannelKeeper - portKeeper icatypes.PortKeeper - - scopedKeeper exported.ScopedKeeper msgRouter icatypes.MessageRouter @@ -44,22 +42,20 @@ type Keeper struct { // NewKeeper creates a new interchain accounts controller Keeper instance func NewKeeper( - cdc codec.Codec, key storetypes.StoreKey, legacySubspace icatypes.ParamSubspace, - ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper, - scopedKeeper exported.ScopedKeeper, msgRouter icatypes.MessageRouter, authority string, + cdc codec.Codec, storeService corestore.KVStoreService, legacySubspace icatypes.ParamSubspace, + ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, + msgRouter icatypes.MessageRouter, authority string, ) Keeper { if strings.TrimSpace(authority) == "" { panic(errors.New("authority must be non-empty")) } return Keeper{ - storeKey: key, + storeService: storeService, cdc: cdc, legacySubspace: legacySubspace, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, - scopedKeeper: scopedKeeper, msgRouter: msgRouter, authority: authority, } @@ -78,12 +74,13 @@ func (k Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper { } // Logger returns the application logger, scoped to the associated module -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) } // GetConnectionID returns the connection id for the given port and channelIDs. -func (k Keeper) GetConnectionID(ctx sdk.Context, portID, channelID string) (string, error) { +func (k Keeper) GetConnectionID(ctx context.Context, portID, channelID string) (string, error) { channel, found := k.channelKeeper.GetChannel(ctx, portID, channelID) if !found { return "", errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) @@ -92,10 +89,10 @@ func (k Keeper) GetConnectionID(ctx sdk.Context, portID, channelID string) (stri } // GetAllPorts returns all ports to which the interchain accounts controller module is bound. Used in ExportGenesis -func (k Keeper) GetAllPorts(ctx sdk.Context) []string { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllPorts(ctx context.Context) []string { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(icatypes.PortKeyPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var ports []string for ; iterator.Valid(); iterator.Next() { @@ -108,46 +105,36 @@ func (k Keeper) GetAllPorts(ctx sdk.Context) []string { } // setPort sets the provided portID in state -func (k Keeper) setPort(ctx sdk.Context, portID string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyPort(portID), []byte{0x01}) -} - -// hasCapability checks if the interchain account controller module owns the port capability for the desired port -func (k Keeper) hasCapability(ctx sdk.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok -} - -// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function -func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool { - return k.scopedKeeper.AuthenticateCapability(ctx, cap, name) -} - -// ClaimCapability wraps the scopedKeeper's ClaimCapability function -func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error { - return k.scopedKeeper.ClaimCapability(ctx, cap, name) +func (k Keeper) setPort(ctx context.Context, portID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyPort(portID), []byte{0x01}); err != nil { + panic(err) + } } // GetAppVersion calls the ICS4Wrapper GetAppVersion function. -func (k Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (k Keeper) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { return k.ics4Wrapper.GetAppVersion(ctx, portID, channelID) } // GetActiveChannelID retrieves the active channelID from the store, keyed by the provided connectionID and portID -func (k Keeper) GetActiveChannelID(ctx sdk.Context, connectionID, portID string) (string, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetActiveChannelID(ctx context.Context, connectionID, portID string) (string, bool) { + store := k.storeService.OpenKVStore(ctx) key := icatypes.KeyActiveChannel(portID, connectionID) - if !store.Has(key) { + bz, err := store.Get(key) + if err != nil { + panic(err) + } + if len(bz) == 0 { return "", false } - return string(store.Get(key)), true + return string(bz), true } // GetOpenActiveChannel retrieves the active channelID from the store, keyed by the provided connectionID and portID & checks if the channel in question is in state OPEN -func (k Keeper) GetOpenActiveChannel(ctx sdk.Context, connectionID, portID string) (string, bool) { +func (k Keeper) GetOpenActiveChannel(ctx context.Context, connectionID, portID string) (string, bool) { channelID, found := k.GetActiveChannelID(ctx, connectionID, portID) if !found { return "", false @@ -163,7 +150,7 @@ func (k Keeper) GetOpenActiveChannel(ctx sdk.Context, connectionID, portID strin } // IsActiveChannelClosed retrieves the active channel from the store and returns true if the channel state is CLOSED, otherwise false -func (k Keeper) IsActiveChannelClosed(ctx sdk.Context, connectionID, portID string) bool { +func (k Keeper) IsActiveChannelClosed(ctx context.Context, connectionID, portID string) bool { channelID, found := k.GetActiveChannelID(ctx, connectionID, portID) if !found { return false @@ -174,10 +161,10 @@ func (k Keeper) IsActiveChannelClosed(ctx sdk.Context, connectionID, portID stri } // GetAllActiveChannels returns a list of all active interchain accounts controller channels and their associated connection and port identifiers -func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []genesistypes.ActiveChannel { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllActiveChannels(ctx context.Context) []genesistypes.ActiveChannel { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(icatypes.ActiveChannelKeyPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var activeChannels []genesistypes.ActiveChannel for ; iterator.Valid(); iterator.Next() { @@ -201,32 +188,38 @@ func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []genesistypes.ActiveChann } // SetActiveChannelID stores the active channelID, keyed by the provided connectionID and portID -func (k Keeper) SetActiveChannelID(ctx sdk.Context, connectionID, portID, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyActiveChannel(portID, connectionID), []byte(channelID)) +func (k Keeper) SetActiveChannelID(ctx context.Context, connectionID, portID, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyActiveChannel(portID, connectionID), []byte(channelID)); err != nil { + panic(err) + } } // IsActiveChannel returns true if there exists an active channel for the provided connectionID and portID, otherwise false -func (k Keeper) IsActiveChannel(ctx sdk.Context, connectionID, portID string) bool { +func (k Keeper) IsActiveChannel(ctx context.Context, connectionID, portID string) bool { _, ok := k.GetActiveChannelID(ctx, connectionID, portID) return ok } // GetInterchainAccountAddress retrieves the InterchainAccount address from the store associated with the provided connectionID and portID -func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, connectionID, portID string) (string, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetInterchainAccountAddress(ctx context.Context, connectionID, portID string) (string, bool) { + store := k.storeService.OpenKVStore(ctx) key := icatypes.KeyOwnerAccount(portID, connectionID) - if !store.Has(key) { + bz, err := store.Get(key) + if err != nil { + panic(err) + } + if len(bz) == 0 { return "", false } - return string(store.Get(key)), true + return string(bz), true } // GetAllInterchainAccounts returns a list of all registered interchain account addresses and their associated connection and controller port identifiers -func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []genesistypes.RegisteredInterchainAccount { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllInterchainAccounts(ctx context.Context) []genesistypes.RegisteredInterchainAccount { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(icatypes.OwnerKeyPrefix)) var interchainAccounts []genesistypes.RegisteredInterchainAccount @@ -246,39 +239,55 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []genesistypes.Registe } // SetInterchainAccountAddress stores the InterchainAccount address, keyed by the associated connectionID and portID -func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, connectionID, portID, address string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyOwnerAccount(portID, connectionID), []byte(address)) +func (k Keeper) SetInterchainAccountAddress(ctx context.Context, connectionID, portID, address string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyOwnerAccount(portID, connectionID), []byte(address)); err != nil { + panic(err) + } } // IsMiddlewareEnabled returns true if the underlying application callbacks are enabled for given port and connection identifier pair, otherwise false -func (k Keeper) IsMiddlewareEnabled(ctx sdk.Context, portID, connectionID string) bool { - store := ctx.KVStore(k.storeKey) - return bytes.Equal(icatypes.MiddlewareEnabled, store.Get(icatypes.KeyIsMiddlewareEnabled(portID, connectionID))) +func (k Keeper) IsMiddlewareEnabled(ctx context.Context, portID, connectionID string) bool { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(icatypes.KeyIsMiddlewareEnabled(portID, connectionID)) + if err != nil { + panic(err) + } + return bytes.Equal(icatypes.MiddlewareEnabled, bz) } // IsMiddlewareDisabled returns true if the underlying application callbacks are disabled for the given port and connection identifier pair, otherwise false -func (k Keeper) IsMiddlewareDisabled(ctx sdk.Context, portID, connectionID string) bool { - store := ctx.KVStore(k.storeKey) - return bytes.Equal(icatypes.MiddlewareDisabled, store.Get(icatypes.KeyIsMiddlewareEnabled(portID, connectionID))) +func (k Keeper) IsMiddlewareDisabled(ctx context.Context, portID, connectionID string) bool { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(icatypes.KeyIsMiddlewareEnabled(portID, connectionID)) + if err != nil { + panic(err) + } + return bytes.Equal(icatypes.MiddlewareDisabled, bz) } // SetMiddlewareEnabled stores a flag to indicate that the underlying application callbacks should be enabled for the given port and connection identifier pair -func (k Keeper) SetMiddlewareEnabled(ctx sdk.Context, portID, connectionID string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyIsMiddlewareEnabled(portID, connectionID), icatypes.MiddlewareEnabled) +func (k Keeper) SetMiddlewareEnabled(ctx context.Context, portID, connectionID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyIsMiddlewareEnabled(portID, connectionID), icatypes.MiddlewareEnabled); err != nil { + panic(err) + } } // SetMiddlewareDisabled stores a flag to indicate that the underlying application callbacks should be disabled for the given port and connection identifier pair -func (k Keeper) SetMiddlewareDisabled(ctx sdk.Context, portID, connectionID string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyIsMiddlewareEnabled(portID, connectionID), icatypes.MiddlewareDisabled) +func (k Keeper) SetMiddlewareDisabled(ctx context.Context, portID, connectionID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyIsMiddlewareEnabled(portID, connectionID), icatypes.MiddlewareDisabled); err != nil { + panic(err) + } } // DeleteMiddlewareEnabled deletes the middleware enabled flag stored in state -func (k Keeper) DeleteMiddlewareEnabled(ctx sdk.Context, portID, connectionID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(icatypes.KeyIsMiddlewareEnabled(portID, connectionID)) +func (k Keeper) DeleteMiddlewareEnabled(ctx context.Context, portID, connectionID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Delete(icatypes.KeyIsMiddlewareEnabled(portID, connectionID)); err != nil { + panic(err) + } } // GetAuthority returns the ica/controller submodule's authority. @@ -287,7 +296,7 @@ func (k Keeper) GetAuthority() string { } // getAppMetadata retrieves the interchain accounts channel metadata from the store associated with the provided portID and channelID -func (k Keeper) getAppMetadata(ctx sdk.Context, portID, channelID string) (icatypes.Metadata, error) { +func (k Keeper) getAppMetadata(ctx context.Context, portID, channelID string) (icatypes.Metadata, error) { appVersion, found := k.GetAppVersion(ctx, portID, channelID) if !found { return icatypes.Metadata{}, errorsmod.Wrapf(ibcerrors.ErrNotFound, "app version not found for port %s and channel %s", portID, channelID) @@ -297,9 +306,12 @@ func (k Keeper) getAppMetadata(ctx sdk.Context, portID, channelID string) (icaty } // GetParams returns the current ica/controller submodule parameters. -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.ParamsKey)) +func (k Keeper) GetParams(ctx context.Context) types.Params { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.ParamsKey)) + if err != nil { + panic(err) + } if bz == nil { // only panic on unset params and not on empty params panic(errors.New("ica/controller params are not set in store")) } @@ -310,8 +322,10 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { } // SetParams sets the ica/controller submodule parameters. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) SetParams(ctx context.Context, params types.Params) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(¶ms) - store.Set([]byte(types.ParamsKey), bz) + if err := store.Set([]byte(types.ParamsKey), bz); err != nil { + panic(err) + } } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go index 701e0b7fd6e..520c6a4383c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go @@ -5,6 +5,7 @@ import ( testifysuite "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/runtime" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -117,12 +118,10 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"success", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().ScopedICAControllerKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) @@ -130,12 +129,10 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: empty authority", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().ScopedICAControllerKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), "", // authority ) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/migrations.go b/modules/apps/27-interchain-accounts/controller/keeper/migrations.go index ad69ceacc65..bd43a02c420 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" controllertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" @@ -19,11 +21,12 @@ func NewMigrator(k *Keeper) Migrator { } // MigrateParams migrates the controller submodule's parameters from the x/params to self store. -func (m Migrator) MigrateParams(ctx sdk.Context) error { +func (m Migrator) MigrateParams(ctx context.Context) error { if m.keeper != nil { params := controllertypes.DefaultParams() if m.keeper.legacySubspace != nil { - m.keeper.legacySubspace.GetParamSetIfExists(ctx, ¶ms) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + m.keeper.legacySubspace.GetParamSetIfExists(sdkCtx, ¶ms) } m.keeper.SetParams(ctx, params) m.keeper.Logger(ctx).Info("successfully migrated ica/controller submodule to self-manage params") diff --git a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go index f4d25b37ea7..0a9da175f92 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go @@ -3,6 +3,8 @@ package keeper_test import ( "fmt" + "github.com/cosmos/cosmos-sdk/runtime" + icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" icacontrollertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" ) @@ -27,12 +29,10 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { func() { suite.chainA.GetSimApp().ICAControllerKeeper = icacontrollerkeeper.NewKeeper( suite.chainA.Codec, - suite.chainA.GetSimApp().GetKey(icacontrollertypes.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(icacontrollertypes.StoreKey)), nil, // assign a nil legacy param subspace suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().ScopedICAControllerKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go index d81abf18c00..6164fc513cb 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go @@ -13,7 +13,6 @@ import ( icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -64,15 +63,6 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount_MsgServer() { }, icatypes.ErrInvalidAccountAddress, }, - { - "port is already bound for owner but capability is claimed by another module", - func() { - capability := suite.chainA.GetSimApp().IBCKeeper.PortKeeper.BindPort(suite.chainA.GetContext(), TestPortID) - err := suite.chainA.GetSimApp().TransferKeeper.ClaimCapability(suite.chainA.GetContext(), capability, host.PortPath(TestPortID)) - suite.Require().NoError(err) - }, - icatypes.ErrPortAlreadyBound, - }, } for _, ordering := range []channeltypes.Order{channeltypes.UNORDERED, channeltypes.ORDERED} { @@ -153,17 +143,6 @@ func (suite *KeeperTestSuite) TestSubmitTx() { }, icatypes.ErrActiveChannelNotFound, }, - { - "failure - controller module does not own capability for this channel", func() { - msg.Owner = "invalid-owner" - portID, err := icatypes.NewControllerPortID(msg.Owner) - suite.Require().NoError(err) - - // set the active channel with the incorrect portID in order to reach the capability check - suite.chainA.GetSimApp().ICAControllerKeeper.SetActiveChannelID(suite.chainA.GetContext(), path.EndpointA.ConnectionID, portID, path.EndpointA.ChannelID) - }, - icatypes.ErrActiveChannelNotFound, - }, } for _, ordering := range []channeltypes.Order{channeltypes.UNORDERED, channeltypes.ORDERED} { diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay.go b/modules/apps/27-interchain-accounts/controller/keeper/relay.go index 7493bd0bde9..7b072bdea2f 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay.go @@ -1,21 +1,20 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) // SendTx takes pre-built packet data containing messages to be executed on the host chain from an authentication module and attempts to send the packet. -// The packet sequence for the outgoing packet is returned as a result. -// If the base application has the capability to send on the provided portID. An appropriate +// The packet sequence for the outgoing packet is returned as a result. An appropriate // absolute timeoutTimestamp must be provided. If the packet is timed out, the channel will be closed. // In the case of channel closure, a new channel may be reopened to reconnect to the host chain. // @@ -23,11 +22,11 @@ import ( // Prior to v6.x.x of ibc-go, the controller module was only functional as middleware, with authentication performed // by the underlying application. For a full summary of the changes in v6.x.x, please see ADR009. // This API will be removed in later releases. -func (k Keeper) SendTx(ctx sdk.Context, _ *capabilitytypes.Capability, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) { +func (k Keeper) SendTx(ctx context.Context, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) { return k.sendTx(ctx, connectionID, portID, icaPacketData, timeoutTimestamp) } -func (k Keeper) sendTx(ctx sdk.Context, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) { +func (k Keeper) sendTx(ctx context.Context, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) { if !k.GetParams(ctx).ControllerEnabled { return 0, types.ErrControllerSubModuleDisabled } @@ -37,12 +36,8 @@ func (k Keeper) sendTx(ctx sdk.Context, connectionID, portID string, icaPacketDa return 0, errorsmod.Wrapf(icatypes.ErrActiveChannelNotFound, "failed to retrieve active channel on connection %s for port %s", connectionID, portID) } - chanCap, found := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(portID, activeChannelID)) - if !found { - return 0, errorsmod.Wrapf(capabilitytypes.ErrCapabilityNotFound, "failed to find capability: %s", host.ChannelCapabilityPath(portID, activeChannelID)) - } - - if uint64(ctx.BlockTime().UnixNano()) >= timeoutTimestamp { + sdkCtx := sdk.UnwrapSDKContext(ctx) + if uint64(sdkCtx.BlockTime().UnixNano()) >= timeoutTimestamp { return 0, icatypes.ErrInvalidTimeoutTimestamp } @@ -50,7 +45,7 @@ func (k Keeper) sendTx(ctx sdk.Context, connectionID, portID string, icaPacketDa return 0, errorsmod.Wrap(err, "invalid interchain account packet data") } - sequence, err := k.ics4Wrapper.SendPacket(ctx, chanCap, portID, activeChannelID, clienttypes.ZeroHeight(), timeoutTimestamp, icaPacketData.GetBytes()) + sequence, err := k.ics4Wrapper.SendPacket(ctx, portID, activeChannelID, clienttypes.ZeroHeight(), timeoutTimestamp, icaPacketData.GetBytes()) if err != nil { return 0, err } @@ -60,6 +55,6 @@ func (k Keeper) sendTx(ctx sdk.Context, connectionID, portID string, icaPacketDa // OnTimeoutPacket removes the active channel associated with the provided packet, the underlying channel end is closed // due to the semantics of ORDERED channels -func (Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error { +func (Keeper) OnTimeoutPacket(ctx context.Context, packet channeltypes.Packet) error { return nil } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go index 08a762768b7..ee886fc59f8 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go @@ -156,8 +156,8 @@ func (suite *KeeperTestSuite) TestSendTx() { tc.malleate() // malleate mutates test data - //nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) - _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), nil, ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, packetData, timeoutTimestamp) + // nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) + _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, packetData, timeoutTimestamp) if tc.expErr == nil { suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module.go b/modules/apps/27-interchain-accounts/host/ibc_module.go index 65af63a3a30..e23b0514e59 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module.go @@ -1,13 +1,13 @@ package host import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/keeper" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" @@ -37,12 +37,11 @@ func NewIBCModule(k keeper.Keeper) IBCModule { // OnChanOpenInit implements the IBCModule interface func (IBCModule) OnChanOpenInit( - _ sdk.Context, + _ context.Context, _ channeltypes.Order, _ []string, _ string, _ string, - _ *capabilitytypes.Capability, _ channeltypes.Counterparty, _ string, ) (string, error) { @@ -51,12 +50,11 @@ func (IBCModule) OnChanOpenInit( // OnChanOpenTry implements the IBCModule interface func (im IBCModule) OnChanOpenTry( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { @@ -64,12 +62,12 @@ func (im IBCModule) OnChanOpenTry( return "", types.ErrHostSubModuleDisabled } - return im.keeper.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) + return im.keeper.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, counterparty, counterpartyVersion) } // OnChanOpenAck implements the IBCModule interface func (IBCModule) OnChanOpenAck( - _ sdk.Context, + _ context.Context, _, _ string, _ string, @@ -80,7 +78,7 @@ func (IBCModule) OnChanOpenAck( // OnChanOpenConfirm implements the IBCModule interface func (im IBCModule) OnChanOpenConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -93,7 +91,7 @@ func (im IBCModule) OnChanOpenConfirm( // OnChanCloseInit implements the IBCModule interface func (IBCModule) OnChanCloseInit( - _ sdk.Context, + _ context.Context, _ string, _ string, ) error { @@ -103,7 +101,7 @@ func (IBCModule) OnChanCloseInit( // OnChanCloseConfirm implements the IBCModule interface func (im IBCModule) OnChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -112,7 +110,7 @@ func (im IBCModule) OnChanCloseConfirm( // OnRecvPacket implements the IBCModule interface func (im IBCModule) OnRecvPacket( - ctx sdk.Context, + ctx context.Context, _ string, packet channeltypes.Packet, _ sdk.AccAddress, @@ -141,7 +139,7 @@ func (im IBCModule) OnRecvPacket( // OnAcknowledgementPacket implements the IBCModule interface func (IBCModule) OnAcknowledgementPacket( - _ sdk.Context, + _ context.Context, _ string, _ channeltypes.Packet, _ []byte, @@ -152,7 +150,7 @@ func (IBCModule) OnAcknowledgementPacket( // OnTimeoutPacket implements the IBCModule interface func (IBCModule) OnTimeoutPacket( - _ sdk.Context, + _ context.Context, _ string, _ channeltypes.Packet, _ sdk.AccAddress, @@ -161,12 +159,12 @@ func (IBCModule) OnTimeoutPacket( } // OnChanUpgradeInit implements the IBCModule interface -func (IBCModule) OnChanUpgradeInit(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { +func (IBCModule) OnChanUpgradeInit(_ context.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { return "", errorsmod.Wrap(icatypes.ErrInvalidChannelFlow, "channel upgrade handshake must be initiated by controller chain") } // OnChanUpgradeTry implements the IBCModule interface -func (im IBCModule) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeTry(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { if !im.keeper.GetParams(ctx).HostEnabled { return "", types.ErrHostSubModuleDisabled } @@ -175,18 +173,18 @@ func (im IBCModule) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, } // OnChanUpgradeAck implements the IBCModule interface -func (IBCModule) OnChanUpgradeAck(_ sdk.Context, _, _, _ string) error { +func (IBCModule) OnChanUpgradeAck(_ context.Context, _, _, _ string) error { return errorsmod.Wrap(icatypes.ErrInvalidChannelFlow, "channel upgrade handshake must be initiated by controller chain") } // OnChanUpgradeOpen implements the IBCModule interface -func (IBCModule) OnChanUpgradeOpen(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) { +func (IBCModule) OnChanUpgradeOpen(_ context.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) { } // UnmarshalPacketData attempts to unmarshal the provided packet data bytes // into an InterchainAccountPacketData. This function implements the optional // PacketDataUnmarshaler interface required for ADR 008 support. -func (im IBCModule) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { +func (im IBCModule) UnmarshalPacketData(ctx context.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { var data icatypes.InterchainAccountPacketData err := data.UnmarshalJSON(bz) if err != nil { diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 54afc584a83..e5050e85442 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -1,6 +1,7 @@ package host_test import ( + "context" "fmt" "strconv" "testing" @@ -14,7 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icahost "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" @@ -160,8 +160,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() { { "success: ICA auth module callback returns error", func() { // mock module callback should not be called on host side - suite.chainB.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenTry = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, - portID, channelID string, chanCap *capabilitytypes.Capability, + suite.chainB.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenTry = func(ctx context.Context, order channeltypes.Order, connectionHops []string, + portID, channelID string, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { return "", fmt.Errorf("mock ica auth fails") @@ -204,17 +204,11 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() { // ensure channel on chainB is set in state suite.chainB.GetSimApp().IBCKeeper.ChannelKeeper.SetChannel(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, *channel) - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - chanCap, err := suite.chainB.App.GetScopedIBCKeeper().NewCapability(suite.chainB.GetContext(), host.ChannelCapabilityPath(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)) - suite.Require().NoError(err) - - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) version, err := cbs.OnChanOpenTry(suite.chainB.GetContext(), channel.Ordering, channel.ConnectionHops, - path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, chanCap, channel.Counterparty, path.EndpointA.ChannelConfig.Version, + path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel.Counterparty, path.EndpointA.ChannelConfig.Version, ) if tc.expErr == nil { @@ -282,7 +276,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() { "success: ICA auth module callback returns error", func() { // mock module callback should not be called on host side suite.chainB.GetSimApp().ICAAuthModule.IBCApp.OnChanOpenConfirm = func( - ctx sdk.Context, portID, channelID string, + ctx context.Context, portID, channelID string, ) error { return fmt.Errorf("mock ica auth fails") } @@ -315,10 +309,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() { tc.malleate() - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) err = cbs.OnChanOpenConfirm(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) @@ -344,10 +335,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseInit() { err := SetupICAPath(path, TestOwnerAddress) suite.Require().NoError(err) - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) err = cbs.OnChanCloseInit( @@ -385,10 +373,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() { suite.Require().NoError(err) tc.malleate() // malleate mutates test data - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) err = cbs.OnChanCloseConfirm( @@ -424,7 +410,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() { { "success with ICA auth module callback failure", func() { suite.chainB.GetSimApp().ICAAuthModule.IBCApp.OnRecvPacket = func( - ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) exported.Acknowledgement { return channeltypes.NewErrorAcknowledgement(fmt.Errorf("failed OnRecvPacket mock callback")) } @@ -496,10 +482,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() { tc.malleate() - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) ctx := suite.chainB.GetContext() @@ -570,10 +553,7 @@ func (suite *InterchainAccountsTestSuite) TestOnAcknowledgementPacket() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) packet := channeltypes.NewPacket( @@ -625,10 +605,7 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) packet := channeltypes.NewPacket( @@ -666,10 +643,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() { suite.Require().NoError(err) // call application callback directly - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) suite.Require().True(ok) @@ -727,10 +701,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeTry() { tc.malleate() // malleate mutates test data - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) suite.Require().True(ok) @@ -767,10 +738,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() { suite.Require().NoError(err) // call application callback directly - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(path.EndpointB.ChannelConfig.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) suite.Require().True(ok) @@ -784,7 +752,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeAck() { } } -func (suite *InterchainAccountsTestSuite) fundICAWallet(ctx sdk.Context, portID string, amount sdk.Coins) { +func (suite *InterchainAccountsTestSuite) fundICAWallet(ctx context.Context, portID string, amount sdk.Coins) { interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(ctx, ibctesting.FirstConnectionID, portID) suite.Require().True(found) @@ -853,8 +821,8 @@ func (suite *InterchainAccountsTestSuite) TestControlAccountAfterChannelClose() params := types.NewParams(true, []string{sdk.MsgTypeURL(msg)}) suite.chainB.GetSimApp().ICAHostKeeper.SetParams(suite.chainB.GetContext(), params) - //nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) - _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), nil, ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) + // nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) + _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) suite.Require().NoError(err) err = path.EndpointB.UpdateClient() suite.Require().NoError(err) @@ -879,8 +847,8 @@ func (suite *InterchainAccountsTestSuite) TestControlAccountAfterChannelClose() path.EndpointB.ChannelID = "" path.CreateChannels() - //nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) - _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), nil, ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) + // nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) + _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) suite.Require().NoError(err) err = path.EndpointB.UpdateClient() suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/account.go b/modules/apps/27-interchain-accounts/host/keeper/account.go index 9e2cc425d5d..c6b239232bb 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/account.go +++ b/modules/apps/27-interchain-accounts/host/keeper/account.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,7 +14,7 @@ import ( // createInterchainAccount creates a new interchain account. An address is generated using the host connectionID, the controller portID, // and block dependent information. An error is returned if an account already exists for the generated account. // An interchain account type is set in the account keeper and the interchain account address mapping is updated. -func (k Keeper) createInterchainAccount(ctx sdk.Context, connectionID, controllerPortID string) (sdk.AccAddress, error) { +func (k Keeper) createInterchainAccount(ctx context.Context, connectionID, controllerPortID string) (sdk.AccAddress, error) { accAddress := icatypes.GenerateAddress(ctx, connectionID, controllerPortID) if acc := k.accountKeeper.GetAccount(ctx, accAddress); acc != nil { diff --git a/modules/apps/27-interchain-accounts/host/keeper/events.go b/modules/apps/27-interchain-accounts/host/keeper/events.go index 91af1e449c4..fb497ec2ca3 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/events.go +++ b/modules/apps/27-interchain-accounts/host/keeper/events.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "strconv" sdk "github.com/cosmos/cosmos-sdk/types" @@ -13,7 +14,7 @@ import ( // EmitAcknowledgementEvent emits an event signalling a successful or failed acknowledgement and including the error // details if any. -func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack exported.Acknowledgement, err error) { +func EmitAcknowledgementEvent(ctx context.Context, packet channeltypes.Packet, ack exported.Acknowledgement, err error) { attributes := []sdk.Attribute{ sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName), sdk.NewAttribute(icatypes.AttributeKeyHostChannelID, packet.GetDestChannel()), @@ -23,8 +24,8 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack e if err != nil { attributes = append(attributes, sdk.NewAttribute(icatypes.AttributeKeyAckError, err.Error())) } - - ctx.EventManager().EmitEvent( + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( icatypes.EventTypePacket, attributes..., @@ -33,8 +34,9 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack e } // EmitHostDisabledEvent emits an event signalling that the host submodule is disabled. -func EmitHostDisabledEvent(ctx sdk.Context, packet channeltypes.Packet) { - ctx.EventManager().EmitEvent( +func EmitHostDisabledEvent(ctx context.Context, packet channeltypes.Packet) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( icatypes.EventTypePacket, sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName), diff --git a/modules/apps/27-interchain-accounts/host/keeper/export_test.go b/modules/apps/27-interchain-accounts/host/keeper/export_test.go index 0d33f9e5006..c9916e1b3b4 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/export_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/export_test.go @@ -5,13 +5,13 @@ package keeper */ import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" ) // GetAppMetadata is a wrapper around getAppMetadata to allow the function to be directly called in tests. -func (k Keeper) GetAppMetadata(ctx sdk.Context, portID, channelID string) (icatypes.Metadata, error) { +func (k Keeper) GetAppMetadata(ctx context.Context, portID, channelID string) (icatypes.Metadata, error) { return k.getAppMetadata(ctx, portID, channelID) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/genesis.go b/modules/apps/27-interchain-accounts/host/keeper/genesis.go index 4af3cbe7f39..4b3dafa3d49 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/genesis.go +++ b/modules/apps/27-interchain-accounts/host/keeper/genesis.go @@ -1,30 +1,17 @@ package keeper import ( + "context" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) // InitGenesis initializes the interchain accounts host application state from a provided genesis state -func InitGenesis(ctx sdk.Context, keeper Keeper, state genesistypes.HostGenesisState) { +func InitGenesis(ctx context.Context, keeper Keeper, state genesistypes.HostGenesisState) { keeper.setPort(ctx, state.Port) - // generate port capability if it does not already exist - if !keeper.hasCapability(ctx, state.Port) { - // use the port keeper to generate a new capability - capability := keeper.portKeeper.BindPort(ctx, state.Port) - - // use the host scoped keeper to claim the port capability - if err := keeper.ClaimCapability(ctx, capability, host.PortPath(state.Port)); err != nil { - panic(fmt.Errorf("could not claim port capability: %v", err)) - } - } - for _, ch := range state.ActiveChannels { keeper.SetActiveChannelID(ctx, ch.ConnectionId, ch.PortId, ch.ChannelId) } @@ -40,7 +27,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, state genesistypes.HostGenesisS } // ExportGenesis returns the interchain accounts host exported genesis -func ExportGenesis(ctx sdk.Context, keeper Keeper) genesistypes.HostGenesisState { +func ExportGenesis(ctx context.Context, keeper Keeper) genesistypes.HostGenesisState { return genesistypes.NewHostGenesisState( keeper.GetAllActiveChannels(ctx), keeper.GetAllInterchainAccounts(ctx), diff --git a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go index 101ea1eb8c8..079e2aa7903 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -46,10 +45,6 @@ func (suite *KeeperTestSuite) TestInitGenesis() { store := suite.chainA.GetContext().KVStore(suite.chainA.GetSimApp().GetKey(types.StoreKey)) suite.Require().True(store.Has(icatypes.KeyPort(icatypes.HostPortID))) - - capability, found := suite.chainA.GetSimApp().ScopedICAHostKeeper.GetCapability(suite.chainA.GetContext(), host.PortPath(icatypes.HostPortID)) - suite.Require().True(found) - suite.Require().NotNil(capability) } func (suite *KeeperTestSuite) TestGenesisParams() { diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake.go b/modules/apps/27-interchain-accounts/host/keeper/handshake.go index 0de6b77a731..19d126218b3 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" "strings" @@ -8,12 +9,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) // OnChanOpenTry performs basic validation of the ICA channel @@ -21,12 +20,11 @@ import ( // The version returned will include the registered interchain // account address. func (k Keeper) OnChanOpenTry( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { @@ -69,12 +67,6 @@ func (k Keeper) OnChanOpenTry( // be overwritten with the correct one before the metadata is returned. } - // On the host chain the capability may only be claimed during the OnChanOpenTry - // The capability being claimed in OpenInit is for a controller chain (the port is different) - if err = k.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", errorsmod.Wrapf(err, "failed to claim capability for channel %s on port %s", channelID, portID) - } - var accAddress sdk.AccAddress interchainAccAddr, found := k.GetInterchainAccountAddress(ctx, metadata.HostConnectionId, counterparty.PortId) @@ -105,7 +97,7 @@ func (k Keeper) OnChanOpenTry( // OnChanOpenConfirm completes the handshake process by setting the active channel in state on the host chain func (k Keeper) OnChanOpenConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -125,7 +117,7 @@ func (k Keeper) OnChanOpenConfirm( // OnChanCloseConfirm removes the active channel stored in state func (Keeper) OnChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -146,7 +138,7 @@ func (Keeper) OnChanCloseConfirm( // - connectionHops (and subsequently host/controller connectionIDs) // - interchain account address // - ICS27 protocol version -func (k Keeper) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { +func (k Keeper) OnChanUpgradeTry(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { if portID != icatypes.HostPortID { return "", errorsmod.Wrapf(porttypes.ErrInvalidPort, "expected %s, got %s", icatypes.HostPortID, portID) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index ab70bcb85b1..53279b724a0 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -5,13 +5,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" hosttypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -48,7 +46,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { var ( channel *channeltypes.Channel path *ibctesting.Path - chanCap *capabilitytypes.Capability metadata icatypes.Metadata ) @@ -68,8 +65,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { // create interchain account // undo setup path.EndpointB.ChannelID = "" - err := suite.chainB.App.GetScopedIBCKeeper().ReleaseCapability(suite.chainB.GetContext(), chanCap) - suite.Require().NoError(err) suite.openAndCloseChannel(path) }, @@ -81,8 +76,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { // create interchain account // undo setup path.EndpointB.ChannelID = "" - err := suite.chainB.App.GetScopedIBCKeeper().ReleaseCapability(suite.chainB.GetContext(), chanCap) - suite.Require().NoError(err) suite.openAndCloseChannel(path) @@ -141,8 +134,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { // create interchain account // undo setup path.EndpointB.ChannelID = "" - err := suite.chainB.App.GetScopedIBCKeeper().ReleaseCapability(suite.chainB.GetContext(), chanCap) - suite.Require().NoError(err) suite.openAndCloseChannel(path) @@ -161,8 +152,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { // create interchain account // undo setup path.EndpointB.ChannelID = "" - err := suite.chainB.App.GetScopedIBCKeeper().ReleaseCapability(suite.chainB.GetContext(), chanCap) - suite.Require().NoError(err) suite.openAndCloseChannel(path) @@ -253,15 +242,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { }, icatypes.ErrInvalidVersion, }, - { - "capability already claimed", - func() { - path.EndpointB.SetChannel(*channel) - err := suite.chainB.GetSimApp().ScopedICAHostKeeper.ClaimCapability(suite.chainB.GetContext(), chanCap, host.ChannelCapabilityPath(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)) - suite.Require().NoError(err) - }, - capabilitytypes.ErrOwnerClaimed, - }, { "active channel already set (OPEN state)", func() { @@ -325,13 +305,10 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { Version: string(versionBytes), } - chanCap, err = suite.chainB.App.GetScopedIBCKeeper().NewCapability(suite.chainB.GetContext(), host.ChannelCapabilityPath(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)) - suite.Require().NoError(err) - tc.malleate() // malleate mutates test data version, err := suite.chainB.GetSimApp().ICAHostKeeper.OnChanOpenTry(suite.chainB.GetContext(), channel.Ordering, channel.ConnectionHops, - path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, chanCap, channel.Counterparty, path.EndpointA.ChannelConfig.Version, + path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channel.Counterparty, path.EndpointA.ChannelConfig.Version, ) if tc.expErr == nil { diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 50e7414939b..07f480248ed 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -1,48 +1,45 @@ package keeper import ( + "context" "errors" "fmt" "strings" gogoproto "github.com/cosmos/gogoproto/proto" "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" msgv1 "cosmossdk.io/api/cosmos/msg/v1" queryv1 "cosmossdk.io/api/cosmos/query/v1" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // Keeper defines the IBC interchain accounts host keeper type Keeper struct { - storeKey storetypes.StoreKey + storeService corestore.KVStoreService cdc codec.Codec legacySubspace icatypes.ParamSubspace ics4Wrapper porttypes.ICS4Wrapper channelKeeper icatypes.ChannelKeeper - portKeeper icatypes.PortKeeper accountKeeper icatypes.AccountKeeper - scopedKeeper exported.ScopedKeeper - msgRouter icatypes.MessageRouter queryRouter icatypes.QueryRouter @@ -56,10 +53,9 @@ type Keeper struct { // NewKeeper creates a new interchain accounts host Keeper instance func NewKeeper( - cdc codec.Codec, key storetypes.StoreKey, legacySubspace icatypes.ParamSubspace, - ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper, - accountKeeper icatypes.AccountKeeper, scopedKeeper exported.ScopedKeeper, msgRouter icatypes.MessageRouter, - queryRouter icatypes.QueryRouter, authority string, + cdc codec.Codec, storeService corestore.KVStoreService, legacySubspace icatypes.ParamSubspace, + ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, + accountKeeper icatypes.AccountKeeper, msgRouter icatypes.MessageRouter, queryRouter icatypes.QueryRouter, authority string, ) Keeper { // ensure ibc interchain accounts module account is set if addr := accountKeeper.GetModuleAddress(icatypes.ModuleName); addr == nil { @@ -71,14 +67,12 @@ func NewKeeper( } return Keeper{ - storeKey: key, + storeService: storeService, cdc: cdc, legacySubspace: legacySubspace, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, accountKeeper: accountKeeper, - scopedKeeper: scopedKeeper, msgRouter: msgRouter, queryRouter: queryRouter, mqsAllowList: newModuleQuerySafeAllowList(), @@ -99,12 +93,13 @@ func (k Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper { } // Logger returns the application logger, scoped to the associated module -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after context.Context is removed from core IBC + return sdkCtx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) } // getConnectionID returns the connection id for the given port and channelIDs. -func (k Keeper) getConnectionID(ctx sdk.Context, portID, channelID string) (string, error) { +func (k Keeper) getConnectionID(ctx context.Context, portID, channelID string) (string, error) { channel, found := k.channelKeeper.GetChannel(ctx, portID, channelID) if !found { return "", errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) @@ -113,34 +108,20 @@ func (k Keeper) getConnectionID(ctx sdk.Context, portID, channelID string) (stri } // setPort sets the provided portID in state. -func (k Keeper) setPort(ctx sdk.Context, portID string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyPort(portID), []byte{0x01}) -} - -// hasCapability checks if the interchain account host module owns the port capability for the desired port -func (k Keeper) hasCapability(ctx sdk.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok -} - -// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function -func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool { - return k.scopedKeeper.AuthenticateCapability(ctx, cap, name) -} - -// ClaimCapability wraps the scopedKeeper's ClaimCapability function -func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error { - return k.scopedKeeper.ClaimCapability(ctx, cap, name) +func (k Keeper) setPort(ctx context.Context, portID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyPort(portID), []byte{0x01}); err != nil { + panic(err) + } } // GetAppVersion calls the ICS4Wrapper GetAppVersion function. -func (k Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (k Keeper) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { return k.ics4Wrapper.GetAppVersion(ctx, portID, channelID) } // getAppMetadata retrieves the interchain accounts channel metadata from the store associated with the provided portID and channelID -func (k Keeper) getAppMetadata(ctx sdk.Context, portID, channelID string) (icatypes.Metadata, error) { +func (k Keeper) getAppMetadata(ctx context.Context, portID, channelID string) (icatypes.Metadata, error) { appVersion, found := k.GetAppVersion(ctx, portID, channelID) if !found { return icatypes.Metadata{}, errorsmod.Wrapf(ibcerrors.ErrNotFound, "app version not found for port %s and channel %s", portID, channelID) @@ -150,19 +131,23 @@ func (k Keeper) getAppMetadata(ctx sdk.Context, portID, channelID string) (icaty } // GetActiveChannelID retrieves the active channelID from the store keyed by the provided connectionID and portID -func (k Keeper) GetActiveChannelID(ctx sdk.Context, connectionID, portID string) (string, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetActiveChannelID(ctx context.Context, connectionID, portID string) (string, bool) { + store := k.storeService.OpenKVStore(ctx) key := icatypes.KeyActiveChannel(portID, connectionID) - if !store.Has(key) { + bz, err := store.Get(key) + if err != nil { + panic(err) + } + if len(bz) == 0 { return "", false } - return string(store.Get(key)), true + return string(bz), true } // GetOpenActiveChannel retrieves the active channelID from the store, keyed by the provided connectionID and portID & checks if the channel in question is in state OPEN -func (k Keeper) GetOpenActiveChannel(ctx sdk.Context, connectionID, portID string) (string, bool) { +func (k Keeper) GetOpenActiveChannel(ctx context.Context, connectionID, portID string) (string, bool) { channelID, found := k.GetActiveChannelID(ctx, connectionID, portID) if !found { return "", false @@ -178,10 +163,10 @@ func (k Keeper) GetOpenActiveChannel(ctx sdk.Context, connectionID, portID strin } // GetAllActiveChannels returns a list of all active interchain accounts host channels and their associated connection and port identifiers -func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []genesistypes.ActiveChannel { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllActiveChannels(ctx context.Context) []genesistypes.ActiveChannel { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(icatypes.ActiveChannelKeyPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var activeChannels []genesistypes.ActiveChannel for ; iterator.Valid(); iterator.Next() { @@ -200,32 +185,38 @@ func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []genesistypes.ActiveChann } // SetActiveChannelID stores the active channelID, keyed by the provided connectionID and portID -func (k Keeper) SetActiveChannelID(ctx sdk.Context, connectionID, portID, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyActiveChannel(portID, connectionID), []byte(channelID)) +func (k Keeper) SetActiveChannelID(ctx context.Context, connectionID, portID, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyActiveChannel(portID, connectionID), []byte(channelID)); err != nil { + panic(err) + } } // IsActiveChannel returns true if there exists an active channel for the provided connectionID and portID, otherwise false -func (k Keeper) IsActiveChannel(ctx sdk.Context, connectionID, portID string) bool { +func (k Keeper) IsActiveChannel(ctx context.Context, connectionID, portID string) bool { _, ok := k.GetActiveChannelID(ctx, connectionID, portID) return ok } // GetInterchainAccountAddress retrieves the InterchainAccount address from the store associated with the provided connectionID and portID -func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, connectionID, portID string) (string, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetInterchainAccountAddress(ctx context.Context, connectionID, portID string) (string, bool) { + store := k.storeService.OpenKVStore(ctx) key := icatypes.KeyOwnerAccount(portID, connectionID) - if !store.Has(key) { + bz, err := store.Get(key) + if len(bz) == 0 { return "", false } + if err != nil { + panic(err) + } - return string(store.Get(key)), true + return string(bz), true } // GetAllInterchainAccounts returns a list of all registered interchain account addresses and their associated connection and controller port identifiers -func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []genesistypes.RegisteredInterchainAccount { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllInterchainAccounts(ctx context.Context) []genesistypes.RegisteredInterchainAccount { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(icatypes.OwnerKeyPrefix)) var interchainAccounts []genesistypes.RegisteredInterchainAccount @@ -245,9 +236,11 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []genesistypes.Registe } // SetInterchainAccountAddress stores the InterchainAccount address, keyed by the associated connectionID and portID -func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, connectionID, portID, address string) { - store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyOwnerAccount(portID, connectionID), []byte(address)) +func (k Keeper) SetInterchainAccountAddress(ctx context.Context, connectionID, portID, address string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(icatypes.KeyOwnerAccount(portID, connectionID), []byte(address)); err != nil { + panic(err) + } } // GetAuthority returns the 27-interchain-accounts host submodule's authority. @@ -256,9 +249,12 @@ func (k Keeper) GetAuthority() string { } // GetParams returns the total set of the host submodule parameters. -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.ParamsKey)) +func (k Keeper) GetParams(ctx context.Context) types.Params { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.ParamsKey)) + if err != nil { + panic(err) + } if bz == nil { // only panic on unset params and not on empty params panic(errors.New("ica/host params are not set in store")) } @@ -269,29 +265,18 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { } // SetParams sets the total set of the host submodule parameters. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) SetParams(ctx context.Context, params types.Params) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(¶ms) - store.Set([]byte(types.ParamsKey), bz) + if err := store.Set([]byte(types.ParamsKey), bz); err != nil { + panic(err) + } } // newModuleQuerySafeAllowList returns a list of all query paths labeled with module_query_safe in the proto files. func newModuleQuerySafeAllowList() []string { - fds, err := gogoproto.MergedGlobalFileDescriptors() - if err != nil { - panic(err) - } - // create the files using 'AllowUnresolvable' to avoid - // unnecessary panic: https://github.com/cosmos/ibc-go/issues/6435 - protoFiles, err := protodesc.FileOptions{ - AllowUnresolvable: true, - }.NewFiles(fds) - if err != nil { - panic(err) - } - allowList := []string{} - protoFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool { + gogoproto.GogoResolver.RangeFiles(func(fd protoreflect.FileDescriptor) bool { for i := 0; i < fd.Services().Len(); i++ { // Get the service descriptor sd := fd.Services().Get(i) diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go index efd201712ae..e2b186286c3 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go @@ -6,6 +6,7 @@ import ( testifysuite "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/runtime" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" @@ -141,13 +142,11 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"success", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), @@ -156,13 +155,11 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: interchain accounts module account does not exist", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, authkeeper.AccountKeeper{}, // empty account keeper - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), @@ -171,13 +168,11 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: empty mock staking keeper", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), "", // authority diff --git a/modules/apps/27-interchain-accounts/host/keeper/migrations.go b/modules/apps/27-interchain-accounts/host/keeper/migrations.go index 1dcc95fd71c..ea0fb9374f5 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/migrations.go +++ b/modules/apps/27-interchain-accounts/host/keeper/migrations.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" @@ -19,11 +21,12 @@ func NewMigrator(k *Keeper) Migrator { } // MigrateParams migrates the host submodule's parameters from the x/params to self store. -func (m Migrator) MigrateParams(ctx sdk.Context) error { +func (m Migrator) MigrateParams(ctx context.Context) error { if m.keeper != nil { params := types.DefaultParams() if m.keeper.legacySubspace != nil { - m.keeper.legacySubspace.GetParamSetIfExists(ctx, ¶ms) + sdkCtx := sdk.UnwrapSDKContext(ctx) + m.keeper.legacySubspace.GetParamSetIfExists(sdkCtx, ¶ms) } if err := params.Validate(); err != nil { return err diff --git a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go index a4007c3d7bc..99a11b9be65 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "fmt" + "github.com/cosmos/cosmos-sdk/runtime" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -30,13 +31,11 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { func() { suite.chainA.GetSimApp().ICAHostKeeper = icahostkeeper.NewKeeper( suite.chainA.Codec, - suite.chainA.GetSimApp().GetKey(icahosttypes.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(icahosttypes.StoreKey)), nil, // assign a nil legacy param subspace suite.chainA.GetSimApp().IBCFeeKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay.go b/modules/apps/27-interchain-accounts/host/keeper/relay.go index 91c03a75ee1..1cfaf2d9cfe 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + "github.com/cosmos/gogoproto/proto" errorsmod "cosmossdk.io/errors" @@ -16,7 +18,7 @@ import ( // OnRecvPacket handles a given interchain accounts packet on a destination host chain. // If the transaction is successfully executed, the transaction response bytes will be returned. -func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet) ([]byte, error) { +func (k Keeper) OnRecvPacket(ctx context.Context, packet channeltypes.Packet) ([]byte, error) { var data icatypes.InterchainAccountPacketData err := data.UnmarshalJSON(packet.GetData()) if err != nil { @@ -50,7 +52,7 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet) ([]byt // If authentication succeeds, it does basic validation of the messages before attempting to deliver each message // into state. The state changes will only be committed if all messages in the transaction succeed. Thus the // execution of the transaction is atomic, all state changes are reverted if a single message fails. -func (k Keeper) executeTx(ctx sdk.Context, sourcePort, destPort, destChannel string, msgs []sdk.Msg) ([]byte, error) { +func (k Keeper) executeTx(ctx context.Context, sourcePort, destPort, destChannel string, msgs []sdk.Msg) ([]byte, error) { channel, found := k.channelKeeper.GetChannel(ctx, destPort, destChannel) if !found { return nil, channeltypes.ErrChannelNotFound @@ -66,7 +68,8 @@ func (k Keeper) executeTx(ctx sdk.Context, sourcePort, destPort, destChannel str // CacheContext returns a new context with the multi-store branched into a cached storage object // writeCache is called only if all msgs succeed, performing state transitions atomically - cacheCtx, writeCache := ctx.CacheContext() + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + cacheCtx, writeCache := sdkCtx.CacheContext() for i, msg := range msgs { if m, ok := msg.(sdk.HasValidateBasic); ok { if err := m.ValidateBasic(); err != nil { @@ -94,7 +97,7 @@ func (k Keeper) executeTx(ctx sdk.Context, sourcePort, destPort, destChannel str // authenticateTx ensures the provided msgs contain the correct interchain account signer address retrieved // from state using the provided controller port identifier -func (k Keeper) authenticateTx(ctx sdk.Context, msgs []sdk.Msg, connectionID, portID string) error { +func (k Keeper) authenticateTx(ctx context.Context, msgs []sdk.Msg, connectionID, portID string) error { interchainAccountAddr, found := k.GetInterchainAccountAddress(ctx, connectionID, portID) if !found { return errorsmod.Wrapf(icatypes.ErrInterchainAccountNotFound, "failed to retrieve interchain account on port %s", portID) @@ -128,7 +131,7 @@ func (k Keeper) authenticateTx(ctx sdk.Context, msgs []sdk.Msg, connectionID, po // Attempts to get the message handler from the router and if found will then execute the message. // If the message execution is successful, the proto marshaled message response will be returned. -func (k Keeper) executeMsg(ctx sdk.Context, msg sdk.Msg) (*codectypes.Any, error) { +func (k Keeper) executeMsg(ctx sdk.Context, msg sdk.Msg) (*codectypes.Any, error) { // TODO: https://github.com/cosmos/ibc-go/issues/7223 handler := k.msgRouter.Handler(msg) if handler == nil { return nil, icatypes.ErrInvalidRoute diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go index b4cbacfcf01..75e5962854a 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "context" "fmt" "strings" "time" @@ -886,7 +887,7 @@ func (suite *KeeperTestSuite) TestJSONOnRecvPacket() { } } -func (suite *KeeperTestSuite) fundICAWallet(ctx sdk.Context, portID string, amount sdk.Coins) { +func (suite *KeeperTestSuite) fundICAWallet(ctx context.Context, portID string, amount sdk.Coins) { interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(ctx, ibctesting.FirstConnectionID, portID) suite.Require().True(found) diff --git a/modules/apps/27-interchain-accounts/types/account.go b/modules/apps/27-interchain-accounts/types/account.go index 60c05ad448c..d1542f52ace 100644 --- a/modules/apps/27-interchain-accounts/types/account.go +++ b/modules/apps/27-interchain-accounts/types/account.go @@ -1,6 +1,7 @@ package types import ( + "context" "encoding/json" "regexp" "strings" @@ -43,9 +44,10 @@ type interchainAccountPretty struct { // GenerateAddress returns an sdk.AccAddress derived using a host module account address, host connection ID, the controller portID, // the current block app hash, and the current block data hash. The sdk.AccAddress returned is a sub-address of the host module account. -func GenerateAddress(ctx sdk.Context, connectionID, portID string) sdk.AccAddress { +func GenerateAddress(ctx context.Context, connectionID, portID string) sdk.AccAddress { hostModuleAcc := sdkaddress.Module(ModuleName, []byte(hostAccountsKey)) - header := ctx.BlockHeader() + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + header := sdkCtx.BlockHeader() buf := []byte(connectionID + portID) buf = append(buf, header.AppHash...) diff --git a/modules/apps/27-interchain-accounts/types/expected_keepers.go b/modules/apps/27-interchain-accounts/types/expected_keepers.go index 2a93fafaa92..9ae0e0346ae 100644 --- a/modules/apps/27-interchain-accounts/types/expected_keepers.go +++ b/modules/apps/27-interchain-accounts/types/expected_keepers.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) @@ -22,16 +21,10 @@ type AccountKeeper interface { // ChannelKeeper defines the expected IBC channel keeper type ChannelKeeper interface { - GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) - GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) - GetConnection(ctx sdk.Context, connectionID string) (connectiontypes.ConnectionEnd, error) - GetAllChannelsWithPortPrefix(ctx sdk.Context, portPrefix string) []channeltypes.IdentifiedChannel -} - -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability - IsBound(ctx sdk.Context, portID string) bool + GetChannel(ctx context.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) + GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) + GetConnection(ctx context.Context, connectionID string) (connectiontypes.ConnectionEnd, error) + GetAllChannelsWithPortPrefix(ctx context.Context, portPrefix string) []channeltypes.IdentifiedChannel } // ParamSubspace defines the expected Subspace interface for module parameters. diff --git a/modules/apps/27-interchain-accounts/types/metadata.go b/modules/apps/27-interchain-accounts/types/metadata.go index 13cc5c30fc2..7998e518d58 100644 --- a/modules/apps/27-interchain-accounts/types/metadata.go +++ b/modules/apps/27-interchain-accounts/types/metadata.go @@ -1,12 +1,11 @@ package types import ( + "context" "slices" errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ) @@ -81,7 +80,7 @@ func IsPreviousMetadataEqual(previousVersion string, metadata Metadata) bool { // ValidateControllerMetadata performs validation of the provided ICS27 controller metadata parameters as well // as the connection params against the provided metadata -func ValidateControllerMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, connectionHops []string, metadata Metadata) error { +func ValidateControllerMetadata(ctx context.Context, channelKeeper ChannelKeeper, connectionHops []string, metadata Metadata) error { if !isSupportedEncoding(metadata.Encoding) { return errorsmod.Wrapf(ErrInvalidCodec, "unsupported encoding format %s", metadata.Encoding) } @@ -113,7 +112,7 @@ func ValidateControllerMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, co } // ValidateHostMetadata performs validation of the provided ICS27 host metadata parameters -func ValidateHostMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, connectionHops []string, metadata Metadata) error { +func ValidateHostMetadata(ctx context.Context, channelKeeper ChannelKeeper, connectionHops []string, metadata Metadata) error { if !isSupportedEncoding(metadata.Encoding) { return errorsmod.Wrapf(ErrInvalidCodec, "unsupported encoding format %s", metadata.Encoding) } diff --git a/modules/apps/29-fee/ibc_middleware.go b/modules/apps/29-fee/ibc_middleware.go index dce52a87cdc..08d8c227a3f 100644 --- a/modules/apps/29-fee/ibc_middleware.go +++ b/modules/apps/29-fee/ibc_middleware.go @@ -1,6 +1,7 @@ package fee import ( + "context" "encoding/json" "strings" @@ -8,7 +9,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/keeper" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" @@ -41,12 +41,11 @@ func NewIBCMiddleware(app porttypes.IBCModule, k keeper.Keeper) IBCMiddleware { // OnChanOpenInit implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenInit( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) { @@ -65,7 +64,7 @@ func (im IBCMiddleware) OnChanOpenInit( // lower down in the stack. Thus, if it is not a fee version we pass the entire version string onto the underlying // application. return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, - chanCap, counterparty, version) + counterparty, version) } versionMetadata = metadata } @@ -74,7 +73,7 @@ func (im IBCMiddleware) OnChanOpenInit( return "", errorsmod.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.FeeVersion) } - appVersion, err := im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, versionMetadata.AppVersion) + appVersion, err := im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, versionMetadata.AppVersion) if err != nil { return "", err } @@ -95,12 +94,11 @@ func (im IBCMiddleware) OnChanOpenInit( // If the channel is not fee enabled the underlying application version will be returned // If the channel is fee enabled we merge the underlying application version with the ics29 version func (im IBCMiddleware) OnChanOpenTry( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { @@ -109,7 +107,7 @@ func (im IBCMiddleware) OnChanOpenTry( // Since it is valid for fee version to not be specified, the above middleware version may be for a middleware // lower down in the stack. Thus, if it is not a fee version we pass the entire version string onto the underlying // application. - return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) + return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, counterparty, counterpartyVersion) } if versionMetadata.FeeVersion != types.Version { @@ -119,7 +117,7 @@ func (im IBCMiddleware) OnChanOpenTry( im.keeper.SetFeeEnabled(ctx, portID, channelID) // call underlying app's OnChanOpenTry callback with the app versions - appVersion, err := im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, versionMetadata.AppVersion) + appVersion, err := im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, counterparty, versionMetadata.AppVersion) if err != nil { return "", err } @@ -135,7 +133,7 @@ func (im IBCMiddleware) OnChanOpenTry( // OnChanOpenAck implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenAck( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyChannelID string, @@ -164,7 +162,7 @@ func (im IBCMiddleware) OnChanOpenAck( // OnChanOpenConfirm implements the IBCMiddleware interface func (im IBCMiddleware) OnChanOpenConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -174,7 +172,7 @@ func (im IBCMiddleware) OnChanOpenConfirm( // OnChanCloseInit implements the IBCMiddleware interface func (im IBCMiddleware) OnChanCloseInit( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -195,7 +193,7 @@ func (im IBCMiddleware) OnChanCloseInit( // OnChanCloseConfirm implements the IBCMiddleware interface func (im IBCMiddleware) OnChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -217,7 +215,7 @@ func (im IBCMiddleware) OnChanCloseConfirm( // OnRecvPacket implements the IBCMiddleware interface. // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnRecvPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -244,7 +242,7 @@ func (im IBCMiddleware) OnRecvPacket( // OnAcknowledgementPacket implements the IBCMiddleware interface // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnAcknowledgementPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, @@ -299,7 +297,7 @@ func (im IBCMiddleware) OnAcknowledgementPacket( // OnTimeoutPacket implements the IBCMiddleware interface // If fees are not enabled, this callback will default to the ibc-core packet callback func (im IBCMiddleware) OnTimeoutPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -344,7 +342,7 @@ func (im IBCMiddleware) OnTimeoutPacket( // OnChanUpgradeInit implements the IBCModule interface func (im IBCMiddleware) OnChanUpgradeInit( - ctx sdk.Context, + ctx context.Context, portID string, channelID string, proposedOrder channeltypes.Order, @@ -382,7 +380,7 @@ func (im IBCMiddleware) OnChanUpgradeInit( } // OnChanUpgradeTry implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { +func (im IBCMiddleware) OnChanUpgradeTry(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { cbs, ok := im.app.(porttypes.UpgradableModule) if !ok { return "", errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") @@ -414,7 +412,7 @@ func (im IBCMiddleware) OnChanUpgradeTry(ctx sdk.Context, portID, channelID stri } // OnChanUpgradeAck implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { +func (im IBCMiddleware) OnChanUpgradeAck(ctx context.Context, portID, channelID, counterpartyVersion string) error { cbs, ok := im.app.(porttypes.UpgradableModule) if !ok { return errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") @@ -436,7 +434,7 @@ func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, cou } // OnChanUpgradeOpen implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { +func (im IBCMiddleware) OnChanUpgradeOpen(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { cbs, ok := im.app.(porttypes.UpgradableModule) if !ok { panic(errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack")) @@ -457,36 +455,34 @@ func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID str // SendPacket implements the ICS4 Wrapper interface func (im IBCMiddleware) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte, ) (uint64, error) { - return im.keeper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) + return im.keeper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) } // WriteAcknowledgement implements the ICS4 Wrapper interface func (im IBCMiddleware) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet exported.PacketI, ack exported.Acknowledgement, ) error { - return im.keeper.WriteAcknowledgement(ctx, chanCap, packet, ack) + return im.keeper.WriteAcknowledgement(ctx, packet, ack) } // GetAppVersion returns the application version of the underlying application -func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (im IBCMiddleware) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { return im.keeper.GetAppVersion(ctx, portID, channelID) } // UnmarshalPacketData attempts to use the underlying app to unmarshal the packet data. // If the underlying app does not support the PacketDataUnmarshaler interface, an error is returned. // This function implements the optional PacketDataUnmarshaler interface required for ADR 008 support. -func (im IBCMiddleware) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { +func (im IBCMiddleware) UnmarshalPacketData(ctx context.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { unmarshaler, ok := im.app.(porttypes.PacketDataUnmarshaler) if !ok { return nil, "", errorsmod.Wrapf(types.ErrUnsupportedAction, "underlying app does not implement %T", (*porttypes.PacketDataUnmarshaler)(nil)) diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index 4e2a9c27280..059a7d28cff 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -1,7 +1,9 @@ package fee_test import ( + "context" "encoding/json" + "errors" "fmt" errorsmod "cosmossdk.io/errors" @@ -9,14 +11,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ibcfee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee" feekeeper "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/keeper" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" "github.com/cosmos/ibc-go/v9/modules/core/exported" ibctesting "github.com/cosmos/ibc-go/v9/testing" ibcmock "github.com/cosmos/ibc-go/v9/testing/mock" @@ -33,44 +34,44 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { testCases := []struct { name string version string - expPass bool isFeeEnabled bool + expErr error }{ { "success - valid fee middleware and mock version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})), true, - true, + nil, }, { "success - fee version not included, only perform mock logic", ibcmock.Version, - true, false, + nil, + }, + { + "passing an empty string returns default version", + "", + true, + nil, }, { "invalid fee middleware version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: "invalid-ics29-1", AppVersion: ibcmock.Version})), false, - false, + types.ErrInvalidVersion, }, { "invalid mock version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: "invalid-mock-version"})), false, - false, + errors.New("incorrect mock version"), }, { "mock version not wrapped", types.Version, false, - false, - }, - { - "passing an empty string returns default version", - "", - true, - true, + errors.New("incorrect mock version"), }, } @@ -84,8 +85,8 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { suite.path.SetupConnections() // setup mock callback - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanOpenInit = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, - portID, channelID string, chanCap *capabilitytypes.Capability, + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanOpenInit = func(ctx context.Context, order channeltypes.Order, connectionHops []string, + portID, channelID string, counterparty channeltypes.Counterparty, version string, ) (string, error) { if version != ibcmock.Version { @@ -105,19 +106,13 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { Version: tc.version, } - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - chanCap, err := suite.chainA.App.GetScopedIBCKeeper().NewCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID)) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) version, err := cbs.OnChanOpenInit(suite.chainA.GetContext(), channel.Ordering, channel.ConnectionHops, - suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, chanCap, counterparty, channel.Version) + suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, counterparty, channel.Version) - if tc.expPass { + if tc.expErr == nil { // check if the channel is fee enabled. If so version string should include metaData if tc.isFeeEnabled { versionMetadata := types.Metadata{ @@ -135,7 +130,7 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { suite.Require().NoError(err, "unexpected error from version: %s", tc.version) } else { - suite.Require().Error(err, "error not returned for version: %s", tc.version) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, "error not returned for version: %s or error %s is not %s", tc.version, err, tc.expErr) suite.Require().Equal("", version) } }) @@ -148,27 +143,27 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { testCases := []struct { name string cpVersion string - expPass bool + expErr error }{ { "success - valid fee middleware version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})), - true, + nil, }, { "success - valid mock version", ibcmock.Version, - true, + nil, }, { "invalid fee middleware version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: "invalid-ics29-1", AppVersion: ibcmock.Version})), - false, + types.ErrInvalidVersion, }, { "invalid mock version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: "invalid-mock-version"})), - false, + errors.New("incorrect mock version"), }, } @@ -184,8 +179,8 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { suite.Require().NoError(err) // setup mock callback - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanOpenTry = func(ctx sdk.Context, order channeltypes.Order, connectionHops []string, - portID, channelID string, chanCap *capabilitytypes.Capability, + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanOpenTry = func(ctx context.Context, order channeltypes.Order, connectionHops []string, + portID, channelID string, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { if counterpartyVersion != ibcmock.Version { @@ -194,13 +189,7 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { return ibcmock.Version, nil } - var ( - chanCap *capabilitytypes.Capability - ok bool - ) - - chanCap, err = suite.chainA.App.GetScopedIBCKeeper().NewCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID)) - suite.Require().NoError(err) + var ok bool suite.path.EndpointA.ChannelID = ibctesting.FirstChannelID @@ -213,19 +202,16 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { Version: tc.cpVersion, } - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) _, err = cbs.OnChanOpenTry(suite.chainA.GetContext(), channel.Ordering, channel.ConnectionHops, - suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, chanCap, counterparty, tc.cpVersion) + suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, counterparty, tc.cpVersion) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -238,31 +224,31 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { name string cpVersion string malleate func(suite *FeeTestSuite) - expPass bool + expErr error }{ { "success", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: ibcmock.Version})), func(suite *FeeTestSuite) {}, - true, + nil, }, { "invalid fee version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: "invalid-ics29-1", AppVersion: ibcmock.Version})), func(suite *FeeTestSuite) {}, - false, + types.ErrInvalidVersion, }, { "invalid mock version", string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: "invalid-mock-version"})), func(suite *FeeTestSuite) {}, - false, + errors.New("incorrect mock version"), }, { "invalid version fails to unmarshal metadata", ibctesting.InvalidID, func(suite *FeeTestSuite) {}, - false, + errors.New("incorrect mock version"), }, { "previous INIT set without fee, however counterparty set fee version", // note this can only happen with incompetent or malicious counterparty chain @@ -272,7 +258,7 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { suite.path.EndpointA.ChannelConfig.Version = ibcmock.Version suite.path.EndpointB.ChannelConfig.Version = ibcmock.Version }, - false, + errors.New("incorrect mock version"), }, } @@ -284,7 +270,7 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { // setup mock callback suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanOpenAck = func( - ctx sdk.Context, portID, channelID string, counterpartyChannelID string, counterpartyVersion string, + ctx context.Context, portID, channelID string, counterpartyChannelID string, counterpartyVersion string, ) error { if counterpartyVersion != ibcmock.Version { return fmt.Errorf("incorrect mock version") @@ -300,17 +286,14 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { err = suite.path.EndpointB.ChanOpenTry() suite.Require().NoError(err) - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) err = cbs.OnChanOpenAck(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, suite.path.EndpointA.Counterparty.ChannelID, tc.cpVersion) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err, "unexpected error for case: %s", tc.name) } else { - suite.Require().Error(err, "%s expected error but returned none", tc.name) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -325,19 +308,16 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { - "success", func() {}, true, + "success", func() {}, nil, }, { - "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseInit = func( - ctx sdk.Context, portID, channelID string, - ) error { - return fmt.Errorf("application callback fails") - } - }, false, + "fee module is not enabled", func() { + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + }, + nil, }, { "RefundFeesOnChannelClosure continues - invalid refund address", func() { @@ -349,19 +329,22 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) suite.Require().NoError(err) }, - true, + nil, }, { - "fee module locked", func() { - lockFeeModule(suite.chainA) - }, - false, + "application callback fails", func() { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseInit = func( + ctx context.Context, portID, channelID string, + ) error { + return fmt.Errorf("application callback fails") + } + }, errors.New("application callback fails"), }, { - "fee module is not enabled", func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + "fee module locked", func() { + lockFeeModule(suite.chainA) }, - true, + types.ErrFeeModuleLocked, }, } @@ -387,18 +370,15 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { tc.malleate() - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) err = cbs.OnChanCloseInit(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -414,19 +394,16 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { - "success", func() {}, true, + "success", func() {}, nil, }, { - "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseConfirm = func( - ctx sdk.Context, portID, channelID string, - ) error { - return fmt.Errorf("application callback fails") - } - }, false, + "fee module is not enabled", func() { + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + }, + nil, }, { "RefundChannelFeesOnClosure continues - refund address is invalid", func() { @@ -438,19 +415,22 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { err := suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), refundAcc, types.ModuleName, fee.Total()) suite.Require().NoError(err) }, - true, + nil, }, { - "fee module locked", func() { - lockFeeModule(suite.chainA) - }, - false, + "application callback fails", func() { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanCloseConfirm = func( + ctx context.Context, portID, channelID string, + ) error { + return fmt.Errorf("application callback fails") + } + }, errors.New("application callback fails"), }, { - "fee module is not enabled", func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + "fee module locked", func() { + lockFeeModule(suite.chainA) }, - true, + types.ErrFeeModuleLocked, }, } @@ -477,18 +457,15 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { tc.malleate() - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) err = cbs.OnChanCloseConfirm(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -513,7 +490,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { func() { // setup mock callback suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnRecvPacket = func( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -556,10 +533,8 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { packet := suite.CreateMockPacket() // set up module and callbacks - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyPayeeAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) @@ -619,7 +594,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { testCases := []struct { name string malleate func() - expPass bool + expErr error expResult func() }{ { @@ -629,7 +604,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { relayerAccBalance := sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), relayerAddr, sdk.DefaultBondDenom)) expPayeeAccBalance = relayerAccBalance.Add(packetFee.Fee.RecvFee...).Add(packetFee.Fee.AckFee...) }, - true, + nil, func() { // assert that the packet fees have been distributed found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -654,7 +629,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { relayerAccBalance := sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), relayerAddr, sdk.DefaultBondDenom)) expPayeeAccBalance = relayerAccBalance.Add(packetFee.Fee.RecvFee...).Add(packetFee.Fee.AckFee...) }, - true, + nil, func() { // assert that the packet fees have been distributed found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -688,7 +663,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { payeeAccBalance := sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), payeeAddr, sdk.DefaultBondDenom)) expPayeeAccBalance = payeeAccBalance.Add(packetFee.Fee.RecvFee...).Add(packetFee.Fee.AckFee...) }, - true, + nil, func() { // assert that the packet fees have been distributed found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -713,7 +688,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { ForwardRelayerAddress: "", }.Acknowledgement() }, - true, + nil, func() { found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) suite.Require().False(found) @@ -725,7 +700,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) ack = ibcmock.MockAcknowledgement.Acknowledgement() }, - true, + nil, func() {}, }, { @@ -733,7 +708,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { func() { lockFeeModule(suite.chainA) }, - true, + nil, func() { suite.Require().Equal(true, suite.chainA.GetSimApp().IBCFeeKeeper.IsLocked(suite.chainA.GetContext())) }, @@ -750,7 +725,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { relayerAccBalance := sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), relayerAddr, sdk.DefaultBondDenom)) expPayeeAccBalance = relayerAccBalance.Add(packetFee.Fee.AckFee...) }, - true, + nil, func() { // assert that the packet fees have been distributed found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -770,7 +745,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { func() { escrowAmount = sdk.NewCoins() }, - true, + nil, func() { suite.Require().Equal(true, suite.chainA.GetSimApp().IBCFeeKeeper.IsLocked(suite.chainA.GetContext())) }, @@ -780,7 +755,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { func() { ack = []byte("unsupported acknowledgement format") }, - false, + ibcerrors.ErrInvalidType, func() {}, }, { @@ -794,17 +769,17 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { suite.path.EndpointA.ChannelID, ) }, - false, + errors.New("failed to create sdk.Address from payee"), func() {}, }, { "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnAcknowledgementPacket = func(_ sdk.Context, _ string, _ channeltypes.Packet, _ []byte, _ sdk.AccAddress) error { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnAcknowledgementPacket = func(_ context.Context, _ string, _ channeltypes.Packet, _ []byte, _ sdk.AccAddress) error { return fmt.Errorf("mock fee app callback fails") } }, - false, + errors.New("mock fee app callback fails"), func() {}, }, } @@ -835,18 +810,15 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { initialRefundAccBal = sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), refundAddr, sdk.DefaultBondDenom)) // retrieve module callbacks - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) err = cbs.OnAcknowledgementPacket(suite.chainA.GetContext(), suite.path.EndpointA.GetChannel().Version, packet, ack, relayerAddr) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } tc.expResult() @@ -869,7 +841,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { testCases := []struct { name string malleate func() - expPass bool + expErr error expResult func() }{ { @@ -879,7 +851,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { refundAccBalance := sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), refundAddr, sdk.DefaultBondDenom)) expRefundAccBalance = refundAccBalance }, - true, + nil, func() { // assert that the packet fees have been distributed found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -906,7 +878,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { refundAccBalance := sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), refundAddr, sdk.DefaultBondDenom)) expRefundAccBalance = refundAccBalance.Add(refundCoins...) }, - true, + nil, func() { // assert that the packet fees have been distributed found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -939,7 +911,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { refundAccBalance := sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), refundAddr, sdk.DefaultBondDenom)) expRefundAccBalance = refundAccBalance }, - true, + nil, func() { // assert that the packet fees have been distributed found := suite.chainA.GetSimApp().IBCFeeKeeper.HasFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -958,7 +930,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { func() { suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) }, - true, + nil, func() {}, }, { @@ -966,7 +938,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { func() { lockFeeModule(suite.chainA) }, - true, + nil, func() { suite.Require().Equal(true, suite.chainA.GetSimApp().IBCFeeKeeper.IsLocked(suite.chainA.GetContext())) }, @@ -976,7 +948,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { func() { suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeesInEscrow(suite.chainA.GetContext(), packetID) }, - true, + nil, func() {}, }, { @@ -984,7 +956,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { func() { relayerAddr = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() }, - true, + nil, func() {}, }, { @@ -992,7 +964,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { func() { escrowAmount = sdk.NewCoins() }, - true, + nil, func() { suite.Require().Equal(true, suite.chainA.GetSimApp().IBCFeeKeeper.IsLocked(suite.chainA.GetContext())) }, @@ -1008,17 +980,17 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { suite.path.EndpointA.ChannelID, ) }, - false, + errors.New("failed to create sdk.Address from payee"), func() {}, }, { "application callback fails", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnTimeoutPacket = func(_ sdk.Context, _ string, _ channeltypes.Packet, _ sdk.AccAddress) error { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnTimeoutPacket = func(_ context.Context, _ string, _ channeltypes.Packet, _ sdk.AccAddress) error { return fmt.Errorf("mock fee app callback fails") } }, - false, + errors.New("mock fee app callback fails"), func() {}, }, } @@ -1046,18 +1018,15 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { initialRelayerAccBal = sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), relayerAddr, sdk.DefaultBondDenom)) // retrieve module callbacks - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) err = cbs.OnTimeoutPacket(suite.chainA.GetContext(), suite.path.EndpointA.GetChannel().Version, packet, relayerAddr) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } tc.expResult() @@ -1098,7 +1067,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeInit() { path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = ibctesting.InvalidID path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = ibctesting.InvalidID - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeInit = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeInit = func(_ context.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { // intentionally force the error here so we can assert that a passthrough occurs when fees should not be enabled for this channel return "", ibcmock.MockApplicationCallbackError } @@ -1117,7 +1086,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeInit() { { "underlying app callback returns error", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeInit = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeInit = func(_ context.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { return "", ibcmock.MockApplicationCallbackError } }, @@ -1205,7 +1174,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeTry() { suite.coordinator.CommitBlock(suite.chainA) // intentionally force the error here so we can assert that a passthrough occurs when fees should not be enabled for this channel - suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { + suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ context.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { return "", ibcmock.MockApplicationCallbackError } }, @@ -1227,7 +1196,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeTry() { { "underlying app callback returns error", func() { - suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ sdk.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { + suite.chainB.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeTry = func(_ context.Context, _, _ string, _ channeltypes.Order, _ []string, _ string) (string, error) { return "", ibcmock.MockApplicationCallbackError } }, @@ -1302,7 +1271,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeAck() { suite.coordinator.CommitBlock(suite.chainB) - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeAck = func(_ sdk.Context, _, _, _ string) error { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeAck = func(_ context.Context, _, _, _ string) error { return types.ErrInvalidVersion } }, @@ -1324,7 +1293,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeAck() { { "underlying app callback returns error", func() { - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeAck = func(_ sdk.Context, _, _, _ string) error { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeAck = func(_ context.Context, _, _, _ string) error { return ibcmock.MockApplicationCallbackError } }, @@ -1361,10 +1330,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeAck() { counterpartyUpgrade := path.EndpointB.GetChannelUpgrade() - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) @@ -1395,7 +1361,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeOpen() { "success: enable fees", func() { // Assert in callback that correct upgrade information is passed - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeOpen = func(_ sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeOpen = func(_ context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) { suite.Require().Equal(path.EndpointA.ChannelConfig.PortID, portID) suite.Require().Equal(path.EndpointA.ChannelID, channelID) suite.Require().Equal(channeltypes.UNORDERED, order) @@ -1425,7 +1391,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeOpen() { path.Setup() // Assert in callback that correct version is passed - suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeOpen = func(_ sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) { + suite.chainA.GetSimApp().FeeMockModule.IBCApp.OnChanUpgradeOpen = func(_ context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) { suite.Require().Equal(path.EndpointA.ChannelConfig.PortID, portID) suite.Require().Equal(path.EndpointA.ChannelID, channelID) suite.Require().Equal(channeltypes.UNORDERED, order) @@ -1471,10 +1437,7 @@ func (suite *FeeTestSuite) TestOnChanUpgradeOpen() { err = path.EndpointB.ChanUpgradeConfirm() suite.Require().NoError(err) - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) @@ -1547,10 +1510,7 @@ func (suite *FeeTestSuite) TestGetAppVersion() { // malleate test case tc.malleate() - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) feeModule, ok := cbs.(porttypes.ICS4Wrapper) @@ -1570,10 +1530,7 @@ func (suite *FeeTestSuite) TestGetAppVersion() { } func (suite *FeeTestSuite) TestPacketDataUnmarshalerInterface() { - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.MockFeePort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) suite.Require().True(ok) feeModule, ok := cbs.(porttypes.PacketDataUnmarshaler) diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index 6fea91f84eb..36571450fb0 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -2,6 +2,7 @@ package keeper import ( "bytes" + "context" "fmt" errorsmod "cosmossdk.io/errors" @@ -13,7 +14,7 @@ import ( ) // escrowPacketFee sends the packet fee to the 29-fee module account to hold in escrow -func (k Keeper) escrowPacketFee(ctx sdk.Context, packetID channeltypes.PacketId, packetFee types.PacketFee) error { +func (k Keeper) escrowPacketFee(ctx context.Context, packetID channeltypes.PacketId, packetFee types.PacketFee) error { // check if the refund address is valid refundAddr, err := sdk.AccAddressFromBech32(packetFee.RefundAddress) if err != nil { @@ -46,10 +47,11 @@ func (k Keeper) escrowPacketFee(ctx sdk.Context, packetID channeltypes.PacketId, } // DistributePacketFeesOnAcknowledgement pays all the acknowledgement & receive fees for a given packetID while refunding the timeout fees to the refund account. -func (k Keeper) DistributePacketFeesOnAcknowledgement(ctx sdk.Context, forwardRelayer string, reverseRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId) { +func (k Keeper) DistributePacketFeesOnAcknowledgement(ctx context.Context, forwardRelayer string, reverseRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId) { // cache context before trying to distribute fees // if the escrow account has insufficient balance then we want to avoid partially distributing fees - cacheCtx, writeFn := ctx.CacheContext() + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + cacheCtx, writeFn := sdkCtx.CacheContext() // forward relayer address will be empty if conversion fails forwardAddr, _ := sdk.AccAddressFromBech32(forwardRelayer) @@ -84,7 +86,7 @@ func (k Keeper) DistributePacketFeesOnAcknowledgement(ctx sdk.Context, forwardRe // distributePacketFeeOnAcknowledgement pays the receive fee for a given packetID while refunding the timeout fee to the refund account associated with the Fee. // If there was no forward relayer or the associated forward relayer address is blocked, the receive fee is refunded. -func (k Keeper) distributePacketFeeOnAcknowledgement(ctx sdk.Context, refundAddr, forwardRelayer, reverseRelayer sdk.AccAddress, packetFee types.PacketFee) { +func (k Keeper) distributePacketFeeOnAcknowledgement(ctx context.Context, refundAddr, forwardRelayer, reverseRelayer sdk.AccAddress, packetFee types.PacketFee) { // distribute fee to valid forward relayer address otherwise refund the fee if !forwardRelayer.Empty() && !k.bankKeeper.BlockedAddr(forwardRelayer) { // distribute fee for forward relaying @@ -103,10 +105,11 @@ func (k Keeper) distributePacketFeeOnAcknowledgement(ctx sdk.Context, refundAddr } // DistributePacketFeesOnTimeout pays all the timeout fees for a given packetID while refunding the acknowledgement & receive fees to the refund account. -func (k Keeper) DistributePacketFeesOnTimeout(ctx sdk.Context, timeoutRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId) { +func (k Keeper) DistributePacketFeesOnTimeout(ctx context.Context, timeoutRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId) { // cache context before trying to distribute fees // if the escrow account has insufficient balance then we want to avoid partially distributing fees - cacheCtx, writeFn := ctx.CacheContext() + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + cacheCtx, writeFn := sdkCtx.CacheContext() for _, packetFee := range packetFees { if !k.EscrowAccountHasBalance(cacheCtx, packetFee.Fee.Total()) { @@ -137,7 +140,7 @@ func (k Keeper) DistributePacketFeesOnTimeout(ctx sdk.Context, timeoutRelayer sd } // distributePacketFeeOnTimeout pays the timeout fee to the timeout relayer and refunds the acknowledgement & receive fee. -func (k Keeper) distributePacketFeeOnTimeout(ctx sdk.Context, refundAddr, timeoutRelayer sdk.AccAddress, packetFee types.PacketFee) { +func (k Keeper) distributePacketFeeOnTimeout(ctx context.Context, refundAddr, timeoutRelayer sdk.AccAddress, packetFee types.PacketFee) { // distribute fee for timeout relaying k.distributeFee(ctx, timeoutRelayer, refundAddr, packetFee.Fee.TimeoutFee) @@ -149,9 +152,10 @@ func (k Keeper) distributePacketFeeOnTimeout(ctx sdk.Context, refundAddr, timeou // distributeFee will attempt to distribute the escrowed fee to the receiver address. // If the distribution fails for any reason (such as the receiving address being blocked), // the state changes will be discarded. -func (k Keeper) distributeFee(ctx sdk.Context, receiver, refundAccAddress sdk.AccAddress, fee sdk.Coins) { +func (k Keeper) distributeFee(ctx context.Context, receiver, refundAccAddress sdk.AccAddress, fee sdk.Coins) { // cache context before trying to distribute fees - cacheCtx, writeFn := ctx.CacheContext() + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + cacheCtx, writeFn := sdkCtx.CacheContext() err := k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, receiver, fee) if err != nil { @@ -181,12 +185,13 @@ func (k Keeper) distributeFee(ctx sdk.Context, receiver, refundAccAddress sdk.Ac // If the escrow account runs out of balance then fee module will become locked as this implies the presence // of a severe bug. When the fee module is locked, no fee distributions will be performed. // Please see ADR 004 for more information. -func (k Keeper) RefundFeesOnChannelClosure(ctx sdk.Context, portID, channelID string) error { +func (k Keeper) RefundFeesOnChannelClosure(ctx context.Context, portID, channelID string) error { identifiedPacketFees := k.GetIdentifiedPacketFeesForChannel(ctx, portID, channelID) // cache context before trying to distribute fees // if the escrow account has insufficient balance then we want to avoid partially distributing fees - cacheCtx, writeFn := ctx.CacheContext() + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + cacheCtx, writeFn := sdkCtx.CacheContext() for _, identifiedPacketFee := range identifiedPacketFees { var unRefundedFees []types.PacketFee diff --git a/modules/apps/29-fee/keeper/events.go b/modules/apps/29-fee/keeper/events.go index d5883be5443..683339a55ff 100644 --- a/modules/apps/29-fee/keeper/events.go +++ b/modules/apps/29-fee/keeper/events.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -11,7 +12,7 @@ import ( // emitIncentivizedPacketEvent emits an event containing information on the total amount of fees incentivizing // a specific packet. It should be emitted on every fee escrowed for the given packetID. -func emitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId, packetFees types.PacketFees) { +func emitIncentivizedPacketEvent(ctx context.Context, packetID channeltypes.PacketId, packetFees types.PacketFees) { var ( totalRecvFees sdk.Coins totalAckFees sdk.Coins @@ -26,8 +27,8 @@ func emitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId totalTimeoutFees = totalTimeoutFees.Add(fee.Fee.TimeoutFee...) } } - - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeIncentivizedPacket, sdk.NewAttribute(channeltypes.AttributeKeyPortID, packetID.PortId), @@ -45,8 +46,9 @@ func emitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId } // emitRegisterPayeeEvent emits an event containing information of a registered payee for a relayer on a particular channel -func emitRegisterPayeeEvent(ctx sdk.Context, relayer, payee, channelID string) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitRegisterPayeeEvent(ctx context.Context, relayer, payee, channelID string) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeRegisterPayee, sdk.NewAttribute(types.AttributeKeyRelayer, relayer), @@ -61,8 +63,9 @@ func emitRegisterPayeeEvent(ctx sdk.Context, relayer, payee, channelID string) { } // emitRegisterCounterpartyPayeeEvent emits an event containing information of a registered counterparty payee for a relayer on a particular channel -func emitRegisterCounterpartyPayeeEvent(ctx sdk.Context, relayer, counterpartyPayee, channelID string) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitRegisterCounterpartyPayeeEvent(ctx context.Context, relayer, counterpartyPayee, channelID string) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeRegisterCounterpartyPayee, sdk.NewAttribute(types.AttributeKeyRelayer, relayer), @@ -77,8 +80,9 @@ func emitRegisterCounterpartyPayeeEvent(ctx sdk.Context, relayer, counterpartyPa } // emitDistributeFeeEvent emits an event containing a distribution fee and receiver address -func emitDistributeFeeEvent(ctx sdk.Context, receiver string, fee sdk.Coins) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitDistributeFeeEvent(ctx context.Context, receiver string, fee sdk.Coins) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeDistributeFee, sdk.NewAttribute(types.AttributeKeyReceiver, receiver), diff --git a/modules/apps/29-fee/keeper/genesis.go b/modules/apps/29-fee/keeper/genesis.go index 913f24c72fd..c407238f772 100644 --- a/modules/apps/29-fee/keeper/genesis.go +++ b/modules/apps/29-fee/keeper/genesis.go @@ -1,13 +1,13 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" ) // InitGenesis initializes the fee middleware application state from a provided genesis state -func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { +func (k Keeper) InitGenesis(ctx context.Context, state types.GenesisState) { for _, identifiedFees := range state.IdentifiedFees { k.SetFeesInEscrow(ctx, identifiedFees.PacketId, types.NewPacketFees(identifiedFees.PacketFees)) } @@ -30,7 +30,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { } // ExportGenesis returns the fee middleware application exported genesis -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { +func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { return &types.GenesisState{ IdentifiedFees: k.GetAllIdentifiedPacketFees(ctx), FeeEnabledChannels: k.GetAllFeeEnabledChannels(ctx), diff --git a/modules/apps/29-fee/keeper/grpc_query.go b/modules/apps/29-fee/keeper/grpc_query.go index 508c6f6fc89..cd6a0e05f33 100644 --- a/modules/apps/29-fee/keeper/grpc_query.go +++ b/modules/apps/29-fee/keeper/grpc_query.go @@ -9,6 +9,7 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" @@ -20,15 +21,14 @@ import ( var _ types.QueryServer = (*Keeper)(nil) // IncentivizedPackets implements the Query/IncentivizedPackets gRPC method -func (k Keeper) IncentivizedPackets(goCtx context.Context, req *types.QueryIncentivizedPacketsRequest) (*types.QueryIncentivizedPacketsResponse, error) { +func (k Keeper) IncentivizedPackets(ctx context.Context, req *types.QueryIncentivizedPacketsRequest) (*types.QueryIncentivizedPacketsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - ctx := sdk.UnwrapSDKContext(goCtx).WithBlockHeight(int64(req.QueryHeight)) - var identifiedPackets []types.IdentifiedPacketFees - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.FeesInEscrowPrefix)) + + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.FeesInEscrowPrefix)) pagination, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { packetID, err := types.ParseKeyFeesInEscrow(types.FeesInEscrowPrefix + string(key)) if err != nil { @@ -90,7 +90,7 @@ func (k Keeper) IncentivizedPacketsForChannel(goCtx context.Context, req *types. var packets []*types.IdentifiedPacketFees keyPrefix := types.KeyFeesInEscrowChannelPrefix(req.PortId, req.ChannelId) - store := prefix.NewStore(ctx.KVStore(k.storeKey), keyPrefix) + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), keyPrefix) pagination, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { packetID, err := types.ParseKeyFeesInEscrow(string(keyPrefix) + string(key)) if err != nil { @@ -229,15 +229,13 @@ func (k Keeper) CounterpartyPayee(goCtx context.Context, req *types.QueryCounter } // FeeEnabledChannels implements the Query/FeeEnabledChannels gRPC method and returns a list of fee enabled channels -func (k Keeper) FeeEnabledChannels(goCtx context.Context, req *types.QueryFeeEnabledChannelsRequest) (*types.QueryFeeEnabledChannelsResponse, error) { +func (k Keeper) FeeEnabledChannels(ctx context.Context, req *types.QueryFeeEnabledChannelsRequest) (*types.QueryFeeEnabledChannelsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - ctx := sdk.UnwrapSDKContext(goCtx).WithBlockHeight(int64(req.QueryHeight)) - var feeEnabledChannels []types.FeeEnabledChannel - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(types.FeeEnabledKeyPrefix)) + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.FeeEnabledKeyPrefix)) pagination, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { portID, channelID, err := types.ParseKeyFeeEnabled(types.FeeEnabledKeyPrefix + string(key)) if err != nil { diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index bf93096744e..3732be86f01 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -24,7 +24,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", @@ -50,22 +50,22 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() { QueryHeight: 0, } }, - true, + "", }, { - "empty request", + "empty pagination", func() { - req = nil + expectedPackets = nil + req = &types.QueryIncentivizedPacketsRequest{} }, - false, + "", }, { - "empty pagination", + "empty request", func() { - expectedPackets = nil - req = &types.QueryIncentivizedPacketsRequest{} + req = nil }, - true, + "InvalidArgument", }, } @@ -81,12 +81,12 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() { res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPackets(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(expectedPackets, res.IncentivizedPackets) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -98,19 +98,19 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, + "", }, { "empty request", func() { req = nil }, - false, + "InvalidArgument", }, { "fees not found for packet id", @@ -120,7 +120,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() { QueryHeight: 0, } }, - false, + "NotFound", }, } @@ -149,12 +149,12 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPacket(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(types.NewIdentifiedPacketFees(packetID, []types.PacketFee{packetFee, packetFee, packetFee}), res.IncentivizedPacket) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -177,7 +177,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() { testCases := []struct { msg string malleate func() - expPass bool + errMsg string }{ { "empty pagination", @@ -192,7 +192,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() { QueryHeight: 0, } }, - true, + "", }, { "success", @@ -215,14 +215,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() { suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), identifiedPacketFees.PacketId, types.NewPacketFees(identifiedPacketFees.PacketFees)) } }, - true, - }, - { - "empty request", - func() { - req = nil - }, - false, + "", }, { "no packets for specified channel", @@ -240,7 +233,14 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() { QueryHeight: 0, } }, - true, + "", + }, + { + "empty request", + func() { + req = nil + }, + "InvalidArgument", }, { "channel not found", @@ -250,7 +250,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() { ChannelId: ibctesting.InvalidID, } }, - false, + "NotFound", }, { "invalid ID", @@ -260,7 +260,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() { ChannelId: "test-channel-id", } }, - false, + "InvalidArgument", }, } @@ -294,12 +294,12 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketsForChannel() { res, err := suite.chainA.GetSimApp().IBCFeeKeeper.IncentivizedPacketsForChannel(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(expIdentifiedPacketFees, res.IncentivizedPackets) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -311,26 +311,26 @@ func (suite *KeeperTestSuite) TestQueryTotalRecvFees() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, + "", }, { "empty request", func() { req = nil }, - false, + "InvalidArgument", }, { "packet not found", func() { req.PacketId = channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 100) }, - false, + "NotFound", }, } @@ -359,7 +359,7 @@ func (suite *KeeperTestSuite) TestQueryTotalRecvFees() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalRecvFees(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().NotNil(res) @@ -367,7 +367,7 @@ func (suite *KeeperTestSuite) TestQueryTotalRecvFees() { expectedFees := defaultRecvFee.Add(defaultRecvFee...).Add(defaultRecvFee...) suite.Require().Equal(expectedFees, res.RecvFees) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -379,26 +379,26 @@ func (suite *KeeperTestSuite) TestQueryTotalAckFees() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, + "", }, { "empty request", func() { req = nil }, - false, + "InvalidArgument", }, { "packet not found", func() { req.PacketId = channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 100) }, - false, + "NotFound", }, } @@ -427,7 +427,7 @@ func (suite *KeeperTestSuite) TestQueryTotalAckFees() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalAckFees(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().NotNil(res) @@ -435,7 +435,7 @@ func (suite *KeeperTestSuite) TestQueryTotalAckFees() { expectedFees := defaultAckFee.Add(defaultAckFee...).Add(defaultAckFee...) suite.Require().Equal(expectedFees, res.AckFees) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -447,26 +447,26 @@ func (suite *KeeperTestSuite) TestQueryTotalTimeoutFees() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, + "", }, { "empty request", func() { req = nil }, - false, + "InvalidArgument", }, { "packet not found", func() { req.PacketId = channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 100) }, - false, + "NotFound", }, } @@ -495,7 +495,7 @@ func (suite *KeeperTestSuite) TestQueryTotalTimeoutFees() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.TotalTimeoutFees(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().NotNil(res) @@ -503,7 +503,7 @@ func (suite *KeeperTestSuite) TestQueryTotalTimeoutFees() { expectedFees := defaultTimeoutFee.Add(defaultTimeoutFee...).Add(defaultTimeoutFee...) suite.Require().Equal(expectedFees, res.TimeoutFees) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -515,33 +515,33 @@ func (suite *KeeperTestSuite) TestQueryPayee() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, + "", }, { "empty request", func() { req = nil }, - false, + "InvalidArgument", }, { "payee address not found: invalid channel", func() { req.ChannelId = "invalid-channel-id" //nolint:goconst }, - false, + "NotFound", }, { "payee address not found: invalid relayer address", func() { req.Relayer = "invalid-addr" //nolint:goconst }, - false, + "NotFound", }, } @@ -571,11 +571,11 @@ func (suite *KeeperTestSuite) TestQueryPayee() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.Payee(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().Equal(expPayeeAddr.String(), res.PayeeAddress) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -587,33 +587,33 @@ func (suite *KeeperTestSuite) TestQueryCounterpartyPayee() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, + "", }, { "empty request", func() { req = nil }, - false, + "InvalidArgument", }, { "counterparty address not found: invalid channel", func() { req.ChannelId = "invalid-channel-id" }, - false, + "NotFound", }, { "counterparty address not found: invalid address", func() { req.Relayer = "invalid-addr" }, - false, + "NotFound", }, } @@ -643,16 +643,61 @@ func (suite *KeeperTestSuite) TestQueryCounterpartyPayee() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.CounterpartyPayee(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().Equal(expCounterpartyPayeeAddr.String(), res.CounterpartyPayee) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } } +func (suite *KeeperTestSuite) TestQueryFeeEnabledChannelsWithPagination() { + suite.SetupTest() // reset + + suite.path.Setup() + + expChannel := types.FeeEnabledChannel{ + PortId: suite.path.EndpointA.ChannelConfig.PortID, + ChannelId: suite.path.EndpointA.ChannelID, + } + + expFeeEnabledChannels := []types.FeeEnabledChannel{expChannel} + + req := &types.QueryFeeEnabledChannelsRequest{ + Pagination: &query.PageRequest{ + Limit: 5, + CountTotal: false, + }, + QueryHeight: 0, + } + + // Extract the next available sequence number for channel IDs. + nextSeq := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetNextChannelSequence(suite.chainA.GetContext()) + for i := 0; i < 8; i++ { + channelID := channeltypes.FormatChannelIdentifier(uint64(i + int(nextSeq))) + suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), ibctesting.MockFeePort, channelID) + + expChannel := types.FeeEnabledChannel{ + PortId: ibctesting.MockFeePort, + ChannelId: channelID, + } + + if i < 4 { // add only the first 5 channels, as our default pagination limit is 5 + expFeeEnabledChannels = append(expFeeEnabledChannels, expChannel) + } + } + + suite.chainA.NextBlock() + + ctx := suite.chainA.GetContext() + res, err := suite.chainA.GetSimApp().IBCFeeKeeper.FeeEnabledChannels(ctx, req) + + suite.Require().NoError(err) + suite.Require().Equal(expFeeEnabledChannels, res.FeeEnabledChannels) +} + func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() { var ( req *types.QueryFeeEnabledChannelsRequest @@ -662,26 +707,19 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, - }, - { - "empty request", - func() { - req = nil - }, - false, + "", }, { "success: empty pagination", func() { req = &types.QueryFeeEnabledChannelsRequest{} }, - true, + "", }, { "success: with multiple fee enabled channels", @@ -695,30 +733,14 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() { expFeeEnabledChannels = append(expFeeEnabledChannels, expChannel) }, - true, + "", }, { - "success: pagination with multiple fee enabled channels", + "failure: empty request", func() { - // Extract the next available sequence number for channel IDs. - nextSeq := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetNextChannelSequence(suite.chainA.GetContext()) - for i := 0; i < 9; i++ { - channelID := channeltypes.FormatChannelIdentifier(uint64(i + int(nextSeq))) - suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), ibctesting.MockFeePort, channelID) - - expChannel := types.FeeEnabledChannel{ - PortId: ibctesting.MockFeePort, - ChannelId: channelID, - } - - if i < 4 { // add only the first 5 channels, as our default pagination limit is 5 - expFeeEnabledChannels = append(expFeeEnabledChannels, expChannel) - } - } - - suite.chainA.NextBlock() + req = nil }, - true, + "InvalidArgument", }, { "empty response", @@ -728,7 +750,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() { suite.chainA.NextBlock() }, - true, + "", }, } @@ -760,11 +782,11 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannels() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.FeeEnabledChannels(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().Equal(expFeeEnabledChannels, res.FeeEnabledChannels) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } @@ -780,20 +802,12 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannel() { testCases := []struct { name string malleate func() - expPass bool + errMsg string }{ { "success", func() {}, - true, - }, - { - "empty request", - func() { - req = nil - expEnabled = false - }, - false, + "", }, { "fee not enabled on channel", @@ -807,14 +821,22 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannel() { ChannelId: path.EndpointA.ChannelID, } }, - true, + "", + }, + { + "empty request", + func() { + req = nil + expEnabled = false + }, + "InvalidArgument", }, { "channel not found", func() { req.ChannelId = ibctesting.InvalidID }, - false, + "NotFound", }, { "invalid ID", @@ -824,7 +846,7 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannel() { ChannelId: "test-channel-id", } }, - false, + "InvalidArgument", }, } @@ -848,11 +870,11 @@ func (suite *KeeperTestSuite) TestQueryFeeEnabledChannel() { ctx := suite.chainA.GetContext() res, err := suite.chainA.GetSimApp().IBCFeeKeeper.FeeEnabledChannel(ctx, req) - if tc.expPass { + if tc.errMsg == "" { suite.Require().NoError(err) suite.Require().Equal(expEnabled, res.FeeEnabled) } else { - suite.Require().Error(err) + suite.Require().ErrorContains(err, tc.errMsg) } }) } diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 74228c9477b..641fa156932 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -1,13 +1,16 @@ package keeper import ( + "context" + + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" @@ -16,35 +19,30 @@ import ( // Middleware must implement types.ChannelKeeper and types.PortKeeper expected interfaces // so that it can wrap IBC channel and port logic for underlying application. -var ( - _ types.ChannelKeeper = (*Keeper)(nil) - _ types.PortKeeper = (*Keeper)(nil) -) +var _ types.ChannelKeeper = (*Keeper)(nil) // Keeper defines the IBC fungible transfer keeper type Keeper struct { - storeKey storetypes.StoreKey - cdc codec.BinaryCodec + storeService corestore.KVStoreService + cdc codec.BinaryCodec authKeeper types.AccountKeeper ics4Wrapper porttypes.ICS4Wrapper channelKeeper types.ChannelKeeper - portKeeper types.PortKeeper bankKeeper types.BankKeeper } // NewKeeper creates a new 29-fee Keeper instance func NewKeeper( - cdc codec.BinaryCodec, key storetypes.StoreKey, + cdc codec.BinaryCodec, storeService corestore.KVStoreService, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, - portKeeper types.PortKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, ) Keeper { return Keeper{ cdc: cdc, - storeKey: key, + storeService: storeService, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, authKeeper: authKeeper, bankKeeper: bankKeeper, } @@ -63,33 +61,28 @@ func (k Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper { } // Logger returns a module-specific logger. -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+ibcexported.ModuleName+"-"+types.ModuleName) -} - -// BindPort defines a wrapper function for the port Keeper's function in -// order to expose it to module's InitGenesis function -func (k Keeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability { - return k.portKeeper.BindPort(ctx, portID) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", "x/"+ibcexported.ModuleName+"-"+types.ModuleName) } // GetChannel wraps IBC ChannelKeeper's GetChannel function -func (k Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool) { +func (k Keeper) GetChannel(ctx context.Context, portID, channelID string) (channeltypes.Channel, bool) { return k.channelKeeper.GetChannel(ctx, portID, channelID) } // HasChannel returns true if the channel with the given identifiers exists in state. -func (k Keeper) HasChannel(ctx sdk.Context, portID, channelID string) bool { +func (k Keeper) HasChannel(ctx context.Context, portID, channelID string) bool { return k.channelKeeper.HasChannel(ctx, portID, channelID) } // GetPacketCommitment wraps IBC ChannelKeeper's GetPacketCommitment function -func (k Keeper) GetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) []byte { +func (k Keeper) GetPacketCommitment(ctx context.Context, portID, channelID string, sequence uint64) []byte { return k.channelKeeper.GetPacketCommitment(ctx, portID, channelID, sequence) } // GetNextSequenceSend wraps IBC ChannelKeeper's GetNextSequenceSend function -func (k Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) { +func (k Keeper) GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) { return k.channelKeeper.GetNextSequenceSend(ctx, portID, channelID) } @@ -99,7 +92,7 @@ func (k Keeper) GetFeeModuleAddress() sdk.AccAddress { } // EscrowAccountHasBalance verifies if the escrow account has the provided fee. -func (k Keeper) EscrowAccountHasBalance(ctx sdk.Context, coins sdk.Coins) bool { +func (k Keeper) EscrowAccountHasBalance(ctx context.Context, coins sdk.Coins) bool { for _, coin := range coins { if !k.bankKeeper.HasBalance(ctx, k.GetFeeModuleAddress(), coin) { return false @@ -112,43 +105,57 @@ func (k Keeper) EscrowAccountHasBalance(ctx sdk.Context, coins sdk.Coins) bool { // lockFeeModule sets a flag to determine if fee handling logic should run for the given channel // identified by channel and port identifiers. // Please see ADR 004 for more information. -func (k Keeper) lockFeeModule(ctx sdk.Context) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyLocked(), []byte{1}) +func (k Keeper) lockFeeModule(ctx context.Context) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(types.KeyLocked(), []byte{1}); err != nil { + panic(err) + } } // IsLocked indicates if the fee module is locked // Please see ADR 004 for more information. -func (k Keeper) IsLocked(ctx sdk.Context) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.KeyLocked()) +func (k Keeper) IsLocked(ctx context.Context) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(types.KeyLocked()) + if err != nil { + panic(err) + } + return has } // SetFeeEnabled sets a flag to determine if fee handling logic should run for the given channel // identified by channel and port identifiers. -func (k Keeper) SetFeeEnabled(ctx sdk.Context, portID, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyFeeEnabled(portID, channelID), []byte{1}) +func (k Keeper) SetFeeEnabled(ctx context.Context, portID, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(types.KeyFeeEnabled(portID, channelID), []byte{1}); err != nil { + panic(err) + } } // DeleteFeeEnabled deletes the fee enabled flag for a given portID and channelID -func (k Keeper) DeleteFeeEnabled(ctx sdk.Context, portID, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyFeeEnabled(portID, channelID)) +func (k Keeper) DeleteFeeEnabled(ctx context.Context, portID, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Delete(types.KeyFeeEnabled(portID, channelID)); err != nil { + panic(err) + } } // IsFeeEnabled returns whether fee handling logic should be run for the given port. It will check the // fee enabled flag for the given port and channel identifiers -func (k Keeper) IsFeeEnabled(ctx sdk.Context, portID, channelID string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.KeyFeeEnabled(portID, channelID)) +func (k Keeper) IsFeeEnabled(ctx context.Context, portID, channelID string) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(types.KeyFeeEnabled(portID, channelID)) + if err != nil { + panic(err) + } + return has } // GetAllFeeEnabledChannels returns a list of all ics29 enabled channels containing portID & channelID that are stored in state -func (k Keeper) GetAllFeeEnabledChannels(ctx sdk.Context) []types.FeeEnabledChannel { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllFeeEnabledChannels(ctx context.Context) []types.FeeEnabledChannel { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(types.FeeEnabledKeyPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var enabledChArr []types.FeeEnabledChannel for ; iterator.Valid(); iterator.Next() { @@ -168,28 +175,35 @@ func (k Keeper) GetAllFeeEnabledChannels(ctx sdk.Context) []types.FeeEnabledChan } // GetPayeeAddress retrieves the fee payee address stored in state given the provided channel identifier and relayer address -func (k Keeper) GetPayeeAddress(ctx sdk.Context, relayerAddr, channelID string) (string, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetPayeeAddress(ctx context.Context, relayerAddr, channelID string) (string, bool) { + store := k.storeService.OpenKVStore(ctx) key := types.KeyPayee(relayerAddr, channelID) - if !store.Has(key) { + bz, err := store.Get(key) + if err != nil { + panic(err) + } + + if len(bz) == 0 { return "", false } - return string(store.Get(key)), true + return string(bz), true } // SetPayeeAddress stores the fee payee address in state keyed by the provided channel identifier and relayer address -func (k Keeper) SetPayeeAddress(ctx sdk.Context, relayerAddr, payeeAddr, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyPayee(relayerAddr, channelID), []byte(payeeAddr)) +func (k Keeper) SetPayeeAddress(ctx context.Context, relayerAddr, payeeAddr, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(types.KeyPayee(relayerAddr, channelID), []byte(payeeAddr)); err != nil { + panic(err) + } } // GetAllPayees returns all registered payees addresses -func (k Keeper) GetAllPayees(ctx sdk.Context) []types.RegisteredPayee { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllPayees(ctx context.Context) []types.RegisteredPayee { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(types.PayeeKeyPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var registeredPayees []types.RegisteredPayee for ; iterator.Valid(); iterator.Next() { @@ -212,29 +226,34 @@ func (k Keeper) GetAllPayees(ctx sdk.Context) []types.RegisteredPayee { // SetCounterpartyPayeeAddress maps the destination chain counterparty payee address to the source relayer address // The receiving chain must store the mapping from: address -> counterpartyPayeeAddress for the given channel -func (k Keeper) SetCounterpartyPayeeAddress(ctx sdk.Context, address, counterpartyAddress, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyCounterpartyPayee(address, channelID), []byte(counterpartyAddress)) +func (k Keeper) SetCounterpartyPayeeAddress(ctx context.Context, address, counterpartyAddress, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(types.KeyCounterpartyPayee(address, channelID), []byte(counterpartyAddress)); err != nil { + panic(err) + } } // GetCounterpartyPayeeAddress gets the counterparty payee address given a destination relayer address -func (k Keeper) GetCounterpartyPayeeAddress(ctx sdk.Context, address, channelID string) (string, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetCounterpartyPayeeAddress(ctx context.Context, address, channelID string) (string, bool) { + store := k.storeService.OpenKVStore(ctx) key := types.KeyCounterpartyPayee(address, channelID) - if !store.Has(key) { - return "", false + addr, err := store.Get(key) + if err != nil { + panic(err) } - addr := string(store.Get(key)) - return addr, true + if len(addr) == 0 { + return "", false + } + return string(addr), true } // GetAllCounterpartyPayees returns all registered counterparty payee addresses -func (k Keeper) GetAllCounterpartyPayees(ctx sdk.Context) []types.RegisteredCounterpartyPayee { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllCounterpartyPayees(ctx context.Context) []types.RegisteredCounterpartyPayee { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(types.CounterpartyPayeeKeyPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var registeredCounterpartyPayees []types.RegisteredCounterpartyPayee for ; iterator.Valid(); iterator.Next() { @@ -256,28 +275,35 @@ func (k Keeper) GetAllCounterpartyPayees(ctx sdk.Context) []types.RegisteredCoun } // SetRelayerAddressForAsyncAck sets the forward relayer address during OnRecvPacket in case of async acknowledgement -func (k Keeper) SetRelayerAddressForAsyncAck(ctx sdk.Context, packetID channeltypes.PacketId, address string) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyRelayerAddressForAsyncAck(packetID), []byte(address)) +func (k Keeper) SetRelayerAddressForAsyncAck(ctx context.Context, packetID channeltypes.PacketId, address string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(types.KeyRelayerAddressForAsyncAck(packetID), []byte(address)); err != nil { + panic(err) + } } // GetRelayerAddressForAsyncAck gets forward relayer address for a particular packet -func (k Keeper) GetRelayerAddressForAsyncAck(ctx sdk.Context, packetID channeltypes.PacketId) (string, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetRelayerAddressForAsyncAck(ctx context.Context, packetID channeltypes.PacketId) (string, bool) { + store := k.storeService.OpenKVStore(ctx) key := types.KeyRelayerAddressForAsyncAck(packetID) - if !store.Has(key) { + + addr, err := store.Get(key) + if err != nil { + panic(err) + } + + if len(addr) == 0 { return "", false } - addr := string(store.Get(key)) - return addr, true + return string(addr), true } // GetAllForwardRelayerAddresses returns all forward relayer addresses stored for async acknowledgements -func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []types.ForwardRelayerAddress { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllForwardRelayerAddresses(ctx context.Context) []types.ForwardRelayerAddress { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(types.ForwardRelayerPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var forwardRelayerAddr []types.ForwardRelayerAddress for ; iterator.Valid(); iterator.Next() { @@ -298,17 +324,22 @@ func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []types.ForwardRe } // DeleteForwardRelayerAddress deletes the forwardRelayerAddr associated with the packetID -func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetID channeltypes.PacketId) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) DeleteForwardRelayerAddress(ctx context.Context, packetID channeltypes.PacketId) { + store := k.storeService.OpenKVStore(ctx) key := types.KeyRelayerAddressForAsyncAck(packetID) - store.Delete(key) + if err := store.Delete(key); err != nil { + panic(err) + } } // GetFeesInEscrow returns all escrowed packet fees for a given packetID -func (k Keeper) GetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) (types.PacketFees, bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetFeesInEscrow(ctx context.Context, packetID channeltypes.PacketId) (types.PacketFees, bool) { + store := k.storeService.OpenKVStore(ctx) key := types.KeyFeesInEscrow(packetID) - bz := store.Get(key) + bz, err := store.Get(key) + if err != nil { + panic(err) + } if len(bz) == 0 { return types.PacketFees{}, false } @@ -317,35 +348,42 @@ func (k Keeper) GetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) } // HasFeesInEscrow returns true if packet fees exist for the provided packetID -func (k Keeper) HasFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) bool { - store := ctx.KVStore(k.storeKey) +func (k Keeper) HasFeesInEscrow(ctx context.Context, packetID channeltypes.PacketId) bool { + store := k.storeService.OpenKVStore(ctx) key := types.KeyFeesInEscrow(packetID) - - return store.Has(key) + has, err := store.Has(key) + if err != nil { + panic(err) + } + return has } // SetFeesInEscrow sets the given packet fees in escrow keyed by the packetID -func (k Keeper) SetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId, fees types.PacketFees) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) SetFeesInEscrow(ctx context.Context, packetID channeltypes.PacketId, fees types.PacketFees) { + store := k.storeService.OpenKVStore(ctx) bz := k.MustMarshalFees(fees) - store.Set(types.KeyFeesInEscrow(packetID), bz) + if err := store.Set(types.KeyFeesInEscrow(packetID), bz); err != nil { + panic(err) + } } // DeleteFeesInEscrow deletes the fee associated with the given packetID -func (k Keeper) DeleteFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) DeleteFeesInEscrow(ctx context.Context, packetID channeltypes.PacketId) { + store := k.storeService.OpenKVStore(ctx) key := types.KeyFeesInEscrow(packetID) - store.Delete(key) + if err := store.Delete(key); err != nil { + panic(err) + } } // GetIdentifiedPacketFeesForChannel returns all the currently escrowed fees on a given channel. -func (k Keeper) GetIdentifiedPacketFeesForChannel(ctx sdk.Context, portID, channelID string) []types.IdentifiedPacketFees { +func (k Keeper) GetIdentifiedPacketFeesForChannel(ctx context.Context, portID, channelID string) []types.IdentifiedPacketFees { var identifiedPacketFees []types.IdentifiedPacketFees - store := ctx.KVStore(k.storeKey) + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.KeyFeesInEscrowChannelPrefix(portID, channelID)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { packetID, err := types.ParseKeyFeesInEscrow(string(iterator.Key())) if err != nil { @@ -362,10 +400,10 @@ func (k Keeper) GetIdentifiedPacketFeesForChannel(ctx sdk.Context, portID, chann } // GetAllIdentifiedPacketFees returns a list of all IdentifiedPacketFees that are stored in state -func (k Keeper) GetAllIdentifiedPacketFees(ctx sdk.Context) []types.IdentifiedPacketFees { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetAllIdentifiedPacketFees(ctx context.Context) []types.IdentifiedPacketFees { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(types.FeesInEscrowPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var identifiedFees []types.IdentifiedPacketFees for ; iterator.Valid(); iterator.Next() { diff --git a/modules/apps/29-fee/keeper/migrations.go b/modules/apps/29-fee/keeper/migrations.go index c4c093de5de..25408c95954 100644 --- a/modules/apps/29-fee/keeper/migrations.go +++ b/modules/apps/29-fee/keeper/migrations.go @@ -3,6 +3,7 @@ package keeper import ( storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" @@ -23,7 +24,7 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate1to2 migrates ibc-fee module from ConsensusVersion 1 to 2 // by refunding leftover fees to the refund address. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - store := ctx.KVStore(m.keeper.storeKey) + store := runtime.KVStoreAdapter(m.keeper.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(types.FeesInEscrowPrefix)) defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index ee1658f16ab..c2c629e95cc 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -1,17 +1,20 @@ package keeper_test import ( + "errors" "fmt" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ibcmock "github.com/cosmos/ibc-go/v9/testing/mock" ) @@ -21,90 +24,92 @@ func (suite *KeeperTestSuite) TestRegisterPayee() { testCases := []struct { name string - expPass bool malleate func() + expErr error }{ { "success", - true, func() {}, + nil, }, { "channel does not exist", - false, func() { msg.ChannelId = "channel-100" //nolint:goconst }, + channeltypes.ErrChannelNotFound, }, { "channel is not fee enabled", - false, func() { suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) }, + types.ErrFeeNotEnabled, }, { "given payee is not an sdk address", - false, func() { msg.Payee = "invalid-addr" }, + errors.New("decoding bech32 failed: invalid separator index -1"), }, { "payee is a blocked address", - false, func() { msg.Payee = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(transfertypes.ModuleName).String() }, + ibcerrors.ErrUnauthorized, }, } for _, tc := range testCases { tc := tc - suite.SetupTest() - suite.path.Setup() + suite.Run(tc.name, func() { + suite.SetupTest() + suite.path.Setup() - msg = types.NewMsgRegisterPayee( - suite.path.EndpointA.ChannelConfig.PortID, - suite.path.EndpointA.ChannelID, - suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), - suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), - ) + msg = types.NewMsgRegisterPayee( + suite.path.EndpointA.ChannelConfig.PortID, + suite.path.EndpointA.ChannelID, + suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), + suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), + ) - tc.malleate() + tc.malleate() - ctx := suite.chainA.GetContext() - res, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterPayee(ctx, msg) + ctx := suite.chainA.GetContext() + res, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterPayee(ctx, msg) - if tc.expPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) + if tc.expErr == nil { + suite.Require().NoError(err) + suite.Require().NotNil(res) - payeeAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetPayeeAddress( - suite.chainA.GetContext(), - suite.chainA.SenderAccount.GetAddress().String(), - suite.path.EndpointA.ChannelID, - ) + payeeAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetPayeeAddress( + suite.chainA.GetContext(), + suite.chainA.SenderAccount.GetAddress().String(), + suite.path.EndpointA.ChannelID, + ) - suite.Require().True(found) - suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), payeeAddr) + suite.Require().True(found) + suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), payeeAddr) - expectedEvents := sdk.Events{ - sdk.NewEvent( - types.EventTypeRegisterPayee, - sdk.NewAttribute(types.AttributeKeyRelayer, suite.chainA.SenderAccount.GetAddress().String()), - sdk.NewAttribute(types.AttributeKeyPayee, payeeAddr), - sdk.NewAttribute(types.AttributeKeyChannelID, suite.path.EndpointA.ChannelID), - ), - }.ToABCIEvents() + expectedEvents := sdk.Events{ + sdk.NewEvent( + types.EventTypeRegisterPayee, + sdk.NewAttribute(types.AttributeKeyRelayer, suite.chainA.SenderAccount.GetAddress().String()), + sdk.NewAttribute(types.AttributeKeyPayee, payeeAddr), + sdk.NewAttribute(types.AttributeKeyChannelID, suite.path.EndpointA.ChannelID), + ), + }.ToABCIEvents() - expectedEvents = sdk.MarkEventsToIndex(expectedEvents, map[string]struct{}{}) - ibctesting.AssertEvents(&suite.Suite, expectedEvents, ctx.EventManager().Events().ToABCIEvents()) + expectedEvents = sdk.MarkEventsToIndex(expectedEvents, map[string]struct{}{}) + ibctesting.AssertEvents(&suite.Suite, expectedEvents, ctx.EventManager().Events().ToABCIEvents()) - } else { - suite.Require().Error(err) - } + } else { + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) + } + }) } } @@ -116,85 +121,87 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyPayee() { testCases := []struct { name string - expPass bool malleate func() + expErr error }{ { "success", - true, func() {}, + nil, }, { "counterparty payee is an arbitrary string", - true, func() { msg.CounterpartyPayee = "arbitrary-string" expCounterpartyPayee = "arbitrary-string" }, + nil, }, { "channel does not exist", - false, func() { msg.ChannelId = "channel-100" }, + channeltypes.ErrChannelNotFound, }, { "channel is not fee enabled", - false, func() { suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) }, + types.ErrFeeNotEnabled, }, } for _, tc := range testCases { tc := tc - suite.SetupTest() - suite.path.Setup() // setup channel + suite.Run(tc.name, func() { + suite.SetupTest() + suite.path.Setup() // setup channel - expCounterpartyPayee = suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String() - msg = types.NewMsgRegisterCounterpartyPayee( - suite.path.EndpointA.ChannelConfig.PortID, - suite.path.EndpointA.ChannelID, - suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), - expCounterpartyPayee, - ) + expCounterpartyPayee = suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String() + msg = types.NewMsgRegisterCounterpartyPayee( + suite.path.EndpointA.ChannelConfig.PortID, + suite.path.EndpointA.ChannelID, + suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), + expCounterpartyPayee, + ) - tc.malleate() + tc.malleate() - ctx := suite.chainA.GetContext() - res, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterCounterpartyPayee(ctx, msg) + ctx := suite.chainA.GetContext() + res, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterCounterpartyPayee(ctx, msg) - if tc.expPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) + if tc.expErr == nil { + suite.Require().NoError(err) + suite.Require().NotNil(res) - counterpartyPayee, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyPayeeAddress( - suite.chainA.GetContext(), - suite.chainA.SenderAccount.GetAddress().String(), - suite.path.EndpointA.ChannelID, - ) + counterpartyPayee, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyPayeeAddress( + suite.chainA.GetContext(), + suite.chainA.SenderAccount.GetAddress().String(), + suite.path.EndpointA.ChannelID, + ) - suite.Require().True(found) - suite.Require().Equal(expCounterpartyPayee, counterpartyPayee) + suite.Require().True(found) + suite.Require().Equal(expCounterpartyPayee, counterpartyPayee) - expectedEvents := sdk.Events{ - sdk.NewEvent( - types.EventTypeRegisterCounterpartyPayee, - sdk.NewAttribute(types.AttributeKeyRelayer, suite.chainA.SenderAccount.GetAddress().String()), - sdk.NewAttribute(types.AttributeKeyCounterpartyPayee, counterpartyPayee), - sdk.NewAttribute(types.AttributeKeyChannelID, suite.path.EndpointA.ChannelID), - ), - }.ToABCIEvents() + expectedEvents := sdk.Events{ + sdk.NewEvent( + types.EventTypeRegisterCounterpartyPayee, + sdk.NewAttribute(types.AttributeKeyRelayer, suite.chainA.SenderAccount.GetAddress().String()), + sdk.NewAttribute(types.AttributeKeyCounterpartyPayee, counterpartyPayee), + sdk.NewAttribute(types.AttributeKeyChannelID, suite.path.EndpointA.ChannelID), + ), + }.ToABCIEvents() - expectedEvents = sdk.MarkEventsToIndex(expectedEvents, map[string]struct{}{}) - ibctesting.AssertEvents(&suite.Suite, expectedEvents, ctx.EventManager().Events().ToABCIEvents()) + expectedEvents = sdk.MarkEventsToIndex(expectedEvents, map[string]struct{}{}) + ibctesting.AssertEvents(&suite.Suite, expectedEvents, ctx.EventManager().Events().ToABCIEvents()) - } else { - suite.Require().Error(err) - } + } else { + suite.Require().ErrorIs(err, tc.expErr) + } + }) } } @@ -210,12 +217,12 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success with existing packet fees in escrow", @@ -235,7 +242,17 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { eventFee = types.NewFee(defaultRecvFee.Add(escrowFee.RecvFee...), defaultAckFee.Add(escrowFee.AckFee...), defaultTimeoutFee.Add(escrowFee.TimeoutFee...)) }, - true, + nil, + }, + { + "refund account is module account", + func() { + suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), ibcmock.ModuleName, fee.Total()) //nolint:errcheck // ignore error for testing + msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(ibcmock.ModuleName).String() + expPacketFee := types.NewPacketFee(fee, msg.Signer, nil) + expFeesInEscrow = []types.PacketFee{expPacketFee} + }, + nil, }, { "bank send enabled for fee denom", @@ -247,24 +264,14 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { ) suite.Require().NoError(err) }, - true, - }, - { - "refund account is module account", - func() { - suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), ibcmock.ModuleName, fee.Total()) //nolint:errcheck // ignore error for testing - msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(ibcmock.ModuleName).String() - expPacketFee := types.NewPacketFee(fee, msg.Signer, nil) - expFeesInEscrow = []types.PacketFee{expPacketFee} - }, - true, + nil, }, { "fee module is locked", func() { lockFeeModule(suite.chainA) }, - false, + types.ErrFeeModuleLocked, }, { "fee module disabled on channel", @@ -272,21 +279,21 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { msg.SourcePortId = "invalid-port" msg.SourceChannelId = "invalid-channel" }, - false, + types.ErrFeeNotEnabled, }, { "invalid refund address", func() { msg.Signer = "invalid-address" }, - false, + errors.New("decoding bech32 failed"), }, { "refund account does not exist", func() { msg.Signer = suite.chainB.SenderAccount.GetAddress().String() }, - false, + types.ErrRefundAccNotFound, }, { "refund account is a blocked address", @@ -294,7 +301,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { blockedAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() msg.Signer = blockedAddr.String() }, - false, + ibcerrors.ErrUnauthorized, }, { "bank send disabled for fee denom", @@ -306,28 +313,28 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { ) suite.Require().NoError(err) }, - false, + banktypes.ErrSendDisabled, }, { "acknowledgement fee balance not found", func() { msg.Fee.AckFee = invalidCoins }, - false, + sdkerrors.ErrInsufficientFunds, }, { "receive fee balance not found", func() { msg.Fee.RecvFee = invalidCoins }, - false, + sdkerrors.ErrInsufficientFunds, }, { "timeout fee balance not found", func() { msg.Fee.TimeoutFee = invalidCoins }, - false, + sdkerrors.ErrInsufficientFunds, }, } @@ -357,7 +364,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { ctx := suite.chainA.GetContext() _, err := suite.chainA.GetSimApp().IBCFeeKeeper.PayPacketFee(ctx, msg) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) // message committed packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, 1) @@ -384,7 +391,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { ibctesting.AssertEvents(&suite.Suite, expectedEvents, ctx.EventManager().Events().ToABCIEvents()) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) escrowBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), sdk.DefaultBondDenom) suite.Require().Equal(sdkmath.NewInt(0), escrowBalance.Amount) @@ -404,12 +411,12 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success with existing packet fees in escrow", @@ -427,7 +434,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { expEscrowBalance = expEscrowBalance.Add(fee.Total()...) expFeesInEscrow = append(expFeesInEscrow, packetFee) }, - true, + nil, }, { "bank send enabled for fee denom", @@ -439,14 +446,14 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { ) suite.Require().NoError(err) }, - true, + nil, }, { "fee module is locked", func() { lockFeeModule(suite.chainA) }, - false, + types.ErrFeeModuleLocked, }, { "fee module disabled on channel", @@ -454,7 +461,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { msg.PacketId.PortId = "invalid-port" msg.PacketId.ChannelId = "invalid-channel" }, - false, + types.ErrFeeNotEnabled, }, { "channel does not exist", @@ -465,14 +472,14 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { // NOTE: the channel doesn't exist in 04-channel keeper, but we will add a mapping within ics29 anyways suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), msg.PacketId.PortId, msg.PacketId.ChannelId) }, - false, + channeltypes.ErrSequenceSendNotFound, }, { "packet not sent", func() { msg.PacketId.Sequence++ }, - false, + channeltypes.ErrPacketNotSent, }, { "packet already acknowledged", @@ -480,7 +487,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { err := suite.path.RelayPacket(packet) suite.Require().NoError(err) }, - false, + channeltypes.ErrPacketCommitmentNotFound, }, { "packet already timed out", @@ -502,21 +509,21 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, sequence) msg.PacketId = packetID }, - false, + channeltypes.ErrPacketCommitmentNotFound, }, { "invalid refund address", func() { msg.PacketFee.RefundAddress = "invalid-address" }, - false, + errors.New("decoding bech32 failed"), }, { "refund account does not exist", func() { msg.PacketFee.RefundAddress = suite.chainB.SenderAccount.GetAddress().String() }, - false, + types.ErrRefundAccNotFound, }, { "refund account is a blocked address", @@ -524,7 +531,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { blockedAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() msg.PacketFee.RefundAddress = blockedAddr.String() }, - false, + ibcerrors.ErrUnauthorized, }, { "bank send disabled for fee denom", @@ -536,28 +543,28 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { ) suite.Require().NoError(err) }, - false, + banktypes.ErrSendDisabled, }, { "acknowledgement fee balance not found", func() { msg.PacketFee.Fee.AckFee = invalidCoins }, - false, + sdkerrors.ErrInsufficientFunds, }, { "receive fee balance not found", func() { msg.PacketFee.Fee.RecvFee = invalidCoins }, - false, + sdkerrors.ErrInsufficientFunds, }, { "timeout fee balance not found", func() { msg.PacketFee.Fee.TimeoutFee = invalidCoins }, - false, + sdkerrors.ErrInsufficientFunds, }, } @@ -587,7 +594,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { _, err = suite.chainA.GetSimApp().IBCFeeKeeper.PayPacketFeeAsync(suite.chainA.GetContext(), msg) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) // message committed feesInEscrow, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetFeesInEscrow(suite.chainA.GetContext(), packetID) @@ -597,7 +604,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { escrowBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), sdk.DefaultBondDenom) suite.Require().Equal(expEscrowBalance.AmountOf(sdk.DefaultBondDenom), escrowBalance.Amount) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) escrowBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), sdk.DefaultBondDenom) suite.Require().Equal(sdkmath.NewInt(0), escrowBalance.Amount) diff --git a/modules/apps/29-fee/keeper/relay.go b/modules/apps/29-fee/keeper/relay.go index a93ea0c88ce..2fe2e2b70c4 100644 --- a/modules/apps/29-fee/keeper/relay.go +++ b/modules/apps/29-fee/keeper/relay.go @@ -1,13 +1,11 @@ package keeper import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -16,23 +14,22 @@ import ( // SendPacket wraps the ICS4Wrapper SendPacket function func (k Keeper) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte, ) (uint64, error) { - return k.ics4Wrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) + return k.ics4Wrapper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) } // WriteAcknowledgement wraps IBC ChannelKeeper's WriteAcknowledgement function // ICS29 WriteAcknowledgement is used for asynchronous acknowledgements -func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error { +func (k Keeper) WriteAcknowledgement(ctx context.Context, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error { if !k.IsFeeEnabled(ctx, packet.GetDestPort(), packet.GetDestChannel()) { // ics4Wrapper may be core IBC or higher-level middleware - return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, acknowledgement) + return k.ics4Wrapper.WriteAcknowledgement(ctx, packet, acknowledgement) } packetID := channeltypes.NewPacketID(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) @@ -52,11 +49,11 @@ func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.C k.DeleteForwardRelayerAddress(ctx, packetID) // ics4Wrapper may be core IBC or higher-level middleware - return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) + return k.ics4Wrapper.WriteAcknowledgement(ctx, packet, ack) } // GetAppVersion returns the underlying application version. -func (k Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (k Keeper) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { version, found := k.ics4Wrapper.GetAppVersion(ctx, portID, channelID) if !found { return "", false diff --git a/modules/apps/29-fee/keeper/relay_test.go b/modules/apps/29-fee/keeper/relay_test.go index 7b98c66b5cc..4bffcedc0d3 100644 --- a/modules/apps/29-fee/keeper/relay_test.go +++ b/modules/apps/29-fee/keeper/relay_test.go @@ -12,7 +12,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", @@ -20,12 +20,12 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { suite.chainB.GetSimApp().IBCFeeKeeper.SetRelayerAddressForAsyncAck(suite.chainB.GetContext(), channeltypes.NewPacketID(suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID, 1), suite.chainA.SenderAccount.GetAddress().String()) suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyPayeeAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) }, - true, + nil, }, { "relayer address not set for async WriteAcknowledgement", func() {}, - false, + types.ErrRelayerNotFoundForAsyncAck, }, } @@ -54,14 +54,13 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { ) ack := channeltypes.NewResultAcknowledgement([]byte("success")) - chanCap := suite.chainB.GetChannelCapability(suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID) // malleate test case tc.malleate() - err := suite.chainB.GetSimApp().IBCFeeKeeper.WriteAcknowledgement(suite.chainB.GetContext(), chanCap, packet, ack) + err := suite.chainB.GetSimApp().IBCFeeKeeper.WriteAcknowledgement(suite.chainB.GetContext(), packet, ack) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) _, found := suite.chainB.GetSimApp().IBCFeeKeeper.GetRelayerAddressForAsyncAck(suite.chainB.GetContext(), channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, 1)) suite.Require().False(found) @@ -70,7 +69,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { committedAck, _ := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationPort, packet.DestinationChannel, 1) suite.Require().Equal(committedAck, channeltypes.CommitAcknowledgement(expectedAck.Acknowledgement())) } else { - suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expErr) } }) } @@ -95,9 +94,8 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsyncFeeDisabled() { ) ack := channeltypes.NewResultAcknowledgement([]byte("success")) - chanCap := suite.chainB.GetChannelCapability(suite.path.EndpointB.ChannelConfig.PortID, suite.path.EndpointB.ChannelID) - err := suite.chainB.GetSimApp().IBCFeeKeeper.WriteAcknowledgement(suite.chainB.GetContext(), chanCap, packet, ack) + err := suite.chainB.GetSimApp().IBCFeeKeeper.WriteAcknowledgement(suite.chainB.GetContext(), packet, ack) suite.Require().NoError(err) packetAck, _ := suite.chainB.GetSimApp().GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationPort, packet.DestinationChannel, 1) diff --git a/modules/apps/29-fee/types/codec_test.go b/modules/apps/29-fee/types/codec_test.go index 1e435f472a6..56666abab64 100644 --- a/modules/apps/29-fee/types/codec_test.go +++ b/modules/apps/29-fee/types/codec_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "testing" "github.com/stretchr/testify/require" @@ -10,38 +11,39 @@ import ( fee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" ) func TestCodecTypeRegistration(t *testing.T) { testCases := []struct { name string typeURL string - expPass bool + expErr error }{ { "success: MsgPayPacketFee", sdk.MsgTypeURL(&types.MsgPayPacketFee{}), - true, + nil, }, { "success: MsgPayPacketFeeAsync", sdk.MsgTypeURL(&types.MsgPayPacketFeeAsync{}), - true, + nil, }, { "success: MsgRegisterPayee", sdk.MsgTypeURL(&types.MsgRegisterPayee{}), - true, + nil, }, { "success: MsgRegisterCounterpartyPayee", sdk.MsgTypeURL(&types.MsgRegisterCounterpartyPayee{}), - true, + nil, }, { "type not registered on codec", "ibc.invalid.MsgTypeURL", - false, + errors.New("unable to resolve type URL ibc.invalid.MsgTypeURL"), }, } @@ -52,12 +54,12 @@ func TestCodecTypeRegistration(t *testing.T) { encodingCfg := moduletestutil.MakeTestEncodingConfig(fee.AppModuleBasic{}) msg, err := encodingCfg.Codec.InterfaceRegistry().Resolve(tc.typeURL) - if tc.expPass { + if tc.expErr == nil { require.NotNil(t, msg) require.NoError(t, err) } else { require.Nil(t, msg) - require.Error(t, err) + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) } }) } diff --git a/modules/apps/29-fee/types/expected_keepers.go b/modules/apps/29-fee/types/expected_keepers.go index acd20d9e7ec..0285a2bc683 100644 --- a/modules/apps/29-fee/types/expected_keepers.go +++ b/modules/apps/29-fee/types/expected_keepers.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) @@ -17,15 +16,10 @@ type AccountKeeper interface { // ChannelKeeper defines the expected IBC channel keeper type ChannelKeeper interface { - GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) - GetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) []byte - GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) - HasChannel(ctx sdk.Context, portID, channelID string) bool -} - -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability + GetChannel(ctx context.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) + GetPacketCommitment(ctx context.Context, portID, channelID string, sequence uint64) []byte + GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) + HasChannel(ctx context.Context, portID, channelID string) bool } // BankKeeper defines the expected bank keeper diff --git a/modules/apps/29-fee/types/fee_test.go b/modules/apps/29-fee/types/fee_test.go index fc3e712e1b8..0168b0e2275 100644 --- a/modules/apps/29-fee/types/fee_test.go +++ b/modules/apps/29-fee/types/fee_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "testing" "github.com/stretchr/testify/require" @@ -12,6 +13,8 @@ import ( "github.com/cometbft/cometbft/crypto/secp256k1" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" + ibctesting "github.com/cosmos/ibc-go/v9/testing" ) var ( @@ -131,26 +134,26 @@ func TestPacketFeeValidation(t *testing.T) { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success with empty slice for Relayers", func() { packetFee.Relayers = []string{} }, - true, + nil, }, { "should fail when refund address is invalid", func() { packetFee.RefundAddress = invalidAddress }, - false, + errors.New("failed to convert RefundAddress into sdk.AccAddress"), }, { "should fail when all fees are invalid", @@ -159,14 +162,14 @@ func TestPacketFeeValidation(t *testing.T) { packetFee.Fee.RecvFee = invalidFee packetFee.Fee.TimeoutFee = invalidFee }, - false, + ibcerrors.ErrInvalidCoins, }, { "should fail with single invalid fee", func() { packetFee.Fee.AckFee = invalidFee }, - false, + ibcerrors.ErrInvalidCoins, }, { "should fail with two invalid fees", @@ -174,7 +177,7 @@ func TestPacketFeeValidation(t *testing.T) { packetFee.Fee.TimeoutFee = invalidFee packetFee.Fee.AckFee = invalidFee }, - false, + ibcerrors.ErrInvalidCoins, }, { "should pass with two empty fees", @@ -182,14 +185,14 @@ func TestPacketFeeValidation(t *testing.T) { packetFee.Fee.TimeoutFee = sdk.Coins{} packetFee.Fee.AckFee = sdk.Coins{} }, - true, + nil, }, { "should pass with one empty fee", func() { packetFee.Fee.TimeoutFee = sdk.Coins{} }, - true, + nil, }, { "should fail if all fees are empty", @@ -198,31 +201,33 @@ func TestPacketFeeValidation(t *testing.T) { packetFee.Fee.RecvFee = sdk.Coins{} packetFee.Fee.TimeoutFee = sdk.Coins{} }, - false, + ibcerrors.ErrInvalidCoins, }, { "should fail with non empty Relayers", func() { packetFee.Relayers = []string{"relayer"} }, - false, + types.ErrRelayersNotEmpty, }, } for _, tc := range testCases { tc := tc - fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee) - packetFee = types.NewPacketFee(fee, defaultAccAddress, nil) + t.Run(tc.name, func(t *testing.T) { + fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee) + packetFee = types.NewPacketFee(fee, defaultAccAddress, nil) - tc.malleate() // malleate mutates test data + tc.malleate() // malleate mutates test data - err := packetFee.Validate() + err := packetFee.Validate() - if tc.expPass { - require.NoError(t, err, tc.name) - } else { - require.Error(t, err, tc.name) - } + if tc.expErr == nil { + require.NoError(t, err, tc.name) + } else { + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) + } + }) } } diff --git a/modules/apps/29-fee/types/genesis_test.go b/modules/apps/29-fee/types/genesis_test.go index 633a3e80c00..93e063745b9 100644 --- a/modules/apps/29-fee/types/genesis_test.go +++ b/modules/apps/29-fee/types/genesis_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "testing" "github.com/stretchr/testify/require" @@ -11,6 +12,8 @@ import ( "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -25,159 +28,160 @@ func TestValidateGenesis(t *testing.T) { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success - valid genesis", func() {}, - true, + nil, }, { "invalid packetID: invalid port ID", func() { genState.IdentifiedFees[0].PacketId = channeltypes.NewPacketID("", ibctesting.FirstChannelID, 1) }, - false, + host.ErrInvalidID, }, { "invalid packetID: invalid channel ID", func() { genState.IdentifiedFees[0].PacketId = channeltypes.NewPacketID(ibctesting.MockFeePort, "", 1) }, - false, + host.ErrInvalidID, }, { "invalid packetID: invalid sequence", func() { genState.IdentifiedFees[0].PacketId = channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 0) }, - false, + host.ErrInvalidPacket, }, { "invalid packet fee: invalid fee", func() { genState.IdentifiedFees[0].PacketFees[0].Fee = types.NewFee(sdk.Coins{}, sdk.Coins{}, sdk.Coins{}) }, - false, + ibcerrors.ErrInvalidCoins, }, { "invalid packet fee: invalid refund address", func() { genState.IdentifiedFees[0].PacketFees[0].RefundAddress = "" }, - false, + errors.New("failed to convert RefundAddress into sdk.AccAddress"), }, { "invalid fee enabled channel: invalid port ID", func() { genState.FeeEnabledChannels[0].PortId = "" }, - false, + host.ErrInvalidID, }, { "invalid fee enabled channel: invalid channel ID", func() { genState.FeeEnabledChannels[0].ChannelId = "" }, - false, + host.ErrInvalidID, }, { "invalid registered payee: invalid relayer address", func() { genState.RegisteredPayees[0].Relayer = "" }, - false, + errors.New("failed to convert relayer address into sdk.AccAddress"), }, { "invalid registered payee: invalid payee address", func() { genState.RegisteredPayees[0].Payee = "" }, - false, + errors.New("failed to convert payee address into sdk.AccAddress"), }, { "invalid registered payee: invalid channel ID", func() { genState.RegisteredPayees[0].ChannelId = "" }, - false, + host.ErrInvalidID, }, { "invalid registered counterparty payees: invalid relayer address", func() { genState.RegisteredCounterpartyPayees[0].Relayer = "" }, - false, + errors.New("failed to convert relayer address into sdk.AccAddress"), }, { "invalid registered counterparty payees: invalid counterparty payee", func() { genState.RegisteredCounterpartyPayees[0].CounterpartyPayee = "" }, - false, + types.ErrCounterpartyPayeeEmpty, }, { "invalid forward relayer address: invalid forward address", func() { genState.ForwardRelayers[0].Address = "" }, - false, + errors.New("failed to convert forward relayer address into sdk.AccAddress"), }, { "invalid forward relayer address: invalid packet", func() { genState.ForwardRelayers[0].PacketId = channeltypes.PacketId{} }, - false, + host.ErrInvalidID, }, } for _, tc := range testCases { tc := tc - - genState = &types.GenesisState{ - IdentifiedFees: []types.IdentifiedPacketFees{ - { - PacketId: channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1), - PacketFees: []types.PacketFee{types.NewPacketFee(types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee), defaultAccAddress, nil)}, + t.Run(tc.name, func(t *testing.T) { + genState = &types.GenesisState{ + IdentifiedFees: []types.IdentifiedPacketFees{ + { + PacketId: channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1), + PacketFees: []types.PacketFee{types.NewPacketFee(types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee), defaultAccAddress, nil)}, + }, }, - }, - FeeEnabledChannels: []types.FeeEnabledChannel{ - { - PortId: ibctesting.MockFeePort, - ChannelId: ibctesting.FirstChannelID, + FeeEnabledChannels: []types.FeeEnabledChannel{ + { + PortId: ibctesting.MockFeePort, + ChannelId: ibctesting.FirstChannelID, + }, }, - }, - RegisteredCounterpartyPayees: []types.RegisteredCounterpartyPayee{ - { - Relayer: defaultAccAddress, - CounterpartyPayee: defaultAccAddress, - ChannelId: ibctesting.FirstChannelID, + RegisteredCounterpartyPayees: []types.RegisteredCounterpartyPayee{ + { + Relayer: defaultAccAddress, + CounterpartyPayee: defaultAccAddress, + ChannelId: ibctesting.FirstChannelID, + }, }, - }, - ForwardRelayers: []types.ForwardRelayerAddress{ - { - Address: defaultAccAddress, - PacketId: channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1), + ForwardRelayers: []types.ForwardRelayerAddress{ + { + Address: defaultAccAddress, + PacketId: channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1), + }, }, - }, - RegisteredPayees: []types.RegisteredPayee{ - { - Relayer: sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), - Payee: sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), - ChannelId: ibctesting.FirstChannelID, + RegisteredPayees: []types.RegisteredPayee{ + { + Relayer: sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), + Payee: sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), + ChannelId: ibctesting.FirstChannelID, + }, }, - }, - } + } - tc.malleate() + tc.malleate() - err := genState.Validate() + err := genState.Validate() - if tc.expPass { - require.NoError(t, err, tc.name) - } else { - require.Error(t, err, tc.name) - } + if tc.expErr == nil { + require.NoError(t, err, tc.name) + } else { + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) + } + }) } } diff --git a/modules/apps/29-fee/types/keys_test.go b/modules/apps/29-fee/types/keys_test.go index edefc87c83d..ec95afab64b 100644 --- a/modules/apps/29-fee/types/keys_test.go +++ b/modules/apps/29-fee/types/keys_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "fmt" "testing" @@ -8,6 +9,7 @@ import ( "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -20,19 +22,19 @@ func TestKeyPayee(t *testing.T) { func TestParseKeyPayee(t *testing.T) { testCases := []struct { - name string - key string - expPass bool + name string + key string + expErr error }{ { "success", string(types.KeyPayee("relayer-address", ibctesting.FirstChannelID)), - true, + nil, }, { "incorrect key - key split has incorrect length", "payeeAddress/relayer_address/transfer/channel-0", - false, + ibcerrors.ErrLogic, }, } @@ -41,12 +43,12 @@ func TestParseKeyPayee(t *testing.T) { address, channelID, err := types.ParseKeyPayeeAddress(tc.key) - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err) require.Equal(t, "relayer-address", address) require.Equal(t, ibctesting.FirstChannelID, channelID) } else { - require.Error(t, err) + require.ErrorIs(t, err, tc.expErr) } } } @@ -68,64 +70,66 @@ func TestKeyFeesInEscrow(t *testing.T) { func TestParseKeyFeeEnabled(t *testing.T) { testCases := []struct { - name string - key string - expPass bool + name string + key string + expErr error }{ { "success", string(types.KeyFeeEnabled(ibctesting.MockPort, ibctesting.FirstChannelID)), - true, + nil, }, { "incorrect key - key split has incorrect length", string(types.KeyFeesInEscrow(validPacketID)), - false, + ibcerrors.ErrLogic, }, { "incorrect key - key split has incorrect length", fmt.Sprintf("%s/%s/%s", "fee", ibctesting.MockPort, ibctesting.FirstChannelID), - false, + ibcerrors.ErrLogic, }, } for _, tc := range testCases { tc := tc - portID, channelID, err := types.ParseKeyFeeEnabled(tc.key) - - if tc.expPass { - require.NoError(t, err) - require.Equal(t, ibctesting.MockPort, portID) - require.Equal(t, ibctesting.FirstChannelID, channelID) - } else { - require.Error(t, err) - require.Empty(t, portID) - require.Empty(t, channelID) - } + t.Run(tc.name, func(t *testing.T) { + portID, channelID, err := types.ParseKeyFeeEnabled(tc.key) + + if tc.expErr == nil { + require.NoError(t, err) + require.Equal(t, ibctesting.MockPort, portID) + require.Equal(t, ibctesting.FirstChannelID, channelID) + } else { + require.ErrorIs(t, err, tc.expErr) + require.Empty(t, portID) + require.Empty(t, channelID) + } + }) } } func TestParseKeyFeesInEscrow(t *testing.T) { testCases := []struct { - name string - key string - expPass bool + name string + key string + expErr error }{ { "success", string(types.KeyFeesInEscrow(validPacketID)), - true, + nil, }, { "incorrect key - key split has incorrect length", string(types.KeyFeeEnabled(validPacketID.PortId, validPacketID.ChannelId)), - false, + ibcerrors.ErrLogic, }, { "incorrect key - sequence cannot be parsed", fmt.Sprintf("%s/%s", types.KeyFeesInEscrowChannelPrefix(validPacketID.PortId, validPacketID.ChannelId), "sequence"), - false, + errors.New("invalid syntax"), }, } @@ -134,35 +138,35 @@ func TestParseKeyFeesInEscrow(t *testing.T) { packetID, err := types.ParseKeyFeesInEscrow(tc.key) - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err) require.Equal(t, validPacketID, packetID) } else { - require.Error(t, err) + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) } } } func TestParseKeyForwardRelayerAddress(t *testing.T) { testCases := []struct { - name string - key string - expPass bool + name string + key string + expErr error }{ { "success", string(types.KeyRelayerAddressForAsyncAck(validPacketID)), - true, + nil, }, { "incorrect key - key split has incorrect length", "forwardRelayer/transfer/channel-0", - false, + ibcerrors.ErrLogic, }, { "incorrect key - sequence is not correct", "forwardRelayer/transfer/channel-0/sequence", - false, + errors.New("invalid syntax"), }, } @@ -171,11 +175,11 @@ func TestParseKeyForwardRelayerAddress(t *testing.T) { packetID, err := types.ParseKeyRelayerAddressForAsyncAck(tc.key) - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err) require.Equal(t, validPacketID, packetID) } else { - require.Error(t, err) + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) } } } @@ -184,19 +188,19 @@ func TestParseKeyCounterpartyPayee(t *testing.T) { relayerAddress := "relayer_address" testCases := []struct { - name string - key string - expPass bool + name string + key string + expErr error }{ { "success", string(types.KeyCounterpartyPayee(relayerAddress, ibctesting.FirstChannelID)), - true, + nil, }, { "incorrect key - key split has incorrect length", "relayerAddress/relayer_address/transfer/channel-0", - false, + ibcerrors.ErrLogic, }, } @@ -205,12 +209,12 @@ func TestParseKeyCounterpartyPayee(t *testing.T) { address, channelID, err := types.ParseKeyCounterpartyPayee(tc.key) - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err) require.Equal(t, relayerAddress, address) require.Equal(t, ibctesting.FirstChannelID, channelID) } else { - require.Error(t, err) + require.ErrorIs(t, err, tc.expErr) } } } diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index e952ee80907..7699b94e990 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "testing" "github.com/stretchr/testify/require" @@ -13,6 +14,8 @@ import ( modulefee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -22,12 +25,12 @@ func TestMsgRegisterPayeeValidation(t *testing.T) { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success: relayer and payee are equal", @@ -35,55 +38,57 @@ func TestMsgRegisterPayeeValidation(t *testing.T) { msg.Relayer = defaultAccAddress msg.Payee = defaultAccAddress }, - true, + nil, }, { "invalid portID", func() { msg.PortId = "" }, - false, + host.ErrInvalidID, }, { "invalid channelID", func() { msg.ChannelId = "" }, - false, + host.ErrInvalidID, }, { "invalid relayer address", func() { msg.Relayer = invalidAddress }, - false, + errors.New("failed to create sdk.AccAddress from relayer address"), }, { "invalid payee address", func() { msg.Payee = invalidAddress }, - false, + errors.New("failed to create sdk.AccAddress from payee address"), }, } for i, tc := range testCases { tc := tc - relayerAddr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) - payeeAddr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + t.Run(tc.name, func(t *testing.T) { + relayerAddr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + payeeAddr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) - msg = types.NewMsgRegisterPayee(ibctesting.MockPort, ibctesting.FirstChannelID, relayerAddr.String(), payeeAddr.String()) + msg = types.NewMsgRegisterPayee(ibctesting.MockPort, ibctesting.FirstChannelID, relayerAddr.String(), payeeAddr.String()) - tc.malleate() + tc.malleate() - err := msg.ValidateBasic() + err := msg.ValidateBasic() - if tc.expPass { - require.NoError(t, err, "valid test case %d failed: %s", i, tc.name) - } else { - require.Error(t, err, "invalid test case %d passed: %s", i, tc.name) - } + if tc.expErr == nil { + require.NoError(t, err, "valid test case %d failed: %s", i, tc.name) + } else { + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) + } + }) } } @@ -103,73 +108,75 @@ func TestMsgRegisterCountepartyPayeeValidation(t *testing.T) { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "invalid portID", func() { msg.PortId = "" }, - false, + host.ErrInvalidID, }, { "invalid channelID", func() { msg.ChannelId = "" }, - false, + host.ErrInvalidID, }, { "validate with incorrect destination relayer address", func() { msg.Relayer = invalidAddress }, - false, + errors.New("failed to create sdk.AccAddress from relayer address"), }, { "invalid counterparty payee address", func() { msg.CounterpartyPayee = "" }, - false, + types.ErrCounterpartyPayeeEmpty, }, { "invalid counterparty payee address: whitespaced empty string", func() { msg.CounterpartyPayee = " " }, - false, + types.ErrCounterpartyPayeeEmpty, }, { "invalid counterparty payee address: too long", func() { msg.CounterpartyPayee = ibctesting.GenerateString(types.MaximumCounterpartyPayeeLength + 1) }, - false, + ibcerrors.ErrInvalidAddress, }, } for i, tc := range testCases { i, tc := i, tc - payeeAddr, err := sdk.AccAddressFromBech32(ibctesting.TestAccAddress) - require.NoError(t, err) - msg = types.NewMsgRegisterCounterpartyPayee(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, payeeAddr.String()) + t.Run(tc.name, func(t *testing.T) { + payeeAddr, err := sdk.AccAddressFromBech32(ibctesting.TestAccAddress) + require.NoError(t, err) + msg = types.NewMsgRegisterCounterpartyPayee(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, payeeAddr.String()) - tc.malleate() + tc.malleate() - err = msg.ValidateBasic() + err = msg.ValidateBasic() - if tc.expPass { - require.NoError(t, err, "valid test case %d failed: %s", i, tc.name) - } else { - require.Error(t, err, "invalid test case %d passed: %s", i, tc.name) - } + if tc.expErr == nil { + require.NoError(t, err, "valid test case %d failed: %s", i, tc.name) + } else { + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) + } + }) } } @@ -189,47 +196,47 @@ func TestMsgPayPacketFeeValidation(t *testing.T) { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success with empty relayers", func() { msg.Relayers = []string{} }, - true, + nil, }, { "invalid channelID", func() { msg.SourceChannelId = "" }, - false, + host.ErrInvalidID, }, { "invalid portID", func() { msg.SourcePortId = "" }, - false, + host.ErrInvalidID, }, { "relayers is not nil", func() { msg.Relayers = []string{defaultAccAddress} }, - false, + types.ErrRelayersNotEmpty, }, { "invalid signer address", func() { msg.Signer = invalidAddress }, - false, + errors.New("failed to convert msg.Signer into sdk.AccAddress"), }, } @@ -243,10 +250,10 @@ func TestMsgPayPacketFeeValidation(t *testing.T) { err := msg.ValidateBasic() - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err, tc.name) } else { - require.Error(t, err, tc.name) + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) } } } @@ -268,54 +275,69 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success with empty relayers", func() { msg.PacketFee.Relayers = []string{} }, - true, + nil, + }, + { + "should pass with two empty fees", + func() { + msg.PacketFee.Fee.AckFee = sdk.Coins{} + msg.PacketFee.Fee.TimeoutFee = sdk.Coins{} + }, + nil, + }, + { + "should pass with one empty fee", + func() { + msg.PacketFee.Fee.TimeoutFee = sdk.Coins{} + }, + nil, }, { "invalid channelID", func() { msg.PacketId.ChannelId = "" }, - false, + host.ErrInvalidID, }, { "invalid portID", func() { msg.PacketId.PortId = "" }, - false, + host.ErrInvalidID, }, { "invalid sequence", func() { msg.PacketId.Sequence = 0 }, - false, + channeltypes.ErrInvalidPacket, }, { "relayers is not nil", func() { msg.PacketFee.Relayers = []string{defaultAccAddress} }, - false, + types.ErrRelayersNotEmpty, }, { "invalid signer address", func() { msg.PacketFee.RefundAddress = "invalid-addr" }, - false, + errors.New("failed to convert RefundAddress into sdk.AccAddress"), }, { "should fail when all fees are invalid", @@ -324,14 +346,14 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { msg.PacketFee.Fee.RecvFee = invalidFee msg.PacketFee.Fee.TimeoutFee = invalidFee }, - false, + ibcerrors.ErrInvalidCoins, }, { "should fail with single invalid fee", func() { msg.PacketFee.Fee.AckFee = invalidFee }, - false, + ibcerrors.ErrInvalidCoins, }, { "should fail with two invalid fees", @@ -339,22 +361,7 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { msg.PacketFee.Fee.AckFee = invalidFee msg.PacketFee.Fee.TimeoutFee = invalidFee }, - false, - }, - { - "should pass with two empty fees", - func() { - msg.PacketFee.Fee.AckFee = sdk.Coins{} - msg.PacketFee.Fee.TimeoutFee = sdk.Coins{} - }, - true, - }, - { - "should pass with one empty fee", - func() { - msg.PacketFee.Fee.TimeoutFee = sdk.Coins{} - }, - true, + ibcerrors.ErrInvalidCoins, }, { "should fail if all fees are empty", @@ -363,7 +370,7 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { msg.PacketFee.Fee.RecvFee = sdk.Coins{} msg.PacketFee.Fee.TimeoutFee = sdk.Coins{} }, - false, + ibcerrors.ErrInvalidCoins, }, } @@ -380,10 +387,10 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { err := msg.ValidateBasic() - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err, tc.name) } else { - require.Error(t, err, tc.name) + ibctesting.RequireErrorIsOrContains(t, err, tc.expErr, err.Error()) } } } diff --git a/modules/apps/callbacks/CHANGELOG.md b/modules/apps/callbacks/CHANGELOG.md index b2c50b90190..03614679a1e 100644 --- a/modules/apps/callbacks/CHANGELOG.md +++ b/modules/apps/callbacks/CHANGELOG.md @@ -40,7 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#6828](https://github.com/cosmos/ibc-go/pull/6828) Bump Cosmos SDK to v0.50.9. * [\#6193](https://github.com/cosmos/ibc-go/pull/6193) Bump `cosmossdk.io/store` to v1.1.0. -* [\#6848](https://github.com/cosmos/ibc-go/pull/6848) Bump CometBFT to v0.38.10. +* [\#7247](https://github.com/cosmos/ibc-go/pull/7247) Bump CometBFT to v0.38.12. ### API Breaking diff --git a/modules/apps/callbacks/go.mod b/modules/apps/callbacks/go.mod index 665e6a69b76..c86dccbdeff 100644 --- a/modules/apps/callbacks/go.mod +++ b/modules/apps/callbacks/go.mod @@ -2,8 +2,6 @@ module github.com/cosmos/ibc-go/modules/apps/callbacks go 1.22.2 -toolchain go1.22.3 - replace github.com/cosmos/ibc-go/v9 => ../../../ replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 @@ -15,18 +13,17 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/store v1.1.0 + cosmossdk.io/store v1.1.1 cosmossdk.io/tools/confix v0.1.2 cosmossdk.io/x/circuit v0.1.1 cosmossdk.io/x/evidence v0.1.1 cosmossdk.io/x/feegrant v0.1.1 cosmossdk.io/x/tx v0.13.4 cosmossdk.io/x/upgrade v0.1.4 - github.com/cometbft/cometbft v0.38.11 + github.com/cometbft/cometbft v0.38.12 github.com/cosmos/cosmos-db v1.0.2 - github.com/cosmos/cosmos-sdk v0.50.9 + github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ibc-go/v9 v9.0.0 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 @@ -54,7 +51,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect @@ -71,7 +68,8 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect @@ -155,13 +153,13 @@ require ( github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect + github.com/rs/cors v1.11.1 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -196,8 +194,8 @@ require ( google.golang.org/api v0.186.0 // indirect google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.66.2 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/modules/apps/callbacks/go.sum b/modules/apps/callbacks/go.sum index 631b8a8a8ef..892ba031de1 100644 --- a/modules/apps/callbacks/go.sum +++ b/modules/apps/callbacks/go.sum @@ -202,8 +202,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= cosmossdk.io/tools/confix v0.1.2 h1:2hoM1oFCNisd0ltSAAZw2i4ponARPmlhuNu3yy0VwI4= cosmossdk.io/tools/confix v0.1.2/go.mod h1:7XfcbK9sC/KNgVGxgLM0BrFbVcR/+6Dg7MFfpx7duYo= cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= @@ -275,10 +275,10 @@ github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE5 github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -335,8 +335,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= -github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= +github.com/cometbft/cometbft v0.38.12 h1:OWsLZN2KcSSFe8bet9xCn07VwhBnavPea3VyPnNq1bg= +github.com/cometbft/cometbft v0.38.12/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -351,8 +351,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= -github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef h1:us0dw4egT2k00jnK4JgQ2Su6yJlBnwCfgWnKC7MIwqk= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef/go.mod h1:9l85MGxnejiuiY4gum/RzdRKfkmLZDJh5uOD3m1zxy0= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -364,8 +364,8 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -736,6 +736,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= @@ -869,8 +871,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -905,8 +907,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -1554,8 +1556,8 @@ google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGr google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1597,8 +1599,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/modules/apps/callbacks/ibc_middleware.go b/modules/apps/callbacks/ibc_middleware.go index 2fb1065fb58..9bc8789ecca 100644 --- a/modules/apps/callbacks/ibc_middleware.go +++ b/modules/apps/callbacks/ibc_middleware.go @@ -1,6 +1,7 @@ package ibccallbacks import ( + "context" "errors" "fmt" @@ -10,7 +11,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/modules/apps/callbacks/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" @@ -86,15 +86,14 @@ func (im *IBCMiddleware) GetICS4Wrapper() porttypes.ICS4Wrapper { // If the contract callback returns an error, panics, or runs out of gas, then // the packet send is rejected. func (im IBCMiddleware) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte, ) (uint64, error) { - seq, err := im.ics4Wrapper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) + seq, err := im.ics4Wrapper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) if err != nil { return 0, err } @@ -102,7 +101,8 @@ func (im IBCMiddleware) SendPacket( // packet is created without destination information present, GetSourceCallbackData does not use these. packet := channeltypes.NewPacket(data, seq, sourcePort, sourceChannel, "", "", timeoutHeight, timeoutTimestamp) - callbackData, err := types.GetSourceCallbackData(ctx, im.app, packet, im.maxCallbackGas) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + callbackData, err := types.GetSourceCallbackData(sdkCtx, im.app, packet, im.maxCallbackGas) // SendPacket is not blocked if the packet does not opt-in to callbacks if err != nil { return seq, nil @@ -114,13 +114,13 @@ func (im IBCMiddleware) SendPacket( ) } - err = im.processCallback(ctx, types.CallbackTypeSendPacket, callbackData, callbackExecutor) + err = im.processCallback(sdkCtx, types.CallbackTypeSendPacket, callbackData, callbackExecutor) // contract keeper is allowed to reject the packet send. if err != nil { return 0, err } - types.EmitCallbackEvent(ctx, sourcePort, sourceChannel, seq, types.CallbackTypeSendPacket, callbackData, nil) + types.EmitCallbackEvent(sdkCtx, sourcePort, sourceChannel, seq, types.CallbackTypeSendPacket, callbackData, nil) return seq, nil } @@ -129,7 +129,7 @@ func (im IBCMiddleware) SendPacket( // If the contract callback runs out of gas and may be retried with a higher gas limit then the state changes are // reverted via a panic. func (im IBCMiddleware) OnAcknowledgementPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, @@ -141,8 +141,10 @@ func (im IBCMiddleware) OnAcknowledgementPacket( return err } + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + callbackData, err := types.GetSourceCallbackData( - ctx, im.app, packet, im.maxCallbackGas, + sdkCtx, im.app, packet, im.maxCallbackGas, ) // OnAcknowledgementPacket is not blocked if the packet does not opt-in to callbacks if err != nil { @@ -156,9 +158,9 @@ func (im IBCMiddleware) OnAcknowledgementPacket( } // callback execution errors are not allowed to block the packet lifecycle, they are only used in event emissions - err = im.processCallback(ctx, types.CallbackTypeAcknowledgementPacket, callbackData, callbackExecutor) + err = im.processCallback(sdkCtx, types.CallbackTypeAcknowledgementPacket, callbackData, callbackExecutor) types.EmitCallbackEvent( - ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence(), + sdkCtx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence(), types.CallbackTypeAcknowledgementPacket, callbackData, err, ) @@ -169,14 +171,16 @@ func (im IBCMiddleware) OnAcknowledgementPacket( // It defers to the underlying application and then calls the contract callback. // If the contract callback runs out of gas and may be retried with a higher gas limit then the state changes are // reverted via a panic. -func (im IBCMiddleware) OnTimeoutPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) error { +func (im IBCMiddleware) OnTimeoutPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) error { err := im.app.OnTimeoutPacket(ctx, channelVersion, packet, relayer) if err != nil { return err } + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + callbackData, err := types.GetSourceCallbackData( - ctx, im.app, packet, im.maxCallbackGas, + sdkCtx, im.app, packet, im.maxCallbackGas, ) // OnTimeoutPacket is not blocked if the packet does not opt-in to callbacks if err != nil { @@ -188,9 +192,9 @@ func (im IBCMiddleware) OnTimeoutPacket(ctx sdk.Context, channelVersion string, } // callback execution errors are not allowed to block the packet lifecycle, they are only used in event emissions - err = im.processCallback(ctx, types.CallbackTypeTimeoutPacket, callbackData, callbackExecutor) + err = im.processCallback(sdkCtx, types.CallbackTypeTimeoutPacket, callbackData, callbackExecutor) types.EmitCallbackEvent( - ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence(), + sdkCtx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence(), types.CallbackTypeTimeoutPacket, callbackData, err, ) @@ -202,7 +206,7 @@ func (im IBCMiddleware) OnTimeoutPacket(ctx sdk.Context, channelVersion string, // It defers to the underlying application and then calls the contract callback. // If the contract callback runs out of gas and may be retried with a higher gas limit then the state changes are // reverted via a panic. -func (im IBCMiddleware) OnRecvPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) ibcexported.Acknowledgement { +func (im IBCMiddleware) OnRecvPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) ibcexported.Acknowledgement { ack := im.app.OnRecvPacket(ctx, channelVersion, packet, relayer) // if ack is nil (asynchronous acknowledgements), then the callback will be handled in WriteAcknowledgement // if ack is not successful, all state changes are reverted. If a packet cannot be received, then there is @@ -211,8 +215,9 @@ func (im IBCMiddleware) OnRecvPacket(ctx sdk.Context, channelVersion string, pac return ack } + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 callbackData, err := types.GetDestCallbackData( - ctx, im.app, packet, im.maxCallbackGas, + sdkCtx, im.app, packet, im.maxCallbackGas, ) // OnRecvPacket is not blocked if the packet does not opt-in to callbacks if err != nil { @@ -224,9 +229,9 @@ func (im IBCMiddleware) OnRecvPacket(ctx sdk.Context, channelVersion string, pac } // callback execution errors are not allowed to block the packet lifecycle, they are only used in event emissions - err = im.processCallback(ctx, types.CallbackTypeReceivePacket, callbackData, callbackExecutor) + err = im.processCallback(sdkCtx, types.CallbackTypeReceivePacket, callbackData, callbackExecutor) types.EmitCallbackEvent( - ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), + sdkCtx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), types.CallbackTypeReceivePacket, callbackData, err, ) @@ -239,12 +244,11 @@ func (im IBCMiddleware) OnRecvPacket(ctx sdk.Context, channelVersion string, pac // If the contract callback runs out of gas and may be retried with a higher gas limit then the state changes are // reverted via a panic. func (im IBCMiddleware) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet ibcexported.PacketI, ack ibcexported.Acknowledgement, ) error { - err := im.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) + err := im.ics4Wrapper.WriteAcknowledgement(ctx, packet, ack) if err != nil { return err } @@ -254,8 +258,9 @@ func (im IBCMiddleware) WriteAcknowledgement( panic(fmt.Errorf("expected type %T, got %T", &channeltypes.Packet{}, packet)) } + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 callbackData, err := types.GetDestCallbackData( - ctx, im.app, chanPacket, im.maxCallbackGas, + sdkCtx, im.app, chanPacket, im.maxCallbackGas, ) // WriteAcknowledgement is not blocked if the packet does not opt-in to callbacks if err != nil { @@ -267,9 +272,9 @@ func (im IBCMiddleware) WriteAcknowledgement( } // callback execution errors are not allowed to block the packet lifecycle, they are only used in event emissions - err = im.processCallback(ctx, types.CallbackTypeReceivePacket, callbackData, callbackExecutor) + err = im.processCallback(sdkCtx, types.CallbackTypeReceivePacket, callbackData, callbackExecutor) types.EmitCallbackEvent( - ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), + sdkCtx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), types.CallbackTypeReceivePacket, callbackData, err, ) @@ -327,34 +332,32 @@ func (IBCMiddleware) processCallback( // OnChanOpenInit defers to the underlying application func (im IBCMiddleware) OnChanOpenInit( - ctx sdk.Context, + ctx context.Context, channelOrdering channeltypes.Order, connectionHops []string, portID, channelID string, - channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) { - return im.app.OnChanOpenInit(ctx, channelOrdering, connectionHops, portID, channelID, channelCap, counterparty, version) + return im.app.OnChanOpenInit(ctx, channelOrdering, connectionHops, portID, channelID, counterparty, version) } // OnChanOpenTry defers to the underlying application func (im IBCMiddleware) OnChanOpenTry( - ctx sdk.Context, + ctx context.Context, channelOrdering channeltypes.Order, connectionHops []string, portID, channelID string, - channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { - return im.app.OnChanOpenTry(ctx, channelOrdering, connectionHops, portID, channelID, channelCap, counterparty, counterpartyVersion) + return im.app.OnChanOpenTry(ctx, channelOrdering, connectionHops, portID, channelID, counterparty, counterpartyVersion) } // OnChanOpenAck defers to the underlying application func (im IBCMiddleware) OnChanOpenAck( - ctx sdk.Context, + ctx context.Context, portID, channelID, counterpartyChannelID, @@ -364,22 +367,22 @@ func (im IBCMiddleware) OnChanOpenAck( } // OnChanOpenConfirm defers to the underlying application -func (im IBCMiddleware) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error { +func (im IBCMiddleware) OnChanOpenConfirm(ctx context.Context, portID, channelID string) error { return im.app.OnChanOpenConfirm(ctx, portID, channelID) } // OnChanCloseInit defers to the underlying application -func (im IBCMiddleware) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error { +func (im IBCMiddleware) OnChanCloseInit(ctx context.Context, portID, channelID string) error { return im.app.OnChanCloseInit(ctx, portID, channelID) } // OnChanCloseConfirm defers to the underlying application -func (im IBCMiddleware) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string) error { +func (im IBCMiddleware) OnChanCloseConfirm(ctx context.Context, portID, channelID string) error { return im.app.OnChanCloseConfirm(ctx, portID, channelID) } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { +func (im IBCMiddleware) OnChanUpgradeInit(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { cbs, ok := im.app.(porttypes.UpgradableModule) if !ok { return "", errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") @@ -389,7 +392,7 @@ func (im IBCMiddleware) OnChanUpgradeInit(ctx sdk.Context, portID, channelID str } // OnChanUpgradeTry implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { +func (im IBCMiddleware) OnChanUpgradeTry(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { cbs, ok := im.app.(porttypes.UpgradableModule) if !ok { return "", errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") @@ -399,7 +402,7 @@ func (im IBCMiddleware) OnChanUpgradeTry(ctx sdk.Context, portID, channelID stri } // OnChanUpgradeAck implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { +func (im IBCMiddleware) OnChanUpgradeAck(ctx context.Context, portID, channelID, counterpartyVersion string) error { cbs, ok := im.app.(porttypes.UpgradableModule) if !ok { return errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack") @@ -409,7 +412,7 @@ func (im IBCMiddleware) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, cou } // OnChanUpgradeOpen implements the IBCModule interface -func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { +func (im IBCMiddleware) OnChanUpgradeOpen(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { cbs, ok := im.app.(porttypes.UpgradableModule) if !ok { panic(errorsmod.Wrap(porttypes.ErrInvalidRoute, "upgrade route not found to module in application callstack")) @@ -420,12 +423,12 @@ func (im IBCMiddleware) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID str // GetAppVersion implements the ICS4Wrapper interface. Callbacks has no version, // so the call is deferred to the underlying application. -func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (im IBCMiddleware) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { return im.ics4Wrapper.GetAppVersion(ctx, portID, channelID) } // UnmarshalPacketData defers to the underlying app to unmarshal the packet data. // This function implements the optional PacketDataUnmarshaler interface. -func (im IBCMiddleware) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { +func (im IBCMiddleware) UnmarshalPacketData(ctx context.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { return im.app.UnmarshalPacketData(ctx, portID, channelID, bz) } diff --git a/modules/apps/callbacks/ibc_middleware_test.go b/modules/apps/callbacks/ibc_middleware_test.go index 46aab6ed33c..be91d422ad5 100644 --- a/modules/apps/callbacks/ibc_middleware_test.go +++ b/modules/apps/callbacks/ibc_middleware_test.go @@ -190,8 +190,6 @@ func (s *CallbacksTestSuite) TestSendPacket() { ibctesting.EmptyForwardingPacketData, ) - chanCap := s.path.EndpointA.Chain.GetChannelCapability(s.path.EndpointA.ChannelConfig.PortID, s.path.EndpointA.ChannelID) - tc.malleate() ctx := s.chainA.GetContext() @@ -202,7 +200,7 @@ func (s *CallbacksTestSuite) TestSendPacket() { err error ) sendPacket := func() { - seq, err = transferICS4Wrapper.SendPacket(ctx, chanCap, s.path.EndpointA.ChannelConfig.PortID, s.path.EndpointA.ChannelID, s.chainB.GetTimeoutHeight(), 0, packetData.GetBytes()) + seq, err = transferICS4Wrapper.SendPacket(ctx, s.path.EndpointA.ChannelConfig.PortID, s.path.EndpointA.ChannelID, s.chainB.GetTimeoutHeight(), 0, packetData.GetBytes()) } expPass := tc.expValue == nil @@ -812,14 +810,12 @@ func (s *CallbacksTestSuite) TestWriteAcknowledgement() { ctx = s.chainB.GetContext() gasLimit := ctx.GasMeter().Limit() - chanCap := s.chainB.GetChannelCapability(s.path.EndpointB.ChannelConfig.PortID, s.path.EndpointB.ChannelID) - tc.malleate() // callbacks module is routed as top level middleware transferICS4Wrapper := GetSimApp(s.chainB).TransferKeeper.GetICS4Wrapper() - err := transferICS4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) + err := transferICS4Wrapper.WriteAcknowledgement(ctx, packet, ack) expPass := tc.expError == nil s.AssertHasExecutedExpectedCallback(tc.callbackType, expPass) @@ -956,10 +952,9 @@ func (s *CallbacksTestSuite) TestProcessCallback() { } tc.malleate() + var err error - module, _, err := s.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(s.chainA.GetContext(), ibctesting.MockFeePort) - s.Require().NoError(err) - cbs, ok := s.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := s.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) s.Require().True(ok) mockCallbackStack, ok := cbs.(ibccallbacks.IBCMiddleware) s.Require().True(ok) @@ -1116,9 +1111,7 @@ func (s *CallbacksTestSuite) TestOnChanCloseConfirm() { func (s *CallbacksTestSuite) TestOnRecvPacketAsyncAck() { s.SetupMockFeeTest() - module, _, err := s.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(s.chainA.GetContext(), ibctesting.MockFeePort) - s.Require().NoError(err) - cbs, ok := s.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := s.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.MockFeePort) s.Require().True(ok) mockFeeCallbackStack, ok := cbs.(porttypes.Middleware) s.Require().True(ok) diff --git a/modules/apps/callbacks/testing/simapp/app.go b/modules/apps/callbacks/testing/simapp/app.go index 5b536c2626b..734089f645d 100644 --- a/modules/apps/callbacks/testing/simapp/app.go +++ b/modules/apps/callbacks/testing/simapp/app.go @@ -102,9 +102,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" ibccallbacks "github.com/cosmos/ibc-go/modules/apps/callbacks" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -162,8 +159,7 @@ var ( ) // SimApp extends an ABCI application, but with most of its parameters exported. -// They are exported for convenience in creating helper functions, as object -// capabilities aren't needed for testing. +// They are exported for convenience in creating helper functions. type SimApp struct { *baseapp.BaseApp legacyAmino *codec.LegacyAmino @@ -179,7 +175,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -201,15 +196,6 @@ type SimApp struct { CircuitKeeper circuitkeeper.Keeper PacketServer *packetserverkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // mock contract keeper used for testing MockContractKeeper *ContractKeeper @@ -301,7 +287,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, ) @@ -311,7 +297,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(ibcmock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -330,25 +316,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -407,9 +374,9 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - app.PacketServer = packetserverkeeper.NewKeeper(appCodec, keys[ibcexported.StoreKey], app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ClientKeeper) + app.PacketServer = packetserverkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ClientKeeper) // NOTE: The mock ContractKeeper is only created for testing. // Real applications should not use the mock ContractKeeper @@ -433,27 +400,27 @@ func NewSimApp( // IBC Fee Module keeper app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( - appCodec, keys[ibcfeetypes.StoreKey], + appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // ICA Host keeper app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -467,10 +434,10 @@ func NewSimApp( // since fee middleware will wrap the IBCKeeper for underlying application. // NOTE: the Transfer Keeper's ICS4Wrapper can later be replaced. app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -479,10 +446,10 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := ibcmock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName)) ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) // Create Transfer Stack @@ -520,7 +487,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule - icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("")) app.ICAAuthModule, ok = icaControllerStack.(ibcmock.IBCModule) if !ok { panic(fmt.Errorf("cannot convert %T to %T", icaControllerStack, app.ICAAuthModule)) @@ -545,9 +512,6 @@ func NewSimApp( // Add host, controller & ica auth modules to IBC router ibcRouter. - // the ICA Controller middleware needs to be explicitly added to the IBC Router because the - // ICA controller module owns the port capability for ICA. The ICA authentication module - // owns the channel capability. AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). AddRoute(icahosttypes.SubModuleName, icaHostStack). AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerStack) // ica with mock auth module stack route to ica (top level of middleware stack) @@ -562,7 +526,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> callbacks.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule var feeWithMockModule porttypes.Middleware = ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) feeWithMockModule = ibccallbacks.NewIBCMiddleware(feeWithMockModule, app.IBCFeeKeeper, app.MockContractKeeper, maxCallbackGas) @@ -603,7 +567,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), @@ -657,9 +620,7 @@ func NewSimApp( // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -679,7 +640,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, feegrant.ModuleName, icatypes.ModuleName, @@ -691,11 +651,7 @@ func NewSimApp( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, @@ -792,17 +748,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } @@ -1065,11 +1010,6 @@ func (app *SimApp) GetPacketServer() *packetserverkeeper.Keeper { return app.PacketServer } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/modules/apps/transfer/ibc_module.go b/modules/apps/transfer/ibc_module.go index 39220cc75eb..c6445645c23 100644 --- a/modules/apps/transfer/ibc_module.go +++ b/modules/apps/transfer/ibc_module.go @@ -1,6 +1,7 @@ package transfer import ( + "context" "fmt" "math" "slices" @@ -10,13 +11,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/internal/events" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/keeper" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -43,7 +42,7 @@ func NewIBCModule(k keeper.Keeper) IBCModule { // channel must be UNORDERED, use the correct port (by default 'transfer'), and use the current // supported version. Only 2^32 channels are allowed to be created. func ValidateTransferChannelParams( - ctx sdk.Context, + ctx context.Context, transferkeeper keeper.Keeper, order channeltypes.Order, portID string, @@ -73,12 +72,11 @@ func ValidateTransferChannelParams( // OnChanOpenInit implements the IBCModule interface func (im IBCModule) OnChanOpenInit( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) { @@ -95,22 +93,16 @@ func (im IBCModule) OnChanOpenInit( return "", errorsmod.Wrapf(types.ErrInvalidVersion, "expected one of %s, got %s", types.SupportedVersions, version) } - // Claim channel capability passed back by IBC module - if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } - return version, nil } // OnChanOpenTry implements the IBCModule interface. func (im IBCModule) OnChanOpenTry( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, - chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { @@ -118,11 +110,6 @@ func (im IBCModule) OnChanOpenTry( return "", err } - // OpenTry must claim the channelCapability that IBC passes into the callback - if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } - if !slices.Contains(types.SupportedVersions, counterpartyVersion) { im.keeper.Logger(ctx).Debug("invalid counterparty version, proposing latest app version", "counterpartyVersion", counterpartyVersion, "version", types.V2) return types.V2, nil @@ -133,7 +120,7 @@ func (im IBCModule) OnChanOpenTry( // OnChanOpenAck implements the IBCModule interface func (IBCModule) OnChanOpenAck( - ctx sdk.Context, + ctx context.Context, portID, channelID string, _ string, @@ -148,7 +135,7 @@ func (IBCModule) OnChanOpenAck( // OnChanOpenConfirm implements the IBCModule interface func (IBCModule) OnChanOpenConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -157,7 +144,7 @@ func (IBCModule) OnChanOpenConfirm( // OnChanCloseInit implements the IBCModule interface func (IBCModule) OnChanCloseInit( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -167,7 +154,7 @@ func (IBCModule) OnChanCloseInit( // OnChanCloseConfirm implements the IBCModule interface func (IBCModule) OnChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error { @@ -179,7 +166,7 @@ func (IBCModule) OnChanCloseConfirm( // logic returns without error. // A nil acknowledgement may be returned when using the packet forwarding feature. This signals to core IBC that the acknowledgement will be written asynchronously. func (im IBCModule) OnRecvPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -223,7 +210,7 @@ func (im IBCModule) OnRecvPacket( // OnAcknowledgementPacket implements the IBCModule interface func (im IBCModule) OnAcknowledgementPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, @@ -250,7 +237,7 @@ func (im IBCModule) OnAcknowledgementPacket( // OnTimeoutPacket implements the IBCModule interface func (im IBCModule) OnTimeoutPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -270,7 +257,7 @@ func (im IBCModule) OnTimeoutPacket( } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeInit(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { if err := ValidateTransferChannelParams(ctx, im.keeper, proposedOrder, portID, channelID); err != nil { return "", err } @@ -283,7 +270,7 @@ func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, } // OnChanUpgradeTry implements the IBCModule interface -func (im IBCModule) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeTry(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { if err := ValidateTransferChannelParams(ctx, im.keeper, proposedOrder, portID, channelID); err != nil { return "", err } @@ -297,7 +284,7 @@ func (im IBCModule) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, } // OnChanUpgradeAck implements the IBCModule interface -func (IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { +func (IBCModule) OnChanUpgradeAck(ctx context.Context, portID, channelID, counterpartyVersion string) error { if !slices.Contains(types.SupportedVersions, counterpartyVersion) { return errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: expected one of %s, got %s", types.SupportedVersions, counterpartyVersion) } @@ -306,13 +293,13 @@ func (IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpar } // OnChanUpgradeOpen implements the IBCModule interface -func (IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { +func (IBCModule) OnChanUpgradeOpen(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { } // UnmarshalPacketData attempts to unmarshal the provided packet data bytes // into a FungibleTokenPacketData. This function implements the optional // PacketDataUnmarshaler interface required for ADR 008 support. -func (im IBCModule) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { +func (im IBCModule) UnmarshalPacketData(ctx context.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { ics20Version, found := im.keeper.GetICS4Wrapper().GetAppVersion(ctx, portID, channelID) if !found { return types.FungibleTokenPacketDataV2{}, "", errorsmod.Wrapf(ibcerrors.ErrNotFound, "app version not found for port %s and channel %s", portID, channelID) diff --git a/modules/apps/transfer/ibc_module_test.go b/modules/apps/transfer/ibc_module_test.go index 0a22a96e8bd..6ff8ab21fee 100644 --- a/modules/apps/transfer/ibc_module_test.go +++ b/modules/apps/transfer/ibc_module_test.go @@ -10,14 +10,12 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/transfer" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" "github.com/cosmos/ibc-go/v9/modules/core/exported" ibctesting "github.com/cosmos/ibc-go/v9/testing" @@ -27,7 +25,6 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() { var ( channel *channeltypes.Channel path *ibctesting.Path - chanCap *capabilitytypes.Capability counterparty channeltypes.Counterparty ) @@ -77,12 +74,6 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() { channel.Version = "version" //nolint:goconst }, types.ErrInvalidVersion, "", }, - { - "capability already claimed", func() { - err := suite.chainA.GetSimApp().ScopedTransferKeeper.ClaimCapability(suite.chainA.GetContext(), chanCap, host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)) - suite.Require().NoError(err) - }, capabilitytypes.ErrOwnerClaimed, "", - }, } for _, tc := range testCases { @@ -103,15 +94,11 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() { Version: types.V2, } - var err error - chanCap, err = suite.chainA.App.GetScopedIBCKeeper().NewCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(ibctesting.TransferPort, path.EndpointA.ChannelID)) - suite.Require().NoError(err) - tc.malleate() // explicitly change fields in channel and testChannel transferModule := transfer.NewIBCModule(suite.chainA.GetSimApp().TransferKeeper) version, err := transferModule.OnChanOpenInit(suite.chainA.GetContext(), channel.Ordering, channel.ConnectionHops, - path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, chanCap, counterparty, channel.Version, + path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, counterparty, channel.Version, ) expPass := tc.expError == nil @@ -129,7 +116,6 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() { func (suite *TransferTestSuite) TestOnChanOpenTry() { var ( channel *channeltypes.Channel - chanCap *capabilitytypes.Capability path *ibctesting.Path counterparty channeltypes.Counterparty counterpartyVersion string @@ -160,12 +146,6 @@ func (suite *TransferTestSuite) TestOnChanOpenTry() { path.EndpointA.ChannelID = channeltypes.FormatChannelIdentifier(math.MaxUint32 + 1) }, types.ErrMaxTransferChannels, "", }, - { - "failure: capability already claimed", func() { - err := suite.chainA.GetSimApp().ScopedTransferKeeper.ClaimCapability(suite.chainA.GetContext(), chanCap, host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)) - suite.Require().NoError(err) - }, capabilitytypes.ErrOwnerClaimed, "", - }, { "failure: invalid order - ORDERED", func() { channel.Ordering = channeltypes.ORDERED @@ -198,19 +178,13 @@ func (suite *TransferTestSuite) TestOnChanOpenTry() { } counterpartyVersion = types.V2 - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.TransferPort) - suite.Require().NoError(err) - - chanCap, err = suite.chainA.App.GetScopedIBCKeeper().NewCapability(suite.chainA.GetContext(), host.ChannelCapabilityPath(ibctesting.TransferPort, path.EndpointA.ChannelID)) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.TransferPort) suite.Require().True(ok) tc.malleate() // explicitly change fields in channel and testChannel version, err := cbs.OnChanOpenTry(suite.chainA.GetContext(), channel.Ordering, channel.ConnectionHops, - path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, chanCap, channel.Counterparty, counterpartyVersion, + path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel.Counterparty, counterpartyVersion, ) expPass := tc.expError == nil if expPass { @@ -255,15 +229,12 @@ func (suite *TransferTestSuite) TestOnChanOpenAck() { path.EndpointA.ChannelID = ibctesting.FirstChannelID counterpartyVersion = types.V2 - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.TransferPort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.TransferPort) suite.Require().True(ok) tc.malleate() // explicitly change fields in channel and testChannel - err = cbs.OnChanOpenAck(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointA.Counterparty.ChannelID, counterpartyVersion) + err := cbs.OnChanOpenAck(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointA.Counterparty.ChannelID, counterpartyVersion) expPass := tc.expError == nil if expPass { @@ -294,7 +265,7 @@ func (suite *TransferTestSuite) TestOnRecvPacket() { "success", func() {}, channeltypes.NewResultAcknowledgement([]byte{byte(1)}), "", }, { - "success: async aknowledgment with forwarding path", + "success: async acknowledgment with forwarding path", func() { packetData := types.NewFungibleTokenPacketDataV2( []types.Token{ @@ -395,10 +366,7 @@ func (suite *TransferTestSuite) TestOnRecvPacket() { packet = channeltypes.NewPacket(packetData.GetBytes(), seq, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.ZeroHeight(), suite.chainA.GetTimeoutTimestamp()) ctx := suite.chainB.GetContext() - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(ctx, ibctesting.TransferPort) - suite.Require().NoError(err) - - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(ibctesting.TransferPort) suite.Require().True(ok) tc.malleate() // change fields in packet @@ -462,10 +430,7 @@ func (suite *TransferTestSuite) TestOnTimeoutPacket() { "already timed-out packet", sdk.NewCoins(ibctesting.TestCoin), func() { - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.TransferPort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.TransferPort) suite.Require().True(ok) suite.Require().NoError(cbs.OnTimeoutPacket(suite.chainA.GetContext(), path.EndpointA.GetChannel().Version, packet, suite.chainA.SenderAccount.GetAddress())) @@ -500,10 +465,7 @@ func (suite *TransferTestSuite) TestOnTimeoutPacket() { packet, err = ibctesting.ParsePacketFromEvents(res.Events) suite.Require().NoError(err) - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), ibctesting.TransferPort) - suite.Require().NoError(err) - - cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.TransferPort) suite.Require().True(ok) tc.malleate() // change fields in packet @@ -650,10 +612,7 @@ func (suite *TransferTestSuite) TestOnChanUpgradeTry() { tc.malleate() - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), types.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(types.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) @@ -721,10 +680,7 @@ func (suite *TransferTestSuite) TestOnChanUpgradeAck() { tc.malleate() - module, _, err := suite.chainA.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainA.GetContext(), types.PortID) - suite.Require().NoError(err) - - app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(module) + app, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(types.PortID) suite.Require().True(ok) cbs, ok := app.(porttypes.UpgradableModule) diff --git a/modules/apps/transfer/internal/events/events.go b/modules/apps/transfer/internal/events/events.go index 64f26cc003a..b6e48282e3c 100644 --- a/modules/apps/transfer/internal/events/events.go +++ b/modules/apps/transfer/internal/events/events.go @@ -1,6 +1,7 @@ package events import ( + "context" "encoding/json" "strconv" @@ -11,11 +12,12 @@ import ( ) // EmitTransferEvent emits a ibc transfer event on successful transfers. -func EmitTransferEvent(ctx sdk.Context, sender, receiver string, tokens types.Tokens, memo string, forwardingHops []types.Hop) { +func EmitTransferEvent(ctx context.Context, sender, receiver string, tokens types.Tokens, memo string, forwardingHops []types.Hop) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 tokensStr := mustMarshalJSON(tokens) forwardingHopsStr := mustMarshalJSON(forwardingHops) - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeTransfer, sdk.NewAttribute(types.AttributeKeySender, sender), @@ -32,7 +34,7 @@ func EmitTransferEvent(ctx sdk.Context, sender, receiver string, tokens types.To } // EmitOnRecvPacketEvent emits a fungible token packet event in the OnRecvPacket callback -func EmitOnRecvPacketEvent(ctx sdk.Context, packetData types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement, ackErr error) { +func EmitOnRecvPacketEvent(ctx context.Context, packetData types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement, ackErr error) { tokensStr := mustMarshalJSON(packetData.Tokens) forwardingHopStr := mustMarshalJSON(packetData.Forwarding.Hops) @@ -49,7 +51,9 @@ func EmitOnRecvPacketEvent(ctx sdk.Context, packetData types.FungibleTokenPacket eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeKeyAckError, ackErr.Error())) } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypePacket, eventAttributes..., @@ -62,11 +66,11 @@ func EmitOnRecvPacketEvent(ctx sdk.Context, packetData types.FungibleTokenPacket } // EmitOnAcknowledgementPacketEvent emits a fungible token packet event in the OnAcknowledgementPacket callback -func EmitOnAcknowledgementPacketEvent(ctx sdk.Context, packetData types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) { +func EmitOnAcknowledgementPacketEvent(ctx context.Context, packetData types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) { tokensStr := mustMarshalJSON(packetData.Tokens) forwardingHopsStr := mustMarshalJSON(packetData.Forwarding.Hops) - - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypePacket, sdk.NewAttribute(sdk.AttributeKeySender, packetData.Sender), @@ -84,14 +88,14 @@ func EmitOnAcknowledgementPacketEvent(ctx sdk.Context, packetData types.Fungible switch resp := ack.Response.(type) { case *channeltypes.Acknowledgement_Result: - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypePacket, sdk.NewAttribute(types.AttributeKeyAckSuccess, string(resp.Result)), ), ) case *channeltypes.Acknowledgement_Error: - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypePacket, sdk.NewAttribute(types.AttributeKeyAckError, resp.Error), @@ -101,11 +105,12 @@ func EmitOnAcknowledgementPacketEvent(ctx sdk.Context, packetData types.Fungible } // EmitOnTimeoutEvent emits a fungible token packet event in the OnTimeoutPacket callback -func EmitOnTimeoutEvent(ctx sdk.Context, packetData types.FungibleTokenPacketDataV2) { +func EmitOnTimeoutEvent(ctx context.Context, packetData types.FungibleTokenPacketDataV2) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 tokensStr := mustMarshalJSON(packetData.Tokens) forwardingHopsStr := mustMarshalJSON(packetData.Forwarding.Hops) - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeTimeout, sdk.NewAttribute(types.AttributeKeyReceiver, packetData.Sender), @@ -121,10 +126,11 @@ func EmitOnTimeoutEvent(ctx sdk.Context, packetData types.FungibleTokenPacketDat } // EmitDenomEvent emits a denomination event in the OnRecv callback. -func EmitDenomEvent(ctx sdk.Context, token types.Token) { +func EmitDenomEvent(ctx context.Context, token types.Token) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 denomStr := mustMarshalJSON(token.Denom) - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeDenom, sdk.NewAttribute(types.AttributeKeyDenomHash, token.Denom.Hash().String()), diff --git a/modules/apps/transfer/keeper/forwarding.go b/modules/apps/transfer/keeper/forwarding.go index d4c2fb57168..cb68b9d919a 100644 --- a/modules/apps/transfer/keeper/forwarding.go +++ b/modules/apps/transfer/keeper/forwarding.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -8,12 +10,11 @@ import ( "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ) // forwardPacket forwards a fungible FungibleTokenPacketDataV2 to the next hop in the forwarding path. -func (k Keeper) forwardPacket(ctx sdk.Context, data types.FungibleTokenPacketDataV2, packet channeltypes.Packet, receivedCoins sdk.Coins) error { +func (k Keeper) forwardPacket(ctx context.Context, data types.FungibleTokenPacketDataV2, packet channeltypes.Packet, receivedCoins sdk.Coins) error { var nextForwardingPath *types.Forwarding if len(data.Forwarding.Hops) > 1 { // remove the first hop since we are going to send to the first hop now and we want to propagate the rest of the hops to the receiver @@ -45,13 +46,8 @@ func (k Keeper) forwardPacket(ctx sdk.Context, data types.FungibleTokenPacketDat } // acknowledgeForwardedPacket writes the async acknowledgement for forwardedPacket -func (k Keeper) acknowledgeForwardedPacket(ctx sdk.Context, forwardedPacket, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error { - capability, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(forwardedPacket.DestinationPort, forwardedPacket.DestinationChannel)) - if !ok { - return errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") - } - - if err := k.ics4Wrapper.WriteAcknowledgement(ctx, capability, forwardedPacket, ack); err != nil { +func (k Keeper) acknowledgeForwardedPacket(ctx context.Context, forwardedPacket, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error { + if err := k.ics4Wrapper.WriteAcknowledgement(ctx, forwardedPacket, ack); err != nil { return err } @@ -62,7 +58,7 @@ func (k Keeper) acknowledgeForwardedPacket(ctx sdk.Context, forwardedPacket, pac // revertForwardedPacket reverts the logic of receive packet that occurs in the middle chains during a packet forwarding. // If the packet fails to be forwarded all the way to the final destination, the state changes on this chain must be reverted // before sending back the error acknowledgement to ensure atomic packet forwarding. -func (k Keeper) revertForwardedPacket(ctx sdk.Context, forwardedPacket channeltypes.Packet, failedPacketData types.FungibleTokenPacketDataV2) error { +func (k Keeper) revertForwardedPacket(ctx context.Context, forwardedPacket channeltypes.Packet, failedPacketData types.FungibleTokenPacketDataV2) error { /* Recall that RecvPacket handles an incoming packet depending on the denom of the received funds: 1. If the funds are native, then the amount is sent to the receiver from the escrow. diff --git a/modules/apps/transfer/keeper/genesis.go b/modules/apps/transfer/keeper/genesis.go index 4239bf3afd8..d9653ce3c6c 100644 --- a/modules/apps/transfer/keeper/genesis.go +++ b/modules/apps/transfer/keeper/genesis.go @@ -1,8 +1,6 @@ package keeper import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" @@ -17,17 +15,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { k.setDenomMetadata(ctx, denom) } - // Only try to bind to port if it is not already bound, since we may already own - // port capability from capability InitGenesis - if !k.hasCapability(ctx, state.PortId) { - // transfer module binds to the transfer port on InitChain - // and claims the returned capability - err := k.BindPort(ctx, state.PortId) - if err != nil { - panic(fmt.Errorf("could not claim port capability: %v", err)) - } - } - k.SetParams(ctx, state.Params) // Every denom will have only one total escrow amount, since any diff --git a/modules/apps/transfer/keeper/grpc_query.go b/modules/apps/transfer/keeper/grpc_query.go index 8b5115007a6..90f53542985 100644 --- a/modules/apps/transfer/keeper/grpc_query.go +++ b/modules/apps/transfer/keeper/grpc_query.go @@ -11,6 +11,7 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" @@ -25,7 +26,7 @@ var ( ) // Denom implements the Query/Denom gRPC method -func (k Keeper) Denom(c context.Context, req *types.QueryDenomRequest) (*types.QueryDenomResponse, error) { +func (k Keeper) Denom(ctx context.Context, req *types.QueryDenomRequest) (*types.QueryDenomResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -35,7 +36,6 @@ func (k Keeper) Denom(c context.Context, req *types.QueryDenomRequest) (*types.Q return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid denom trace hash: %s, error: %s", hash.String(), err)) } - ctx := sdk.UnwrapSDKContext(c) denom, found := k.GetDenom(ctx, hash) if !found { return nil, status.Error( @@ -50,15 +50,13 @@ func (k Keeper) Denom(c context.Context, req *types.QueryDenomRequest) (*types.Q } // Denoms implements the Query/Denoms gRPC method -func (k Keeper) Denoms(c context.Context, req *types.QueryDenomsRequest) (*types.QueryDenomsResponse, error) { +func (k Keeper) Denoms(ctx context.Context, req *types.QueryDenomsRequest) (*types.QueryDenomsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - ctx := sdk.UnwrapSDKContext(c) - var denoms types.Denoms - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomKey) + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { var denom types.Denom @@ -80,8 +78,7 @@ func (k Keeper) Denoms(c context.Context, req *types.QueryDenomsRequest) (*types } // Params implements the Query/Params gRPC method -func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) +func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { params := k.GetParams(ctx) return &types.QueryParamsResponse{ @@ -90,7 +87,7 @@ func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.Q } // DenomHash implements the Query/DenomHash gRPC method -func (k Keeper) DenomHash(c context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error) { +func (k Keeper) DenomHash(ctx context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -101,7 +98,6 @@ func (k Keeper) DenomHash(c context.Context, req *types.QueryDenomHashRequest) ( return nil, status.Error(codes.InvalidArgument, err.Error()) } - ctx := sdk.UnwrapSDKContext(c) denomHash := denom.Hash() found := k.HasDenom(ctx, denomHash) if !found { @@ -117,7 +113,7 @@ func (k Keeper) DenomHash(c context.Context, req *types.QueryDenomHashRequest) ( } // EscrowAddress implements the EscrowAddress gRPC method -func (k Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error) { +func (k Keeper) EscrowAddress(ctx context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -128,7 +124,6 @@ func (k Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRe return nil, err } - ctx := sdk.UnwrapSDKContext(c) if !k.channelKeeper.HasChannel(ctx, req.PortId, req.ChannelId) { return nil, status.Error( codes.NotFound, @@ -142,13 +137,11 @@ func (k Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRe } // TotalEscrowForDenom implements the TotalEscrowForDenom gRPC method. -func (k Keeper) TotalEscrowForDenom(c context.Context, req *types.QueryTotalEscrowForDenomRequest) (*types.QueryTotalEscrowForDenomResponse, error) { +func (k Keeper) TotalEscrowForDenom(ctx context.Context, req *types.QueryTotalEscrowForDenomRequest) (*types.QueryTotalEscrowForDenomResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - ctx := sdk.UnwrapSDKContext(c) - if err := sdk.ValidateDenom(req.Denom); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } diff --git a/modules/apps/transfer/keeper/grpc_query_test.go b/modules/apps/transfer/keeper/grpc_query_test.go index 3b49c468c1f..866a5b34728 100644 --- a/modules/apps/transfer/keeper/grpc_query_test.go +++ b/modules/apps/transfer/keeper/grpc_query_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "errors" "fmt" sdkmath "cosmossdk.io/math" @@ -21,7 +22,7 @@ func (suite *KeeperTestSuite) TestQueryDenom() { testCases := []struct { msg string malleate func() - expPass bool + expErr error }{ { "success: correct ibc denom", @@ -37,7 +38,7 @@ func (suite *KeeperTestSuite) TestQueryDenom() { Hash: expDenom.IBCDenom(), } }, - true, + nil, }, { "success: correct hex hash", @@ -53,7 +54,7 @@ func (suite *KeeperTestSuite) TestQueryDenom() { Hash: expDenom.Hash().String(), } }, - true, + nil, }, { "failure: invalid hash", @@ -62,7 +63,7 @@ func (suite *KeeperTestSuite) TestQueryDenom() { Hash: "!@#!@#!", } }, - false, + errors.New("invalid denom trace hash"), }, { "failure: not found denom trace", @@ -77,7 +78,7 @@ func (suite *KeeperTestSuite) TestQueryDenom() { Hash: expDenom.IBCDenom(), } }, - false, + errors.New("denomination not found"), }, } @@ -91,12 +92,12 @@ func (suite *KeeperTestSuite) TestQueryDenom() { res, err := suite.chainA.GetSimApp().TransferKeeper.Denom(ctx, req) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(&expDenom, res.Denom) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -111,14 +112,14 @@ func (suite *KeeperTestSuite) TestQueryDenoms() { testCases := []struct { msg string malleate func() - expPass bool + expErr error }{ { "empty pagination", func() { req = &types.QueryDenomsRequest{} }, - true, + nil, }, { "success", @@ -138,7 +139,7 @@ func (suite *KeeperTestSuite) TestQueryDenoms() { }, } }, - true, + nil, }, } @@ -152,12 +153,12 @@ func (suite *KeeperTestSuite) TestQueryDenoms() { res, err := suite.chainA.GetSimApp().TransferKeeper.Denoms(ctx, req) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(expDenoms.Sort(), res.Denoms) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -181,16 +182,21 @@ func (suite *KeeperTestSuite) TestQueryDenomHash() { testCases := []struct { msg string malleate func() - expPass bool + expErr error }{ + { + "success", + func() {}, + nil, + }, { "invalid trace", func() { req = &types.QueryDenomHashRequest{ - Trace: "transfer/channelToA/transfer/", + Trace: "transfer%%/channel-1/transfer/channel-1/uatom", } }, - false, + errors.New("invalid trace"), }, { "not found denom trace", @@ -199,12 +205,7 @@ func (suite *KeeperTestSuite) TestQueryDenomHash() { Trace: "transfer/channelToC/uatom", } }, - false, - }, - { - "success", - func() {}, - true, + errors.New("denomination not found"), }, } @@ -223,12 +224,12 @@ func (suite *KeeperTestSuite) TestQueryDenomHash() { res, err := suite.chainA.GetSimApp().TransferKeeper.DenomHash(ctx, req) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(expHash, res.Hash) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -241,7 +242,7 @@ func (suite *KeeperTestSuite) TestEscrowAddress() { testCases := []struct { msg string malleate func() - expPass bool + expErr error }{ { "success", @@ -251,7 +252,7 @@ func (suite *KeeperTestSuite) TestEscrowAddress() { ChannelId: path.EndpointA.ChannelID, } }, - true, + nil, }, { "failure - channel not found", @@ -261,7 +262,7 @@ func (suite *KeeperTestSuite) TestEscrowAddress() { ChannelId: ibctesting.FirstChannelID, } }, - false, + errors.New("channel not found"), }, { "failure - empty channelID", @@ -271,7 +272,7 @@ func (suite *KeeperTestSuite) TestEscrowAddress() { ChannelId: "", } }, - false, + errors.New("identifier cannot be blank"), }, { "failure - empty portID", @@ -281,7 +282,7 @@ func (suite *KeeperTestSuite) TestEscrowAddress() { ChannelId: ibctesting.FirstChannelID, } }, - false, + errors.New("identifier cannot be blank"), }, } @@ -297,12 +298,12 @@ func (suite *KeeperTestSuite) TestEscrowAddress() { res, err := suite.chainA.GetSimApp().TransferKeeper.EscrowAddress(ctx, req) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) expected := types.GetEscrowAddress(ibctesting.TransferPort, path.EndpointA.ChannelID).String() suite.Require().Equal(expected, res.EscrowAddress) } else { - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) } }) } @@ -317,7 +318,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { testCases := []struct { msg string malleate func() - expPass bool + expErr error }{ { "valid native denom with escrow amount < 2^63", @@ -329,7 +330,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { expEscrowAmount = sdkmath.NewInt(100) suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(sdk.DefaultBondDenom, expEscrowAmount)) }, - true, + nil, }, { "valid ibc denom with escrow amount > 2^63", @@ -345,7 +346,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { Denom: denom.IBCDenom(), } }, - true, + nil, }, { "valid ibc denom treated as native denom", @@ -356,7 +357,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { Denom: denom.IBCDenom(), } }, - true, // denom trace is not found, thus the denom is considered a native token + nil, // denom trace is not found, thus the denom is considered a native token }, { "invalid ibc denom treated as valid native denom", @@ -365,7 +366,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { Denom: "ibc/123", } }, - true, // the ibc denom does not contain a valid hash, thus the denom is considered a native token + nil, // the ibc denom does not contain a valid hash, thus the denom is considered a native token }, { "invalid denom", @@ -374,7 +375,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { Denom: "??𓃠🐾??", } }, - false, + errors.New("invalid denom"), }, } @@ -389,10 +390,11 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { res, err := suite.chainA.GetSimApp().TransferKeeper.TotalEscrowForDenom(ctx, req) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) suite.Require().Equal(expEscrowAmount, res.Amount.Amount) } else { + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr, err.Error()) suite.Require().Error(err) } }) diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 0ce1399513d..1ebb14ace71 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -1,22 +1,24 @@ package keeper import ( + "context" "errors" "fmt" "strings" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" sdkmath "cosmossdk.io/math" "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" cmtbytes "github.com/cometbft/cometbft/libs/bytes" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" @@ -26,16 +28,14 @@ import ( // Keeper defines the IBC fungible transfer keeper type Keeper struct { - storeKey storetypes.StoreKey + storeService corestore.KVStoreService cdc codec.BinaryCodec legacySubspace types.ParamSubspace ics4Wrapper porttypes.ICS4Wrapper channelKeeper types.ChannelKeeper - portKeeper types.PortKeeper authKeeper types.AccountKeeper bankKeeper types.BankKeeper - scopedKeeper exported.ScopedKeeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. @@ -45,14 +45,12 @@ type Keeper struct { // NewKeeper creates a new IBC transfer Keeper instance func NewKeeper( cdc codec.BinaryCodec, - key storetypes.StoreKey, + storeService corestore.KVStoreService, legacySubspace types.ParamSubspace, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, - portKeeper types.PortKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, - scopedKeeper exported.ScopedKeeper, authority string, ) Keeper { // ensure ibc transfer module account is set @@ -66,14 +64,12 @@ func NewKeeper( return Keeper{ cdc: cdc, - storeKey: key, + storeService: storeService, legacySubspace: legacySubspace, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, authKeeper: authKeeper, bankKeeper: bankKeeper, - scopedKeeper: scopedKeeper, authority: authority, } } @@ -96,39 +92,36 @@ func (k Keeper) GetAuthority() string { } // Logger returns a module-specific logger. -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName) -} - -// hasCapability checks if the transfer module owns the port capability for the desired port -func (k Keeper) hasCapability(ctx sdk.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok -} - -// BindPort defines a wrapper function for the port Keeper's function in -// order to expose it to module's InitGenesis function -func (k Keeper) BindPort(ctx sdk.Context, portID string) error { - capability := k.portKeeper.BindPort(ctx, portID) - return k.ClaimCapability(ctx, capability, host.PortPath(portID)) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName) } // GetPort returns the portID for the transfer module. Used in ExportGenesis -func (k Keeper) GetPort(ctx sdk.Context) string { - store := ctx.KVStore(k.storeKey) - return string(store.Get(types.PortKey)) +func (k Keeper) GetPort(ctx context.Context) string { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.PortKey) + if err != nil { + panic(err) + } + return string(bz) } // SetPort sets the portID for the transfer module. Used in InitGenesis -func (k Keeper) SetPort(ctx sdk.Context, portID string) { - store := ctx.KVStore(k.storeKey) - store.Set(types.PortKey, []byte(portID)) +func (k Keeper) SetPort(ctx context.Context, portID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(types.PortKey, []byte(portID)); err != nil { + panic(err) + } } // GetParams returns the current transfer module parameters. -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.ParamsKey)) +func (k Keeper) GetParams(ctx context.Context) types.Params { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.ParamsKey)) + if err != nil { + panic(err) + } if bz == nil { // only panic on unset params and not on empty params panic(errors.New("transfer params are not set in store")) } @@ -139,15 +132,17 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { } // SetParams sets the transfer module parameters. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) SetParams(ctx context.Context, params types.Params) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(¶ms) - store.Set([]byte(types.ParamsKey), bz) + if err := store.Set([]byte(types.ParamsKey), bz); err != nil { + panic(err) + } } // GetDenom retrieves the denom from store given the hash of the denom. -func (k Keeper) GetDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) (types.Denom, bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomKey) +func (k Keeper) GetDenom(ctx context.Context, denomHash cmtbytes.HexBytes) (types.Denom, bool) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) bz := store.Get(denomHash) if len(bz) == 0 { return types.Denom{}, false @@ -160,21 +155,21 @@ func (k Keeper) GetDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) (types.De } // HasDenom checks if a the key with the given denomination hash exists on the store. -func (k Keeper) HasDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) bool { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomKey) +func (k Keeper) HasDenom(ctx context.Context, denomHash cmtbytes.HexBytes) bool { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) return store.Has(denomHash) } // SetDenom sets a new {denom hash -> denom } pair to the store. // This allows for reverse lookup of the denom given the hash. -func (k Keeper) SetDenom(ctx sdk.Context, denom types.Denom) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomKey) +func (k Keeper) SetDenom(ctx context.Context, denom types.Denom) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) bz := k.cdc.MustMarshal(&denom) store.Set(denom.Hash(), bz) } // GetAllDenoms returns all the denominations. -func (k Keeper) GetAllDenoms(ctx sdk.Context) types.Denoms { +func (k Keeper) GetAllDenoms(ctx context.Context) types.Denoms { denoms := types.Denoms{} k.IterateDenoms(ctx, func(denom types.Denom) bool { denoms = append(denoms, denom) @@ -185,11 +180,11 @@ func (k Keeper) GetAllDenoms(ctx sdk.Context) types.Denoms { } // IterateDenoms iterates over the denominations in the store and performs a callback function. -func (k Keeper) IterateDenoms(ctx sdk.Context, cb func(denom types.Denom) bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) IterateDenoms(ctx context.Context, cb func(denom types.Denom) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.DenomKey) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var denom types.Denom k.cdc.MustUnmarshal(iterator.Value(), &denom) @@ -201,7 +196,7 @@ func (k Keeper) IterateDenoms(ctx sdk.Context, cb func(denom types.Denom) bool) } // setDenomMetadata sets an IBC token's denomination metadata -func (k Keeper) setDenomMetadata(ctx sdk.Context, denom types.Denom) { +func (k Keeper) setDenomMetadata(ctx context.Context, denom types.Denom) { metadata := banktypes.Metadata{ Description: fmt.Sprintf("IBC token from %s", denom.Path()), DenomUnits: []*banktypes.DenomUnit{ @@ -227,9 +222,12 @@ func (k Keeper) setDenomMetadata(ctx sdk.Context, denom types.Denom) { // // NOTE: if there is no value stored in state for the provided denom then a new Coin is returned for the denom with an initial value of zero. // This accommodates callers to simply call `Add()` on the returned Coin as an empty Coin literal (e.g. sdk.Coin{}) will trigger a panic due to the absence of a denom. -func (k Keeper) GetTotalEscrowForDenom(ctx sdk.Context, denom string) sdk.Coin { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.TotalEscrowForDenomKey(denom)) +func (k Keeper) GetTotalEscrowForDenom(ctx context.Context, denom string) sdk.Coin { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.TotalEscrowForDenomKey(denom)) + if err != nil { + panic(err) + } if len(bz) == 0 { return sdk.NewCoin(denom, sdkmath.ZeroInt()) } @@ -243,25 +241,29 @@ func (k Keeper) GetTotalEscrowForDenom(ctx sdk.Context, denom string) sdk.Coin { // SetTotalEscrowForDenom stores the total amount of source chain tokens that are in escrow. // Amount is stored in state if and only if it is not equal to zero. The function will panic // if the amount is negative. -func (k Keeper) SetTotalEscrowForDenom(ctx sdk.Context, coin sdk.Coin) { +func (k Keeper) SetTotalEscrowForDenom(ctx context.Context, coin sdk.Coin) { if coin.Amount.IsNegative() { panic(fmt.Errorf("amount cannot be negative: %s", coin.Amount)) } - store := ctx.KVStore(k.storeKey) + store := k.storeService.OpenKVStore(ctx) key := types.TotalEscrowForDenomKey(coin.Denom) if coin.Amount.IsZero() { - store.Delete(key) // delete the key since Cosmos SDK x/bank module will prune any non-zero balances + if err := store.Delete(key); err != nil { // delete the key since Cosmos SDK x/bank module will prune any non-zero balances + panic(err) + } return } bz := k.cdc.MustMarshal(&sdk.IntProto{Int: coin.Amount}) - store.Set(key, bz) + if err := store.Set(key, bz); err != nil { + panic(err) + } } // GetAllTotalEscrowed returns the escrow information for all the denominations. -func (k Keeper) GetAllTotalEscrowed(ctx sdk.Context) sdk.Coins { +func (k Keeper) GetAllTotalEscrowed(ctx context.Context) sdk.Coins { var escrows sdk.Coins k.IterateTokensInEscrow(ctx, []byte(types.KeyTotalEscrowPrefix), func(denomEscrow sdk.Coin) bool { escrows = escrows.Add(denomEscrow) @@ -274,11 +276,11 @@ func (k Keeper) GetAllTotalEscrowed(ctx sdk.Context) sdk.Coins { // IterateTokensInEscrow iterates over the denomination escrows in the store // and performs a callback function. Denominations for which an invalid value // (i.e. not integer) is stored, will be skipped. -func (k Keeper) IterateTokensInEscrow(ctx sdk.Context, storeprefix []byte, cb func(denomEscrow sdk.Coin) bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) IterateTokensInEscrow(ctx context.Context, storeprefix []byte, cb func(denomEscrow sdk.Coin) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, storeprefix) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { denom := strings.TrimPrefix(string(iterator.Key()), fmt.Sprintf("%s/", types.KeyTotalEscrowPrefix)) if strings.TrimSpace(denom) == "" { @@ -297,28 +299,22 @@ func (k Keeper) IterateTokensInEscrow(ctx sdk.Context, storeprefix []byte, cb fu } } -// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function -func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool { - return k.scopedKeeper.AuthenticateCapability(ctx, cap, name) -} - -// ClaimCapability allows the transfer module that can claim a capability that IBC module -// passes to it -func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error { - return k.scopedKeeper.ClaimCapability(ctx, cap, name) -} - // setForwardedPacket sets the forwarded packet in the store. -func (k Keeper) setForwardedPacket(ctx sdk.Context, portID, channelID string, sequence uint64, packet channeltypes.Packet) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) setForwardedPacket(ctx context.Context, portID, channelID string, sequence uint64, packet channeltypes.Packet) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(&packet) - store.Set(types.PacketForwardKey(portID, channelID, sequence), bz) + if err := store.Set(types.PacketForwardKey(portID, channelID, sequence), bz); err != nil { + panic(err) + } } // getForwardedPacket gets the forwarded packet from the store. -func (k Keeper) getForwardedPacket(ctx sdk.Context, portID, channelID string, sequence uint64) (channeltypes.Packet, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PacketForwardKey(portID, channelID, sequence)) +func (k Keeper) getForwardedPacket(ctx context.Context, portID, channelID string, sequence uint64) (channeltypes.Packet, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(types.PacketForwardKey(portID, channelID, sequence)) + if err != nil { + panic(err) + } if bz == nil { return channeltypes.Packet{}, false } @@ -330,15 +326,17 @@ func (k Keeper) getForwardedPacket(ctx sdk.Context, portID, channelID string, se } // deleteForwardedPacket deletes the forwarded packet from the store. -func (k Keeper) deleteForwardedPacket(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) deleteForwardedPacket(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) packetKey := types.PacketForwardKey(portID, channelID, sequence) - store.Delete(packetKey) + if err := store.Delete(packetKey); err != nil { + panic(err) + } } // getAllForwardedPackets gets all forward packets stored in state. -func (k Keeper) getAllForwardedPackets(ctx sdk.Context) []types.ForwardedPacket { +func (k Keeper) getAllForwardedPackets(ctx context.Context) []types.ForwardedPacket { var packets []types.ForwardedPacket k.iterateForwardedPackets(ctx, func(packet types.ForwardedPacket) bool { packets = append(packets, packet) @@ -349,11 +347,11 @@ func (k Keeper) getAllForwardedPackets(ctx sdk.Context) []types.ForwardedPacket } // iterateForwardedPackets iterates over the forward packets in the store and performs a callback function. -func (k Keeper) iterateForwardedPackets(ctx sdk.Context, cb func(packet types.ForwardedPacket) bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) iterateForwardedPackets(ctx context.Context, cb func(packet types.ForwardedPacket) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.ForwardedPacketKey) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var forwardPacket types.ForwardedPacket k.cdc.MustUnmarshal(iterator.Value(), &forwardPacket.Packet) diff --git a/modules/apps/transfer/keeper/keeper_test.go b/modules/apps/transfer/keeper/keeper_test.go index 683bf8175ab..72dc5453733 100644 --- a/modules/apps/transfer/keeper/keeper_test.go +++ b/modules/apps/transfer/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -52,50 +53,44 @@ func (suite *KeeperTestSuite) TestNewKeeper() { testCases := []struct { name string instantiateFn func() - expPass bool + panicMsg string }{ {"success", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, suite.chainA.GetSimApp().BankKeeper, - suite.chainA.GetSimApp().ScopedTransferKeeper, suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) - }, true}, + }, ""}, {"failure: transfer module account does not exist", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, authkeeper.AccountKeeper{}, // empty account keeper suite.chainA.GetSimApp().BankKeeper, - suite.chainA.GetSimApp().ScopedTransferKeeper, suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) - }, false}, + }, "the IBC transfer module account has not been set"}, {"failure: empty authority", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(types.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, suite.chainA.GetSimApp().BankKeeper, - suite.chainA.GetSimApp().ScopedTransferKeeper, "", // authority ) - }, false}, + }, "authority must be non-empty"}, } for _, tc := range testCases { @@ -103,12 +98,13 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.SetupTest() suite.Run(tc.name, func() { - if tc.expPass { + if tc.panicMsg == "" { suite.Require().NotPanics( tc.instantiateFn, ) } else { - suite.Require().Panics( + suite.Require().PanicsWithError( + tc.panicMsg, tc.instantiateFn, ) } @@ -325,15 +321,15 @@ func (suite *KeeperTestSuite) TestGetAllForwardedPackets() { func (suite *KeeperTestSuite) TestParams() { testCases := []struct { - name string - input types.Params - expPass bool + name string + input types.Params + panicMsg string }{ // it is not possible to set invalid booleans - {"success: set params false-false", types.NewParams(false, false), true}, - {"success: set params false-true", types.NewParams(false, true), true}, - {"success: set params true-false", types.NewParams(true, false), true}, - {"success: set params true-true", types.NewParams(true, true), true}, + {"success: set params false-false", types.NewParams(false, false), ""}, + {"success: set params false-true", types.NewParams(false, true), ""}, + {"success: set params true-false", types.NewParams(true, false), ""}, + {"success: set params true-true", types.NewParams(true, true), ""}, } for _, tc := range testCases { @@ -342,13 +338,13 @@ func (suite *KeeperTestSuite) TestParams() { suite.Run(tc.name, func() { suite.SetupTest() // reset ctx := suite.chainA.GetContext() - if tc.expPass { + if tc.panicMsg == "" { suite.chainA.GetSimApp().TransferKeeper.SetParams(ctx, tc.input) expected := tc.input p := suite.chainA.GetSimApp().TransferKeeper.GetParams(ctx) suite.Require().Equal(expected, p) } else { - suite.Require().Panics(func() { + suite.Require().PanicsWithError(tc.panicMsg, func() { suite.chainA.GetSimApp().TransferKeeper.SetParams(ctx, tc.input) }) } diff --git a/modules/apps/transfer/keeper/migrations.go b/modules/apps/transfer/keeper/migrations.go index bcfb43344f0..ab1e526d4a2 100644 --- a/modules/apps/transfer/keeper/migrations.go +++ b/modules/apps/transfer/keeper/migrations.go @@ -1,12 +1,14 @@ package keeper import ( + "context" "fmt" "strings" "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -113,26 +115,26 @@ func (m Migrator) MigrateDenomTraceToDenom(ctx sdk.Context) error { } // setDenomTrace sets a new {trace hash -> denom trace} pair to the store. -func (k Keeper) setDenomTrace(ctx sdk.Context, denomTrace internaltypes.DenomTrace) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomTraceKey) +func (k Keeper) setDenomTrace(ctx context.Context, denomTrace internaltypes.DenomTrace) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomTraceKey) bz := k.cdc.MustMarshal(&denomTrace) store.Set(denomTrace.Hash(), bz) } // deleteDenomTrace deletes the denom trace -func (k Keeper) deleteDenomTrace(ctx sdk.Context, denomTrace internaltypes.DenomTrace) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.DenomTraceKey) +func (k Keeper) deleteDenomTrace(ctx context.Context, denomTrace internaltypes.DenomTrace) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomTraceKey) store.Delete(denomTrace.Hash()) } // iterateDenomTraces iterates over the denomination traces in the store // and performs a callback function. -func (k Keeper) iterateDenomTraces(ctx sdk.Context, cb func(denomTrace internaltypes.DenomTrace) bool) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) iterateDenomTraces(ctx context.Context, cb func(denomTrace internaltypes.DenomTrace) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.DenomTraceKey) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var denomTrace internaltypes.DenomTrace k.cdc.MustUnmarshal(iterator.Value(), &denomTrace) diff --git a/modules/apps/transfer/keeper/msg_server_test.go b/modules/apps/transfer/keeper/msg_server_test.go index 793137e7843..0fb434b08fb 100644 --- a/modules/apps/transfer/keeper/msg_server_test.go +++ b/modules/apps/transfer/keeper/msg_server_test.go @@ -201,34 +201,34 @@ func (suite *KeeperTestSuite) TestMsgTransfer() { func (suite *KeeperTestSuite) TestUpdateParams() { signer := suite.chainA.GetSimApp().TransferKeeper.GetAuthority() testCases := []struct { - name string - msg *types.MsgUpdateParams - expPass bool + name string + msg *types.MsgUpdateParams + expErr error }{ { "success: valid signer and default params", types.NewMsgUpdateParams(signer, types.DefaultParams()), - true, + nil, }, { "failure: malformed signer address", types.NewMsgUpdateParams(ibctesting.InvalidID, types.DefaultParams()), - false, + ibcerrors.ErrUnauthorized, }, { "failure: empty signer address", types.NewMsgUpdateParams("", types.DefaultParams()), - false, + ibcerrors.ErrUnauthorized, }, { "failure: whitespace signer address", types.NewMsgUpdateParams(" ", types.DefaultParams()), - false, + ibcerrors.ErrUnauthorized, }, { "failure: unauthorized signer address", types.NewMsgUpdateParams(ibctesting.TestAccAddress, types.DefaultParams()), - false, + ibcerrors.ErrUnauthorized, }, } @@ -237,10 +237,10 @@ func (suite *KeeperTestSuite) TestUpdateParams() { suite.Run(tc.name, func() { suite.SetupTest() _, err := suite.chainA.GetSimApp().TransferKeeper.UpdateParams(suite.chainA.GetContext(), tc.msg) - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) } else { - suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expErr) } }) } diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index 122e4501fae..71ef740132c 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" "strings" @@ -15,7 +16,6 @@ import ( "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ) @@ -90,10 +90,6 @@ func (k Keeper) sendTransfer( // begin createOutgoingPacket logic // See spec for this logic: https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#packet-relay - channelCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(sourcePort, sourceChannel)) - if !ok { - return 0, errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") - } tokens := make([]types.Token, 0, len(coins)) @@ -146,7 +142,7 @@ func (k Keeper) sendTransfer( return 0, err } - sequence, err := k.ics4Wrapper.SendPacket(ctx, channelCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, packetDataBytes) + sequence, err := k.ics4Wrapper.SendPacket(ctx, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, packetDataBytes) if err != nil { return 0, err } @@ -167,7 +163,7 @@ func (k Keeper) sendTransfer( // // In the case of packet forwarding, the packet is sent on the next hop as specified // in the packet's ForwardingPacketData. -func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error { +func (k Keeper) OnRecvPacket(ctx context.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error { // validate packet data upon receiving if err := data.ValidateBasic(); err != nil { return errorsmod.Wrapf(err, "error validating ICS-20 transfer packet data") @@ -277,7 +273,7 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t // If forwarding is used and the acknowledgement was a success, a successful acknowledgement is written // for the forwarded packet. Otherwise, if the acknowledgement failed, after refunding the sender, the // tokens of the forwarded packet that were received are in turn either refunded or burned. -func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) error { +func (k Keeper) OnAcknowledgementPacket(ctx context.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) error { forwardedPacket, isForwarded := k.getForwardedPacket(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) switch ack.Response.(type) { @@ -321,7 +317,7 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac // If forwarding is used and the chain acted as a middle hop on a multihop transfer, after refunding // the tokens to the sender, the tokens of the forwarded packet that were received are in turn // either refunded or burned. -func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error { +func (k Keeper) OnTimeoutPacket(ctx context.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error { if err := k.refundPacketTokens(ctx, packet, data); err != nil { return err } @@ -343,7 +339,7 @@ func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, dat // if the sending chain was the source chain. Otherwise, the sent tokens // were burnt in the original send so new tokens are minted and sent to // the sending address. -func (k Keeper) refundPacketTokens(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error { +func (k Keeper) refundPacketTokens(ctx context.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error { // NOTE: packet data type already checked in handler.go sender, err := sdk.AccAddressFromBech32(data.Sender) @@ -389,7 +385,7 @@ func (k Keeper) refundPacketTokens(ctx sdk.Context, packet channeltypes.Packet, // escrowCoin will send the given coin from the provided sender to the escrow address. It will also // update the total escrowed amount by adding the escrowed coin's amount to the current total escrow. -func (k Keeper) escrowCoin(ctx sdk.Context, sender, escrowAddress sdk.AccAddress, coin sdk.Coin) error { +func (k Keeper) escrowCoin(ctx context.Context, sender, escrowAddress sdk.AccAddress, coin sdk.Coin) error { if err := k.bankKeeper.SendCoins(ctx, sender, escrowAddress, sdk.NewCoins(coin)); err != nil { // failure is expected for insufficient balances return err @@ -405,7 +401,7 @@ func (k Keeper) escrowCoin(ctx sdk.Context, sender, escrowAddress sdk.AccAddress // unescrowCoin will send the given coin from the escrow address to the provided receiver. It will also // update the total escrow by deducting the unescrowed coin's amount from the current total escrow. -func (k Keeper) unescrowCoin(ctx sdk.Context, escrowAddress, receiver sdk.AccAddress, coin sdk.Coin) error { +func (k Keeper) unescrowCoin(ctx context.Context, escrowAddress, receiver sdk.AccAddress, coin sdk.Coin) error { if err := k.bankKeeper.SendCoins(ctx, escrowAddress, receiver, sdk.NewCoins(coin)); err != nil { // NOTE: this error is only expected to occur given an unexpected bug or a malicious // counterparty module. The bug may occur in bank or any part of the code that allows diff --git a/modules/apps/transfer/keeper/relay_forwarding_test.go b/modules/apps/transfer/keeper/relay_forwarding_test.go index 452cea3f597..183a077db1e 100644 --- a/modules/apps/transfer/keeper/relay_forwarding_test.go +++ b/modules/apps/transfer/keeper/relay_forwarding_test.go @@ -1105,11 +1105,7 @@ func (suite *ForwardingTestSuite) TestOnTimeoutPacketForwarding() { packet.TimeoutHeight, packet.TimeoutTimestamp) - // retrieve module callbacks - module, _, err := suite.chainB.App.GetIBCKeeper().PortKeeper.LookupModuleByPort(suite.chainB.GetContext(), pathBtoC.EndpointA.ChannelConfig.PortID) - suite.Require().NoError(err) - - cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(module) + cbs, ok := suite.chainB.App.GetIBCKeeper().PortKeeper.Route(pathBtoC.EndpointA.ChannelConfig.PortID) suite.Require().True(ok) // Trigger OnTimeoutPacket for chainB diff --git a/modules/apps/transfer/keeper/relay_test.go b/modules/apps/transfer/keeper/relay_test.go index b1bc29f9ec0..da7efa7f105 100644 --- a/modules/apps/transfer/keeper/relay_test.go +++ b/modules/apps/transfer/keeper/relay_test.go @@ -161,16 +161,6 @@ func (suite *KeeperTestSuite) TestSendTransfer() { }, sdkerrors.ErrInsufficientFunds, }, - { - "failure: channel capability not found", - func() { - capability := suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - - // Release channel capability - suite.chainA.GetSimApp().ScopedTransferKeeper.ReleaseCapability(suite.chainA.GetContext(), capability) //nolint:errcheck // ignore error for testing - }, - channeltypes.ErrChannelCapabilityNotFound, - }, { "failure: forwarding hops is not empty with ics20-1", func() { diff --git a/modules/apps/transfer/types/codec_test.go b/modules/apps/transfer/types/codec_test.go index 6be95087a9b..591282526b7 100644 --- a/modules/apps/transfer/types/codec_test.go +++ b/modules/apps/transfer/types/codec_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -8,6 +9,7 @@ import ( "github.com/cosmos/ibc-go/v9/modules/apps/transfer" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" ) // TestMustMarshalProtoJSON tests that the memo field is only emitted (marshalled) if it is populated @@ -30,27 +32,27 @@ func (suite *TypesTestSuite) TestCodecTypeRegistration() { testCases := []struct { name string typeURL string - expPass bool + expErr error }{ { "success: MsgTransfer", sdk.MsgTypeURL(&types.MsgTransfer{}), - true, + nil, }, { "success: MsgUpdateParams", sdk.MsgTypeURL(&types.MsgUpdateParams{}), - true, + nil, }, { "success: TransferAuthorization", sdk.MsgTypeURL(&types.TransferAuthorization{}), - true, + nil, }, { "type not registered on codec", "ibc.invalid.MsgTypeURL", - false, + errors.New("unable to resolve type URL"), }, } @@ -61,12 +63,12 @@ func (suite *TypesTestSuite) TestCodecTypeRegistration() { encodingCfg := moduletestutil.MakeTestEncodingConfig(transfer.AppModuleBasic{}) msg, err := encodingCfg.Codec.InterfaceRegistry().Resolve(tc.typeURL) - if tc.expPass { + if tc.expErr == nil { suite.Require().NotNil(msg) suite.Require().NoError(err) } else { suite.Require().Nil(msg) - suite.Require().Error(err) + ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expErr) } }) } diff --git a/modules/apps/transfer/types/expected_keepers.go b/modules/apps/transfer/types/expected_keepers.go index 5125eb43315..157703fd771 100644 --- a/modules/apps/transfer/types/expected_keepers.go +++ b/modules/apps/transfer/types/expected_keepers.go @@ -7,7 +7,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -36,10 +35,10 @@ type BankKeeper interface { // ChannelKeeper defines the expected IBC channel keeper type ChannelKeeper interface { - GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) - GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) - GetAllChannelsWithPortPrefix(ctx sdk.Context, portPrefix string) []channeltypes.IdentifiedChannel - HasChannel(ctx sdk.Context, portID, channelID string) bool + GetChannel(ctx context.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) + GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) + GetAllChannelsWithPortPrefix(ctx context.Context, portPrefix string) []channeltypes.IdentifiedChannel + HasChannel(ctx context.Context, portID, channelID string) bool } // ClientKeeper defines the expected IBC client keeper @@ -52,11 +51,6 @@ type ConnectionKeeper interface { GetConnection(ctx sdk.Context, connectionID string) (connection connectiontypes.ConnectionEnd, found bool) } -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability -} - // ParamSubspace defines the expected Subspace interface for module parameters. type ParamSubspace interface { GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet) diff --git a/modules/apps/transfer/types/genesis_test.go b/modules/apps/transfer/types/genesis_test.go index bd9acc7c9ff..b86f337ee4a 100644 --- a/modules/apps/transfer/types/genesis_test.go +++ b/modules/apps/transfer/types/genesis_test.go @@ -6,42 +6,43 @@ import ( "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) func TestValidateGenesis(t *testing.T) { testCases := []struct { name string genState *types.GenesisState - expPass bool + expErr error }{ { name: "default", genState: types.DefaultGenesisState(), - expPass: true, + expErr: nil, }, { "valid genesis", &types.GenesisState{ PortId: "portidone", }, - true, + nil, }, { "invalid client", &types.GenesisState{ PortId: "(INVALIDPORT)", }, - false, + host.ErrInvalidID, }, } for _, tc := range testCases { tc := tc err := tc.genState.Validate() - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err, tc.name) } else { - require.Error(t, err, tc.name) + require.ErrorIs(t, err, tc.expErr, tc.name) } } } diff --git a/modules/apps/transfer/types/msgs_test.go b/modules/apps/transfer/types/msgs_test.go index 625202e1816..f630b041d4b 100644 --- a/modules/apps/transfer/types/msgs_test.go +++ b/modules/apps/transfer/types/msgs_test.go @@ -148,10 +148,10 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { testCases := []struct { name string address sdk.AccAddress - expPass bool + errMsg string }{ - {"success: valid address", sdk.AccAddress(ibctesting.TestAccAddress), true}, - {"failure: nil address", nil, false}, + {"success: valid address", sdk.AccAddress(ibctesting.TestAccAddress), ""}, + {"failure: nil address", nil, "empty address string is not allowed"}, } for _, tc := range testCases { @@ -164,11 +164,11 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { encodingCfg := moduletestutil.MakeTestEncodingConfig(transfer.AppModuleBasic{}) signers, _, err := encodingCfg.Codec.GetMsgV1Signers(&msg) - if tc.expPass { + if tc.errMsg == "" { require.NoError(t, err) require.Equal(t, tc.address.Bytes(), signers[0]) } else { - require.Error(t, err) + require.ErrorContains(t, err, tc.errMsg) } }) } diff --git a/modules/apps/transfer/types/packet_test.go b/modules/apps/transfer/types/packet_test.go index c876444d08d..254cec03522 100644 --- a/modules/apps/transfer/types/packet_test.go +++ b/modules/apps/transfer/types/packet_test.go @@ -10,6 +10,7 @@ import ( errorsmod "cosmossdk.io/errors" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -26,29 +27,29 @@ func TestFungibleTokenPacketDataValidateBasic(t *testing.T) { testCases := []struct { name string packetData types.FungibleTokenPacketData - expPass bool + expErr error }{ - {"valid packet", types.NewFungibleTokenPacketData(denom, amount, sender, receiver, ""), true}, - {"valid packet with memo", types.NewFungibleTokenPacketData(denom, amount, sender, receiver, "memo"), true}, - {"valid packet with large amount", types.NewFungibleTokenPacketData(denom, largeAmount, sender, receiver, ""), true}, - {"invalid denom", types.NewFungibleTokenPacketData("", amount, sender, receiver, ""), false}, - {"invalid denom, invalid portID", types.NewFungibleTokenPacketData("(tranfer)/channel-1/uatom", amount, sender, receiver, ""), false}, - {"invalid empty amount", types.NewFungibleTokenPacketData(denom, "", sender, receiver, ""), false}, - {"invalid zero amount", types.NewFungibleTokenPacketData(denom, "0", sender, receiver, ""), false}, - {"invalid negative amount", types.NewFungibleTokenPacketData(denom, "-1", sender, receiver, ""), false}, - {"invalid large amount", types.NewFungibleTokenPacketData(denom, invalidLargeAmount, sender, receiver, ""), false}, - {"missing sender address", types.NewFungibleTokenPacketData(denom, amount, emptyAddr, receiver, ""), false}, - {"missing recipient address", types.NewFungibleTokenPacketData(denom, amount, sender, emptyAddr, ""), false}, + {"valid packet", types.NewFungibleTokenPacketData(denom, amount, sender, receiver, ""), nil}, + {"valid packet with memo", types.NewFungibleTokenPacketData(denom, amount, sender, receiver, "memo"), nil}, + {"valid packet with large amount", types.NewFungibleTokenPacketData(denom, largeAmount, sender, receiver, ""), nil}, + {"invalid denom", types.NewFungibleTokenPacketData("", amount, sender, receiver, ""), types.ErrInvalidDenomForTransfer}, + {"invalid denom, invalid portID", types.NewFungibleTokenPacketData("(tranfer)/channel-1/uatom", amount, sender, receiver, ""), host.ErrInvalidID}, + {"invalid empty amount", types.NewFungibleTokenPacketData(denom, "", sender, receiver, ""), types.ErrInvalidAmount}, + {"invalid zero amount", types.NewFungibleTokenPacketData(denom, "0", sender, receiver, ""), types.ErrInvalidAmount}, + {"invalid negative amount", types.NewFungibleTokenPacketData(denom, "-1", sender, receiver, ""), types.ErrInvalidAmount}, + {"invalid large amount", types.NewFungibleTokenPacketData(denom, invalidLargeAmount, sender, receiver, ""), types.ErrInvalidAmount}, + {"missing sender address", types.NewFungibleTokenPacketData(denom, amount, emptyAddr, receiver, ""), ibcerrors.ErrInvalidAddress}, + {"missing recipient address", types.NewFungibleTokenPacketData(denom, amount, sender, emptyAddr, ""), ibcerrors.ErrInvalidAddress}, } for i, tc := range testCases { tc := tc err := tc.packetData.ValidateBasic() - if tc.expPass { + if tc.expErr == nil { require.NoError(t, err, "valid test case %d failed: %v", i, err) } else { - require.Error(t, err, "invalid test case %d passed: %s", i, tc.name) + require.ErrorIs(t, err, tc.expErr, "invalid test case %d passed: %s", i, tc.name) } } } diff --git a/modules/apps/transfer/types/transfer_authorization.go b/modules/apps/transfer/types/transfer_authorization.go index 6e166fe63b9..81a19b0b384 100644 --- a/modules/apps/transfer/types/transfer_authorization.go +++ b/modules/apps/transfer/types/transfer_authorization.go @@ -123,7 +123,7 @@ func (a TransferAuthorization) ValidateBasic() error { } if err := allocation.SpendLimit.Validate(); err != nil { - return errorsmod.Wrapf(ibcerrors.ErrInvalidCoins, err.Error()) + return errorsmod.Wrapf(ibcerrors.ErrInvalidCoins, "invalid spend limit: %s", err.Error()) } if err := host.PortIdentifierValidator(allocation.SourcePort); err != nil { diff --git a/modules/apps/transfer/types/transfer_authorization_test.go b/modules/apps/transfer/types/transfer_authorization_test.go index 678c42247f3..a02bc51a2f4 100644 --- a/modules/apps/transfer/types/transfer_authorization_test.go +++ b/modules/apps/transfer/types/transfer_authorization_test.go @@ -9,6 +9,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/cosmos/ibc-go/v9/testing/mock" @@ -530,19 +532,19 @@ func (suite *TypesTestSuite) TestTransferAuthorizationValidateBasic() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success: empty allow list", func() { transferAuthz.Allocations[0].AllowList = []string{} }, - true, + nil, }, { "success: with multiple allocations", @@ -556,21 +558,21 @@ func (suite *TypesTestSuite) TestTransferAuthorizationValidateBasic() { transferAuthz.Allocations = append(transferAuthz.Allocations, allocation) }, - true, + nil, }, { "success: with unlimited spend limit of max uint256", func() { transferAuthz.Allocations[0].SpendLimit = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, types.UnboundedSpendLimit())) }, - true, + nil, }, { "success: wildcard allowed packet data", func() { transferAuthz.Allocations[0].AllowedPacketData = []string{"*"} }, - true, + nil, }, { "success: with allowed forwarding hops", @@ -580,56 +582,56 @@ func (suite *TypesTestSuite) TestTransferAuthorizationValidateBasic() { {Hops: []types.Hop{types.NewHop(types.PortID, "channel-1")}}, } }, - true, + nil, }, { "empty allocations", func() { transferAuthz = types.TransferAuthorization{Allocations: []types.Allocation{}} }, - false, + types.ErrInvalidAuthorization, }, { "nil allocations", func() { transferAuthz = types.TransferAuthorization{} }, - false, + types.ErrInvalidAuthorization, }, { "nil spend limit coins", func() { transferAuthz.Allocations[0].SpendLimit = nil }, - false, + ibcerrors.ErrInvalidCoins, }, { "invalid spend limit coins", func() { transferAuthz.Allocations[0].SpendLimit = sdk.Coins{sdk.Coin{Denom: ""}} }, - false, + ibcerrors.ErrInvalidCoins, }, { "duplicate entry in allow list", func() { transferAuthz.Allocations[0].AllowList = []string{ibctesting.TestAccAddress, ibctesting.TestAccAddress} }, - false, + types.ErrInvalidAuthorization, }, { "invalid port identifier", func() { transferAuthz.Allocations[0].SourcePort = "" }, - false, + host.ErrInvalidID, }, { "invalid channel identifier", func() { transferAuthz.Allocations[0].SourceChannel = "" }, - false, + host.ErrInvalidID, }, { "duplicate channel ID", @@ -643,27 +645,27 @@ func (suite *TypesTestSuite) TestTransferAuthorizationValidateBasic() { transferAuthz.Allocations = append(transferAuthz.Allocations, allocation) }, - false, + channeltypes.ErrInvalidChannel, }, { - "fowarding hop with invalid port ID", + "forwarding hop with invalid port ID", func() { transferAuthz.Allocations[0].AllowedForwarding = []types.AllowedForwarding{ {Hops: []types.Hop{validHop}}, {Hops: []types.Hop{types.NewHop("invalid/port", ibctesting.FirstChannelID)}}, } }, - false, + host.ErrInvalidID, }, { - "fowarding hop with invalid channel ID", + "forwarding hop with invalid channel ID", func() { transferAuthz.Allocations[0].AllowedForwarding = []types.AllowedForwarding{ {Hops: []types.Hop{validHop}}, {Hops: []types.Hop{types.NewHop(types.PortID, "invalid/channel")}}, } }, - false, + host.ErrInvalidID, }, } @@ -686,10 +688,10 @@ func (suite *TypesTestSuite) TestTransferAuthorizationValidateBasic() { err := transferAuthz.ValidateBasic() - if tc.expPass { + if tc.expErr == nil { suite.Require().NoError(err) } else { - suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expErr) } }) } diff --git a/modules/capability/CHANGELOG.md b/modules/capability/CHANGELOG.md deleted file mode 100644 index 52e267fb93c..00000000000 --- a/modules/capability/CHANGELOG.md +++ /dev/null @@ -1,78 +0,0 @@ - - -# Changelog - -## [Unreleased] - -### Dependencies - -* [\#6828](https://github.com/cosmos/ibc-go/pull/6828) Bump Cosmos SDK to v0.50.9. -* [\#6193](https://github.com/cosmos/ibc-go/pull/6193) Bump `cosmossdk.io/store` to v1.1.0. -* [\#6848](https://github.com/cosmos/ibc-go/pull/6848) Bump CometBFT to v0.38.10. - -### API Breaking - -### State Machine Breaking - -### Improvements - -* [\#6716](https://github.com/cosmos/ibc-go/pull/6716) Add `HasModule` to capability keeper to allow checking if a scoped module already exists. - -### Features - -### Bug Fixes - -## [v1.0.0] - -### Dependencies - -* [\#4068](https://github.com/cosmos/ibc-go/pull/4068) Upgrade capability module to cosmos-sdk v0.50 - -### API Breaking - -### State Machine Breaking - -### Improvements - -* [\#4068](https://github.com/cosmos/ibc-go/pull/4068) Various improvements made to testing to reduce the dependency tree and use new cosmos-sdk test utils. - -### Features - -### Bug Fixes - -* [\#15030](https://github.com/cosmos/cosmos-sdk/pull/15030) `InitMemStore` now correctly uses a `NewInfiniteGasMeter` for both `GasMeter` **and** `BlockGasMeter`. This fixes an issue where the `gasMeter` was incremented non-deterministically across validators. See [\#15015](https://github.com/cosmos/cosmos-sdk/issues/15015) for more information. - -## Capability in the Cosmos SDK Repository - -The capability module was originally released in [v0.40.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.40.0) of the Cosmos SDK. -Please see the [Release Notes](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/RELEASE_NOTES.md). - -The capability module has been removed from the Cosmos SDK from `v0.50.0` onwards and has been migrated to this repository. -It will now be maintained as a standalone go module. - -Please refer to the Cosmos SDK repository for historical content. diff --git a/modules/capability/capability_test.go b/modules/capability/capability_test.go deleted file mode 100644 index 72fae13e3e8..00000000000 --- a/modules/capability/capability_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package capability_test - -import ( - "testing" - - dbm "github.com/cosmos/cosmos-db" - testifysuite "github.com/stretchr/testify/suite" - - "cosmossdk.io/log" - "cosmossdk.io/store" - "cosmossdk.io/store/metrics" - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - - "github.com/cosmos/ibc-go/modules/capability" - "github.com/cosmos/ibc-go/modules/capability/keeper" - "github.com/cosmos/ibc-go/modules/capability/types" -) - -const mockMemStoreKey = "memory:mock" - -type CapabilityTestSuite struct { - testifysuite.Suite - - cdc codec.Codec - ctx sdk.Context - - keeper *keeper.Keeper - - storeKey *storetypes.KVStoreKey - memStoreKey *storetypes.MemoryStoreKey - mockMemStoreKey *storetypes.MemoryStoreKey -} - -func (suite *CapabilityTestSuite) SetupTest() { - encodingCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModule{}) - suite.cdc = encodingCfg.Codec - - suite.storeKey = storetypes.NewKVStoreKey(types.StoreKey) - suite.memStoreKey = storetypes.NewMemoryStoreKey(types.MemStoreKey) - suite.mockMemStoreKey = storetypes.NewMemoryStoreKey(mockMemStoreKey) - - suite.ctx = suite.NewTestContext() - suite.keeper = keeper.NewKeeper(suite.cdc, suite.storeKey, suite.memStoreKey) -} - -func (suite *CapabilityTestSuite) NewTestContext() sdk.Context { - db := dbm.NewMemDB() - cms := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) - cms.MountStoreWithDB(suite.storeKey, storetypes.StoreTypeIAVL, db) - cms.MountStoreWithDB(suite.memStoreKey, storetypes.StoreTypeMemory, db) - cms.MountStoreWithDB(suite.mockMemStoreKey, storetypes.StoreTypeMemory, db) - - err := cms.LoadLatestVersion() - suite.Require().NoError(err) - - return sdk.NewContext(cms, cmtproto.Header{}, false, log.NewNopLogger()) -} - -// The following test case mocks a specific bug discovered in https://github.com/cosmos/cosmos-sdk/issues/9800 -// and ensures that the current code successfully fixes the issue. -// This test emulates statesync by firstly populating persisted state by creating a new scoped keeper and capability. -// In-memory storage is then discarded by creating a new capability keeper and app module using a mock memstore key. -// BeginBlock is then called to populate the new in-memory store using the persisted state. -func (suite *CapabilityTestSuite) TestInitializeMemStore() { - // create a scoped keeper and instantiate a new capability to populate state - scopedKeeper := suite.keeper.ScopeToModule(banktypes.ModuleName) - - cap1, err := scopedKeeper.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - // mock statesync by creating a new keeper and module that shares persisted state - // but discards in-memory map by using a mock memstore key - newKeeper := keeper.NewKeeper(suite.cdc, suite.storeKey, suite.mockMemStoreKey) - newModule := capability.NewAppModule(suite.cdc, *newKeeper, true) - - // reassign the scoped keeper, this will inherit the mock memstore key used above - scopedKeeper = newKeeper.ScopeToModule(banktypes.ModuleName) - - // seal the new keeper and ensure the in-memory store is not initialized - newKeeper.Seal() - suite.Require().False(newKeeper.IsInitialized(suite.ctx), "memstore initialized flag set before BeginBlock") - - cap1, ok := scopedKeeper.GetCapability(suite.ctx, "transfer") - suite.Require().False(ok) - suite.Require().Nil(cap1) - - // add a new block gas meter to the context - ctx := suite.ctx.WithBlockGasMeter(storetypes.NewGasMeter(50)) - - prevGas := ctx.GasMeter().GasConsumed() - prevBlockGas := ctx.BlockGasMeter().GasConsumed() - - // call app module BeginBlock and ensure that no gas has been consumed - err = newModule.BeginBlock(ctx) - suite.Require().NoError(err) - - gasUsed := ctx.GasMeter().GasConsumed() - blockGasUsed := ctx.BlockGasMeter().GasConsumed() - - suite.Require().Equal(prevBlockGas, blockGasUsed, "ensure beginblocker consumed no block gas during execution") - suite.Require().Equal(prevGas, gasUsed, "ensure beginblocker consumed no gas during execution") - - // assert that the in-memory store is now initialized - suite.Require().True(newKeeper.IsInitialized(ctx), "memstore initialized flag not set") - - // ensure that BeginBlock has populated the new in-memory store (using the mock memstore key) and initialized capabilities - cap1, ok = scopedKeeper.GetCapability(ctx, "transfer") - suite.Require().True(ok) - suite.Require().NotNil(cap1) - - // ensure capabilities do not get reinitialized on next BeginBlock by comparing capability pointers - // and assert that the in-memory store is still initialized - err = newModule.BeginBlock(ctx) - suite.Require().NoError(err) - - refreshedCap, ok := scopedKeeper.GetCapability(ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(cap1, refreshedCap, "capabilities got reinitialized after second BeginBlock") - suite.Require().True(newKeeper.IsInitialized(ctx), "memstore initialized flag not set") -} - -func TestCapabilityTestSuite(t *testing.T) { - testifysuite.Run(t, new(CapabilityTestSuite)) -} diff --git a/modules/capability/genesis.go b/modules/capability/genesis.go deleted file mode 100644 index 06c233027dc..00000000000 --- a/modules/capability/genesis.go +++ /dev/null @@ -1,48 +0,0 @@ -package capability - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/ibc-go/modules/capability/keeper" - "github.com/cosmos/ibc-go/modules/capability/types" -) - -// InitGenesis initializes the capability module's state from a provided genesis -// state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - if err := k.InitializeIndex(ctx, genState.Index); err != nil { - panic(err) - } - - // set owners for each index - for _, genOwner := range genState.Owners { - k.SetOwners(ctx, genOwner.Index, genOwner.IndexOwners) - } - - // initialize in-memory capabilities - k.InitMemStore(ctx) -} - -// ExportGenesis returns the capability module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - index := k.GetLatestIndex(ctx) - owners := []types.GenesisOwners{} - - for i := uint64(1); i < index; i++ { - capabilityOwners, ok := k.GetOwners(ctx, i) - if !ok || len(capabilityOwners.Owners) == 0 { - continue - } - - genOwner := types.GenesisOwners{ - Index: i, - IndexOwners: capabilityOwners, - } - owners = append(owners, genOwner) - } - - return &types.GenesisState{ - Index: index, - Owners: owners, - } -} diff --git a/modules/capability/genesis_test.go b/modules/capability/genesis_test.go deleted file mode 100644 index 9f1aed78e1a..00000000000 --- a/modules/capability/genesis_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package capability_test - -import ( - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/cosmos/ibc-go/modules/capability" - "github.com/cosmos/ibc-go/modules/capability/keeper" - "github.com/cosmos/ibc-go/modules/capability/types" -) - -func (suite *CapabilityTestSuite) TestGenesis() { - // InitGenesis must be called in order to set the initial index to 1. - capability.InitGenesis(suite.ctx, *suite.keeper, *types.DefaultGenesis()) - - sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName) - sk2 := suite.keeper.ScopeToModule(stakingtypes.ModuleName) - - cap1, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - err = sk2.ClaimCapability(suite.ctx, cap1, "transfer") - suite.Require().NoError(err) - - cap2, err := sk2.NewCapability(suite.ctx, "ica") - suite.Require().NoError(err) - suite.Require().NotNil(cap2) - - genState := capability.ExportGenesis(suite.ctx, *suite.keeper) - - newKeeper := keeper.NewKeeper(suite.cdc, suite.storeKey, suite.memStoreKey) - newSk1 := newKeeper.ScopeToModule(banktypes.ModuleName) - newSk2 := newKeeper.ScopeToModule(stakingtypes.ModuleName) - deliverCtx := suite.NewTestContext() - - capability.InitGenesis(deliverCtx, *newKeeper, *genState) - - // check that all previous capabilities exist in new app after InitGenesis - sk1Cap1, ok := newSk1.GetCapability(deliverCtx, "transfer") - suite.Require().True(ok, "could not get first capability after genesis on first ScopedKeeper") - suite.Require().Equal(*cap1, *sk1Cap1, "capability values not equal on first ScopedKeeper") - - sk2Cap1, ok := newSk2.GetCapability(deliverCtx, "transfer") - suite.Require().True(ok, "could not get first capability after genesis on first ScopedKeeper") - suite.Require().Equal(*cap1, *sk2Cap1, "capability values not equal on first ScopedKeeper") - - sk2Cap2, ok := newSk2.GetCapability(deliverCtx, "ica") - suite.Require().True(ok, "could not get second capability after genesis on second ScopedKeeper") - suite.Require().Equal(*cap2, *sk2Cap2, "capability values not equal on second ScopedKeeper") -} diff --git a/modules/capability/go.mod b/modules/capability/go.mod deleted file mode 100644 index 798716d7477..00000000000 --- a/modules/capability/go.mod +++ /dev/null @@ -1,160 +0,0 @@ -module github.com/cosmos/ibc-go/modules/capability - -go 1.22 - -toolchain go1.22.0 - -replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - -require ( - cosmossdk.io/core v0.11.1 - cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.1 - cosmossdk.io/math v1.3.0 - cosmossdk.io/store v1.1.0 - github.com/cometbft/cometbft v0.38.11 - github.com/cosmos/cosmos-db v1.0.2 - github.com/cosmos/cosmos-sdk v0.50.9 - github.com/cosmos/gogoproto v1.6.0 - github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/stretchr/testify v1.9.0 - sigs.k8s.io/yaml v1.4.0 -) - -require ( - cosmossdk.io/api v0.7.5 // indirect - cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/depinject v1.0.0 // indirect - cosmossdk.io/x/tx v0.13.4 // indirect - filippo.io/edwards25519 v1.0.0 // indirect - github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect - github.com/DataDog/datadog-go v3.2.0+incompatible // indirect - github.com/DataDog/zstd v1.5.5 // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cockroachdb/errors v1.11.1 // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect - github.com/cockroachdb/redact v1.1.5 // indirect - github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cometbft/cometbft-db v0.9.1 // indirect - github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect - github.com/cosmos/go-bip39 v1.0.0 // indirect - github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v1.1.2 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect - github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect - github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect - github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/emicklei/dot v1.6.1 // indirect - github.com/fatih/color v1.15.0 // indirect - github.com/felixge/httpsnoop v1.0.2 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getsentry/sentry-go v0.27.0 // indirect - github.com/go-kit/kit v0.12.0 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-playground/validator/v10 v10.14.0 // indirect - github.com/gobwas/ws v1.1.0 // indirect - github.com/goccy/go-json v0.10.2 // indirect - github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect - github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.2.0 // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.6.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/mux v1.8.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect - github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/hashicorp/go-hclog v1.5.0 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-metrics v0.5.3 // indirect - github.com/hashicorp/go-plugin v1.5.2 // indirect - github.com/hashicorp/go-uuid v1.0.2 // indirect - github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hashicorp/yamux v0.1.1 // indirect - github.com/hdevalence/ed25519consensus v0.1.0 // indirect - github.com/huandu/skiplist v1.2.0 // indirect - github.com/iancoleman/strcase v0.3.0 // indirect - github.com/improbable-eng/grpc-web v0.15.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.7 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/linxGnu/grocksdb v1.8.14 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mitchellh/go-testing-interface v1.14.1 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/mtibben/percent v0.2.1 // indirect - github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect - github.com/oklog/run v1.1.0 // indirect - github.com/onsi/ginkgo v1.16.4 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.0 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.52.2 // indirect - github.com/prometheus/procfs v0.13.0 // indirect - github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.33.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.18.2 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tidwall/btree v1.7.0 // indirect - github.com/ugorji/go/codec v1.2.11 // indirect - github.com/zondax/hid v0.9.2 // indirect - github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect - go.uber.org/multierr v1.10.0 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect - google.golang.org/grpc v1.64.1 // indirect - google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - gotest.tools/v3 v3.5.1 // indirect - nhooyr.io/websocket v1.8.6 // indirect - pgregory.net/rapid v1.1.0 // indirect -) diff --git a/modules/capability/go.sum b/modules/capability/go.sum deleted file mode 100644 index 82e93912bfa..00000000000 --- a/modules/capability/go.sum +++ /dev/null @@ -1,982 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= -cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= -cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= -cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= -cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= -cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= -cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= -cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= -cosmossdk.io/x/tx v0.13.4 h1:Eg0PbJgeO0gM8p5wx6xa0fKR7hIV6+8lC56UrsvSo0Y= -cosmossdk.io/x/tx v0.13.4/go.mod h1:BkFqrnGGgW50Y6cwTy+JvgAhiffbGEKW6KF9ufcDpvk= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= -filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= -github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= -github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= -github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= -github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= -github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= -github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= -github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= -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= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= -github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= -github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= -github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= -github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= -github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= -github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= -github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= -github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= -github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= -github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= -github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.6.0 h1:Xm0F/96O5Ox4g6xGgjA41rWaaPjYtOdTi59uBcV2qEE= -github.com/cosmos/gogoproto v1.6.0/go.mod h1:Y+g956rcUf2vr4uwtCcK/1Xx9BWVluCtcI9vsh0GHmk= -github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= -github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= -github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= -github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= -github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= -github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= -github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= -github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= -github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= -github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= -github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= -github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= -github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= -github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= -github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= -github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA= -github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= -github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= -github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= -github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= -github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= -github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= -github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= -github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= -github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= -github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= -github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= -github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= -github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= -github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= -github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= -github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= -github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= -github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= -github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= -github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= -github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= -github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= -github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.52.2 h1:LW8Vk7BccEdONfrJBDffQGRtpSzi5CQaRZGtboOO2ck= -github.com/prometheus/common v0.52.2/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= -github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= -github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= -github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= -github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= -github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= -github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= -github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= -go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= -google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= -nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= -pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/modules/capability/keeper/keeper.go b/modules/capability/keeper/keeper.go deleted file mode 100644 index 5d856c5e64b..00000000000 --- a/modules/capability/keeper/keeper.go +++ /dev/null @@ -1,502 +0,0 @@ -package keeper - -import ( - "errors" - "fmt" - "strings" - - errorsmod "cosmossdk.io/errors" - "cosmossdk.io/log" - "cosmossdk.io/store/prefix" - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/ibc-go/modules/capability/types" -) - -type ( - // Keeper defines the capability module's keeper. It is responsible for provisioning, - // tracking, and authenticating capabilities at runtime. During application - // initialization, the keeper can be hooked up to modules through unique function - // references so that it can identify the calling module when later invoked. - // - // When the initial state is loaded from disk, the keeper allows the ability to - // create new capability keys for all previously allocated capability identifiers - // (allocated during execution of past transactions and assigned to particular modes), - // and keep them in a memory-only store while the chain is running. - // - // The keeper allows the ability to create scoped sub-keepers which are tied to - // a single specific module. - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - capMap map[uint64]*types.Capability - scopedModules map[string]struct{} - sealed bool - } - - // ScopedKeeper defines a scoped sub-keeper which is tied to a single specific - // module provisioned by the capability keeper. Scoped keepers must be created - // at application initialization and passed to modules, which can then use them - // to claim capabilities they receive and retrieve capabilities which they own - // by name, in addition to creating new capabilities & authenticating capabilities - // passed by other modules. - ScopedKeeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - capMap map[uint64]*types.Capability - module string - } -) - -// NewKeeper constructs a new CapabilityKeeper instance and initializes maps -// for capability map and scopedModules map. -func NewKeeper(cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey) *Keeper { - return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - capMap: make(map[uint64]*types.Capability), - scopedModules: make(map[string]struct{}), - sealed: false, - } -} - -// HasModule checks if the module name already has a ScopedKeeper. -func (k *Keeper) HasModule(moduleName string) bool { - _, ok := k.scopedModules[moduleName] - return ok -} - -// ScopeToModule attempts to create and return a ScopedKeeper for a given module -// by name. It will panic if the keeper is already sealed or if the module name -// already has a ScopedKeeper. -func (k *Keeper) ScopeToModule(moduleName string) ScopedKeeper { - if k.sealed { - panic(errors.New("cannot scope to module via a sealed capability keeper")) - } - if strings.TrimSpace(moduleName) == "" { - panic(errors.New("cannot scope to an empty module name")) - } - - if _, ok := k.scopedModules[moduleName]; ok { - panic(fmt.Errorf("cannot create multiple scoped keepers for the same module name: %s", moduleName)) - } - - k.scopedModules[moduleName] = struct{}{} - - return ScopedKeeper{ - cdc: k.cdc, - storeKey: k.storeKey, - memKey: k.memKey, - capMap: k.capMap, - module: moduleName, - } -} - -// Seal seals the keeper to prevent further modules from creating a scoped keeper. -// Seal may be called during app initialization for applications that do not wish to create scoped keepers dynamically. -func (k *Keeper) Seal() { - if k.sealed { - panic(errors.New("cannot initialize and seal an already sealed capability keeper")) - } - - k.sealed = true -} - -// IsSealed returns if the keeper is sealed. -func (k *Keeper) IsSealed() bool { - return k.sealed -} - -// InitMemStore will assure that the module store is a memory store (it will panic if it's not) -// and will initialize it. The function is safe to be called multiple times. -// InitMemStore must be called every time the app starts before the keeper is used (so -// `BeginBlock` or `InitChain` - whichever is first). We need access to the store so we -// can't initialize it in a constructor. -func (k *Keeper) InitMemStore(ctx sdk.Context) { - memStore := ctx.KVStore(k.memKey) - memStoreType := memStore.GetStoreType() - - if memStoreType != storetypes.StoreTypeMemory { - panic(fmt.Errorf("invalid memory store type; got %s, expected: %s", memStoreType, storetypes.StoreTypeMemory)) - } - - // create context with no block gas meter to ensure we do not consume gas during local initialization logic. - noGasCtx := ctx.WithBlockGasMeter(storetypes.NewInfiniteGasMeter()).WithGasMeter(storetypes.NewInfiniteGasMeter()) - - // check if memory store has not been initialized yet by checking if initialized flag is nil. - if !k.IsInitialized(noGasCtx) { - prefixStore := prefix.NewStore(noGasCtx.KVStore(k.storeKey), types.KeyPrefixIndexCapability) - iterator := storetypes.KVStorePrefixIterator(prefixStore, nil) - - // initialize the in-memory store for all persisted capabilities - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - index := types.IndexFromKey(iterator.Key()) - - var capOwners types.CapabilityOwners - - k.cdc.MustUnmarshal(iterator.Value(), &capOwners) - k.InitializeCapability(noGasCtx, index, capOwners) - } - - // set the initialized flag so we don't rerun initialization logic - memStore := noGasCtx.KVStore(k.memKey) - memStore.Set(types.KeyMemInitialized, []byte{1}) - } -} - -// IsInitialized returns true if the keeper is properly initialized, and false otherwise. -func (k *Keeper) IsInitialized(ctx sdk.Context) bool { - memStore := ctx.KVStore(k.memKey) - return memStore.Has(types.KeyMemInitialized) -} - -// InitializeIndex sets the index to one (or greater) in InitChain according -// to the GenesisState. It must only be called once. -// It will panic if the provided index is 0, or if the index is already set. -func (k Keeper) InitializeIndex(ctx sdk.Context, index uint64) error { - if index == 0 { - panic(errors.New("SetIndex requires index > 0")) - } - latest := k.GetLatestIndex(ctx) - if latest > 0 { - panic(errors.New("SetIndex requires index to not be set")) - } - - // set the global index to the passed index - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyIndex, types.IndexToKey(index)) - return nil -} - -// GetLatestIndex returns the latest index of the CapabilityKeeper -func (k Keeper) GetLatestIndex(ctx sdk.Context) uint64 { - store := ctx.KVStore(k.storeKey) - return types.IndexFromKey(store.Get(types.KeyIndex)) -} - -// SetOwners set the capability owners to the store -func (k Keeper) SetOwners(ctx sdk.Context, index uint64, owners types.CapabilityOwners) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(index) - - // set owners in persistent store - prefixStore.Set(indexKey, k.cdc.MustMarshal(&owners)) -} - -// GetOwners returns the capability owners with a given index. -func (k Keeper) GetOwners(ctx sdk.Context, index uint64) (types.CapabilityOwners, bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(index) - - // get owners for index from persistent store - ownerBytes := prefixStore.Get(indexKey) - if ownerBytes == nil { - return types.CapabilityOwners{}, false - } - var owners types.CapabilityOwners - k.cdc.MustUnmarshal(ownerBytes, &owners) - return owners, true -} - -// InitializeCapability takes in an index and an owners array. It creates the capability in memory -// and sets the fwd and reverse keys for each owner in the memstore. -// It is used during initialization from genesis. -func (k Keeper) InitializeCapability(ctx sdk.Context, index uint64, owners types.CapabilityOwners) { - memStore := ctx.KVStore(k.memKey) - - capability := types.NewCapability(index) - for _, owner := range owners.Owners { - // Set the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Set(types.FwdCapabilityKey(owner.Module, capability), []byte(owner.Name)) - - // Set the reverse mapping between the module and capability name and the - // index in the in-memory store. Since marshalling and unmarshalling into a store - // will change memory address of capability, we simply store index as value here - // and retrieve the in-memory pointer to the capability from our map - memStore.Set(types.RevCapabilityKey(owner.Module, owner.Name), sdk.Uint64ToBigEndian(index)) - - // Set the mapping from index to in-memory capability in the go map - k.capMap[index] = capability - } -} - -// NewCapability attempts to create a new capability with a given name. If the -// capability already exists in the in-memory store, an error will be returned. -// Otherwise, a new capability is created with the current global unique index. -// The newly created capability has the scoped module name and capability name -// tuple set as the initial owner. Finally, the global index is incremented along -// with forward and reverse indexes set in the in-memory store. -// -// Note, namespacing is completely local, which is safe since records are prefixed -// with the module name and no two ScopedKeeper can have the same module name. -func (sk ScopedKeeper) NewCapability(ctx sdk.Context, name string) (*types.Capability, error) { - if strings.TrimSpace(name) == "" { - return nil, errorsmod.Wrap(types.ErrInvalidCapabilityName, "capability name cannot be empty") - } - store := ctx.KVStore(sk.storeKey) - - if _, ok := sk.GetCapability(ctx, name); ok { - return nil, errorsmod.Wrapf(types.ErrCapabilityTaken, fmt.Sprintf("module: %s, name: %s", sk.module, name)) - } - - // create new capability with the current global index - index := types.IndexFromKey(store.Get(types.KeyIndex)) - capability := types.NewCapability(index) - - // update capability owner set - if err := sk.addOwner(ctx, capability, name); err != nil { - return nil, err - } - - // increment global index - store.Set(types.KeyIndex, types.IndexToKey(index+1)) - - memStore := ctx.KVStore(sk.memKey) - - // Set the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Set(types.FwdCapabilityKey(sk.module, capability), []byte(name)) - - // Set the reverse mapping between the module and capability name and the - // index in the in-memory store. Since marshalling and unmarshalling into a store - // will change memory address of capability, we simply store index as value here - // and retrieve the in-memory pointer to the capability from our map - memStore.Set(types.RevCapabilityKey(sk.module, name), sdk.Uint64ToBigEndian(index)) - - // Set the mapping from index to in-memory capability in the go map - sk.capMap[index] = capability - - logger(ctx).Info("created new capability", "module", sk.module, "name", name) - - return capability, nil -} - -// AuthenticateCapability attempts to authenticate a given capability and name -// from a caller. It allows for a caller to check that a capability does in fact -// correspond to a particular name. The scoped keeper will lookup the capability -// from the internal in-memory store and check against the provided name. It returns -// true upon success and false upon failure. -// -// Note, the capability's forward mapping is indexed by a string which should -// contain its unique memory reference. -func (sk ScopedKeeper) AuthenticateCapability(ctx sdk.Context, cap *types.Capability, name string) bool { - if strings.TrimSpace(name) == "" || cap == nil { - return false - } - return sk.GetCapabilityName(ctx, cap) == name -} - -// ClaimCapability attempts to claim a given Capability. The provided name and -// the scoped module's name tuple are treated as the owner. It will attempt -// to add the owner to the persistent set of capability owners for the capability -// index. If the owner already exists, it will return an error. Otherwise, it will -// also set a forward and reverse index for the capability and capability name. -func (sk ScopedKeeper) ClaimCapability(ctx sdk.Context, cap *types.Capability, name string) error { - if cap == nil { - return errorsmod.Wrap(types.ErrNilCapability, "cannot claim nil capability") - } - if strings.TrimSpace(name) == "" { - return errorsmod.Wrap(types.ErrInvalidCapabilityName, "capability name cannot be empty") - } - // update capability owner set - if err := sk.addOwner(ctx, cap, name); err != nil { - return err - } - - memStore := ctx.KVStore(sk.memKey) - - // Set the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Set(types.FwdCapabilityKey(sk.module, cap), []byte(name)) - - // Set the reverse mapping between the module and capability name and the - // index in the in-memory store. Since marshalling and unmarshalling into a store - // will change memory address of capability, we simply store index as value here - // and retrieve the in-memory pointer to the capability from our map - memStore.Set(types.RevCapabilityKey(sk.module, name), sdk.Uint64ToBigEndian(cap.GetIndex())) - - logger(ctx).Info("claimed capability", "module", sk.module, "name", name, "capability", cap.GetIndex()) - - return nil -} - -// ReleaseCapability allows a scoped module to release a capability which it had -// previously claimed or created. After releasing the capability, if no more -// owners exist, the capability will be globally removed. -func (sk ScopedKeeper) ReleaseCapability(ctx sdk.Context, cap *types.Capability) error { - if cap == nil { - return errorsmod.Wrap(types.ErrNilCapability, "cannot release nil capability") - } - name := sk.GetCapabilityName(ctx, cap) - if len(name) == 0 { - return errorsmod.Wrap(types.ErrCapabilityNotOwned, sk.module) - } - - memStore := ctx.KVStore(sk.memKey) - - // Delete the forward mapping between the module and capability tuple and the - // capability name in the memKVStore - memStore.Delete(types.FwdCapabilityKey(sk.module, cap)) - - // Delete the reverse mapping between the module and capability name and the - // index in the in-memory store. - memStore.Delete(types.RevCapabilityKey(sk.module, name)) - - // remove owner - capOwners := sk.getOwners(ctx, cap) - capOwners.Remove(types.NewOwner(sk.module, name)) - - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(cap.GetIndex()) - - if len(capOwners.Owners) == 0 { - // remove capability owner set - prefixStore.Delete(indexKey) - // since no one owns capability, we can delete capability from map - delete(sk.capMap, cap.GetIndex()) - } else { - // update capability owner set - prefixStore.Set(indexKey, sk.cdc.MustMarshal(capOwners)) - } - - return nil -} - -// GetCapability allows a module to fetch a capability which it previously claimed -// by name. The module is not allowed to retrieve capabilities which it does not -// own. -func (sk ScopedKeeper) GetCapability(ctx sdk.Context, name string) (*types.Capability, bool) { - if strings.TrimSpace(name) == "" { - return nil, false - } - memStore := ctx.KVStore(sk.memKey) - - key := types.RevCapabilityKey(sk.module, name) - indexBytes := memStore.Get(key) - index := sdk.BigEndianToUint64(indexBytes) - - if len(indexBytes) == 0 { - // If a tx failed and NewCapability got reverted, it is possible - // to still have the capability in the go map since changes to - // go map do not automatically get reverted on tx failure, - // so we delete here to remove unnecessary values in map - // TODO: Delete index correctly from capMap by storing some reverse lookup - // in-memory map. Issue: https://github.com/cosmos/cosmos-sdk/issues/7805 - - return nil, false - } - - capability := sk.capMap[index] - if capability == nil { - panic(errors.New("capability found in memstore is missing from map")) - } - - return capability, true -} - -// GetCapabilityName allows a module to retrieve the name under which it stored a given -// capability given the capability -func (sk ScopedKeeper) GetCapabilityName(ctx sdk.Context, cap *types.Capability) string { - if cap == nil { - return "" - } - memStore := ctx.KVStore(sk.memKey) - - return string(memStore.Get(types.FwdCapabilityKey(sk.module, cap))) -} - -// GetOwners all the Owners that own the capability associated with the name this ScopedKeeper uses -// to refer to the capability -func (sk ScopedKeeper) GetOwners(ctx sdk.Context, name string) (*types.CapabilityOwners, bool) { - if strings.TrimSpace(name) == "" { - return nil, false - } - capability, ok := sk.GetCapability(ctx, name) - if !ok { - return nil, false - } - - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(capability.GetIndex()) - - var capOwners types.CapabilityOwners - - bz := prefixStore.Get(indexKey) - if len(bz) == 0 { - return nil, false - } - - sk.cdc.MustUnmarshal(bz, &capOwners) - - return &capOwners, true -} - -// LookupModules returns all the module owners for a given capability -// as a string array and the capability itself. -// The method returns an error if either the capability or the owners cannot be -// retrieved from the memstore. -func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *types.Capability, error) { - if strings.TrimSpace(name) == "" { - return nil, nil, errorsmod.Wrap(types.ErrInvalidCapabilityName, "cannot lookup modules with empty capability name") - } - capability, ok := sk.GetCapability(ctx, name) - if !ok { - return nil, nil, errorsmod.Wrap(types.ErrCapabilityNotFound, name) - } - - capOwners, ok := sk.GetOwners(ctx, name) - if !ok { - return nil, nil, errorsmod.Wrap(types.ErrCapabilityOwnersNotFound, name) - } - - mods := make([]string, len(capOwners.Owners)) - for i, co := range capOwners.Owners { - mods[i] = co.Module - } - - return mods, capability, nil -} - -func (sk ScopedKeeper) addOwner(ctx sdk.Context, cap *types.Capability, name string) error { - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(cap.GetIndex()) - - capOwners := sk.getOwners(ctx, cap) - - if err := capOwners.Set(types.NewOwner(sk.module, name)); err != nil { - return err - } - - // update capability owner set - prefixStore.Set(indexKey, sk.cdc.MustMarshal(capOwners)) - - return nil -} - -func (sk ScopedKeeper) getOwners(ctx sdk.Context, cap *types.Capability) *types.CapabilityOwners { - prefixStore := prefix.NewStore(ctx.KVStore(sk.storeKey), types.KeyPrefixIndexCapability) - indexKey := types.IndexToKey(cap.GetIndex()) - - bz := prefixStore.Get(indexKey) - - if len(bz) == 0 { - return types.NewCapabilityOwners() - } - - var capOwners types.CapabilityOwners - sk.cdc.MustUnmarshal(bz, &capOwners) - return &capOwners -} - -func logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) -} diff --git a/modules/capability/keeper/keeper_test.go b/modules/capability/keeper/keeper_test.go deleted file mode 100644 index c2cd70597dc..00000000000 --- a/modules/capability/keeper/keeper_test.go +++ /dev/null @@ -1,318 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - - testifysuite "github.com/stretchr/testify/suite" - - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - - "github.com/cosmos/ibc-go/modules/capability" - "github.com/cosmos/ibc-go/modules/capability/keeper" - "github.com/cosmos/ibc-go/modules/capability/types" -) - -var ( - stakingModuleName = "staking" - bankModuleName = "bank" -) - -type KeeperTestSuite struct { - testifysuite.Suite - - ctx sdk.Context - keeper *keeper.Keeper -} - -func (suite *KeeperTestSuite) SetupTest() { - key := storetypes.NewKVStoreKey(types.StoreKey) - testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) - suite.ctx = testCtx.Ctx - encCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModule{}) - suite.keeper = keeper.NewKeeper(encCfg.Codec, key, key) -} - -func (suite *KeeperTestSuite) TestSeal() { - sk := suite.keeper.ScopeToModule(bankModuleName) - suite.Require().Panics(func() { - suite.keeper.ScopeToModule(" ") - }) - - caps := make([]*types.Capability, 5) - // Get Latest Index before creating new ones to synchronize indices correctly - prevIndex := suite.keeper.GetLatestIndex(suite.ctx) - - for i := range caps { - transferCap, err := sk.NewCapability(suite.ctx, fmt.Sprintf("transfer-%d", i)) - suite.Require().NoError(err) - suite.Require().NotNil(transferCap) - suite.Require().Equal(uint64(i)+prevIndex, transferCap.GetIndex()) - - caps[i] = transferCap - } - - suite.Require().NotPanics(func() { - suite.keeper.Seal() - }) - - for i, cap := range caps { - got, ok := sk.GetCapability(suite.ctx, fmt.Sprintf("transfer-%d", i)) - suite.Require().True(ok) - suite.Require().Equal(cap, got) - suite.Require().Equal(uint64(i)+prevIndex, got.GetIndex()) - } - - suite.Require().Panics(func() { - suite.keeper.Seal() - }) - - suite.Require().Panics(func() { - _ = suite.keeper.ScopeToModule(stakingModuleName) - }) -} - -func (suite *KeeperTestSuite) TestHasModule() { - _ = suite.keeper.ScopeToModule(bankModuleName) - suite.Require().True(suite.keeper.HasModule(bankModuleName), "bank module does not exist") - suite.Require().False(suite.keeper.HasModule("invalid"), "invalid module exists") -} - -func (suite *KeeperTestSuite) TestNewCapability() { - sk := suite.keeper.ScopeToModule(bankModuleName) - - got, ok := sk.GetCapability(suite.ctx, "transfer") - suite.Require().False(ok) - suite.Require().Nil(got) - - transferCap, err := sk.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(transferCap) - - got, ok = sk.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(transferCap, got) - suite.Require().True(transferCap == got, "expected memory addresses to be equal") - - got, ok = sk.GetCapability(suite.ctx, "invalid") - suite.Require().False(ok) - suite.Require().Nil(got) - - got, ok = sk.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(transferCap, got) - suite.Require().True(transferCap == got, "expected memory addresses to be equal") - - cap2, err := sk.NewCapability(suite.ctx, "transfer") - suite.Require().Error(err) - suite.Require().Nil(cap2) - - got, ok = sk.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(transferCap, got) - suite.Require().True(transferCap == got, "expected memory addresses to be equal") - - transferCap, err = sk.NewCapability(suite.ctx, " ") - suite.Require().Error(err) - suite.Require().Nil(transferCap) -} - -func (suite *KeeperTestSuite) TestAuthenticateCapability() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - - cap1, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - forgedCap := types.NewCapability(cap1.Index) // index should be the same index as the first capability - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, forgedCap, "transfer")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, forgedCap, "transfer")) - - cap2, err := sk2.NewCapability(suite.ctx, "bond") - suite.Require().NoError(err) - suite.Require().NotNil(cap2) - - got, ok := sk1.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - - suite.Require().True(sk1.AuthenticateCapability(suite.ctx, cap1, "transfer")) - suite.Require().True(sk1.AuthenticateCapability(suite.ctx, got, "transfer")) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, cap1, "invalid")) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, cap2, "transfer")) - - suite.Require().True(sk2.AuthenticateCapability(suite.ctx, cap2, "bond")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, cap2, "invalid")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, cap1, "bond")) - - err = sk2.ReleaseCapability(suite.ctx, cap2) - suite.Require().NoError(err) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, cap2, "bond")) - - badCap := types.NewCapability(100) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, badCap, "transfer")) - suite.Require().False(sk2.AuthenticateCapability(suite.ctx, badCap, "bond")) - - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, cap1, " ")) - suite.Require().False(sk1.AuthenticateCapability(suite.ctx, nil, "transfer")) -} - -func (suite *KeeperTestSuite) TestClaimCapability() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - sk3 := suite.keeper.ScopeToModule("foo") - - transferCap, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(transferCap) - - suite.Require().Error(sk1.ClaimCapability(suite.ctx, transferCap, "transfer")) - suite.Require().NoError(sk2.ClaimCapability(suite.ctx, transferCap, "transfer")) - - got, ok := sk1.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(transferCap, got) - - got, ok = sk2.GetCapability(suite.ctx, "transfer") - suite.Require().True(ok) - suite.Require().Equal(transferCap, got) - - suite.Require().Error(sk3.ClaimCapability(suite.ctx, transferCap, " ")) - suite.Require().Error(sk3.ClaimCapability(suite.ctx, nil, "transfer")) -} - -func (suite *KeeperTestSuite) TestGetOwners() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - sk3 := suite.keeper.ScopeToModule("foo") - - sks := []keeper.ScopedKeeper{sk1, sk2, sk3} - - transferCap, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(transferCap) - - suite.Require().NoError(sk2.ClaimCapability(suite.ctx, transferCap, "transfer")) - suite.Require().NoError(sk3.ClaimCapability(suite.ctx, transferCap, "transfer")) - - expectedOrder := []string{bankModuleName, "foo", stakingModuleName} - // Ensure all scoped keepers can get owners - for _, sk := range sks { - owners, ok := sk.GetOwners(suite.ctx, "transfer") - mods, gotCap, err := sk.LookupModules(suite.ctx, "transfer") - - suite.Require().True(ok, "could not retrieve owners") - suite.Require().NotNil(owners, "owners is nil") - - suite.Require().NoError(err, "could not retrieve modules") - suite.Require().NotNil(gotCap, "capability is nil") - suite.Require().NotNil(mods, "modules is nil") - suite.Require().Equal(transferCap, gotCap, "caps not equal") - - suite.Require().Equal(len(expectedOrder), len(owners.Owners), "length of owners is unexpected") - for i, o := range owners.Owners { - // Require owner is in expected position - suite.Require().Equal(expectedOrder[i], o.Module, "module is unexpected") - suite.Require().Equal(expectedOrder[i], mods[i], "module in lookup is unexpected") - } - } - - // foo module releases capability - err = sk3.ReleaseCapability(suite.ctx, transferCap) - suite.Require().Nil(err, "could not release capability") - - // new expected order and scoped capabilities - expectedOrder = []string{bankModuleName, stakingModuleName} - sks = []keeper.ScopedKeeper{sk1, sk2} - - // Ensure all scoped keepers can get owners - for _, sk := range sks { - owners, ok := sk.GetOwners(suite.ctx, "transfer") - mods, transferCap, err := sk.LookupModules(suite.ctx, "transfer") - - suite.Require().True(ok, "could not retrieve owners") - suite.Require().NotNil(owners, "owners is nil") - - suite.Require().NoError(err, "could not retrieve modules") - suite.Require().NotNil(transferCap, "capability is nil") - suite.Require().NotNil(mods, "modules is nil") - - suite.Require().Equal(len(expectedOrder), len(owners.Owners), "length of owners is unexpected") - for i, o := range owners.Owners { - // Require owner is in expected position - suite.Require().Equal(expectedOrder[i], o.Module, "module is unexpected") - suite.Require().Equal(expectedOrder[i], mods[i], "module in lookup is unexpected") - } - } - - _, ok := sk1.GetOwners(suite.ctx, " ") - suite.Require().False(ok, "got owners from empty capability name") -} - -func (suite *KeeperTestSuite) TestReleaseCapability() { - sk1 := suite.keeper.ScopeToModule(bankModuleName) - sk2 := suite.keeper.ScopeToModule(stakingModuleName) - - cap1, err := sk1.NewCapability(suite.ctx, "transfer") - suite.Require().NoError(err) - suite.Require().NotNil(cap1) - - suite.Require().NoError(sk2.ClaimCapability(suite.ctx, cap1, "transfer")) - - cap2, err := sk2.NewCapability(suite.ctx, "bond") - suite.Require().NoError(err) - suite.Require().NotNil(cap2) - - suite.Require().Error(sk1.ReleaseCapability(suite.ctx, cap2)) - - suite.Require().NoError(sk2.ReleaseCapability(suite.ctx, cap1)) - got, ok := sk2.GetCapability(suite.ctx, "transfer") - suite.Require().False(ok) - suite.Require().Nil(got) - - suite.Require().NoError(sk1.ReleaseCapability(suite.ctx, cap1)) - got, ok = sk1.GetCapability(suite.ctx, "transfer") - suite.Require().False(ok) - suite.Require().Nil(got) - - suite.Require().Error(sk1.ReleaseCapability(suite.ctx, nil)) -} - -func (suite *KeeperTestSuite) TestRevertCapability() { - sk := suite.keeper.ScopeToModule(bankModuleName) - - ms := suite.ctx.MultiStore() - - msCache := ms.CacheMultiStore() - cacheCtx := suite.ctx.WithMultiStore(msCache) - - capName := "revert" - // Create cachedCap on cached context - cachedCap, err := sk.NewCapability(cacheCtx, capName) - suite.Require().NoError(err, "could not create capability") - - // Check that capability written in cached context - gotCache, ok := sk.GetCapability(cacheCtx, capName) - suite.Require().True(ok, "could not retrieve capability from cached context") - suite.Require().Equal(cachedCap, gotCache, "did not get correct capability from cached context") - - // Check that capability is NOT written to original context - got, ok := sk.GetCapability(suite.ctx, capName) - suite.Require().False(ok, "retrieved capability from original context before write") - suite.Require().Nil(got, "capability not nil in original store") - - // Write to underlying memKVStore - msCache.Write() - - got, ok = sk.GetCapability(suite.ctx, capName) - suite.Require().True(ok, "could not retrieve capability from context") - suite.Require().Equal(cachedCap, got, "did not get correct capability from context") -} - -func TestKeeperTestSuite(t *testing.T) { - testifysuite.Run(t, new(KeeperTestSuite)) -} diff --git a/modules/capability/module.go b/modules/capability/module.go deleted file mode 100644 index 5f048a3b838..00000000000 --- a/modules/capability/module.go +++ /dev/null @@ -1,152 +0,0 @@ -package capability - -import ( - "context" - "encoding/json" - "fmt" - "time" - - gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" - - "cosmossdk.io/core/appmodule" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/telemetry" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/cosmos/ibc-go/modules/capability/keeper" - "github.com/cosmos/ibc-go/modules/capability/simulation" - "github.com/cosmos/ibc-go/modules/capability/types" -) - -var ( - _ module.AppModule = (*AppModule)(nil) - _ module.AppModuleSimulation = (*AppModule)(nil) - _ module.HasName = (*AppModule)(nil) - _ module.HasConsensusVersion = (*AppModule)(nil) - _ module.HasGenesis = (*AppModule)(nil) - _ appmodule.AppModule = (*AppModule)(nil) - _ appmodule.HasBeginBlocker = (*AppModule)(nil) -) - -// ---------------------------------------------------------------------------- -// AppModuleBasic -// ---------------------------------------------------------------------------- - -// AppModuleBasic implements the AppModuleBasic interface for the capability module. -type AppModuleBasic struct { - cdc codec.Codec -} - -func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} - -// Name returns the capability module's name. -func (AppModuleBasic) Name() string { - return types.ModuleName -} - -// RegisterLegacyAminoCodec does nothing. Capability does not support amino. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} - -// RegisterInterfaces registers the module's interface types -func (AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {} - -// DefaultGenesis returns the capability module's default genesis state. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesis()) -} - -// ValidateGenesis performs genesis state validation for the capability module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genState); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) - } - return genState.Validate() -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the capability module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *gwruntime.ServeMux) { -} - -// ---------------------------------------------------------------------------- -// AppModule -// ---------------------------------------------------------------------------- - -// AppModule implements the AppModule interface for the capability module. -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - - sealKeeper bool -} - -func NewAppModule(cdc codec.Codec, capabilityKeeper keeper.Keeper, sealKeeper bool) AppModule { - return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), - keeper: capabilityKeeper, - sealKeeper: sealKeeper, - } -} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (AppModule) IsOnePerModuleType() {} - -// IsAppModule implements the appmodule.AppModule interface. -func (AppModule) IsAppModule() {} - -// InitGenesis performs the capability module's genesis initialization It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) -} - -// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -// BeginBlocker calls InitMemStore to assert that the memory store is initialized. -// It's safe to run multiple times. -func (am AppModule) BeginBlock(ctx context.Context) error { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) - - am.keeper.InitMemStore(sdk.UnwrapSDKContext(ctx)) - - if am.sealKeeper && !am.keeper.IsSealed() { - am.keeper.Seal() - } - - return nil -} - -// GenerateGenesisState creates a randomized GenState of the capability module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// RegisterStoreDecoder registers a decoder for capability module's types -func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { - sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) -} - -// WeightedOperations returns the all the gov module operations with their respective weights. -func (AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return nil -} diff --git a/modules/capability/simulation/decoder.go b/modules/capability/simulation/decoder.go deleted file mode 100644 index 651cdb542fe..00000000000 --- a/modules/capability/simulation/decoder.go +++ /dev/null @@ -1,34 +0,0 @@ -package simulation - -import ( - "bytes" - "fmt" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" - - "github.com/cosmos/ibc-go/modules/capability/types" -) - -// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's -// Value to the corresponding capability type. -func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { - return func(kvA, kvB kv.Pair) string { - switch { - case bytes.Equal(kvA.Key, types.KeyIndex): - idxA := sdk.BigEndianToUint64(kvA.Value) - idxB := sdk.BigEndianToUint64(kvB.Value) - return fmt.Sprintf("Index A: %d\nIndex B: %d\n", idxA, idxB) - - case bytes.HasPrefix(kvA.Key, types.KeyPrefixIndexCapability): - var capOwnersA, capOwnersB types.CapabilityOwners - cdc.MustUnmarshal(kvA.Value, &capOwnersA) - cdc.MustUnmarshal(kvB.Value, &capOwnersB) - return fmt.Sprintf("CapabilityOwners A: %v\nCapabilityOwners B: %v\n", capOwnersA, capOwnersB) - - default: - panic(fmt.Errorf("invalid %s key prefix %X (%s)", types.ModuleName, kvA.Key, kvA.Key)) - } - } -} diff --git a/modules/capability/simulation/decoder_test.go b/modules/capability/simulation/decoder_test.go deleted file mode 100644 index b5115e66139..00000000000 --- a/modules/capability/simulation/decoder_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package simulation_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - - "github.com/cosmos/ibc-go/modules/capability" - "github.com/cosmos/ibc-go/modules/capability/simulation" - "github.com/cosmos/ibc-go/modules/capability/types" -) - -func TestDecodeStore(t *testing.T) { - encodingCfg := moduletestutil.MakeTestEncodingConfig(capability.AppModule{}) - dec := simulation.NewDecodeStore(encodingCfg.Codec) - - capOwners := types.CapabilityOwners{ - Owners: []types.Owner{{Module: "transfer", Name: "ports/transfer"}}, - } - - kvPairs := kv.Pairs{ - Pairs: []kv.Pair{ - { - Key: types.KeyIndex, - Value: sdk.Uint64ToBigEndian(10), - }, - { - Key: types.KeyPrefixIndexCapability, - Value: encodingCfg.Codec.MustMarshal(&capOwners), - }, - { - Key: []byte{0x99}, - Value: []byte{0x99}, - }, - }, - } - tests := []struct { - name string - expectedLog string - }{ - {"Index", "Index A: 10\nIndex B: 10\n"}, - {"CapabilityOwners", fmt.Sprintf("CapabilityOwners A: %v\nCapabilityOwners B: %v\n", capOwners, capOwners)}, - {"other", ""}, - } - - for i, tc := range tests { - i, tc := i, tc - t.Run(tc.name, func(t *testing.T) { - switch i { - case len(tests) - 1: - require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tc.name) - default: - require.Equal(t, tc.expectedLog, dec(kvPairs.Pairs[i], kvPairs.Pairs[i]), tc.name) - } - }) - } -} diff --git a/modules/capability/simulation/genesis.go b/modules/capability/simulation/genesis.go deleted file mode 100644 index 8e11a7ee8bc..00000000000 --- a/modules/capability/simulation/genesis.go +++ /dev/null @@ -1,38 +0,0 @@ -package simulation - -import ( - "encoding/json" - "fmt" - "math/rand" - - "github.com/cosmos/cosmos-sdk/types/module" - - "github.com/cosmos/ibc-go/modules/capability/types" -) - -// Simulation parameter constants -const index = "index" - -// GenIndex returns a random global index between 1-1000 -func GenIndex(r *rand.Rand) uint64 { - return uint64(r.Int63n(1000)) + 1 -} - -// RandomizedGenState generates a random GenesisState for capability -func RandomizedGenState(simState *module.SimulationState) { - var idx uint64 - - simState.AppParams.GetOrGenerate( - index, &idx, simState.Rand, - func(r *rand.Rand) { idx = GenIndex(r) }, - ) - - capabilityGenesis := types.GenesisState{Index: idx} - - bz, err := json.MarshalIndent(&capabilityGenesis, "", " ") - if err != nil { - panic(err) - } - fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz) - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&capabilityGenesis) -} diff --git a/modules/capability/simulation/genesis_test.go b/modules/capability/simulation/genesis_test.go deleted file mode 100644 index 18d2520533b..00000000000 --- a/modules/capability/simulation/genesis_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package simulation_test - -import ( - "encoding/json" - "math/rand" - "testing" - - "github.com/stretchr/testify/require" - - sdkmath "cosmossdk.io/math" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/cosmos/ibc-go/modules/capability/simulation" - "github.com/cosmos/ibc-go/modules/capability/types" -) - -// TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. -// Abonormal scenarios are not tested here. -func TestRandomizedGenState(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - s := rand.NewSource(1) - r := rand.New(s) - - simState := module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - NumBonded: 3, - Accounts: simtypes.RandomAccounts(r, 3), - InitialStake: sdkmath.NewInt(1000), - GenState: make(map[string]json.RawMessage), - } - - simulation.RandomizedGenState(&simState) - - var capGenesis types.GenesisState - simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &capGenesis) - - require.Equal(t, uint64(149), capGenesis.Index) - require.Len(t, capGenesis.Owners, 0) -} - -// TestRandomizedGenState1 tests abnormal scenarios of applying RandomizedGenState. -func TestRandomizedGenState1(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - - s := rand.NewSource(1) - r := rand.New(s) - - // all these tests will panic - tests := []struct { - simState module.SimulationState - panicMsg string - }{ - { // panic => reason: incomplete initialization of the simState - module.SimulationState{}, "invalid memory address or nil pointer dereference"}, - { // panic => reason: incomplete initialization of the simState - module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - }, "assignment to entry in nil map"}, - } - - for _, tc := range tests { - tc := tc - require.Panicsf(t, func() { simulation.RandomizedGenState(&tc.simState) }, tc.panicMsg) - } -} diff --git a/modules/capability/sonar-project.properties b/modules/capability/sonar-project.properties deleted file mode 100644 index 4b0d5147597..00000000000 --- a/modules/capability/sonar-project.properties +++ /dev/null @@ -1,14 +0,0 @@ -sonar.projectKey=ibc-go-capability -sonar.organization=cosmos - -sonar.projectName=ibc-go - Capability -sonar.project.monorepo.enabled=true - -sonar.sources=. -sonar.exclusions=**/*_test.go -sonar.tests=. -sonar.test.inclusions=**/*_test.go -sonar.go.coverage.reportPaths=coverage.out - -sonar.sourceEncoding=UTF-8 -sonar.scm.provider=git \ No newline at end of file diff --git a/modules/capability/types/capability.pb.go b/modules/capability/types/capability.pb.go deleted file mode 100644 index 0922c0241d1..00000000000 --- a/modules/capability/types/capability.pb.go +++ /dev/null @@ -1,699 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: capability/v1/capability.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Capability defines an implementation of an object capability. The index -// provided to a Capability must be globally unique. -type Capability struct { - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` -} - -func (m *Capability) Reset() { *m = Capability{} } -func (*Capability) ProtoMessage() {} -func (*Capability) Descriptor() ([]byte, []int) { - return fileDescriptor_d0cd7c311a7ed50b, []int{0} -} -func (m *Capability) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Capability) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Capability.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Capability) XXX_Merge(src proto.Message) { - xxx_messageInfo_Capability.Merge(m, src) -} -func (m *Capability) XXX_Size() int { - return m.Size() -} -func (m *Capability) XXX_DiscardUnknown() { - xxx_messageInfo_Capability.DiscardUnknown(m) -} - -var xxx_messageInfo_Capability proto.InternalMessageInfo - -func (m *Capability) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -// Owner defines a single capability owner. An owner is defined by the name of -// capability and the module name. -type Owner struct { - Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` -} - -func (m *Owner) Reset() { *m = Owner{} } -func (*Owner) ProtoMessage() {} -func (*Owner) Descriptor() ([]byte, []int) { - return fileDescriptor_d0cd7c311a7ed50b, []int{1} -} -func (m *Owner) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Owner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Owner.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Owner) XXX_Merge(src proto.Message) { - xxx_messageInfo_Owner.Merge(m, src) -} -func (m *Owner) XXX_Size() int { - return m.Size() -} -func (m *Owner) XXX_DiscardUnknown() { - xxx_messageInfo_Owner.DiscardUnknown(m) -} - -var xxx_messageInfo_Owner proto.InternalMessageInfo - -// CapabilityOwners defines a set of owners of a single Capability. The set of -// owners must be unique. -type CapabilityOwners struct { - Owners []Owner `protobuf:"bytes,1,rep,name=owners,proto3" json:"owners"` -} - -func (m *CapabilityOwners) Reset() { *m = CapabilityOwners{} } -func (m *CapabilityOwners) String() string { return proto.CompactTextString(m) } -func (*CapabilityOwners) ProtoMessage() {} -func (*CapabilityOwners) Descriptor() ([]byte, []int) { - return fileDescriptor_d0cd7c311a7ed50b, []int{2} -} -func (m *CapabilityOwners) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CapabilityOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CapabilityOwners.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *CapabilityOwners) XXX_Merge(src proto.Message) { - xxx_messageInfo_CapabilityOwners.Merge(m, src) -} -func (m *CapabilityOwners) XXX_Size() int { - return m.Size() -} -func (m *CapabilityOwners) XXX_DiscardUnknown() { - xxx_messageInfo_CapabilityOwners.DiscardUnknown(m) -} - -var xxx_messageInfo_CapabilityOwners proto.InternalMessageInfo - -func (m *CapabilityOwners) GetOwners() []Owner { - if m != nil { - return m.Owners - } - return nil -} - -func init() { - proto.RegisterType((*Capability)(nil), "capability.v1.Capability") - proto.RegisterType((*Owner)(nil), "capability.v1.Owner") - proto.RegisterType((*CapabilityOwners)(nil), "capability.v1.CapabilityOwners") -} - -func init() { proto.RegisterFile("capability/v1/capability.proto", fileDescriptor_d0cd7c311a7ed50b) } - -var fileDescriptor_d0cd7c311a7ed50b = []byte{ - // 271 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4e, 0x2c, 0x48, - 0x4c, 0xca, 0xcc, 0xc9, 0x2c, 0xa9, 0xd4, 0x2f, 0x33, 0xd4, 0x47, 0xf0, 0xf4, 0x0a, 0x8a, 0xf2, - 0x4b, 0xf2, 0x85, 0x78, 0x91, 0x44, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x32, - 0xfa, 0x20, 0x16, 0x44, 0x91, 0x94, 0x60, 0x62, 0x6e, 0x66, 0x5e, 0xbe, 0x3e, 0x98, 0x84, 0x08, - 0x29, 0x69, 0x70, 0x71, 0x39, 0xc3, 0x75, 0x0a, 0x89, 0x70, 0xb1, 0x66, 0xe6, 0xa5, 0xa4, 0x56, - 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x04, 0x41, 0x38, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x28, - 0xd9, 0x72, 0xb1, 0xfa, 0x97, 0xe7, 0xa5, 0x16, 0x09, 0x89, 0x71, 0xb1, 0xe5, 0xe6, 0xa7, 0x94, - 0xe6, 0xa4, 0x82, 0x55, 0x71, 0x06, 0x41, 0x79, 0x42, 0x42, 0x5c, 0x2c, 0x79, 0x89, 0xb9, 0xa9, - 0x12, 0x4c, 0x60, 0x51, 0x30, 0xdb, 0x8a, 0xa3, 0x63, 0x81, 0x3c, 0x03, 0x58, 0xbb, 0x37, 0x97, - 0x00, 0xc2, 0x22, 0xb0, 0x41, 0xc5, 0x42, 0xe6, 0x5c, 0x6c, 0xf9, 0x60, 0x96, 0x04, 0xa3, 0x02, - 0xb3, 0x06, 0xb7, 0x91, 0x88, 0x1e, 0x8a, 0x2f, 0xf4, 0xc0, 0xca, 0x9c, 0x38, 0x4f, 0xdc, 0x93, - 0x67, 0x58, 0xf1, 0x7c, 0x83, 0x16, 0x63, 0x10, 0x54, 0xb9, 0x93, 0xf7, 0x89, 0x47, 0x72, 0x8c, - 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, - 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, - 0xe7, 0xea, 0x27, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb, 0x67, 0x26, 0x25, 0xeb, 0xa6, 0xe7, 0xeb, - 0x43, 0x5c, 0x59, 0x8c, 0x14, 0x74, 0xfa, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x90, - 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x0d, 0xad, 0x4b, 0x9f, 0x63, 0x01, 0x00, 0x00, -} - -func (m *Capability) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Capability) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Capability) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Index != 0 { - i = encodeVarintCapability(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Owner) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Owner) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Owner) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintCapability(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Module) > 0 { - i -= len(m.Module) - copy(dAtA[i:], m.Module) - i = encodeVarintCapability(dAtA, i, uint64(len(m.Module))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CapabilityOwners) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CapabilityOwners) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CapabilityOwners) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owners) > 0 { - for iNdEx := len(m.Owners) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Owners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCapability(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintCapability(dAtA []byte, offset int, v uint64) int { - offset -= sovCapability(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Capability) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovCapability(uint64(m.Index)) - } - return n -} - -func (m *Owner) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Module) - if l > 0 { - n += 1 + l + sovCapability(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovCapability(uint64(l)) - } - return n -} - -func (m *CapabilityOwners) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Owners) > 0 { - for _, e := range m.Owners { - l = e.Size() - n += 1 + l + sovCapability(uint64(l)) - } - } - return n -} - -func sovCapability(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCapability(x uint64) (n int) { - return sovCapability(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Capability) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Capability: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Capability: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCapability(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCapability - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Owner) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Owner: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Owner: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Module", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCapability - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCapability - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Module = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCapability - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCapability - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCapability(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCapability - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CapabilityOwners) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CapabilityOwners: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CapabilityOwners: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCapability - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCapability - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCapability - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owners = append(m.Owners, Owner{}) - if err := m.Owners[len(m.Owners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCapability(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCapability - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCapability(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCapability - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCapability - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCapability - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthCapability - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCapability - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCapability - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCapability = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCapability = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCapability = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/capability/types/errors.go b/modules/capability/types/errors.go deleted file mode 100644 index 60947338a24..00000000000 --- a/modules/capability/types/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" -) - -var ( - ErrInvalidCapabilityName = errorsmod.Register(ModuleName, 2, "capability name not valid") - ErrNilCapability = errorsmod.Register(ModuleName, 3, "provided capability is nil") - ErrCapabilityTaken = errorsmod.Register(ModuleName, 4, "capability name already taken") - ErrOwnerClaimed = errorsmod.Register(ModuleName, 5, "given owner already claimed capability") - ErrCapabilityNotOwned = errorsmod.Register(ModuleName, 6, "capability not owned by module") - ErrCapabilityNotFound = errorsmod.Register(ModuleName, 7, "capability not found") - ErrCapabilityOwnersNotFound = errorsmod.Register(ModuleName, 8, "owners not found for capability") -) diff --git a/modules/capability/types/genesis.go b/modules/capability/types/genesis.go deleted file mode 100644 index e2a2a9cd72e..00000000000 --- a/modules/capability/types/genesis.go +++ /dev/null @@ -1,50 +0,0 @@ -package types - -import ( - "errors" - "fmt" - "strings" -) - -// DefaultIndex is the default capability global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default Capability genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - Index: DefaultIndex, - Owners: []GenesisOwners{}, - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // NOTE: index must be greater than 0 - if gs.Index == 0 { - return errors.New("capability index must be non-zero") - } - - for _, genOwner := range gs.Owners { - if len(genOwner.IndexOwners.Owners) == 0 { - return errors.New("empty owners in genesis") - } - - // all exported existing indices must be between [1, gs.Index) - if genOwner.Index == 0 || genOwner.Index >= gs.Index { - return fmt.Errorf("owners exist for index %d outside of valid range: %d-%d", genOwner.Index, 1, gs.Index-1) - } - - for _, owner := range genOwner.IndexOwners.Owners { - if strings.TrimSpace(owner.Module) == "" { - return fmt.Errorf("owner's module cannot be blank: %s", owner) - } - - if strings.TrimSpace(owner.Name) == "" { - return fmt.Errorf("owner's name cannot be blank: %s", owner) - } - } - } - - return nil -} diff --git a/modules/capability/types/genesis.pb.go b/modules/capability/types/genesis.pb.go deleted file mode 100644 index cd96bf41a6c..00000000000 --- a/modules/capability/types/genesis.pb.go +++ /dev/null @@ -1,584 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: capability/v1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisOwners defines the capability owners with their corresponding index. -type GenesisOwners struct { - // index is the index of the capability owner. - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // index_owners are the owners at the given index. - IndexOwners CapabilityOwners `protobuf:"bytes,2,opt,name=index_owners,json=indexOwners,proto3" json:"index_owners"` -} - -func (m *GenesisOwners) Reset() { *m = GenesisOwners{} } -func (m *GenesisOwners) String() string { return proto.CompactTextString(m) } -func (*GenesisOwners) ProtoMessage() {} -func (*GenesisOwners) Descriptor() ([]byte, []int) { - return fileDescriptor_ad939573472b47ef, []int{0} -} -func (m *GenesisOwners) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisOwners.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisOwners) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisOwners.Merge(m, src) -} -func (m *GenesisOwners) XXX_Size() int { - return m.Size() -} -func (m *GenesisOwners) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisOwners.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisOwners proto.InternalMessageInfo - -func (m *GenesisOwners) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *GenesisOwners) GetIndexOwners() CapabilityOwners { - if m != nil { - return m.IndexOwners - } - return CapabilityOwners{} -} - -// GenesisState defines the capability module's genesis state. -type GenesisState struct { - // index is the capability global index. - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // owners represents a map from index to owners of the capability index - // index key is string to allow amino marshalling. - Owners []GenesisOwners `protobuf:"bytes,2,rep,name=owners,proto3" json:"owners"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_ad939573472b47ef, []int{1} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *GenesisState) GetOwners() []GenesisOwners { - if m != nil { - return m.Owners - } - return nil -} - -func init() { - proto.RegisterType((*GenesisOwners)(nil), "capability.v1.GenesisOwners") - proto.RegisterType((*GenesisState)(nil), "capability.v1.GenesisState") -} - -func init() { proto.RegisterFile("capability/v1/genesis.proto", fileDescriptor_ad939573472b47ef) } - -var fileDescriptor_ad939573472b47ef = []byte{ - // 275 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x4e, 0x2c, 0x48, - 0x4c, 0xca, 0xcc, 0xc9, 0x2c, 0xa9, 0xd4, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, - 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x45, 0x48, 0xea, 0x95, 0x19, 0x4a, 0x89, - 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x65, 0xf4, 0x41, 0x2c, 0x88, 0x22, 0x29, 0x39, 0x54, 0x13, 0x90, - 0xb4, 0x40, 0xe4, 0x05, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x48, 0xa9, 0x84, - 0x8b, 0xd7, 0x1d, 0x62, 0x91, 0x7f, 0x79, 0x5e, 0x6a, 0x51, 0xb1, 0x90, 0x08, 0x17, 0x6b, 0x66, - 0x5e, 0x4a, 0x6a, 0x85, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4b, 0x10, 0x84, 0x23, 0xe4, 0xcb, 0xc5, - 0x03, 0x66, 0xc4, 0xe7, 0x83, 0x55, 0x49, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0xc9, 0xeb, 0xa1, - 0xb8, 0x4a, 0xcf, 0x19, 0xce, 0x83, 0x18, 0xe6, 0xc4, 0x79, 0xe2, 0x9e, 0x3c, 0xc3, 0x8a, 0xe7, - 0x1b, 0xb4, 0x18, 0x83, 0xb8, 0xc1, 0xfa, 0x21, 0xe2, 0x4a, 0xa9, 0x5c, 0x3c, 0x50, 0x5b, 0x83, - 0x4b, 0x12, 0x4b, 0x52, 0x71, 0x58, 0x6a, 0xcf, 0xc5, 0x06, 0xb7, 0x8e, 0x59, 0x83, 0xdb, 0x48, - 0x06, 0xcd, 0x3a, 0x14, 0x87, 0x23, 0xdb, 0x05, 0xd5, 0xe6, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, - 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, - 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, - 0xb9, 0xfa, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xfa, 0x99, 0x49, 0xc9, 0xba, 0xe9, 0xf9, 0xfa, - 0xb9, 0xf9, 0x29, 0xa5, 0x39, 0xa9, 0xc5, 0x48, 0x81, 0xa7, 0x5f, 0x52, 0x59, 0x90, 0x5a, 0x9c, - 0xc4, 0x06, 0x0e, 0x30, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xce, 0xba, 0x56, 0x2e, 0xa7, - 0x01, 0x00, 0x00, -} - -func (m *GenesisOwners) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisOwners) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisOwners) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.IndexOwners.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Index != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *GenesisState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owners) > 0 { - for iNdEx := len(m.Owners) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Owners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Index != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisOwners) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovGenesis(uint64(m.Index)) - } - l = m.IndexOwners.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovGenesis(uint64(m.Index)) - } - if len(m.Owners) > 0 { - for _, e := range m.Owners { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisOwners) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisOwners: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisOwners: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IndexOwners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IndexOwners.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owners = append(m.Owners, GenesisOwners{}) - if err := m.Owners[len(m.Owners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/capability/types/genesis_test.go b/modules/capability/types/genesis_test.go deleted file mode 100644 index 551ec8a2e6e..00000000000 --- a/modules/capability/types/genesis_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/ibc-go/modules/capability/types" -) - -func TestValidateGenesis(t *testing.T) { - testCases := []struct { - name string - malleate func(*types.GenesisState) - expPass bool - }{ - { - name: "default", - malleate: func(_ *types.GenesisState) {}, - expPass: true, - }, - { - name: "valid genesis state", - malleate: func(genState *types.GenesisState) { - genState.Index = 10 - genOwner := types.GenesisOwners{ - Index: 1, - IndexOwners: types.CapabilityOwners{[]types.Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: true, - }, - { - name: "initial index is 0", - malleate: func(genState *types.GenesisState) { - genState.Index = 0 - genOwner := types.GenesisOwners{ - Index: 0, - IndexOwners: types.CapabilityOwners{[]types.Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - - { - name: "blank owner module", - malleate: func(genState *types.GenesisState) { - genState.Index = 1 - genOwner := types.GenesisOwners{ - Index: 1, - IndexOwners: types.CapabilityOwners{[]types.Owner{{Module: "", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "blank owner name", - malleate: func(genState *types.GenesisState) { - genState.Index = 1 - genOwner := types.GenesisOwners{ - Index: 1, - IndexOwners: types.CapabilityOwners{[]types.Owner{{Module: "ibc", Name: ""}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "index above range", - malleate: func(genState *types.GenesisState) { - genState.Index = 10 - genOwner := types.GenesisOwners{ - Index: 12, - IndexOwners: types.CapabilityOwners{[]types.Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "index below range", - malleate: func(genState *types.GenesisState) { - genState.Index = 10 - genOwner := types.GenesisOwners{ - Index: 0, - IndexOwners: types.CapabilityOwners{[]types.Owner{{Module: "ibc", Name: "port/transfer"}}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - { - name: "owners are empty", - malleate: func(genState *types.GenesisState) { - genState.Index = 10 - genOwner := types.GenesisOwners{ - Index: 0, - IndexOwners: types.CapabilityOwners{[]types.Owner{}}, - } - - genState.Owners = append(genState.Owners, genOwner) - }, - expPass: false, - }, - } - - for _, tc := range testCases { - tc := tc - genState := types.DefaultGenesis() - tc.malleate(genState) - err := genState.Validate() - if tc.expPass { - require.NoError(t, err, tc.name) - } else { - require.Error(t, err, tc.name) - } - } -} diff --git a/modules/capability/types/keys.go b/modules/capability/types/keys.go deleted file mode 100644 index fe6ae41aacf..00000000000 --- a/modules/capability/types/keys.go +++ /dev/null @@ -1,54 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName defines the module name - ModuleName = "capability" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // MemStoreKey defines the in-memory store key - MemStoreKey = "memory:capability" -) - -var ( - // KeyIndex defines the key that stores the current globally unique capability - // index. - KeyIndex = []byte("index") - - // KeyPrefixIndexCapability defines a key prefix that stores index to capability - // owners mappings. - KeyPrefixIndexCapability = []byte("capability_index") - - // KeyMemInitialized defines the key that stores the initialized flag in the memory store - KeyMemInitialized = []byte("mem_initialized") -) - -// RevCapabilityKey returns a reverse lookup key for a given module and capability -// name. -func RevCapabilityKey(module, name string) []byte { - return []byte(fmt.Sprintf("%s/rev/%s", module, name)) -} - -// FwdCapabilityKey returns a forward lookup key for a given module and capability -// reference. -func FwdCapabilityKey(module string, cap *Capability) []byte { - return []byte(fmt.Sprintf("%s/fwd/%#016p", module, cap)) -} - -// IndexToKey returns bytes to be used as a key for a given capability index. -func IndexToKey(index uint64) []byte { - return sdk.Uint64ToBigEndian(index) -} - -// IndexFromKey returns an index from a call to IndexToKey for a given capability -// index. -func IndexFromKey(key []byte) uint64 { - return sdk.BigEndianToUint64(key) -} diff --git a/modules/capability/types/keys_test.go b/modules/capability/types/keys_test.go deleted file mode 100644 index c79cf2723ec..00000000000 --- a/modules/capability/types/keys_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package types_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/ibc-go/modules/capability/types" -) - -func TestRevCapabilityKey(t *testing.T) { - expected := []byte("bank/rev/send") - require.Equal(t, expected, types.RevCapabilityKey("bank", "send")) -} - -func TestFwdCapabilityKey(t *testing.T) { - capability := types.NewCapability(23) - expected := []byte(fmt.Sprintf("bank/fwd/%#016p", capability)) - require.Equal(t, expected, types.FwdCapabilityKey("bank", capability)) -} - -func TestIndexToKey(t *testing.T) { - require.Equal(t, []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc, 0x5a}, types.IndexToKey(3162)) -} - -func TestIndexFromKey(t *testing.T) { - require.Equal(t, uint64(3162), types.IndexFromKey([]byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc, 0x5a})) -} diff --git a/modules/capability/types/types.go b/modules/capability/types/types.go deleted file mode 100644 index 84f8ca48d5b..00000000000 --- a/modules/capability/types/types.go +++ /dev/null @@ -1,87 +0,0 @@ -package types - -import ( - "fmt" - "sort" - - "sigs.k8s.io/yaml" - - errorsmod "cosmossdk.io/errors" -) - -// NewCapability returns a reference to a new Capability to be used as an -// actual capability. -func NewCapability(index uint64) *Capability { - return &Capability{Index: index} -} - -// String returns the string representation of a Capability. The string contains -// the Capability's memory reference as the string is to be used in a composite -// key and to authenticate capabilities. -func (ck *Capability) String() string { - return fmt.Sprintf("Capability{%p, %d}", ck, ck.Index) -} - -func NewOwner(module, name string) Owner { - return Owner{Module: module, Name: name} -} - -// Key returns a composite key for an Owner. -func (o Owner) Key() string { - return fmt.Sprintf("%s/%s", o.Module, o.Name) -} - -func (o Owner) String() string { - bz, _ := yaml.Marshal(o) - return string(bz) -} - -func NewCapabilityOwners() *CapabilityOwners { - return &CapabilityOwners{Owners: make([]Owner, 0)} -} - -// Set attempts to add a given owner to the CapabilityOwners. If the owner -// already exists, an error will be returned. Set runs in O(log n) average time -// and O(n) in the worst case. -func (co *CapabilityOwners) Set(owner Owner) error { - i, ok := co.Get(owner) - if ok { - // owner already exists at co.Owners[i] - return errorsmod.Wrapf(ErrOwnerClaimed, owner.String()) - } - - // owner does not exist in the set of owners, so we insert at position i - co.Owners = append(co.Owners, Owner{}) // expand by 1 in amortized O(1) / O(n) worst case - copy(co.Owners[i+1:], co.Owners[i:]) - co.Owners[i] = owner - - return nil -} - -// Remove removes a provided owner from the CapabilityOwners if it exists. If the -// owner does not exist, Remove is considered a no-op. -func (co *CapabilityOwners) Remove(owner Owner) { - if len(co.Owners) == 0 { - return - } - - i, ok := co.Get(owner) - if ok { - // owner exists at co.Owners[i] - co.Owners = append(co.Owners[:i], co.Owners[i+1:]...) - } -} - -// Get returns (i, true) of the provided owner in the CapabilityOwners if the -// owner exists, where i indicates the owner's index in the set. Otherwise -// (i, false) where i indicates where in the set the owner should be added. -func (co *CapabilityOwners) Get(owner Owner) (int, bool) { - // find smallest index s.t. co.Owners[i] >= owner in O(log n) time - i := sort.Search(len(co.Owners), func(i int) bool { return co.Owners[i].Key() >= owner.Key() }) - if i < len(co.Owners) && co.Owners[i].Key() == owner.Key() { - // owner exists at co.Owners[i] - return i, true - } - - return i, false -} diff --git a/modules/capability/types/types_test.go b/modules/capability/types/types_test.go deleted file mode 100644 index 0e623aaefa7..00000000000 --- a/modules/capability/types/types_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package types_test - -import ( - "fmt" - "sort" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/ibc-go/modules/capability/types" -) - -func TestCapabilityKey(t *testing.T) { - idx := uint64(3162) - capability := types.NewCapability(idx) - require.Equal(t, idx, capability.GetIndex()) - require.Equal(t, fmt.Sprintf("Capability{%p, %d}", capability, idx), capability.String()) -} - -func TestOwner(t *testing.T) { - o := types.NewOwner("bank", "send") - require.Equal(t, "bank/send", o.Key()) - require.Equal(t, "module: bank\nname: send\n", o.String()) -} - -func TestCapabilityOwners_Set(t *testing.T) { - co := types.NewCapabilityOwners() - - owners := make([]types.Owner, 1024) - for i := range owners { - var owner types.Owner - - if i%2 == 0 { - owner = types.NewOwner("bank", fmt.Sprintf("send-%d", i)) - } else { - owner = types.NewOwner("slashing", fmt.Sprintf("slash-%d", i)) - } - - owners[i] = owner - require.NoError(t, co.Set(owner)) - } - - sort.Slice(owners, func(i, j int) bool { return owners[i].Key() < owners[j].Key() }) - require.Equal(t, owners, co.Owners) - - for _, owner := range owners { - require.Error(t, co.Set(owner)) - } -} - -func TestCapabilityOwners_Remove(t *testing.T) { - co := types.NewCapabilityOwners() - - co.Remove(types.NewOwner("bank", "send-0")) - require.Len(t, co.Owners, 0) - - for i := 0; i < 5; i++ { - require.NoError(t, co.Set(types.NewOwner("bank", fmt.Sprintf("send-%d", i)))) - } - - require.Len(t, co.Owners, 5) - - for i := 0; i < 5; i++ { - co.Remove(types.NewOwner("bank", fmt.Sprintf("send-%d", i))) - require.Len(t, co.Owners, 5-(i+1)) - } - - require.Len(t, co.Owners, 0) -} diff --git a/modules/core/02-client/keeper/grpc_query.go b/modules/core/02-client/keeper/grpc_query.go index b8d742ba838..e0dafbd3294 100644 --- a/modules/core/02-client/keeper/grpc_query.go +++ b/modules/core/02-client/keeper/grpc_query.go @@ -14,6 +14,7 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" @@ -77,7 +78,7 @@ func (q *queryServer) ClientStates(c context.Context, req *types.QueryClientStat ctx := sdk.UnwrapSDKContext(c) var clientStates types.IdentifiedClientStates - store := prefix.NewStore(ctx.KVStore(q.storeKey), host.KeyClientStorePrefix) + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.KeyClientStorePrefix) pageRes, err := query.FilteredPaginate(store, req.Pagination, func(key, value []byte, accumulate bool) (bool, error) { // filter any metadata stored under client state key @@ -172,7 +173,7 @@ func (q *queryServer) ConsensusStates(c context.Context, req *types.QueryConsens ctx := sdk.UnwrapSDKContext(c) var consensusStates []types.ConsensusStateWithHeight - store := prefix.NewStore(ctx.KVStore(q.storeKey), host.FullClientKey(req.ClientId, []byte(fmt.Sprintf("%s/", host.KeyConsensusStatePrefix)))) + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.FullClientKey(req.ClientId, []byte(fmt.Sprintf("%s/", host.KeyConsensusStatePrefix)))) pageRes, err := query.FilteredPaginate(store, req.Pagination, func(key, value []byte, accumulate bool) (bool, error) { // filter any metadata stored under consensus state key @@ -216,7 +217,7 @@ func (q *queryServer) ConsensusStateHeights(c context.Context, req *types.QueryC ctx := sdk.UnwrapSDKContext(c) var consensusStateHeights []types.Height - store := prefix.NewStore(ctx.KVStore(q.storeKey), host.FullClientKey(req.ClientId, []byte(fmt.Sprintf("%s/", host.KeyConsensusStatePrefix)))) + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.FullClientKey(req.ClientId, []byte(fmt.Sprintf("%s/", host.KeyConsensusStatePrefix)))) pageRes, err := query.FilteredPaginate(store, req.Pagination, func(key, _ []byte, accumulate bool) (bool, error) { // filter any metadata stored under consensus state key diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index dd5fb094657..a19ec874743 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -1,10 +1,12 @@ package keeper import ( + "context" "errors" "fmt" "strings" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/store/prefix" @@ -12,6 +14,7 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" @@ -24,7 +27,7 @@ import ( // Keeper represents a type that grants read and write permissions to any client // state information type Keeper struct { - storeKey storetypes.StoreKey + storeService corestore.KVStoreService cdc codec.BinaryCodec router *types.Router legacySubspace types.ParamSubspace @@ -32,13 +35,13 @@ type Keeper struct { } // NewKeeper creates a new NewKeeper instance -func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace types.ParamSubspace, uk types.UpgradeKeeper) *Keeper { +func NewKeeper(cdc codec.BinaryCodec, storeService corestore.KVStoreService, legacySubspace types.ParamSubspace, uk types.UpgradeKeeper) *Keeper { router := types.NewRouter() - localhostModule := localhost.NewLightClientModule(cdc, key) + localhostModule := localhost.NewLightClientModule(cdc, storeService) router.AddRoute(exported.Localhost, localhostModule) return &Keeper{ - storeKey: key, + storeService: storeService, cdc: cdc, router: router, legacySubspace: legacySubspace, @@ -52,8 +55,9 @@ func (k *Keeper) Codec() codec.BinaryCodec { } // Logger returns a module-specific logger. -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } // AddRoute adds a new route to the underlying router. @@ -63,11 +67,11 @@ func (k *Keeper) AddRoute(clientType string, module exported.LightClientModule) // GetStoreProvider returns the light client store provider. func (k *Keeper) GetStoreProvider() types.StoreProvider { - return types.NewStoreProvider(k.storeKey) + return types.NewStoreProvider(k.storeService) } // Route returns the light client module for the given client identifier. -func (k *Keeper) Route(ctx sdk.Context, clientID string) (exported.LightClientModule, error) { +func (k *Keeper) Route(ctx context.Context, clientID string) (exported.LightClientModule, error) { clientType, _, err := types.ParseClientIdentifier(clientID) if err != nil { return nil, errorsmod.Wrapf(err, "unable to parse client identifier %s", clientID) @@ -89,7 +93,7 @@ func (k *Keeper) Route(ctx sdk.Context, clientID string) (exported.LightClientMo } // GenerateClientIdentifier returns the next client identifier. -func (k *Keeper) GenerateClientIdentifier(ctx sdk.Context, clientType string) string { +func (k *Keeper) GenerateClientIdentifier(ctx context.Context, clientType string) string { nextClientSeq := k.GetNextClientSequence(ctx) clientID := types.FormatClientIdentifier(clientType, nextClientSeq) @@ -99,7 +103,7 @@ func (k *Keeper) GenerateClientIdentifier(ctx sdk.Context, clientType string) st } // GetClientState gets a particular client from the store -func (k *Keeper) GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) { +func (k *Keeper) GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) { store := k.ClientStore(ctx, clientID) bz := store.Get(host.ClientStateKey()) if len(bz) == 0 { @@ -111,13 +115,13 @@ func (k *Keeper) GetClientState(ctx sdk.Context, clientID string) (exported.Clie } // SetClientState sets a particular Client to the store -func (k *Keeper) SetClientState(ctx sdk.Context, clientID string, clientState exported.ClientState) { +func (k *Keeper) SetClientState(ctx context.Context, clientID string, clientState exported.ClientState) { store := k.ClientStore(ctx, clientID) store.Set(host.ClientStateKey(), types.MustMarshalClientState(k.cdc, clientState)) } // GetClientConsensusState gets the stored consensus state from a client at a given height. -func (k *Keeper) GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) { +func (k *Keeper) GetClientConsensusState(ctx context.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) { store := k.ClientStore(ctx, clientID) bz := store.Get(host.ConsensusStateKey(height)) if len(bz) == 0 { @@ -130,15 +134,18 @@ func (k *Keeper) GetClientConsensusState(ctx sdk.Context, clientID string, heigh // SetClientConsensusState sets a ConsensusState to a particular client at the given // height -func (k *Keeper) SetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height, consensusState exported.ConsensusState) { +func (k *Keeper) SetClientConsensusState(ctx context.Context, clientID string, height exported.Height, consensusState exported.ConsensusState) { store := k.ClientStore(ctx, clientID) store.Set(host.ConsensusStateKey(height), types.MustMarshalConsensusState(k.cdc, consensusState)) } // GetNextClientSequence gets the next client sequence from the store. -func (k *Keeper) GetNextClientSequence(ctx sdk.Context) uint64 { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.KeyNextClientSequence)) +func (k *Keeper) GetNextClientSequence(ctx context.Context) uint64 { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.KeyNextClientSequence)) + if err != nil { + panic(err) + } if len(bz) == 0 { panic(errors.New("next client sequence is nil")) } @@ -147,20 +154,22 @@ func (k *Keeper) GetNextClientSequence(ctx sdk.Context) uint64 { } // SetNextClientSequence sets the next client sequence to the store. -func (k *Keeper) SetNextClientSequence(ctx sdk.Context, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetNextClientSequence(ctx context.Context, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set([]byte(types.KeyNextClientSequence), bz) + if err := store.Set([]byte(types.KeyNextClientSequence), bz); err != nil { + panic(err) + } } // IterateConsensusStates provides an iterator over all stored consensus states. // objects. For each State object, cb will be called. If the cb returns true, // the iterator will close and stop. -func (k *Keeper) IterateConsensusStates(ctx sdk.Context, cb func(clientID string, cs types.ConsensusStateWithHeight) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IterateConsensusStates(ctx context.Context, cb func(clientID string, cs types.ConsensusStateWithHeight) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, host.KeyClientStorePrefix) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { keySplit := strings.Split(string(iterator.Key()), "/") // consensus key is in the format "clients//consensusStates/" @@ -181,11 +190,11 @@ func (k *Keeper) IterateConsensusStates(ctx sdk.Context, cb func(clientID string // iterateMetadata provides an iterator over all stored metadata keys in the client store. // For each metadata object, it will perform a callback. -func (k *Keeper) iterateMetadata(ctx sdk.Context, cb func(clientID string, key, value []byte) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) iterateMetadata(ctx context.Context, cb func(clientID string, key, value []byte) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, host.KeyClientStorePrefix) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { split := strings.Split(string(iterator.Key()), "/") if len(split) == 3 && split[2] == string(host.KeyClientState) { @@ -216,7 +225,7 @@ func (k *Keeper) iterateMetadata(ctx sdk.Context, cb func(clientID string, key, } // GetAllGenesisClients returns all the clients in state with their client ids returned as IdentifiedClientState -func (k *Keeper) GetAllGenesisClients(ctx sdk.Context) types.IdentifiedClientStates { +func (k *Keeper) GetAllGenesisClients(ctx context.Context) types.IdentifiedClientStates { var genClients types.IdentifiedClientStates k.IterateClientStates(ctx, nil, func(clientID string, cs exported.ClientState) bool { genClients = append(genClients, types.NewIdentifiedClientState(clientID, cs)) @@ -229,7 +238,7 @@ func (k *Keeper) GetAllGenesisClients(ctx sdk.Context) types.IdentifiedClientSta // GetAllClientMetadata will take a list of IdentifiedClientState and return a list // of IdentifiedGenesisMetadata necessary for exporting and importing client metadata // into the client store. -func (k *Keeper) GetAllClientMetadata(ctx sdk.Context, genClients []types.IdentifiedClientState) ([]types.IdentifiedGenesisMetadata, error) { +func (k *Keeper) GetAllClientMetadata(ctx context.Context, genClients []types.IdentifiedClientState) ([]types.IdentifiedGenesisMetadata, error) { metadataMap := make(map[string][]types.GenesisMetadata) k.iterateMetadata(ctx, func(clientID string, key, value []byte) bool { metadataMap[clientID] = append(metadataMap[clientID], types.NewGenesisMetadata(key, value)) @@ -251,7 +260,7 @@ func (k *Keeper) GetAllClientMetadata(ctx sdk.Context, genClients []types.Identi } // SetAllClientMetadata takes a list of IdentifiedGenesisMetadata and stores all of the metadata in the client store at the appropriate paths. -func (k *Keeper) SetAllClientMetadata(ctx sdk.Context, genMetadata []types.IdentifiedGenesisMetadata) { +func (k *Keeper) SetAllClientMetadata(ctx context.Context, genMetadata []types.IdentifiedGenesisMetadata) { for _, igm := range genMetadata { // create client store store := k.ClientStore(ctx, igm.ClientId) @@ -263,7 +272,7 @@ func (k *Keeper) SetAllClientMetadata(ctx sdk.Context, genMetadata []types.Ident } // GetAllConsensusStates returns all stored client consensus states. -func (k *Keeper) GetAllConsensusStates(ctx sdk.Context) types.ClientsConsensusStates { +func (k *Keeper) GetAllConsensusStates(ctx context.Context) types.ClientsConsensusStates { clientConsStates := make(types.ClientsConsensusStates, 0) mapClientIDToConsStateIdx := make(map[string]int) @@ -289,13 +298,13 @@ func (k *Keeper) GetAllConsensusStates(ctx sdk.Context) types.ClientsConsensusSt // HasClientConsensusState returns if keeper has a ConsensusState for a particular // client at the given height -func (k *Keeper) HasClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) bool { +func (k *Keeper) HasClientConsensusState(ctx context.Context, clientID string, height exported.Height) bool { store := k.ClientStore(ctx, clientID) return store.Has(host.ConsensusStateKey(height)) } // GetLatestClientConsensusState gets the latest ConsensusState stored for a given client -func (k *Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string) (exported.ConsensusState, bool) { +func (k *Keeper) GetLatestClientConsensusState(ctx context.Context, clientID string) (exported.ConsensusState, bool) { clientModule, err := k.Route(ctx, clientID) if err != nil { return nil, false @@ -305,8 +314,9 @@ func (k *Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string) } // GetCreator returns the creator of the client. -func (k *Keeper) GetCreator(ctx sdk.Context, clientID string) (string, bool) { - bz := k.ClientStore(ctx, clientID).Get([]byte(types.CreatorKey)) +func (k *Keeper) GetCreator(ctx context.Context, clientID string) (string, bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + bz := k.ClientStore(sdkCtx, clientID).Get([]byte(types.CreatorKey)) if len(bz) == 0 { return "", false } @@ -315,17 +325,19 @@ func (k *Keeper) GetCreator(ctx sdk.Context, clientID string) (string, bool) { } // SetCreator sets the creator of the client. -func (k *Keeper) SetCreator(ctx sdk.Context, clientID, creator string) { - k.ClientStore(ctx, clientID).Set([]byte(types.CreatorKey), []byte(creator)) +func (k *Keeper) SetCreator(ctx context.Context, clientID, creator string) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + k.ClientStore(sdkCtx, clientID).Set([]byte(types.CreatorKey), []byte(creator)) } // DeleteCreator deletes the creator associated with the client. -func (k *Keeper) DeleteCreator(ctx sdk.Context, clientID string) { - k.ClientStore(ctx, clientID).Delete([]byte(types.CreatorKey)) +func (k *Keeper) DeleteCreator(ctx context.Context, clientID string) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + k.ClientStore(sdkCtx, clientID).Delete([]byte(types.CreatorKey)) } // VerifyMembership retrieves the light client module for the clientID and verifies the proof of the existence of a key-value pair at a specified height. -func (k *Keeper) VerifyMembership(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error { +func (k *Keeper) VerifyMembership(ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error { clientModule, err := k.Route(ctx, clientID) if err != nil { return err @@ -339,7 +351,7 @@ func (k *Keeper) VerifyMembership(ctx sdk.Context, clientID string, height expor } // VerifyNonMembership retrieves the light client module for the clientID and verifies the absence of a given key at a specified height. -func (k *Keeper) VerifyNonMembership(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path) error { +func (k *Keeper) VerifyNonMembership(ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path) error { clientModule, err := k.Route(ctx, clientID) if err != nil { return err @@ -353,33 +365,33 @@ func (k *Keeper) VerifyNonMembership(ctx sdk.Context, clientID string, height ex } // GetUpgradePlan executes the upgrade keeper GetUpgradePlan function. -func (k *Keeper) GetUpgradePlan(ctx sdk.Context) (upgradetypes.Plan, error) { +func (k *Keeper) GetUpgradePlan(ctx context.Context) (upgradetypes.Plan, error) { return k.upgradeKeeper.GetUpgradePlan(ctx) } // GetUpgradedClient executes the upgrade keeper GetUpgradeClient function. -func (k *Keeper) GetUpgradedClient(ctx sdk.Context, planHeight int64) ([]byte, error) { +func (k *Keeper) GetUpgradedClient(ctx context.Context, planHeight int64) ([]byte, error) { return k.upgradeKeeper.GetUpgradedClient(ctx, planHeight) } // GetUpgradedConsensusState returns the upgraded consensus state -func (k *Keeper) GetUpgradedConsensusState(ctx sdk.Context, planHeight int64) ([]byte, error) { +func (k *Keeper) GetUpgradedConsensusState(ctx context.Context, planHeight int64) ([]byte, error) { return k.upgradeKeeper.GetUpgradedConsensusState(ctx, planHeight) } // SetUpgradedConsensusState executes the upgrade keeper SetUpgradedConsensusState function. -func (k *Keeper) SetUpgradedConsensusState(ctx sdk.Context, planHeight int64, bz []byte) error { +func (k *Keeper) SetUpgradedConsensusState(ctx context.Context, planHeight int64, bz []byte) error { return k.upgradeKeeper.SetUpgradedConsensusState(ctx, planHeight, bz) } // IterateClientStates provides an iterator over all stored ibc ClientState // objects using the provided store prefix. For each ClientState object, cb will be called. If the cb returns true, // the iterator will close and stop. -func (k *Keeper) IterateClientStates(ctx sdk.Context, storePrefix []byte, cb func(clientID string, cs exported.ClientState) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IterateClientStates(ctx context.Context, storePrefix []byte, cb func(clientID string, cs exported.ClientState) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, host.PrefixedClientStoreKey(storePrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { path := string(iterator.Key()) if !strings.Contains(path, host.KeyClientState) { @@ -397,7 +409,7 @@ func (k *Keeper) IterateClientStates(ctx sdk.Context, storePrefix []byte, cb fun } // GetAllClients returns all stored light client State objects. -func (k *Keeper) GetAllClients(ctx sdk.Context) []exported.ClientState { +func (k *Keeper) GetAllClients(ctx context.Context) []exported.ClientState { var states []exported.ClientState k.IterateClientStates(ctx, nil, func(_ string, state exported.ClientState) bool { states = append(states, state) @@ -409,14 +421,15 @@ func (k *Keeper) GetAllClients(ctx sdk.Context) []exported.ClientState { // ClientStore returns isolated prefix store for each client so they can read/write in separate // namespace without being able to read/write other client's data -func (k *Keeper) ClientStore(ctx sdk.Context, clientID string) storetypes.KVStore { +func (k *Keeper) ClientStore(ctx context.Context, clientID string) storetypes.KVStore { clientPrefix := []byte(fmt.Sprintf("%s/%s/", host.KeyClientStorePrefix, clientID)) - return prefix.NewStore(ctx.KVStore(k.storeKey), clientPrefix) + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + return prefix.NewStore(store, clientPrefix) } // GetClientStatus returns the status for a client state given a client identifier. If the client type is not in the allowed // clients param field, Unauthorized is returned, otherwise the client state status is returned. -func (k *Keeper) GetClientStatus(ctx sdk.Context, clientID string) exported.Status { +func (k *Keeper) GetClientStatus(ctx context.Context, clientID string) exported.Status { clientModule, err := k.Route(ctx, clientID) if err != nil { return exported.Unauthorized @@ -427,7 +440,7 @@ func (k *Keeper) GetClientStatus(ctx sdk.Context, clientID string) exported.Stat // GetClientLatestHeight returns the latest height of a client state for a given client identifier. If the client type is not in the allowed // clients param field, a zero value height is returned, otherwise the client state latest height is returned. -func (k *Keeper) GetClientLatestHeight(ctx sdk.Context, clientID string) types.Height { +func (k *Keeper) GetClientLatestHeight(ctx context.Context, clientID string) types.Height { clientModule, err := k.Route(ctx, clientID) if err != nil { return types.ZeroHeight() @@ -442,7 +455,7 @@ func (k *Keeper) GetClientLatestHeight(ctx sdk.Context, clientID string) types.H } // GetClientTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height. -func (k *Keeper) GetClientTimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) { +func (k *Keeper) GetClientTimestampAtHeight(ctx context.Context, clientID string, height exported.Height) (uint64, error) { clientModule, err := k.Route(ctx, clientID) if err != nil { return 0, err @@ -452,9 +465,12 @@ func (k *Keeper) GetClientTimestampAtHeight(ctx sdk.Context, clientID string, he } // GetParams returns the total set of ibc-client parameters. -func (k *Keeper) GetParams(ctx sdk.Context) types.Params { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.ParamsKey)) +func (k *Keeper) GetParams(ctx context.Context) types.Params { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.ParamsKey)) + if err != nil { + panic(err) + } if bz == nil { // only panic on unset params and not on empty params panic(errors.New("client params are not set in store")) } @@ -465,14 +481,16 @@ func (k *Keeper) GetParams(ctx sdk.Context) types.Params { } // SetParams sets the total set of ibc-client parameters. -func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetParams(ctx context.Context, params types.Params) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(¶ms) - store.Set([]byte(types.ParamsKey), bz) + if err := store.Set([]byte(types.ParamsKey), bz); err != nil { + panic(err) + } } // ScheduleIBCSoftwareUpgrade schedules an upgrade for the IBC client. -func (k *Keeper) ScheduleIBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { +func (k *Keeper) ScheduleIBCSoftwareUpgrade(ctx context.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { // zero out any custom fields before setting cs, ok := upgradedClientState.(*ibctm.ClientState) if !ok { @@ -496,7 +514,8 @@ func (k *Keeper) ScheduleIBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.P } // emitting an event for scheduling an upgrade plan - emitScheduleIBCSoftwareUpgradeEvent(ctx, plan.Name, plan.Height) + sdkContext := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + emitScheduleIBCSoftwareUpgradeEvent(sdkContext, plan.Name, plan.Height) return nil } diff --git a/modules/core/02-client/keeper/migrations.go b/modules/core/02-client/keeper/migrations.go index ba45e543622..d39a756ed93 100644 --- a/modules/core/02-client/keeper/migrations.go +++ b/modules/core/02-client/keeper/migrations.go @@ -26,7 +26,7 @@ func NewMigrator(keeper *Keeper) Migrator { // - removes the localhost client // - asserts that existing tendermint clients are properly registered on the chain codec func (m Migrator) Migrate2to3(ctx sdk.Context) error { - return v7.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc, m.keeper) + return v7.MigrateStore(ctx, m.keeper.storeService, m.keeper.cdc, m.keeper) } // MigrateParams migrates from consensus version 4 to 5. diff --git a/modules/core/02-client/migrations/v7/expected_keepers.go b/modules/core/02-client/migrations/v7/expected_keepers.go index d25f9f880f6..feb486b73f2 100644 --- a/modules/core/02-client/migrations/v7/expected_keepers.go +++ b/modules/core/02-client/migrations/v7/expected_keepers.go @@ -1,16 +1,16 @@ package v7 import ( - storetypes "cosmossdk.io/store/types" + "context" - sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // ClientKeeper expected IBC client keeper type ClientKeeper interface { - GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) - SetClientState(ctx sdk.Context, clientID string, clientState exported.ClientState) - ClientStore(ctx sdk.Context, clientID string) storetypes.KVStore + GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) + SetClientState(ctx context.Context, clientID string, clientState exported.ClientState) + ClientStore(ctx context.Context, clientID string) storetypes.KVStore } diff --git a/modules/core/02-client/migrations/v7/genesis_test.go b/modules/core/02-client/migrations/v7/genesis_test.go index f97f5aa4ed7..2478f2a00f4 100644 --- a/modules/core/02-client/migrations/v7/genesis_test.go +++ b/modules/core/02-client/migrations/v7/genesis_test.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" ibcclient "github.com/cosmos/ibc-go/v9/modules/core/02-client" "github.com/cosmos/ibc-go/v9/modules/core/02-client/migrations/v7" @@ -107,7 +108,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { // migrate store get expected genesis // store migration and genesis migration should produce identical results // NOTE: tendermint clients are not pruned in genesis so the test should not have expired tendermint clients - err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := v7.MigrateStore(suite.chainA.GetContext(), runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) expectedClientGenState := ibcclient.ExportGenesis(suite.chainA.GetContext(), suite.chainA.App.GetIBCKeeper().ClientKeeper) diff --git a/modules/core/02-client/migrations/v7/solomachine.go b/modules/core/02-client/migrations/v7/solomachine.go index c350fc53d77..7999b9279d8 100644 --- a/modules/core/02-client/migrations/v7/solomachine.go +++ b/modules/core/02-client/migrations/v7/solomachine.go @@ -1,6 +1,7 @@ package v7 import ( + "context" "errors" storetypes "cosmossdk.io/store/types" @@ -8,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -63,7 +63,7 @@ func (ClientState) GetLatestHeight() exported.Height { } // Status panics! -func (ClientState) Status(_ sdk.Context, _ storetypes.KVStore, _ codec.BinaryCodec) exported.Status { +func (ClientState) Status(_ context.Context, _ storetypes.KVStore, _ codec.BinaryCodec) exported.Status { panic(errors.New("legacy solo machine is deprecated")) } @@ -73,51 +73,51 @@ func (ClientState) Validate() error { } // Initialize panics! -func (ClientState) Initialize(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ConsensusState) error { +func (ClientState) Initialize(_ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ConsensusState) error { panic(errors.New("legacy solo machine is deprecated")) } // CheckForMisbehaviour panics! -func (ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) bool { +func (ClientState) CheckForMisbehaviour(_ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) bool { panic(errors.New("legacy solo machine is deprecated")) } // UpdateStateOnMisbehaviour panics! func (*ClientState) UpdateStateOnMisbehaviour( - _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, + _ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) { panic(errors.New("legacy solo machine is deprecated")) } // VerifyClientMessage panics! func (*ClientState) VerifyClientMessage( - _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, + _ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) error { panic(errors.New("legacy solo machine is deprecated")) } // UpdateState panis! -func (*ClientState) UpdateState(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) []exported.Height { +func (*ClientState) UpdateState(_ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) []exported.Height { panic(errors.New("legacy solo machine is deprecated")) } // CheckHeaderAndUpdateState panics! func (*ClientState) CheckHeaderAndUpdateState( - _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, + _ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) (exported.ClientState, exported.ConsensusState, error) { panic(errors.New("legacy solo machine is deprecated")) } // CheckMisbehaviourAndUpdateState panics! func (ClientState) CheckMisbehaviourAndUpdateState( - _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, + _ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) (exported.ClientState, error) { panic(errors.New("legacy solo machine is deprecated")) } // CheckSubstituteAndUpdateState panics! func (ClientState) CheckSubstituteAndUpdateState( - ctx sdk.Context, _ codec.BinaryCodec, _, _ storetypes.KVStore, + ctx context.Context, _ codec.BinaryCodec, _, _ storetypes.KVStore, _ exported.ClientState, ) error { panic(errors.New("legacy solo machine is deprecated")) @@ -125,7 +125,7 @@ func (ClientState) CheckSubstituteAndUpdateState( // VerifyUpgradeAndUpdateState panics! func (ClientState) VerifyUpgradeAndUpdateState( - _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, + _ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientState, _ exported.ConsensusState, _, _ []byte, ) error { panic(errors.New("legacy solo machine is deprecated")) @@ -150,7 +150,7 @@ func (ClientState) VerifyClientConsensusState( // VerifyPacketCommitment panics! func (ClientState) VerifyPacketCommitment( - sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, + context.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, []byte, ) error { @@ -159,7 +159,7 @@ func (ClientState) VerifyPacketCommitment( // VerifyPacketAcknowledgement panics! func (ClientState) VerifyPacketAcknowledgement( - sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, + context.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, []byte, ) error { @@ -168,7 +168,7 @@ func (ClientState) VerifyPacketAcknowledgement( // VerifyPacketReceiptAbsence panics! func (ClientState) VerifyPacketReceiptAbsence( - sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, + context.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, ) error { @@ -177,7 +177,7 @@ func (ClientState) VerifyPacketReceiptAbsence( // VerifyNextSequenceRecv panics! func (ClientState) VerifyNextSequenceRecv( - sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, + context.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, ) error { @@ -186,14 +186,14 @@ func (ClientState) VerifyNextSequenceRecv( // GetTimestampAtHeight panics! func (ClientState) GetTimestampAtHeight( - sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, + context.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, ) (uint64, error) { panic(errors.New("legacy solo machine is deprecated")) } // VerifyMembership panics! func (*ClientState) VerifyMembership( - ctx sdk.Context, + ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height, @@ -208,7 +208,7 @@ func (*ClientState) VerifyMembership( // VerifyNonMembership panics! func (*ClientState) VerifyNonMembership( - ctx sdk.Context, + ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height, diff --git a/modules/core/02-client/migrations/v7/store.go b/modules/core/02-client/migrations/v7/store.go index a75de44cbed..2bfff6099de 100644 --- a/modules/core/02-client/migrations/v7/store.go +++ b/modules/core/02-client/migrations/v7/store.go @@ -3,11 +3,13 @@ package v7 import ( "strings" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" @@ -29,8 +31,8 @@ const Localhost string = "09-localhost" // - Pruning all solo machine consensus states // - Removing the localhost client // - Asserting existing tendermint clients are properly registered on the chain codec -func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, clientKeeper ClientKeeper) error { - store := ctx.KVStore(storeKey) +func MigrateStore(ctx sdk.Context, storeService corestore.KVStoreService, cdc codec.BinaryCodec, clientKeeper ClientKeeper) error { + store := runtime.KVStoreAdapter(storeService.OpenKVStore(ctx)) if err := handleSolomachineMigration(ctx, store, cdc, clientKeeper); err != nil { return err diff --git a/modules/core/02-client/migrations/v7/store_test.go b/modules/core/02-client/migrations/v7/store_test.go index 620da77107c..f9e104e823f 100644 --- a/modules/core/02-client/migrations/v7/store_test.go +++ b/modules/core/02-client/migrations/v7/store_test.go @@ -7,6 +7,7 @@ import ( testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/ibc-go/v9/modules/core/02-client/migrations/v7" "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" @@ -61,7 +62,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateStore() { suite.createSolomachineClients(solomachines) suite.createLocalhostClients() - err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := v7.MigrateStore(suite.chainA.GetContext(), runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) suite.assertSolomachineClients(solomachines) @@ -77,7 +78,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateStoreNoTendermintClients() { suite.createSolomachineClients(solomachines) suite.createLocalhostClients() - err := v7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := v7.MigrateStore(suite.chainA.GetContext(), runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) suite.assertSolomachineClients(solomachines) diff --git a/modules/core/02-client/types/height.go b/modules/core/02-client/types/height.go index a326142a685..c5d6839588a 100644 --- a/modules/core/02-client/types/height.go +++ b/modules/core/02-client/types/height.go @@ -1,6 +1,7 @@ package types import ( + "context" "fmt" "math/big" "regexp" @@ -185,7 +186,8 @@ func ParseChainID(chainID string) uint64 { // GetSelfHeight is a utility function that returns self height given context // Revision number is retrieved from ctx.ChainID() -func GetSelfHeight(ctx sdk.Context) Height { - revision := ParseChainID(ctx.ChainID()) - return NewHeight(revision, uint64(ctx.BlockHeight())) +func GetSelfHeight(ctx context.Context) Height { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + revision := ParseChainID(sdkCtx.ChainID()) + return NewHeight(revision, uint64(sdkCtx.BlockHeight())) } diff --git a/modules/core/02-client/types/router_test.go b/modules/core/02-client/types/router_test.go index 7b18319601c..095c7fb141e 100644 --- a/modules/core/02-client/types/router_test.go +++ b/modules/core/02-client/types/router_test.go @@ -6,6 +6,8 @@ import ( "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ibctm "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint" @@ -53,7 +55,7 @@ func (suite *TypesTestSuite) TestAddRoute() { suite.SetupTest() cdc := suite.chainA.App.AppCodec() - storeProvider := types.NewStoreProvider(suite.chainA.GetSimApp().GetKey(exported.StoreKey)) + storeProvider := types.NewStoreProvider(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(exported.StoreKey))) tmLightClientModule := ibctm.NewLightClientModule(cdc, storeProvider) router = types.NewRouter() @@ -110,7 +112,7 @@ func (suite *TypesTestSuite) TestHasGetRoute() { suite.SetupTest() cdc := suite.chainA.App.AppCodec() - storeProvider := types.NewStoreProvider(suite.chainA.GetSimApp().GetKey(exported.StoreKey)) + storeProvider := types.NewStoreProvider(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(exported.StoreKey))) tmLightClientModule := ibctm.NewLightClientModule(cdc, storeProvider) router := types.NewRouter() router.AddRoute(exported.Tendermint, &tmLightClientModule) diff --git a/modules/core/02-client/types/store.go b/modules/core/02-client/types/store.go index 446e6933d8a..416a75e3ec5 100644 --- a/modules/core/02-client/types/store.go +++ b/modules/core/02-client/types/store.go @@ -1,35 +1,37 @@ package types import ( + "context" "fmt" + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/runtime" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) -// StoreProvider encapsulates the IBC core store key and offers convenience methods for LightClientModules. +// StoreProvider encapsulates the IBC core store service and offers convenience methods for LightClientModules. type StoreProvider struct { - storeKey storetypes.StoreKey + storeService corestore.KVStoreService } // NewStoreProvider creates and returns a new client StoreProvider. -func NewStoreProvider(storeKey storetypes.StoreKey) StoreProvider { +func NewStoreProvider(storeService corestore.KVStoreService) StoreProvider { return StoreProvider{ - storeKey: storeKey, + storeService: storeService, } } // ClientStore returns isolated prefix store for each client so they can read/write in separate namespaces. -func (s StoreProvider) ClientStore(ctx sdk.Context, clientID string) storetypes.KVStore { +func (s StoreProvider) ClientStore(ctx context.Context, clientID string) storetypes.KVStore { clientPrefix := []byte(fmt.Sprintf("%s/%s/", host.KeyClientStorePrefix, clientID)) - return prefix.NewStore(ctx.KVStore(s.storeKey), clientPrefix) + return prefix.NewStore(runtime.KVStoreAdapter(s.storeService.OpenKVStore(ctx)), clientPrefix) } // ClientModuleStore returns the module store for a provided client type. -func (s StoreProvider) ClientModuleStore(ctx sdk.Context, clientType string) storetypes.KVStore { - return prefix.NewStore(ctx.KVStore(s.storeKey), host.PrefixedClientStoreKey([]byte(clientType))) +func (s StoreProvider) ClientModuleStore(ctx context.Context, clientType string) storetypes.KVStore { + return prefix.NewStore(runtime.KVStoreAdapter(s.storeService.OpenKVStore(ctx)), host.PrefixedClientStoreKey([]byte(clientType))) } diff --git a/modules/core/03-connection/genesis.go b/modules/core/03-connection/genesis.go index 91b6d5a9bdf..a7fbfb4e5d7 100644 --- a/modules/core/03-connection/genesis.go +++ b/modules/core/03-connection/genesis.go @@ -1,7 +1,7 @@ package connection import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/cosmos/ibc-go/v9/modules/core/03-connection/keeper" "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" @@ -9,7 +9,7 @@ import ( // InitGenesis initializes the ibc connection submodule's state from a provided genesis // state. -func InitGenesis(ctx sdk.Context, k *keeper.Keeper, gs types.GenesisState) { +func InitGenesis(ctx context.Context, k *keeper.Keeper, gs types.GenesisState) { for _, connection := range gs.Connections { conn := types.NewConnectionEnd(connection.State, connection.ClientId, connection.Counterparty, connection.Versions, connection.DelayPeriod) k.SetConnection(ctx, connection.Id, conn) @@ -24,7 +24,7 @@ func InitGenesis(ctx sdk.Context, k *keeper.Keeper, gs types.GenesisState) { } // ExportGenesis returns the ibc connection submodule's exported genesis. -func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) types.GenesisState { +func ExportGenesis(ctx context.Context, k *keeper.Keeper) types.GenesisState { return types.GenesisState{ Connections: k.GetAllConnections(ctx), ClientConnectionPaths: k.GetAllClientConnectionPaths(ctx), diff --git a/modules/core/03-connection/keeper/events.go b/modules/core/03-connection/keeper/events.go index 0e5cb03eade..04d0bb4851d 100644 --- a/modules/core/03-connection/keeper/events.go +++ b/modules/core/03-connection/keeper/events.go @@ -1,14 +1,17 @@ package keeper import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" ) // emitConnectionOpenInitEvent emits a connection open init event -func emitConnectionOpenInitEvent(ctx sdk.Context, connectionID string, clientID string, counterparty types.Counterparty) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitConnectionOpenInitEvent(ctx context.Context, connectionID string, clientID string, counterparty types.Counterparty) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeConnectionOpenInit, sdk.NewAttribute(types.AttributeKeyConnectionID, connectionID), @@ -23,8 +26,9 @@ func emitConnectionOpenInitEvent(ctx sdk.Context, connectionID string, clientID } // emitConnectionOpenTryEvent emits a connection open try event -func emitConnectionOpenTryEvent(ctx sdk.Context, connectionID string, clientID string, counterparty types.Counterparty) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitConnectionOpenTryEvent(ctx context.Context, connectionID string, clientID string, counterparty types.Counterparty) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeConnectionOpenTry, sdk.NewAttribute(types.AttributeKeyConnectionID, connectionID), @@ -40,8 +44,9 @@ func emitConnectionOpenTryEvent(ctx sdk.Context, connectionID string, clientID s } // emitConnectionOpenAckEvent emits a connection open acknowledge event -func emitConnectionOpenAckEvent(ctx sdk.Context, connectionID string, connectionEnd types.ConnectionEnd) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitConnectionOpenAckEvent(ctx context.Context, connectionID string, connectionEnd types.ConnectionEnd) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeConnectionOpenAck, sdk.NewAttribute(types.AttributeKeyConnectionID, connectionID), @@ -57,8 +62,9 @@ func emitConnectionOpenAckEvent(ctx sdk.Context, connectionID string, connection } // emitConnectionOpenConfirmEvent emits a connection open confirm event -func emitConnectionOpenConfirmEvent(ctx sdk.Context, connectionID string, connectionEnd types.ConnectionEnd) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitConnectionOpenConfirmEvent(ctx context.Context, connectionID string, connectionEnd types.ConnectionEnd) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeConnectionOpenConfirm, sdk.NewAttribute(types.AttributeKeyConnectionID, connectionID), diff --git a/modules/core/03-connection/keeper/grpc_query.go b/modules/core/03-connection/keeper/grpc_query.go index 960c1ea025c..859b6125332 100644 --- a/modules/core/03-connection/keeper/grpc_query.go +++ b/modules/core/03-connection/keeper/grpc_query.go @@ -9,6 +9,7 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" @@ -66,7 +67,8 @@ func (q *queryServer) Connections(c context.Context, req *types.QueryConnections ctx := sdk.UnwrapSDKContext(c) var connections []*types.IdentifiedConnection - store := prefix.NewStore(ctx.KVStore(q.storeKey), []byte(host.KeyConnectionPrefix)) + + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), []byte(host.KeyConnectionPrefix)) pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { var result types.ConnectionEnd diff --git a/modules/core/03-connection/keeper/handshake.go b/modules/core/03-connection/keeper/handshake.go index 1e646b787e3..0b52d58991a 100644 --- a/modules/core/03-connection/keeper/handshake.go +++ b/modules/core/03-connection/keeper/handshake.go @@ -1,10 +1,11 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/telemetry" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" @@ -18,7 +19,7 @@ import ( // NOTE: Msg validation verifies the supplied identifiers and ensures that the counterparty // connection identifier is empty. func (k *Keeper) ConnOpenInit( - ctx sdk.Context, + ctx context.Context, clientID string, counterparty types.Counterparty, // counterpartyPrefix, counterpartyClientIdentifier version *types.Version, @@ -62,7 +63,7 @@ func (k *Keeper) ConnOpenInit( // - Here chain A acts as the counterparty // - Identifiers are checked on msg validation func (k *Keeper) ConnOpenTry( - ctx sdk.Context, + ctx context.Context, counterparty types.Counterparty, // counterpartyConnectionIdentifier, counterpartyPrefix and counterpartyClientIdentifier delayPeriod uint64, clientID string, // clientID of chainA @@ -119,7 +120,7 @@ func (k *Keeper) ConnOpenTry( // // NOTE: Identifiers are checked on msg validation. func (k *Keeper) ConnOpenAck( - ctx sdk.Context, + ctx context.Context, connectionID string, version *types.Version, // version that ChainB chose in ConnOpenTry counterpartyConnectionID string, @@ -180,7 +181,7 @@ func (k *Keeper) ConnOpenAck( // // NOTE: Identifiers are checked on msg validation. func (k *Keeper) ConnOpenConfirm( - ctx sdk.Context, + ctx context.Context, connectionID string, ackProof []byte, // proof that connection opened on ChainA during ConnOpenAck proofHeight exported.Height, // height that relayer constructed proofAck diff --git a/modules/core/03-connection/keeper/keeper.go b/modules/core/03-connection/keeper/keeper.go index 2ce0c82aa69..72d9beb6d08 100644 --- a/modules/core/03-connection/keeper/keeper.go +++ b/modules/core/03-connection/keeper/keeper.go @@ -1,13 +1,16 @@ package keeper import ( + "context" "errors" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" @@ -22,16 +25,16 @@ type Keeper struct { // implements gRPC QueryServer interface types.QueryServer - storeKey storetypes.StoreKey + storeService corestore.KVStoreService legacySubspace types.ParamSubspace cdc codec.BinaryCodec clientKeeper types.ClientKeeper } // NewKeeper creates a new IBC connection Keeper instance -func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace types.ParamSubspace, ck types.ClientKeeper) *Keeper { +func NewKeeper(cdc codec.BinaryCodec, storeService corestore.KVStoreService, legacySubspace types.ParamSubspace, ck types.ClientKeeper) *Keeper { return &Keeper{ - storeKey: key, + storeService: storeService, cdc: cdc, legacySubspace: legacySubspace, clientKeeper: ck, @@ -39,18 +42,19 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace ty } // Logger returns a module-specific logger. -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } // GetCommitmentPrefix returns the IBC connection store prefix as a commitment // Prefix -func (k *Keeper) GetCommitmentPrefix() exported.Prefix { - return commitmenttypes.NewMerklePrefix([]byte(k.storeKey.Name())) +func (*Keeper) GetCommitmentPrefix() exported.Prefix { + return commitmenttypes.NewMerklePrefix([]byte(exported.StoreKey)) } // GenerateConnectionIdentifier returns the next connection identifier. -func (k *Keeper) GenerateConnectionIdentifier(ctx sdk.Context) string { +func (k *Keeper) GenerateConnectionIdentifier(ctx context.Context) string { nextConnSeq := k.GetNextConnectionSequence(ctx) connectionID := types.FormatConnectionIdentifier(nextConnSeq) @@ -60,9 +64,13 @@ func (k *Keeper) GenerateConnectionIdentifier(ctx sdk.Context) string { } // GetConnection returns a connection with a particular identifier -func (k *Keeper) GetConnection(ctx sdk.Context, connectionID string) (types.ConnectionEnd, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.ConnectionKey(connectionID)) +func (k *Keeper) GetConnection(ctx context.Context, connectionID string) (types.ConnectionEnd, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.ConnectionKey(connectionID)) + if err != nil { + panic(err) + } + if len(bz) == 0 { return types.ConnectionEnd{}, false } @@ -75,23 +83,33 @@ func (k *Keeper) GetConnection(ctx sdk.Context, connectionID string) (types.Conn // HasConnection returns a true if the connection with the given identifier // exists in the store. -func (k *Keeper) HasConnection(ctx sdk.Context, connectionID string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(host.ConnectionKey(connectionID)) +func (k *Keeper) HasConnection(ctx context.Context, connectionID string) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(host.ConnectionKey(connectionID)) + if err != nil { + return false + } + return has } // SetConnection sets a connection to the store -func (k *Keeper) SetConnection(ctx sdk.Context, connectionID string, connection types.ConnectionEnd) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetConnection(ctx context.Context, connectionID string, connection types.ConnectionEnd) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(&connection) - store.Set(host.ConnectionKey(connectionID), bz) + if err := store.Set(host.ConnectionKey(connectionID), bz); err != nil { + panic(err) + } } // GetClientConnectionPaths returns all the connection paths stored under a // particular client -func (k *Keeper) GetClientConnectionPaths(ctx sdk.Context, clientID string) ([]string, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.ClientConnectionsKey(clientID)) +func (k *Keeper) GetClientConnectionPaths(ctx context.Context, clientID string) ([]string, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.ClientConnectionsKey(clientID)) + if err != nil { + panic(err) + } + if len(bz) == 0 { return nil, false } @@ -102,17 +120,23 @@ func (k *Keeper) GetClientConnectionPaths(ctx sdk.Context, clientID string) ([]s } // SetClientConnectionPaths sets the connections paths for client -func (k *Keeper) SetClientConnectionPaths(ctx sdk.Context, clientID string, paths []string) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetClientConnectionPaths(ctx context.Context, clientID string, paths []string) { + store := k.storeService.OpenKVStore(ctx) clientPaths := types.ClientPaths{Paths: paths} bz := k.cdc.MustMarshal(&clientPaths) - store.Set(host.ClientConnectionsKey(clientID), bz) + if err := store.Set(host.ClientConnectionsKey(clientID), bz); err != nil { + panic(err) + } } // GetNextConnectionSequence gets the next connection sequence from the store. -func (k *Keeper) GetNextConnectionSequence(ctx sdk.Context) uint64 { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.KeyNextConnectionSequence)) +func (k *Keeper) GetNextConnectionSequence(ctx context.Context) uint64 { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.KeyNextConnectionSequence)) + if err != nil { + panic(err) + } + if len(bz) == 0 { panic(errors.New("next connection sequence is nil")) } @@ -121,18 +145,21 @@ func (k *Keeper) GetNextConnectionSequence(ctx sdk.Context) uint64 { } // SetNextConnectionSequence sets the next connection sequence to the store. -func (k *Keeper) SetNextConnectionSequence(ctx sdk.Context, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetNextConnectionSequence(ctx context.Context, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set([]byte(types.KeyNextConnectionSequence), bz) + if err := store.Set([]byte(types.KeyNextConnectionSequence), bz); err != nil { + panic(err) + } } // GetAllClientConnectionPaths returns all stored clients connection id paths. It // will ignore the clients that haven't initialized a connection handshake since // no paths are stored. -func (k *Keeper) GetAllClientConnectionPaths(ctx sdk.Context) []types.ConnectionPaths { +func (k *Keeper) GetAllClientConnectionPaths(ctx context.Context) []types.ConnectionPaths { var allConnectionPaths []types.ConnectionPaths - k.clientKeeper.IterateClientStates(ctx, nil, func(clientID string, cs exported.ClientState) bool { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + k.clientKeeper.IterateClientStates(sdkCtx, nil, func(clientID string, cs exported.ClientState) bool { paths, found := k.GetClientConnectionPaths(ctx, clientID) if !found { // continue when connection handshake is not initialized @@ -149,11 +176,12 @@ func (k *Keeper) GetAllClientConnectionPaths(ctx sdk.Context) []types.Connection // IterateConnections provides an iterator over all ConnectionEnd objects. // For each ConnectionEnd, cb will be called. If the cb returns true, the // iterator will close and stop. -func (k *Keeper) IterateConnections(ctx sdk.Context, cb func(types.IdentifiedConnection) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IterateConnections(ctx context.Context, cb func(types.IdentifiedConnection) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyConnectionPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var connection types.ConnectionEnd k.cdc.MustUnmarshal(iterator.Value(), &connection) @@ -167,7 +195,7 @@ func (k *Keeper) IterateConnections(ctx sdk.Context, cb func(types.IdentifiedCon } // GetAllConnections returns all stored ConnectionEnd objects. -func (k *Keeper) GetAllConnections(ctx sdk.Context) (connections []types.IdentifiedConnection) { +func (k *Keeper) GetAllConnections(ctx context.Context) (connections []types.IdentifiedConnection) { k.IterateConnections(ctx, func(connection types.IdentifiedConnection) bool { connections = append(connections, connection) return false @@ -176,7 +204,7 @@ func (k *Keeper) GetAllConnections(ctx sdk.Context) (connections []types.Identif } // CreateSentinelLocalhostConnection creates and sets the sentinel localhost connection end in the IBC store. -func (k *Keeper) CreateSentinelLocalhostConnection(ctx sdk.Context) { +func (k *Keeper) CreateSentinelLocalhostConnection(ctx context.Context) { counterparty := types.NewCounterparty(exported.LocalhostClientID, exported.LocalhostConnectionID, commitmenttypes.NewMerklePrefix(k.GetCommitmentPrefix().Bytes())) connectionEnd := types.NewConnectionEnd(types.OPEN, exported.LocalhostClientID, counterparty, types.GetCompatibleVersions(), 0) @@ -185,7 +213,7 @@ func (k *Keeper) CreateSentinelLocalhostConnection(ctx sdk.Context) { // addConnectionToClient is used to add a connection identifier to the set of // connections associated with a client. -func (k *Keeper) addConnectionToClient(ctx sdk.Context, clientID, connectionID string) error { +func (k *Keeper) addConnectionToClient(ctx context.Context, clientID, connectionID string) error { _, found := k.clientKeeper.GetClientState(ctx, clientID) if !found { return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID) @@ -202,9 +230,13 @@ func (k *Keeper) addConnectionToClient(ctx sdk.Context, clientID, connectionID s } // GetParams returns the total set of ibc-connection parameters. -func (k *Keeper) GetParams(ctx sdk.Context) types.Params { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.ParamsKey)) +func (k *Keeper) GetParams(ctx context.Context) types.Params { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.ParamsKey)) + if err != nil { + panic(err) + } + if bz == nil { // only panic on unset params and not on empty params panic(errors.New("connection params are not set in store")) } @@ -215,8 +247,10 @@ func (k *Keeper) GetParams(ctx sdk.Context) types.Params { } // SetParams sets the total set of ibc-connection parameters. -func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetParams(ctx context.Context, params types.Params) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(¶ms) - store.Set([]byte(types.ParamsKey), bz) + if err := store.Set([]byte(types.ParamsKey), bz); err != nil { + panic(err) + } } diff --git a/modules/core/03-connection/keeper/verify.go b/modules/core/03-connection/keeper/verify.go index c5c733511a3..1cdc8193d2e 100644 --- a/modules/core/03-connection/keeper/verify.go +++ b/modules/core/03-connection/keeper/verify.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "math" errorsmod "cosmossdk.io/errors" @@ -17,7 +18,7 @@ import ( // VerifyConnectionState verifies a proof of the connection state of the // specified connection end stored on the target machine. func (k *Keeper) VerifyConnectionState( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, height exported.Height, proof []byte, @@ -50,7 +51,7 @@ func (k *Keeper) VerifyConnectionState( // VerifyChannelState verifies a proof of the channel state of the specified // channel end, under the specified port, stored on the target machine. func (k *Keeper) VerifyChannelState( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, height exported.Height, proof []byte, @@ -84,7 +85,7 @@ func (k *Keeper) VerifyChannelState( // VerifyPacketCommitment verifies a proof of an outgoing packet commitment at // the specified port, specified channel, and specified sequence. func (k *Keeper) VerifyPacketCommitment( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, height exported.Height, proof []byte, @@ -116,7 +117,7 @@ func (k *Keeper) VerifyPacketCommitment( // VerifyPacketAcknowledgement verifies a proof of an incoming packet // acknowledgement at the specified port, specified channel, and specified sequence. func (k *Keeper) VerifyPacketAcknowledgement( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, height exported.Height, proof []byte, @@ -150,7 +151,7 @@ func (k *Keeper) VerifyPacketAcknowledgement( // incoming packet receipt at the specified port, specified channel, and // specified sequence. func (k *Keeper) VerifyPacketReceiptAbsence( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, height exported.Height, proof []byte, @@ -181,7 +182,7 @@ func (k *Keeper) VerifyPacketReceiptAbsence( // VerifyNextSequenceRecv verifies a proof of the next sequence number to be // received of the specified channel at the specified port. func (k *Keeper) VerifyNextSequenceRecv( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, height exported.Height, proof []byte, @@ -213,7 +214,7 @@ func (k *Keeper) VerifyNextSequenceRecv( // VerifyChannelUpgradeError verifies a proof of the provided upgrade error receipt. func (k *Keeper) VerifyChannelUpgradeError( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, height exported.Height, proof []byte, @@ -246,7 +247,7 @@ func (k *Keeper) VerifyChannelUpgradeError( // VerifyChannelUpgrade verifies the proof that a particular proposed upgrade has been stored in the upgrade path. func (k *Keeper) VerifyChannelUpgrade( - ctx sdk.Context, + ctx context.Context, connection types.ConnectionEnd, proofHeight exported.Height, upgradeProof []byte, @@ -279,7 +280,7 @@ func (k *Keeper) VerifyChannelUpgrade( // getBlockDelay calculates the block delay period from the time delay of the connection // and the maximum expected time per block. -func (k *Keeper) getBlockDelay(ctx sdk.Context, connection types.ConnectionEnd) uint64 { +func (k *Keeper) getBlockDelay(ctx context.Context, connection types.ConnectionEnd) uint64 { // expectedTimePerBlock should never be zero, however if it is then return a 0 block delay for safety // as the expectedTimePerBlock parameter was not set. expectedTimePerBlock := k.GetParams(ctx).MaxExpectedTimePerBlock diff --git a/modules/core/03-connection/migrations/v7/expected_keepers.go b/modules/core/03-connection/migrations/v7/expected_keepers.go index 8427e2cc2bf..c36d1fbae93 100644 --- a/modules/core/03-connection/migrations/v7/expected_keepers.go +++ b/modules/core/03-connection/migrations/v7/expected_keepers.go @@ -1,10 +1,8 @@ package v7 -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) +import "context" // ConnectionKeeper expected IBC connection keeper type ConnectionKeeper interface { - CreateSentinelLocalhostConnection(ctx sdk.Context) + CreateSentinelLocalhostConnection(ctx context.Context) } diff --git a/modules/core/03-connection/migrations/v7/localhost.go b/modules/core/03-connection/migrations/v7/localhost.go index 76f768402de..6c85a1f837d 100644 --- a/modules/core/03-connection/migrations/v7/localhost.go +++ b/modules/core/03-connection/migrations/v7/localhost.go @@ -1,11 +1,9 @@ package v7 -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) +import "context" // MigrateLocalhostConnection creates the sentinel localhost connection end to enable // localhost ibc functionality. -func MigrateLocalhostConnection(ctx sdk.Context, connectionKeeper ConnectionKeeper) { +func MigrateLocalhostConnection(ctx context.Context, connectionKeeper ConnectionKeeper) { connectionKeeper.CreateSentinelLocalhostConnection(ctx) } diff --git a/modules/core/03-connection/types/expected_keepers.go b/modules/core/03-connection/types/expected_keepers.go index ff13cf0d742..81430da3242 100644 --- a/modules/core/03-connection/types/expected_keepers.go +++ b/modules/core/03-connection/types/expected_keepers.go @@ -1,6 +1,8 @@ package types import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -9,12 +11,12 @@ import ( // ClientKeeper expected account IBC client keeper type ClientKeeper interface { - GetClientStatus(ctx sdk.Context, clientID string) exported.Status - GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) - GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) - VerifyMembership(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error - VerifyNonMembership(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path) error - IterateClientStates(ctx sdk.Context, prefix []byte, cb func(string, exported.ClientState) bool) + GetClientStatus(ctx context.Context, clientID string) exported.Status + GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) + GetClientConsensusState(ctx context.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) + VerifyMembership(ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error + VerifyNonMembership(ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path) error + IterateClientStates(ctx context.Context, prefix []byte, cb func(string, exported.ClientState) bool) } // ParamSubspace defines the expected Subspace interface for module parameters. diff --git a/modules/core/04-channel/genesis.go b/modules/core/04-channel/genesis.go index 905b66bdd6f..416d5cacfd6 100644 --- a/modules/core/04-channel/genesis.go +++ b/modules/core/04-channel/genesis.go @@ -1,17 +1,16 @@ package channel import ( + "context" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) // InitGenesis initializes the ibc channel submodule's state from a provided genesis // state. -func InitGenesis(ctx sdk.Context, k *keeper.Keeper, gs types.GenesisState) { +func InitGenesis(ctx context.Context, k *keeper.Keeper, gs types.GenesisState) { if err := gs.Params.Validate(); err != nil { panic(fmt.Sprintf("invalid ibc channel genesis state parameters: %v", err)) } @@ -42,7 +41,7 @@ func InitGenesis(ctx sdk.Context, k *keeper.Keeper, gs types.GenesisState) { } // ExportGenesis returns the ibc channel submodule's exported genesis. -func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) types.GenesisState { +func ExportGenesis(ctx context.Context, k *keeper.Keeper) types.GenesisState { return types.GenesisState{ Channels: k.GetAllChannels(ctx), Acknowledgements: k.GetAllPacketAcks(ctx), diff --git a/modules/core/04-channel/keeper/events.go b/modules/core/04-channel/keeper/events.go index 89aa79a652c..0cb410a924c 100644 --- a/modules/core/04-channel/keeper/events.go +++ b/modules/core/04-channel/keeper/events.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "encoding/hex" "fmt" @@ -11,8 +12,9 @@ import ( ) // emitChannelOpenInitEvent emits a channel open init event -func emitChannelOpenInitEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelOpenInitEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelOpenInit, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -29,8 +31,9 @@ func emitChannelOpenInitEvent(ctx sdk.Context, portID string, channelID string, } // emitChannelOpenTryEvent emits a channel open try event -func emitChannelOpenTryEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelOpenTryEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelOpenTry, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -48,8 +51,9 @@ func emitChannelOpenTryEvent(ctx sdk.Context, portID string, channelID string, c } // emitChannelOpenAckEvent emits a channel open acknowledge event -func emitChannelOpenAckEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelOpenAckEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelOpenAck, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -66,8 +70,9 @@ func emitChannelOpenAckEvent(ctx sdk.Context, portID string, channelID string, c } // emitChannelOpenConfirmEvent emits a channel open confirm event -func emitChannelOpenConfirmEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelOpenConfirmEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelOpenConfirm, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -84,8 +89,9 @@ func emitChannelOpenConfirmEvent(ctx sdk.Context, portID string, channelID strin } // emitChannelCloseInitEvent emits a channel close init event -func emitChannelCloseInitEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelCloseInitEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelCloseInit, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -102,8 +108,9 @@ func emitChannelCloseInitEvent(ctx sdk.Context, portID string, channelID string, } // emitChannelCloseConfirmEvent emits a channel close confirm event -func emitChannelCloseConfirmEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelCloseConfirmEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelCloseConfirm, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -121,7 +128,8 @@ func emitChannelCloseConfirmEvent(ctx sdk.Context, portID string, channelID stri // emitSendPacketEvent emits an event with packet data along with other packet information for relayer // to pick up and relay to other chain -func EmitSendPacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Channel, timeoutHeight exported.Height) { +func EmitSendPacketEvent(ctx context.Context, packet types.Packet, channel *types.Channel, timeoutHeight exported.Height) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 eventAttributes := []sdk.Attribute{ sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, timeoutHeight.String()), @@ -143,7 +151,7 @@ func EmitSendPacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Ch ) } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSendPacket, eventAttributes..., @@ -157,7 +165,8 @@ func EmitSendPacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Ch // EmitRecvPacketEvent emits a receive packet event. It will be emitted both the first time a packet // is received for a certain sequence and for all duplicate receives. -func EmitRecvPacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Channel) { +func EmitRecvPacketEvent(ctx context.Context, packet types.Packet, channel *types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 eventAttributes := []sdk.Attribute{ sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), @@ -179,7 +188,7 @@ func EmitRecvPacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Ch ) } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeRecvPacket, eventAttributes..., @@ -192,7 +201,8 @@ func EmitRecvPacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Ch } // EmitWriteAcknowledgementEvent emits an event that the relayer can query for -func EmitWriteAcknowledgementEvent(ctx sdk.Context, packet types.Packet, channel *types.Channel, acknowledgement []byte) { +func EmitWriteAcknowledgementEvent(ctx context.Context, packet types.Packet, channel *types.Channel, acknowledgement []byte) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 eventAttributes := []sdk.Attribute{ sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), @@ -215,7 +225,7 @@ func EmitWriteAcknowledgementEvent(ctx sdk.Context, packet types.Packet, channel ) } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeWriteAck, eventAttributes..., @@ -229,7 +239,8 @@ func EmitWriteAcknowledgementEvent(ctx sdk.Context, packet types.Packet, channel // EmitAcknowledgePacketEvent emits an acknowledge packet event. It will be emitted both the first time // a packet is acknowledged for a certain sequence and for all duplicate acknowledgements. -func EmitAcknowledgePacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Channel) { +func EmitAcknowledgePacketEvent(ctx context.Context, packet types.Packet, channel *types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 eventAttributes := []sdk.Attribute{ sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -250,7 +261,7 @@ func EmitAcknowledgePacketEvent(ctx sdk.Context, packet types.Packet, channel *t ) } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeAcknowledgePacket, eventAttributes..., @@ -264,7 +275,8 @@ func EmitAcknowledgePacketEvent(ctx sdk.Context, packet types.Packet, channel *t // emitTimeoutPacketEvent emits a timeout packet event. It will be emitted both the first time a packet // is timed out for a certain sequence and for all duplicate timeouts. -func EmitTimeoutPacketEvent(ctx sdk.Context, packet types.Packet, channel *types.Channel) { +func EmitTimeoutPacketEvent(ctx context.Context, packet types.Packet, channel *types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 eventAttributes := []sdk.Attribute{ sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -281,7 +293,7 @@ func EmitTimeoutPacketEvent(ctx sdk.Context, packet types.Packet, channel *types sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()), ) } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeTimeoutPacket, eventAttributes..., @@ -294,8 +306,9 @@ func EmitTimeoutPacketEvent(ctx sdk.Context, packet types.Packet, channel *types } // emitChannelClosedEvent emits a channel closed event. -func emitChannelClosedEvent(ctx sdk.Context, packet types.Packet, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelClosedEvent(ctx context.Context, packet types.Packet, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelClosed, sdk.NewAttribute(types.AttributeKeyPortID, packet.GetSourcePort()), @@ -313,8 +326,9 @@ func emitChannelClosedEvent(ctx sdk.Context, packet types.Packet, channel types. } // EmitChannelUpgradeInitEvent emits a channel upgrade init event -func EmitChannelUpgradeInitEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitChannelUpgradeInitEvent(ctx context.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeInit, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -331,8 +345,9 @@ func EmitChannelUpgradeInitEvent(ctx sdk.Context, portID string, channelID strin } // EmitChannelUpgradeTryEvent emits a channel upgrade try event -func EmitChannelUpgradeTryEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitChannelUpgradeTryEvent(ctx context.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeTry, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -349,8 +364,9 @@ func EmitChannelUpgradeTryEvent(ctx sdk.Context, portID string, channelID string } // EmitChannelUpgradeAckEvent emits a channel upgrade ack event -func EmitChannelUpgradeAckEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitChannelUpgradeAckEvent(ctx context.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeAck, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -367,8 +383,9 @@ func EmitChannelUpgradeAckEvent(ctx sdk.Context, portID string, channelID string } // EmitChannelUpgradeConfirmEvent emits a channel upgrade confirm event -func EmitChannelUpgradeConfirmEvent(ctx sdk.Context, portID, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitChannelUpgradeConfirmEvent(ctx context.Context, portID, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeConfirm, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -386,8 +403,9 @@ func EmitChannelUpgradeConfirmEvent(ctx sdk.Context, portID, channelID string, c } // EmitChannelUpgradeOpenEvent emits a channel upgrade open event -func EmitChannelUpgradeOpenEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitChannelUpgradeOpenEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeOpen, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -405,8 +423,9 @@ func EmitChannelUpgradeOpenEvent(ctx sdk.Context, portID string, channelID strin } // EmitChannelUpgradeTimeoutEvent emits an upgrade timeout event. -func EmitChannelUpgradeTimeoutEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitChannelUpgradeTimeoutEvent(ctx context.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeTimeout, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -425,8 +444,9 @@ func EmitChannelUpgradeTimeoutEvent(ctx sdk.Context, portID string, channelID st } // EmitErrorReceiptEvent emits an error receipt event -func EmitErrorReceiptEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel, err error) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitErrorReceiptEvent(ctx context.Context, portID string, channelID string, channel types.Channel, err error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeError, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -444,8 +464,9 @@ func EmitErrorReceiptEvent(ctx sdk.Context, portID string, channelID string, cha } // EmitChannelUpgradeCancelEvent emits an upgraded cancelled event. -func EmitChannelUpgradeCancelEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { - ctx.EventManager().EmitEvents(sdk.Events{ +func EmitChannelUpgradeCancelEvent(ctx context.Context, portID string, channelID string, channel types.Channel, upgrade types.Upgrade) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelUpgradeCancel, sdk.NewAttribute(types.AttributeKeyPortID, portID), @@ -462,8 +483,9 @@ func EmitChannelUpgradeCancelEvent(ctx sdk.Context, portID string, channelID str } // emitChannelFlushCompleteEvent emits an flushing event. -func emitChannelFlushCompleteEvent(ctx sdk.Context, portID string, channelID string, channel types.Channel) { - ctx.EventManager().EmitEvents(sdk.Events{ +func emitChannelFlushCompleteEvent(ctx context.Context, portID string, channelID string, channel types.Channel) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeChannelFlushComplete, sdk.NewAttribute(types.AttributeKeyPortID, portID), diff --git a/modules/core/04-channel/keeper/export_test.go b/modules/core/04-channel/keeper/export_test.go index b28e1db97d5..fce2e6487b4 100644 --- a/modules/core/04-channel/keeper/export_test.go +++ b/modules/core/04-channel/keeper/export_test.go @@ -7,7 +7,6 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) @@ -37,6 +36,6 @@ func (k *Keeper) SetRecvStartSequence(ctx sdk.Context, portID, channelID string, } // TimeoutExecuted is a wrapper around timeoutExecuted to allow the function to be directly called in tests. -func (k *Keeper) TimeoutExecuted(ctx sdk.Context, channel types.Channel, capability *capabilitytypes.Capability, packet types.Packet) error { - return k.timeoutExecuted(ctx, channel, capability, packet) +func (k *Keeper) TimeoutExecuted(ctx sdk.Context, channel types.Channel, packet types.Packet) error { + return k.timeoutExecuted(ctx, channel, packet) } diff --git a/modules/core/04-channel/keeper/grpc_query.go b/modules/core/04-channel/keeper/grpc_query.go index 3d03f8f9088..648a8028534 100644 --- a/modules/core/04-channel/keeper/grpc_query.go +++ b/modules/core/04-channel/keeper/grpc_query.go @@ -11,7 +11,7 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/ibc-go/v9/internal/validate" @@ -37,7 +37,7 @@ func NewQueryServer(k *Keeper) types.QueryServer { } // Channel implements the Query/Channel gRPC method -func (q *queryServer) Channel(c context.Context, req *types.QueryChannelRequest) (*types.QueryChannelResponse, error) { +func (q *queryServer) Channel(ctx context.Context, req *types.QueryChannelRequest) (*types.QueryChannelResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -46,7 +46,6 @@ func (q *queryServer) Channel(c context.Context, req *types.QueryChannelRequest) return nil, err } - ctx := sdk.UnwrapSDKContext(c) channel, found := q.GetChannel(ctx, req.PortId, req.ChannelId) if !found { return nil, status.Error( @@ -60,15 +59,13 @@ func (q *queryServer) Channel(c context.Context, req *types.QueryChannelRequest) } // Channels implements the Query/Channels gRPC method -func (q *queryServer) Channels(c context.Context, req *types.QueryChannelsRequest) (*types.QueryChannelsResponse, error) { +func (q *queryServer) Channels(ctx context.Context, req *types.QueryChannelsRequest) (*types.QueryChannelsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - ctx := sdk.UnwrapSDKContext(c) - var channels []*types.IdentifiedChannel - store := prefix.NewStore(ctx.KVStore(q.storeKey), []byte(host.KeyChannelEndPrefix)) + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), []byte(host.KeyChannelEndPrefix)) pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { var result types.Channel @@ -98,7 +95,7 @@ func (q *queryServer) Channels(c context.Context, req *types.QueryChannelsReques } // ConnectionChannels implements the Query/ConnectionChannels gRPC method -func (q *queryServer) ConnectionChannels(c context.Context, req *types.QueryConnectionChannelsRequest) (*types.QueryConnectionChannelsResponse, error) { +func (q *queryServer) ConnectionChannels(ctx context.Context, req *types.QueryConnectionChannelsRequest) (*types.QueryConnectionChannelsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -107,10 +104,9 @@ func (q *queryServer) ConnectionChannels(c context.Context, req *types.QueryConn return nil, status.Error(codes.InvalidArgument, err.Error()) } - ctx := sdk.UnwrapSDKContext(c) - var channels []*types.IdentifiedChannel - store := prefix.NewStore(ctx.KVStore(q.storeKey), []byte(host.KeyChannelEndPrefix)) + + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), []byte(host.KeyChannelEndPrefix)) pageRes, err := query.FilteredPaginate(store, req.Pagination, func(key, value []byte, accumulate bool) (bool, error) { // filter any metadata stored under channel key @@ -147,7 +143,7 @@ func (q *queryServer) ConnectionChannels(c context.Context, req *types.QueryConn } // ChannelClientState implements the Query/ChannelClientState gRPC method -func (q *queryServer) ChannelClientState(c context.Context, req *types.QueryChannelClientStateRequest) (*types.QueryChannelClientStateResponse, error) { +func (q *queryServer) ChannelClientState(ctx context.Context, req *types.QueryChannelClientStateRequest) (*types.QueryChannelClientStateResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -156,8 +152,6 @@ func (q *queryServer) ChannelClientState(c context.Context, req *types.QueryChan return nil, err } - ctx := sdk.UnwrapSDKContext(c) - clientID, clientState, err := q.GetChannelClientState(ctx, req.PortId, req.ChannelId) if err != nil { return nil, status.Error(codes.NotFound, err.Error()) @@ -170,7 +164,7 @@ func (q *queryServer) ChannelClientState(c context.Context, req *types.QueryChan } // ChannelConsensusState implements the Query/ChannelConsensusState gRPC method -func (q *queryServer) ChannelConsensusState(c context.Context, req *types.QueryChannelConsensusStateRequest) (*types.QueryChannelConsensusStateResponse, error) { +func (q *queryServer) ChannelConsensusState(ctx context.Context, req *types.QueryChannelConsensusStateRequest) (*types.QueryChannelConsensusStateResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -179,8 +173,6 @@ func (q *queryServer) ChannelConsensusState(c context.Context, req *types.QueryC return nil, err } - ctx := sdk.UnwrapSDKContext(c) - channel, found := q.GetChannel(ctx, req.PortId, req.ChannelId) if !found { return nil, status.Error( @@ -216,7 +208,7 @@ func (q *queryServer) ChannelConsensusState(c context.Context, req *types.QueryC } // PacketCommitment implements the Query/PacketCommitment gRPC method -func (q *queryServer) PacketCommitment(c context.Context, req *types.QueryPacketCommitmentRequest) (*types.QueryPacketCommitmentResponse, error) { +func (q *queryServer) PacketCommitment(ctx context.Context, req *types.QueryPacketCommitmentRequest) (*types.QueryPacketCommitmentResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -229,8 +221,6 @@ func (q *queryServer) PacketCommitment(c context.Context, req *types.QueryPacket return nil, status.Error(codes.InvalidArgument, "packet sequence cannot be 0") } - ctx := sdk.UnwrapSDKContext(c) - if !q.HasChannel(ctx, req.PortId, req.ChannelId) { return nil, status.Error( codes.NotFound, @@ -248,7 +238,7 @@ func (q *queryServer) PacketCommitment(c context.Context, req *types.QueryPacket } // PacketCommitments implements the Query/PacketCommitments gRPC method -func (q *queryServer) PacketCommitments(c context.Context, req *types.QueryPacketCommitmentsRequest) (*types.QueryPacketCommitmentsResponse, error) { +func (q *queryServer) PacketCommitments(ctx context.Context, req *types.QueryPacketCommitmentsRequest) (*types.QueryPacketCommitmentsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -257,8 +247,6 @@ func (q *queryServer) PacketCommitments(c context.Context, req *types.QueryPacke return nil, err } - ctx := sdk.UnwrapSDKContext(c) - if !q.HasChannel(ctx, req.PortId, req.ChannelId) { return nil, status.Error( codes.NotFound, @@ -266,7 +254,7 @@ func (q *queryServer) PacketCommitments(c context.Context, req *types.QueryPacke ) } var commitments []*types.PacketState - store := prefix.NewStore(ctx.KVStore(q.storeKey), host.PacketCommitmentPrefixKey(req.PortId, req.ChannelId)) + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.PacketCommitmentPrefixKey(req.PortId, req.ChannelId)) pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { keySplit := strings.Split(string(key), "/") @@ -293,7 +281,7 @@ func (q *queryServer) PacketCommitments(c context.Context, req *types.QueryPacke } // PacketReceipt implements the Query/PacketReceipt gRPC method -func (q *queryServer) PacketReceipt(c context.Context, req *types.QueryPacketReceiptRequest) (*types.QueryPacketReceiptResponse, error) { +func (q *queryServer) PacketReceipt(ctx context.Context, req *types.QueryPacketReceiptRequest) (*types.QueryPacketReceiptResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -306,8 +294,6 @@ func (q *queryServer) PacketReceipt(c context.Context, req *types.QueryPacketRec return nil, status.Error(codes.InvalidArgument, "packet sequence cannot be 0") } - ctx := sdk.UnwrapSDKContext(c) - if !q.HasChannel(ctx, req.PortId, req.ChannelId) { return nil, status.Error( codes.NotFound, @@ -321,7 +307,7 @@ func (q *queryServer) PacketReceipt(c context.Context, req *types.QueryPacketRec } // PacketAcknowledgement implements the Query/PacketAcknowledgement gRPC method -func (q *queryServer) PacketAcknowledgement(c context.Context, req *types.QueryPacketAcknowledgementRequest) (*types.QueryPacketAcknowledgementResponse, error) { +func (q *queryServer) PacketAcknowledgement(ctx context.Context, req *types.QueryPacketAcknowledgementRequest) (*types.QueryPacketAcknowledgementResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -334,8 +320,6 @@ func (q *queryServer) PacketAcknowledgement(c context.Context, req *types.QueryP return nil, status.Error(codes.InvalidArgument, "packet sequence cannot be 0") } - ctx := sdk.UnwrapSDKContext(c) - if !q.HasChannel(ctx, req.PortId, req.ChannelId) { return nil, status.Error( codes.NotFound, @@ -352,7 +336,7 @@ func (q *queryServer) PacketAcknowledgement(c context.Context, req *types.QueryP } // PacketAcknowledgements implements the Query/PacketAcknowledgements gRPC method -func (q *queryServer) PacketAcknowledgements(c context.Context, req *types.QueryPacketAcknowledgementsRequest) (*types.QueryPacketAcknowledgementsResponse, error) { +func (q *queryServer) PacketAcknowledgements(ctx context.Context, req *types.QueryPacketAcknowledgementsRequest) (*types.QueryPacketAcknowledgementsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -361,8 +345,6 @@ func (q *queryServer) PacketAcknowledgements(c context.Context, req *types.Query return nil, err } - ctx := sdk.UnwrapSDKContext(c) - if !q.HasChannel(ctx, req.PortId, req.ChannelId) { return nil, status.Error( codes.NotFound, @@ -370,7 +352,7 @@ func (q *queryServer) PacketAcknowledgements(c context.Context, req *types.Query ) } var acks []*types.PacketState - store := prefix.NewStore(ctx.KVStore(q.storeKey), host.PacketAcknowledgementPrefixKey(req.PortId, req.ChannelId)) + store := prefix.NewStore(runtime.KVStoreAdapter(q.storeService.OpenKVStore(ctx)), host.PacketAcknowledgementPrefixKey(req.PortId, req.ChannelId)) // if a list of packet sequences is provided then query for each specific ack and return a list <= len(req.PacketCommitmentSequences) // otherwise, maintain previous behaviour and perform paginated query @@ -434,7 +416,7 @@ func (q *queryServer) PacketAcknowledgements(c context.Context, req *types.Query // commitments is correct and will not function properly if the list // is not up to date. Ideally the query height should equal the latest height // on the counterparty's client which represents this chain. -func (q *queryServer) UnreceivedPackets(c context.Context, req *types.QueryUnreceivedPacketsRequest) (*types.QueryUnreceivedPacketsResponse, error) { +func (q *queryServer) UnreceivedPackets(ctx context.Context, req *types.QueryUnreceivedPacketsRequest) (*types.QueryUnreceivedPacketsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -443,8 +425,6 @@ func (q *queryServer) UnreceivedPackets(c context.Context, req *types.QueryUnrec return nil, err } - ctx := sdk.UnwrapSDKContext(c) - channel, found := q.GetChannel(ctx, req.PortId, req.ChannelId) if !found { return nil, status.Error( @@ -520,7 +500,7 @@ func (q *queryServer) UnreceivedPackets(c context.Context, req *types.QueryUnrec // acknowledgements is correct and will not function properly if the list // is not up to date. Ideally the query height should equal the latest height // on the counterparty's client which represents this chain. -func (q *queryServer) UnreceivedAcks(c context.Context, req *types.QueryUnreceivedAcksRequest) (*types.QueryUnreceivedAcksResponse, error) { +func (q *queryServer) UnreceivedAcks(ctx context.Context, req *types.QueryUnreceivedAcksRequest) (*types.QueryUnreceivedAcksResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -529,8 +509,6 @@ func (q *queryServer) UnreceivedAcks(c context.Context, req *types.QueryUnreceiv return nil, err } - ctx := sdk.UnwrapSDKContext(c) - if !q.HasChannel(ctx, req.PortId, req.ChannelId) { return nil, status.Error( codes.NotFound, @@ -560,7 +538,7 @@ func (q *queryServer) UnreceivedAcks(c context.Context, req *types.QueryUnreceiv } // NextSequenceReceive implements the Query/NextSequenceReceive gRPC method -func (q *queryServer) NextSequenceReceive(c context.Context, req *types.QueryNextSequenceReceiveRequest) (*types.QueryNextSequenceReceiveResponse, error) { +func (q *queryServer) NextSequenceReceive(ctx context.Context, req *types.QueryNextSequenceReceiveRequest) (*types.QueryNextSequenceReceiveResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -569,7 +547,6 @@ func (q *queryServer) NextSequenceReceive(c context.Context, req *types.QueryNex return nil, err } - ctx := sdk.UnwrapSDKContext(c) channel, found := q.GetChannel(ctx, req.PortId, req.ChannelId) if !found { return nil, status.Error( @@ -595,7 +572,7 @@ func (q *queryServer) NextSequenceReceive(c context.Context, req *types.QueryNex } // NextSequenceSend implements the Query/NextSequenceSend gRPC method -func (q *queryServer) NextSequenceSend(c context.Context, req *types.QueryNextSequenceSendRequest) (*types.QueryNextSequenceSendResponse, error) { +func (q *queryServer) NextSequenceSend(ctx context.Context, req *types.QueryNextSequenceSendRequest) (*types.QueryNextSequenceSendResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -604,8 +581,6 @@ func (q *queryServer) NextSequenceSend(c context.Context, req *types.QueryNextSe return nil, err } - ctx := sdk.UnwrapSDKContext(c) - sequence, found := q.GetNextSequenceSend(ctx, req.PortId, req.ChannelId) if !found { return nil, status.Error( @@ -618,7 +593,7 @@ func (q *queryServer) NextSequenceSend(c context.Context, req *types.QueryNextSe } // UpgradeErrorReceipt implements the Query/UpgradeErrorReceipt gRPC method -func (q *queryServer) UpgradeError(c context.Context, req *types.QueryUpgradeErrorRequest) (*types.QueryUpgradeErrorResponse, error) { +func (q *queryServer) UpgradeError(ctx context.Context, req *types.QueryUpgradeErrorRequest) (*types.QueryUpgradeErrorResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -627,7 +602,6 @@ func (q *queryServer) UpgradeError(c context.Context, req *types.QueryUpgradeErr return nil, err } - ctx := sdk.UnwrapSDKContext(c) found := q.HasChannel(ctx, req.PortId, req.ChannelId) if !found { return nil, status.Error( @@ -649,7 +623,7 @@ func (q *queryServer) UpgradeError(c context.Context, req *types.QueryUpgradeErr } // Upgrade implements the Query/UpgradeSequence gRPC method -func (q *queryServer) Upgrade(c context.Context, req *types.QueryUpgradeRequest) (*types.QueryUpgradeResponse, error) { +func (q *queryServer) Upgrade(ctx context.Context, req *types.QueryUpgradeRequest) (*types.QueryUpgradeResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -658,7 +632,6 @@ func (q *queryServer) Upgrade(c context.Context, req *types.QueryUpgradeRequest) return nil, err } - ctx := sdk.UnwrapSDKContext(c) found := q.HasChannel(ctx, req.PortId, req.ChannelId) if !found { return nil, status.Error( @@ -680,8 +653,7 @@ func (q *queryServer) Upgrade(c context.Context, req *types.QueryUpgradeRequest) } // ChannelParams implements the Query/ChannelParams gRPC method. -func (q *queryServer) ChannelParams(c context.Context, req *types.QueryChannelParamsRequest) (*types.QueryChannelParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) +func (q *queryServer) ChannelParams(ctx context.Context, req *types.QueryChannelParamsRequest) (*types.QueryChannelParamsResponse, error) { params := q.GetParams(ctx) return &types.QueryChannelParamsResponse{ diff --git a/modules/core/04-channel/keeper/handshake.go b/modules/core/04-channel/keeper/handshake.go index 0105fb211b5..635b178e067 100644 --- a/modules/core/04-channel/keeper/handshake.go +++ b/modules/core/04-channel/keeper/handshake.go @@ -1,19 +1,16 @@ package keeper import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/telemetry" - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -21,23 +18,22 @@ import ( // a module on another chain. The counterparty channel identifier is validated to be // empty in msg validation. func (k *Keeper) ChanOpenInit( - ctx sdk.Context, + ctx context.Context, order types.Order, connectionHops []string, portID string, - portCap *capabilitytypes.Capability, counterparty types.Counterparty, version string, -) (string, *capabilitytypes.Capability, error) { +) (string, error) { // connection hop length checked on msg.ValidateBasic() connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0]) if !found { - return "", nil, errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0]) + return "", errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0]) } getVersions := connectionEnd.Versions if len(getVersions) != 1 { - return "", nil, errorsmod.Wrapf( + return "", errorsmod.Wrapf( connectiontypes.ErrInvalidVersion, "single version must be negotiated on connection before opening channel, got: %v", getVersions, @@ -45,7 +41,7 @@ func (k *Keeper) ChanOpenInit( } if !connectiontypes.VerifySupportedFeature(getVersions[0], order.String()) { - return "", nil, errorsmod.Wrapf( + return "", errorsmod.Wrapf( connectiontypes.ErrInvalidVersion, "connection version %s does not support channel ordering: %s", getVersions[0], order.String(), @@ -53,28 +49,19 @@ func (k *Keeper) ChanOpenInit( } if status := k.clientKeeper.GetClientStatus(ctx, connectionEnd.ClientId); status != exported.Active { - return "", nil, errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", connectionEnd.ClientId, status) - } - - if !k.portKeeper.Authenticate(ctx, portCap, portID) { - return "", nil, errorsmod.Wrapf(porttypes.ErrInvalidPort, "caller does not own port capability for port ID %s", portID) + return "", errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", connectionEnd.ClientId, status) } channelID := k.GenerateChannelIdentifier(ctx) - capKey, err := k.scopedKeeper.NewCapability(ctx, host.ChannelCapabilityPath(portID, channelID)) - if err != nil { - return "", nil, errorsmod.Wrapf(err, "could not create channel capability for port ID %s and channel ID %s", portID, channelID) - } - - return channelID, capKey, nil + return channelID, nil } // WriteOpenInitChannel writes a channel which has successfully passed the OpenInit handshake step. // The channel is set in state and all the associated Send and Recv sequences are set to 1. // An event is emitted for the handshake step. func (k *Keeper) WriteOpenInitChannel( - ctx sdk.Context, + ctx context.Context, portID, channelID string, order types.Order, @@ -99,40 +86,35 @@ func (k *Keeper) WriteOpenInitChannel( // ChanOpenTry is called by a module to accept the first step of a channel opening // handshake initiated by a module on another chain. func (k *Keeper) ChanOpenTry( - ctx sdk.Context, + ctx context.Context, order types.Order, connectionHops []string, portID string, - portCap *capabilitytypes.Capability, counterparty types.Counterparty, counterpartyVersion string, initProof []byte, proofHeight exported.Height, -) (string, *capabilitytypes.Capability, error) { +) (string, error) { // connection hops only supports a single connection if len(connectionHops) != 1 { - return "", nil, errorsmod.Wrapf(types.ErrTooManyConnectionHops, "expected 1, got %d", len(connectionHops)) + return "", errorsmod.Wrapf(types.ErrTooManyConnectionHops, "expected 1, got %d", len(connectionHops)) } // generate a new channel channelID := k.GenerateChannelIdentifier(ctx) - if !k.portKeeper.Authenticate(ctx, portCap, portID) { - return "", nil, errorsmod.Wrapf(porttypes.ErrInvalidPort, "caller does not own port capability for port ID %s", portID) - } - connectionEnd, found := k.connectionKeeper.GetConnection(ctx, connectionHops[0]) if !found { - return "", nil, errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0]) + return "", errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, connectionHops[0]) } if connectionEnd.State != connectiontypes.OPEN { - return "", nil, errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State) + return "", errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State) } getVersions := connectionEnd.Versions if len(getVersions) != 1 { - return "", nil, errorsmod.Wrapf( + return "", errorsmod.Wrapf( connectiontypes.ErrInvalidVersion, "single version must be negotiated on connection before opening channel, got: %v", getVersions, @@ -140,7 +122,7 @@ func (k *Keeper) ChanOpenTry( } if !connectiontypes.VerifySupportedFeature(getVersions[0], order.String()) { - return "", nil, errorsmod.Wrapf( + return "", errorsmod.Wrapf( connectiontypes.ErrInvalidVersion, "connection version %s does not support channel ordering: %s", getVersions[0], order.String(), @@ -161,27 +143,17 @@ func (k *Keeper) ChanOpenTry( ctx, connectionEnd, proofHeight, initProof, counterparty.PortId, counterparty.ChannelId, expectedChannel, ); err != nil { - return "", nil, err - } - - var ( - capKey *capabilitytypes.Capability - err error - ) - - capKey, err = k.scopedKeeper.NewCapability(ctx, host.ChannelCapabilityPath(portID, channelID)) - if err != nil { - return "", nil, errorsmod.Wrapf(err, "could not create channel capability for port ID %s and channel ID %s", portID, channelID) + return "", err } - return channelID, capKey, nil + return channelID, nil } // WriteOpenTryChannel writes a channel which has successfully passed the OpenTry handshake step. // The channel is set in state. If a previous channel state did not exist, all the Send and Recv // sequences are set to 1. An event is emitted for the handshake step. func (k *Keeper) WriteOpenTryChannel( - ctx sdk.Context, + ctx context.Context, portID, channelID string, order types.Order, @@ -207,10 +179,9 @@ func (k *Keeper) WriteOpenTryChannel( // ChanOpenAck is called by the handshake-originating module to acknowledge the // acceptance of the initial request by the counterparty module on the other chain. func (k *Keeper) ChanOpenAck( - ctx sdk.Context, + ctx context.Context, portID, channelID string, - chanCap *capabilitytypes.Capability, counterpartyVersion, counterpartyChannelID string, tryProof []byte, @@ -225,10 +196,6 @@ func (k *Keeper) ChanOpenAck( return errorsmod.Wrapf(types.ErrInvalidChannelState, "channel state should be INIT (got %s)", channel.State) } - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { - return errorsmod.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", portID, channelID) - } - connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) if !found { return errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0]) @@ -256,7 +223,7 @@ func (k *Keeper) ChanOpenAck( // WriteOpenAckChannel writes an updated channel state for the successful OpenAck handshake step. // An event is emitted for the handshake step. func (k *Keeper) WriteOpenAckChannel( - ctx sdk.Context, + ctx context.Context, portID, channelID, counterpartyVersion, @@ -282,10 +249,9 @@ func (k *Keeper) WriteOpenAckChannel( // ChanOpenConfirm is called by the handshake-accepting module to confirm the acknowledgement // of the handshake-originating module on the other chain and finish the channel opening handshake. func (k *Keeper) ChanOpenConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, - chanCap *capabilitytypes.Capability, ackProof []byte, proofHeight exported.Height, ) error { @@ -301,10 +267,6 @@ func (k *Keeper) ChanOpenConfirm( ) } - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { - return errorsmod.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", portID, channelID) - } - connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) if !found { return errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, channel.ConnectionHops[0]) @@ -333,7 +295,7 @@ func (k *Keeper) ChanOpenConfirm( // WriteOpenConfirmChannel writes an updated channel state for the successful OpenConfirm handshake step. // An event is emitted for the handshake step. func (k *Keeper) WriteOpenConfirmChannel( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) { @@ -359,15 +321,10 @@ func (k *Keeper) WriteOpenConfirmChannel( // ChanCloseInit is called by either module to close their end of the channel. Once // closed, channels cannot be reopened. func (k *Keeper) ChanCloseInit( - ctx sdk.Context, + ctx context.Context, portID, channelID string, - chanCap *capabilitytypes.Capability, ) error { - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { - return errorsmod.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", portID, channelID) - } - channel, found := k.GetChannel(ctx, portID, channelID) if !found { return errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) @@ -405,18 +362,13 @@ func (k *Keeper) ChanCloseInit( // ChanCloseConfirm is called by the counterparty module to close their end of the // channel, since the other end has been closed. func (k *Keeper) ChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, - chanCap *capabilitytypes.Capability, initProof []byte, proofHeight exported.Height, counterpartyUpgradeSequence uint64, ) error { - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { - return errorsmod.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", portID, channelID) - } - channel, found := k.GetChannel(ctx, portID, channelID) if !found { return errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) diff --git a/modules/core/04-channel/keeper/handshake_test.go b/modules/core/04-channel/keeper/handshake_test.go index 35bdf3783b8..4ed5b5abbd6 100644 --- a/modules/core/04-channel/keeper/handshake_test.go +++ b/modules/core/04-channel/keeper/handshake_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "fmt" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -21,13 +20,11 @@ type testCase = struct { // TestChanOpenInit tests the OpenInit handshake call for channels. It uses message passing // to enter into the appropriate state and then calls ChanOpenInit directly. The channel is -// being created on chainA. The port capability must be created on chainA before ChanOpenInit -// can succeed. +// being created on chainA. func (suite *KeeperTestSuite) TestChanOpenInit() { var ( path *ibctesting.Path features []string - portCap *capabilitytypes.Capability expErrorMsgSubstring string ) @@ -35,22 +32,12 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { {"success", func() { path.SetupConnections() features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"} - suite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainA.GetPortCapability(ibctesting.MockPort) }, true}, - {"channel already exists", func() { - path.Setup() - }, false}, {"connection doesn't exist", func() { // any non-empty values path.EndpointA.ConnectionID = "connection-0" path.EndpointB.ConnectionID = "connection-0" }, false}, - {"capability is incorrect", func() { - path.SetupConnections() - features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"} - portCap = capabilitytypes.NewCapability(3) - }, false}, {"connection version not negotiated", func() { path.SetupConnections() @@ -60,8 +47,6 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { }) features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"} - suite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainA.GetPortCapability(ibctesting.MockPort) }, false}, {"connection does not support ORDERED channels", func() { path.SetupConnections() @@ -73,8 +58,6 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { // NOTE: Opening UNORDERED channels is still expected to pass but ORDERED channels should fail features = []string{"ORDER_UNORDERED"} - suite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainA.GetPortCapability(ibctesting.MockPort) }, true}, { msg: "unauthorized client", @@ -87,9 +70,6 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { params := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetParams(suite.chainA.GetContext()) params.AllowedClients = []string{} suite.chainA.App.GetIBCKeeper().ClientKeeper.SetParams(suite.chainA.GetContext(), params) - - suite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainA.GetPortCapability(ibctesting.MockPort) }, }, } @@ -109,9 +89,9 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { counterparty := types.NewCounterparty(ibctesting.MockPort, ibctesting.FirstChannelID) - channelID, capability, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanOpenInit( + channelID, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanOpenInit( suite.chainA.GetContext(), path.EndpointA.ChannelConfig.Order, []string{path.EndpointA.ConnectionID}, - path.EndpointA.ChannelConfig.PortID, portCap, counterparty, path.EndpointA.ChannelConfig.Version, + path.EndpointA.ChannelConfig.PortID, counterparty, path.EndpointA.ChannelConfig.Version, ) // check if order is supported by channel to determine expected behaviour @@ -126,19 +106,10 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { // asserting the channel handshake initiation succeeded if tc.expPass && orderSupported { suite.Require().NoError(err) - suite.Require().NotNil(capability) suite.Require().Equal(types.FormatChannelIdentifier(0), channelID) - - chanCap, ok := suite.chainA.App.GetScopedIBCKeeper().GetCapability( - suite.chainA.GetContext(), - host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, channelID), - ) - suite.Require().True(ok, "could not retrieve channel capability after successful ChanOpenInit") - suite.Require().Equal(chanCap.String(), capability.String(), "channel capability is not correct") } else { suite.Require().Error(err) suite.Require().Contains(err.Error(), expErrorMsgSubstring) - suite.Require().Nil(capability) suite.Require().Equal("", channelID) } } @@ -148,12 +119,10 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { // TestChanOpenTry tests the OpenTry handshake call for channels. It uses message passing // to enter into the appropriate state and then calls ChanOpenTry directly. The channel -// is being created on chainB. The port capability must be created on chainB before -// ChanOpenTry can succeed. +// is being created on chainB. func (suite *KeeperTestSuite) TestChanOpenTry() { var ( path *ibctesting.Path - portCap *capabilitytypes.Capability heightDiff uint64 ) @@ -163,23 +132,13 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { path.SetChannelOrdered() err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) - - suite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) }, true}, {"connection doesn't exist", func() { path.EndpointA.ConnectionID = ibctesting.FirstConnectionID path.EndpointB.ConnectionID = ibctesting.FirstConnectionID - - // pass capability check - suite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) }, false}, {"connection is not OPEN", func() { path.SetupClients() - // pass capability check - suite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) err := path.EndpointB.ConnOpenInit() suite.Require().NoError(err) @@ -190,23 +149,11 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) - suite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) - heightDiff = 3 // consensus state doesn't exist at this height }, false}, {"channel verification failed", func() { // not creating a channel on chainA will result in an invalid proof of existence path.SetupConnections() - portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) - }, false}, - {"port capability not found", func() { - path.SetupConnections() - path.SetChannelOrdered() - err := path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - - portCap = capabilitytypes.NewCapability(3) }, false}, {"connection version not negotiated", func() { path.SetupConnections() @@ -218,9 +165,6 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { path.EndpointB.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { c.Versions = append(c.Versions, connectiontypes.NewVersion("2", []string{"ORDER_ORDERED", "ORDER_UNORDERED"})) }) - - suite.chainB.CreatePortCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainB.GetPortCapability(ibctesting.MockPort) }, false}, {"connection does not support ORDERED channels", func() { path.SetupConnections() @@ -228,13 +172,10 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { err := path.EndpointA.ChanOpenInit() suite.Require().NoError(err) - // modify connA versions to only support UNORDERED channels - path.EndpointA.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { + // modify connB versions to only support UNORDERED channels + path.EndpointB.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { c.Versions = []*connectiontypes.Version{connectiontypes.NewVersion("1", []string{"ORDER_UNORDERED"})} }) - - suite.chainA.CreatePortCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, ibctesting.MockPort) - portCap = suite.chainA.GetPortCapability(ibctesting.MockPort) }, false}, } @@ -258,22 +199,15 @@ func (suite *KeeperTestSuite) TestChanOpenTry() { channelKey := host.ChannelKey(counterparty.PortId, counterparty.ChannelId) proof, proofHeight := suite.chainA.QueryProof(channelKey) - channelID, capability, err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanOpenTry( + channelID, err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanOpenTry( suite.chainB.GetContext(), types.ORDERED, []string{path.EndpointB.ConnectionID}, - path.EndpointB.ChannelConfig.PortID, portCap, counterparty, path.EndpointA.ChannelConfig.Version, + path.EndpointB.ChannelConfig.PortID, counterparty, path.EndpointA.ChannelConfig.Version, proof, malleateHeight(proofHeight, heightDiff), ) if tc.expPass { suite.Require().NoError(err) - suite.Require().NotNil(capability) - - chanCap, ok := suite.chainB.App.GetScopedIBCKeeper().GetCapability( - suite.chainB.GetContext(), - host.ChannelCapabilityPath(path.EndpointB.ChannelConfig.PortID, channelID), - ) - suite.Require().True(ok, "could not retrieve channel capability after successful ChanOpenTry") - suite.Require().Equal(chanCap.String(), capability.String(), "channel capability is not correct") + suite.Require().NotEmpty(channelID) } else { suite.Require().Error(err) } @@ -288,7 +222,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { var ( path *ibctesting.Path counterpartyChannelID string - channelCap *capabilitytypes.Capability heightDiff uint64 ) @@ -301,8 +234,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { err = path.EndpointB.ChanOpenTry() suite.Require().NoError(err) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success with empty stored counterparty channel ID", func() { path.SetupConnections() @@ -322,14 +253,11 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { counterpartyChannelID = path.EndpointB.ChannelID suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"channel doesn't exist", func() {}, false}, {"channel state is not INIT", func() { // create fully open channels on both chains path.Setup() - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"connection not found", func() { path.SetupConnections() @@ -340,8 +268,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { err = path.EndpointB.ChanOpenTry() suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - // set the channel's connection hops to wrong connection ID channel := path.EndpointA.GetChannel() channel.ConnectionHops[0] = doesnotexist @@ -358,9 +284,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { err = path.EndpointA.ChanOpenInit() suite.Require().NoError(err) - - suite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"consensus state not found", func() { path.SetupConnections() @@ -372,8 +295,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { err = path.EndpointB.ChanOpenTry() suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - heightDiff = 3 // consensus state doesn't exist at this height }, false}, {"invalid counterparty channel identifier", func() { @@ -387,8 +308,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { suite.Require().NoError(err) counterpartyChannelID = "otheridentifier" - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel verification failed", func() { // chainB is INIT, chainA in TRYOPEN @@ -400,19 +319,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { err = path.EndpointA.ChanOpenTry() suite.Require().NoError(err) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - }, false}, - {"channel capability not found", func() { - path.SetupConnections() - path.SetChannelOrdered() - err := path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - - err = path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - - channelCap = capabilitytypes.NewCapability(6) }, false}, } @@ -440,7 +346,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { proof, proofHeight := suite.chainB.QueryProof(channelKey) err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanOpenAck( - suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channelCap, path.EndpointB.ChannelConfig.Version, counterpartyChannelID, + suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.Version, counterpartyChannelID, proof, malleateHeight(proofHeight, heightDiff), ) @@ -459,7 +365,6 @@ func (suite *KeeperTestSuite) TestChanOpenAck() { func (suite *KeeperTestSuite) TestChanOpenConfirm() { var ( path *ibctesting.Path - channelCap *capabilitytypes.Capability heightDiff uint64 ) testCases := []testCase{ @@ -475,14 +380,11 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { err = path.EndpointA.ChanOpenAck() suite.Require().NoError(err) - - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, true}, {"channel doesn't exist", func() {}, false}, {"channel state is not TRYOPEN", func() { // create fully open channels on both chains path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"connection not found", func() { path.SetupConnections() @@ -497,8 +399,6 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { err = path.EndpointA.ChanOpenAck() suite.Require().NoError(err) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - // set the channel's connection hops to wrong connection ID channel := path.EndpointB.GetChannel() channel.ConnectionHops[0] = doesnotexist @@ -509,9 +409,6 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { err := path.EndpointB.ConnOpenInit() suite.Require().NoError(err) - - suite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID) }, false}, {"consensus state not found", func() { path.SetupConnections() @@ -526,8 +423,6 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { err = path.EndpointA.ChanOpenAck() suite.Require().NoError(err) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - heightDiff = 3 }, false}, {"channel verification failed", func() { @@ -540,23 +435,6 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { err = path.EndpointB.ChanOpenTry() suite.Require().NoError(err) - - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - }, false}, - {"channel capability not found", func() { - path.SetupConnections() - path.SetChannelOrdered() - - err := path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - - err = path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - - err = path.EndpointA.ChanOpenAck() - suite.Require().NoError(err) - - channelCap = capabilitytypes.NewCapability(6) }, false}, } @@ -581,7 +459,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanOpenConfirm( suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, - channelCap, proof, malleateHeight(proofHeight, heightDiff), + proof, malleateHeight(proofHeight, heightDiff), ) if tc.expPass { @@ -598,14 +476,12 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() { func (suite *KeeperTestSuite) TestChanCloseInit() { var ( path *ibctesting.Path - channelCap *capabilitytypes.Capability expErrorMsgSubstring string ) testCases := []testCase{ {"success", func() { path.Setup() - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"channel doesn't exist", func() { // any non-nil values work for connections @@ -614,21 +490,15 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { path.EndpointA.ChannelID = ibctesting.FirstChannelID path.EndpointB.ChannelID = ibctesting.FirstChannelID - - // ensure channel capability check passes - suite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel state is CLOSED", func() { path.Setup() - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) // close channel path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) }, false}, {"connection not found", func() { path.Setup() - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) // set the channel's connection hops to wrong connection ID channel := path.EndpointA.GetChannel() @@ -645,21 +515,12 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { path.SetChannelOrdered() err = path.EndpointA.ChanOpenInit() suite.Require().NoError(err) - - // ensure channel capability check passes - suite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - }, false}, - {"channel capability not found", func() { - path.Setup() - channelCap = capabilitytypes.NewCapability(3) }, false}, { msg: "unauthorized client", expPass: false, malleate: func() { path.Setup() - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) // remove client from allowed list params := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetParams(suite.chainA.GetContext()) @@ -680,7 +541,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { tc.malleate() err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.ChanCloseInit( - suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channelCap, + suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ) if tc.expPass { @@ -699,7 +560,6 @@ func (suite *KeeperTestSuite) TestChanCloseInit() { func (suite *KeeperTestSuite) TestChanCloseConfirm() { var ( path *ibctesting.Path - channelCap *capabilitytypes.Capability heightDiff uint64 counterpartyUpgradeSequence uint64 ) @@ -707,16 +567,12 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { testCases := []testCase{ {"success", func() { path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) }, true}, {"success with upgrade info", func() { path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - err := path.EndpointA.SetChannelState(types.CLOSED) - suite.Require().NoError(err) + path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) // add mock upgrade info to simulate that the channel is closing during // an upgrade and verify that the upgrade information is deleted @@ -737,20 +593,14 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { // any non-nil values work for connections path.EndpointA.ChannelID = ibctesting.FirstChannelID path.EndpointB.ChannelID = ibctesting.FirstChannelID - - // ensure channel capability check passes - suite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, ibctesting.FirstChannelID) }, false}, {"channel state is CLOSED", func() { path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) }, false}, {"connection not found", func() { path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) // set the channel's connection hops to wrong connection ID channel := path.EndpointB.GetChannel() @@ -767,14 +617,9 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { path.SetChannelOrdered() err = path.EndpointB.ChanOpenInit() suite.Require().NoError(err) - - // ensure channel capability check passes - suite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"consensus state not found", func() { path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) @@ -783,30 +628,18 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { {"channel verification failed", func() { // channel not closed path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - }, false}, - {"channel capability not found", func() { - path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) - - channelCap = capabilitytypes.NewCapability(3) }, false}, { "failure: invalid counterparty upgrade sequence", func() { path.Setup() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - // trigger upgradeInit on B which will bump the counterparty upgrade sequence. - path.EndpointB.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion - err := path.EndpointB.ChanUpgradeInit() + // trigger upgradeInit on A which will bump the counterparty upgrade sequence. + path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = mock.UpgradeVersion + err := path.EndpointA.ChanUpgradeInit() suite.Require().NoError(err) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) - - channelCap = capabilitytypes.NewCapability(3) }, false, }, @@ -827,7 +660,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() { ctx := suite.chainB.GetContext() err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.ChanCloseConfirm( - ctx, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, channelCap, + ctx, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, proof, malleateHeight(proofHeight, heightDiff), counterpartyUpgradeSequence, ) diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index 3c5e65b97f6..1dddc74e126 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -1,20 +1,22 @@ package keeper import ( + "context" "errors" "strconv" "strings" db "github.com/cosmos/cosmos-db" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -30,37 +32,35 @@ type Keeper struct { // implements gRPC QueryServer interface types.QueryServer - storeKey storetypes.StoreKey + storeService corestore.KVStoreService cdc codec.BinaryCodec clientKeeper types.ClientKeeper connectionKeeper types.ConnectionKeeper - portKeeper types.PortKeeper - scopedKeeper exported.ScopedKeeper } // NewKeeper creates a new IBC channel Keeper instance func NewKeeper( - cdc codec.BinaryCodec, key storetypes.StoreKey, - clientKeeper types.ClientKeeper, connectionKeeper types.ConnectionKeeper, - portKeeper types.PortKeeper, scopedKeeper exported.ScopedKeeper, + cdc codec.BinaryCodec, + storeService corestore.KVStoreService, + clientKeeper types.ClientKeeper, + connectionKeeper types.ConnectionKeeper, ) *Keeper { return &Keeper{ - storeKey: key, + storeService: storeService, cdc: cdc, clientKeeper: clientKeeper, connectionKeeper: connectionKeeper, - portKeeper: portKeeper, - scopedKeeper: scopedKeeper, } } // Logger returns a module-specific logger. -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } // GenerateChannelIdentifier returns the next channel identifier. -func (k *Keeper) GenerateChannelIdentifier(ctx sdk.Context) string { +func (k *Keeper) GenerateChannelIdentifier(ctx context.Context) string { nextChannelSeq := k.GetNextChannelSequence(ctx) channelID := types.FormatChannelIdentifier(nextChannelSeq) @@ -70,15 +70,22 @@ func (k *Keeper) GenerateChannelIdentifier(ctx sdk.Context) string { } // HasChannel true if the channel with the given identifiers exists in state. -func (k *Keeper) HasChannel(ctx sdk.Context, portID, channelID string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(host.ChannelKey(portID, channelID)) +func (k *Keeper) HasChannel(ctx context.Context, portID, channelID string) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(host.ChannelKey(portID, channelID)) + if err != nil { + panic(err) + } + return has } // GetChannel returns a channel with a particular identifier binded to a specific port -func (k *Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (types.Channel, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.ChannelKey(portID, channelID)) +func (k *Keeper) GetChannel(ctx context.Context, portID, channelID string) (types.Channel, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.ChannelKey(portID, channelID)) + if err != nil { + panic(err) + } if len(bz) == 0 { return types.Channel{}, false } @@ -89,14 +96,16 @@ func (k *Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (types.Ch } // SetChannel sets a channel to the store -func (k *Keeper) SetChannel(ctx sdk.Context, portID, channelID string, channel types.Channel) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetChannel(ctx context.Context, portID, channelID string, channel types.Channel) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(&channel) - store.Set(host.ChannelKey(portID, channelID), bz) + if err := store.Set(host.ChannelKey(portID, channelID), bz); err != nil { + panic(err) + } } // GetAppVersion gets the version for the specified channel. -func (k *Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (k *Keeper) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { channel, found := k.GetChannel(ctx, portID, channelID) if !found { return "", false @@ -106,9 +115,12 @@ func (k *Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (strin } // GetNextChannelSequence gets the next channel sequence from the store. -func (k *Keeper) GetNextChannelSequence(ctx sdk.Context) uint64 { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.KeyNextChannelSequence)) +func (k *Keeper) GetNextChannelSequence(ctx context.Context) uint64 { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.KeyNextChannelSequence)) + if err != nil { + panic(err) + } if len(bz) == 0 { panic(errors.New("next channel sequence is nil")) } @@ -117,16 +129,21 @@ func (k *Keeper) GetNextChannelSequence(ctx sdk.Context) uint64 { } // SetNextChannelSequence sets the next channel sequence to the store. -func (k *Keeper) SetNextChannelSequence(ctx sdk.Context, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetNextChannelSequence(ctx context.Context, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set([]byte(types.KeyNextChannelSequence), bz) + if err := store.Set([]byte(types.KeyNextChannelSequence), bz); err != nil { + panic(err) + } } // GetNextSequenceSend gets a channel's next send sequence from the store -func (k *Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.NextSequenceSendKey(portID, channelID)) +func (k *Keeper) GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.NextSequenceSendKey(portID, channelID)) + if err != nil { + panic(err) + } if len(bz) == 0 { return 0, false } @@ -135,16 +152,21 @@ func (k *Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) } // SetNextSequenceSend sets a channel's next send sequence to the store -func (k *Keeper) SetNextSequenceSend(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetNextSequenceSend(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set(host.NextSequenceSendKey(portID, channelID), bz) + if err := store.Set(host.NextSequenceSendKey(portID, channelID), bz); err != nil { + panic(err) + } } // GetNextSequenceRecv gets a channel's next receive sequence from the store -func (k *Keeper) GetNextSequenceRecv(ctx sdk.Context, portID, channelID string) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.NextSequenceRecvKey(portID, channelID)) +func (k *Keeper) GetNextSequenceRecv(ctx context.Context, portID, channelID string) (uint64, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.NextSequenceRecvKey(portID, channelID)) + if err != nil { + panic(err) + } if len(bz) == 0 { return 0, false } @@ -153,16 +175,22 @@ func (k *Keeper) GetNextSequenceRecv(ctx sdk.Context, portID, channelID string) } // SetNextSequenceRecv sets a channel's next receive sequence to the store -func (k *Keeper) SetNextSequenceRecv(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetNextSequenceRecv(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set(host.NextSequenceRecvKey(portID, channelID), bz) + if err := store.Set(host.NextSequenceRecvKey(portID, channelID), bz); err != nil { + panic(err) + } } // GetNextSequenceAck gets a channel's next ack sequence from the store -func (k *Keeper) GetNextSequenceAck(ctx sdk.Context, portID, channelID string) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.NextSequenceAckKey(portID, channelID)) +func (k *Keeper) GetNextSequenceAck(ctx context.Context, portID, channelID string) (uint64, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.NextSequenceAckKey(portID, channelID)) + if err != nil { + panic(err) + } + if len(bz) == 0 { return 0, false } @@ -171,16 +199,22 @@ func (k *Keeper) GetNextSequenceAck(ctx sdk.Context, portID, channelID string) ( } // SetNextSequenceAck sets a channel's next ack sequence to the store -func (k *Keeper) SetNextSequenceAck(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetNextSequenceAck(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set(host.NextSequenceAckKey(portID, channelID), bz) + if err := store.Set(host.NextSequenceAckKey(portID, channelID), bz); err != nil { + panic(err) + } } // GetPacketReceipt gets a packet receipt from the store -func (k *Keeper) GetPacketReceipt(ctx sdk.Context, portID, channelID string, sequence uint64) (string, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.PacketReceiptKey(portID, channelID, sequence)) +func (k *Keeper) GetPacketReceipt(ctx context.Context, portID, channelID string, sequence uint64) (string, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.PacketReceiptKey(portID, channelID, sequence)) + if err != nil { + panic(err) + } + if len(bz) == 0 { return "", false } @@ -189,74 +223,103 @@ func (k *Keeper) GetPacketReceipt(ctx sdk.Context, portID, channelID string, seq } // SetPacketReceipt sets an empty packet receipt to the store -func (k *Keeper) SetPacketReceipt(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) - store.Set(host.PacketReceiptKey(portID, channelID, sequence), []byte{byte(1)}) +func (k *Keeper) SetPacketReceipt(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(host.PacketReceiptKey(portID, channelID, sequence), []byte{byte(1)}); err != nil { + panic(err) + } } // deletePacketReceipt deletes a packet receipt from the store -func (k *Keeper) deletePacketReceipt(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(host.PacketReceiptKey(portID, channelID, sequence)) +func (k *Keeper) deletePacketReceipt(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Delete(host.PacketReceiptKey(portID, channelID, sequence)); err != nil { + panic(err) + } } // GetPacketCommitment gets the packet commitment hash from the store -func (k *Keeper) GetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) []byte { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.PacketCommitmentKey(portID, channelID, sequence)) +func (k *Keeper) GetPacketCommitment(ctx context.Context, portID, channelID string, sequence uint64) []byte { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.PacketCommitmentKey(portID, channelID, sequence)) + if err != nil { + panic(err) + } + return bz } // HasPacketCommitment returns true if the packet commitment exists -func (k *Keeper) HasPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(host.PacketCommitmentKey(portID, channelID, sequence)) +func (k *Keeper) HasPacketCommitment(ctx context.Context, portID, channelID string, sequence uint64) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(host.PacketCommitmentKey(portID, channelID, sequence)) + if err != nil { + panic(err) + } + return has } // SetPacketCommitment sets the packet commitment hash to the store -func (k *Keeper) SetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64, commitmentHash []byte) { - store := ctx.KVStore(k.storeKey) - store.Set(host.PacketCommitmentKey(portID, channelID, sequence), commitmentHash) +func (k *Keeper) SetPacketCommitment(ctx context.Context, portID, channelID string, sequence uint64, commitmentHash []byte) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(host.PacketCommitmentKey(portID, channelID, sequence), commitmentHash); err != nil { + panic(err) + } } -func (k *Keeper) DeletePacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(host.PacketCommitmentKey(portID, channelID, sequence)) +func (k *Keeper) DeletePacketCommitment(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Delete(host.PacketCommitmentKey(portID, channelID, sequence)); err != nil { + panic(err) + } } // SetPacketAcknowledgement sets the packet ack hash to the store -func (k *Keeper) SetPacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64, ackHash []byte) { - store := ctx.KVStore(k.storeKey) - store.Set(host.PacketAcknowledgementKey(portID, channelID, sequence), ackHash) +func (k *Keeper) SetPacketAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64, ackHash []byte) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Set(host.PacketAcknowledgementKey(portID, channelID, sequence), ackHash); err != nil { + panic(err) + } } // GetPacketAcknowledgement gets the packet ack hash from the store -func (k *Keeper) GetPacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64) ([]byte, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.PacketAcknowledgementKey(portID, channelID, sequence)) +func (k *Keeper) GetPacketAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) ([]byte, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.PacketAcknowledgementKey(portID, channelID, sequence)) + if err != nil { + panic(err) + } + if len(bz) == 0 { return nil, false } + return bz, true } // HasPacketAcknowledgement check if the packet ack hash is already on the store -func (k *Keeper) HasPacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(host.PacketAcknowledgementKey(portID, channelID, sequence)) +func (k *Keeper) HasPacketAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(host.PacketAcknowledgementKey(portID, channelID, sequence)) + if err != nil { + panic(err) + } + return has } // deletePacketAcknowledgement deletes the packet ack hash from the store -func (k *Keeper) deletePacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(host.PacketAcknowledgementKey(portID, channelID, sequence)) +func (k *Keeper) deletePacketAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Delete(host.PacketAcknowledgementKey(portID, channelID, sequence)); err != nil { + panic(err) + } } // IteratePacketSequence provides an iterator over all send, receive or ack sequences. // For each sequence, cb will be called. If the cb returns true, the iterator // will close and stop. -func (Keeper) IteratePacketSequence(ctx sdk.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64) bool) { - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) +func (k *Keeper) IteratePacketSequence(ctx context.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64) bool) { + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { portID, channelID, err := host.ParseChannelPath(string(iterator.Key())) if err != nil { @@ -273,8 +336,8 @@ func (Keeper) IteratePacketSequence(ctx sdk.Context, iterator db.Iterator, cb fu } // GetAllPacketSendSeqs returns all stored next send sequences. -func (k *Keeper) GetAllPacketSendSeqs(ctx sdk.Context) (seqs []types.PacketSequence) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) GetAllPacketSendSeqs(ctx context.Context) (seqs []types.PacketSequence) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyNextSeqSendPrefix)) k.IteratePacketSequence(ctx, iterator, func(portID, channelID string, nextSendSeq uint64) bool { ps := types.NewPacketSequence(portID, channelID, nextSendSeq) @@ -285,8 +348,8 @@ func (k *Keeper) GetAllPacketSendSeqs(ctx sdk.Context) (seqs []types.PacketSeque } // GetAllPacketRecvSeqs returns all stored next recv sequences. -func (k *Keeper) GetAllPacketRecvSeqs(ctx sdk.Context) (seqs []types.PacketSequence) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) GetAllPacketRecvSeqs(ctx context.Context) (seqs []types.PacketSequence) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyNextSeqRecvPrefix)) k.IteratePacketSequence(ctx, iterator, func(portID, channelID string, nextRecvSeq uint64) bool { ps := types.NewPacketSequence(portID, channelID, nextRecvSeq) @@ -297,8 +360,8 @@ func (k *Keeper) GetAllPacketRecvSeqs(ctx sdk.Context) (seqs []types.PacketSeque } // GetAllPacketAckSeqs returns all stored next acknowledgements sequences. -func (k *Keeper) GetAllPacketAckSeqs(ctx sdk.Context) (seqs []types.PacketSequence) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) GetAllPacketAckSeqs(ctx context.Context) (seqs []types.PacketSequence) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyNextSeqAckPrefix)) k.IteratePacketSequence(ctx, iterator, func(portID, channelID string, nextAckSeq uint64) bool { ps := types.NewPacketSequence(portID, channelID, nextAckSeq) @@ -311,14 +374,14 @@ func (k *Keeper) GetAllPacketAckSeqs(ctx sdk.Context) (seqs []types.PacketSequen // IteratePacketCommitment provides an iterator over all PacketCommitment objects. For each // packet commitment, cb will be called. If the cb returns true, the iterator will close // and stop. -func (k *Keeper) IteratePacketCommitment(ctx sdk.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IteratePacketCommitment(ctx context.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyPacketCommitmentPrefix)) k.iterateHashes(ctx, iterator, cb) } // GetAllPacketCommitments returns all stored PacketCommitments objects. -func (k *Keeper) GetAllPacketCommitments(ctx sdk.Context) (commitments []types.PacketState) { +func (k *Keeper) GetAllPacketCommitments(ctx context.Context) (commitments []types.PacketState) { k.IteratePacketCommitment(ctx, func(portID, channelID string, sequence uint64, hash []byte) bool { pc := types.NewPacketState(portID, channelID, sequence, hash) commitments = append(commitments, pc) @@ -330,15 +393,15 @@ func (k *Keeper) GetAllPacketCommitments(ctx sdk.Context) (commitments []types.P // IteratePacketCommitmentAtChannel provides an iterator over all PacketCommmitment objects // at a specified channel. For each packet commitment, cb will be called. If the cb returns // true, the iterator will close and stop. -func (k *Keeper) IteratePacketCommitmentAtChannel(ctx sdk.Context, portID, channelID string, cb func(_, _ string, sequence uint64, hash []byte) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IteratePacketCommitmentAtChannel(ctx context.Context, portID, channelID string, cb func(_, _ string, sequence uint64, hash []byte) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, host.PacketCommitmentPrefixKey(portID, channelID)) k.iterateHashes(ctx, iterator, cb) } // GetAllPacketCommitmentsAtChannel returns all stored PacketCommitments objects for a specified // port ID and channel ID. -func (k *Keeper) GetAllPacketCommitmentsAtChannel(ctx sdk.Context, portID, channelID string) (commitments []types.PacketState) { +func (k *Keeper) GetAllPacketCommitmentsAtChannel(ctx context.Context, portID, channelID string) (commitments []types.PacketState) { k.IteratePacketCommitmentAtChannel(ctx, portID, channelID, func(_, _ string, sequence uint64, hash []byte) bool { pc := types.NewPacketState(portID, channelID, sequence, hash) commitments = append(commitments, pc) @@ -350,14 +413,14 @@ func (k *Keeper) GetAllPacketCommitmentsAtChannel(ctx sdk.Context, portID, chann // IteratePacketReceipt provides an iterator over all PacketReceipt objects. For each // receipt, cb will be called. If the cb returns true, the iterator will close // and stop. -func (k *Keeper) IteratePacketReceipt(ctx sdk.Context, cb func(portID, channelID string, sequence uint64, receipt []byte) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IteratePacketReceipt(ctx context.Context, cb func(portID, channelID string, sequence uint64, receipt []byte) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyPacketReceiptPrefix)) k.iterateHashes(ctx, iterator, cb) } // GetAllPacketReceipts returns all stored PacketReceipt objects. -func (k *Keeper) GetAllPacketReceipts(ctx sdk.Context) (receipts []types.PacketState) { +func (k *Keeper) GetAllPacketReceipts(ctx context.Context) (receipts []types.PacketState) { k.IteratePacketReceipt(ctx, func(portID, channelID string, sequence uint64, receipt []byte) bool { packetReceipt := types.NewPacketState(portID, channelID, sequence, receipt) receipts = append(receipts, packetReceipt) @@ -369,14 +432,14 @@ func (k *Keeper) GetAllPacketReceipts(ctx sdk.Context) (receipts []types.PacketS // IteratePacketAcknowledgement provides an iterator over all PacketAcknowledgement objects. For each // acknowledgement, cb will be called. If the cb returns true, the iterator will close // and stop. -func (k *Keeper) IteratePacketAcknowledgement(ctx sdk.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IteratePacketAcknowledgement(ctx context.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyPacketAckPrefix)) k.iterateHashes(ctx, iterator, cb) } // GetAllPacketAcks returns all stored PacketAcknowledgements objects. -func (k *Keeper) GetAllPacketAcks(ctx sdk.Context) (acks []types.PacketState) { +func (k *Keeper) GetAllPacketAcks(ctx context.Context) (acks []types.PacketState) { k.IteratePacketAcknowledgement(ctx, func(portID, channelID string, sequence uint64, ack []byte) bool { packetAck := types.NewPacketState(portID, channelID, sequence, ack) acks = append(acks, packetAck) @@ -388,11 +451,11 @@ func (k *Keeper) GetAllPacketAcks(ctx sdk.Context) (acks []types.PacketState) { // IterateChannels provides an iterator over all Channel objects. For each // Channel, cb will be called. If the cb returns true, the iterator will close // and stop. -func (k *Keeper) IterateChannels(ctx sdk.Context, cb func(types.IdentifiedChannel) bool) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) IterateChannels(ctx context.Context, cb func(types.IdentifiedChannel) bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyChannelEndPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var channel types.Channel k.cdc.MustUnmarshal(iterator.Value(), &channel) @@ -407,13 +470,13 @@ func (k *Keeper) IterateChannels(ctx sdk.Context, cb func(types.IdentifiedChanne // GetAllChannelsWithPortPrefix returns all channels with the specified port prefix. If an empty prefix is provided // all channels will be returned. -func (k *Keeper) GetAllChannelsWithPortPrefix(ctx sdk.Context, portPrefix string) []types.IdentifiedChannel { +func (k *Keeper) GetAllChannelsWithPortPrefix(ctx context.Context, portPrefix string) []types.IdentifiedChannel { if strings.TrimSpace(portPrefix) == "" { return k.GetAllChannels(ctx) } - store := ctx.KVStore(k.storeKey) + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.FilteredPortPrefix(portPrefix)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) var filteredChannels []types.IdentifiedChannel for ; iterator.Valid(); iterator.Next() { @@ -428,7 +491,7 @@ func (k *Keeper) GetAllChannelsWithPortPrefix(ctx sdk.Context, portPrefix string } // GetAllChannels returns all stored Channel objects. -func (k *Keeper) GetAllChannels(ctx sdk.Context) (channels []types.IdentifiedChannel) { +func (k *Keeper) GetAllChannels(ctx context.Context) (channels []types.IdentifiedChannel) { k.IterateChannels(ctx, func(channel types.IdentifiedChannel) bool { channels = append(channels, channel) return false @@ -437,7 +500,7 @@ func (k *Keeper) GetAllChannels(ctx sdk.Context) (channels []types.IdentifiedCha } // GetChannelClientState returns the associated client state with its ID, from a port and channel identifier. -func (k *Keeper) GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, exported.ClientState, error) { +func (k *Keeper) GetChannelClientState(ctx context.Context, portID, channelID string) (string, exported.ClientState, error) { channel, found := k.GetChannel(ctx, portID, channelID) if !found { return "", nil, errorsmod.Wrapf(types.ErrChannelNotFound, "port-id: %s, channel-id: %s", portID, channelID) @@ -457,7 +520,7 @@ func (k *Keeper) GetChannelClientState(ctx sdk.Context, portID, channelID string } // GetConnection wraps the connection keeper's GetConnection function. -func (k *Keeper) GetConnection(ctx sdk.Context, connectionID string) (connectiontypes.ConnectionEnd, error) { +func (k *Keeper) GetConnection(ctx context.Context, connectionID string) (connectiontypes.ConnectionEnd, error) { connection, found := k.connectionKeeper.GetConnection(ctx, connectionID) if !found { return connectiontypes.ConnectionEnd{}, errorsmod.Wrapf(connectiontypes.ErrConnectionNotFound, "connection-id: %s", connectionID) @@ -467,7 +530,7 @@ func (k *Keeper) GetConnection(ctx sdk.Context, connectionID string) (connection } // GetChannelConnection returns the connection ID and state associated with the given port and channel identifier. -func (k *Keeper) GetChannelConnection(ctx sdk.Context, portID, channelID string) (string, connectiontypes.ConnectionEnd, error) { +func (k *Keeper) GetChannelConnection(ctx context.Context, portID, channelID string) (string, connectiontypes.ConnectionEnd, error) { channel, found := k.GetChannel(ctx, portID, channelID) if !found { return "", connectiontypes.ConnectionEnd{}, errorsmod.Wrapf(types.ErrChannelNotFound, "port-id: %s, channel-id: %s", portID, channelID) @@ -483,21 +546,15 @@ func (k *Keeper) GetChannelConnection(ctx sdk.Context, portID, channelID string) return connectionID, connection, nil } -// LookupModuleByChannel will return the IBCModule along with the capability associated with a given channel defined by its portID and channelID -func (k *Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capabilitytypes.Capability, error) { - modules, capability, err := k.scopedKeeper.LookupModules(ctx, host.ChannelCapabilityPath(portID, channelID)) +// GetUpgradeErrorReceipt returns the upgrade error receipt for the provided port and channel identifiers. +func (k *Keeper) GetUpgradeErrorReceipt(ctx context.Context, portID, channelID string) (types.ErrorReceipt, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.ChannelUpgradeErrorKey(portID, channelID)) if err != nil { - return "", nil, err + panic(err) } - return porttypes.GetModuleOwner(modules), capability, nil -} - -// GetUpgradeErrorReceipt returns the upgrade error receipt for the provided port and channel identifiers. -func (k *Keeper) GetUpgradeErrorReceipt(ctx sdk.Context, portID, channelID string) (types.ErrorReceipt, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.ChannelUpgradeErrorKey(portID, channelID)) - if bz == nil { + if len(bz) == 0 { return types.ErrorReceipt{}, false } @@ -508,23 +565,33 @@ func (k *Keeper) GetUpgradeErrorReceipt(ctx sdk.Context, portID, channelID strin } // setUpgradeErrorReceipt sets the provided error receipt in store using the port and channel identifiers. -func (k *Keeper) setUpgradeErrorReceipt(ctx sdk.Context, portID, channelID string, errorReceipt types.ErrorReceipt) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) setUpgradeErrorReceipt(ctx context.Context, portID, channelID string, errorReceipt types.ErrorReceipt) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(&errorReceipt) - store.Set(host.ChannelUpgradeErrorKey(portID, channelID), bz) + if err := store.Set(host.ChannelUpgradeErrorKey(portID, channelID), bz); err != nil { + panic(err) + } } // hasUpgrade returns true if a proposed upgrade exists in store -func (k *Keeper) hasUpgrade(ctx sdk.Context, portID, channelID string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(host.ChannelUpgradeKey(portID, channelID)) +func (k *Keeper) hasUpgrade(ctx context.Context, portID, channelID string) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(host.ChannelUpgradeKey(portID, channelID)) + if err != nil { + panic(err) + } + return has } // GetUpgrade returns the proposed upgrade for the provided port and channel identifiers. -func (k *Keeper) GetUpgrade(ctx sdk.Context, portID, channelID string) (types.Upgrade, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.ChannelUpgradeKey(portID, channelID)) - if bz == nil { +func (k *Keeper) GetUpgrade(ctx context.Context, portID, channelID string) (types.Upgrade, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.ChannelUpgradeKey(portID, channelID)) + if err != nil { + panic(err) + } + + if len(bz) == 0 { return types.Upgrade{}, false } @@ -535,29 +602,41 @@ func (k *Keeper) GetUpgrade(ctx sdk.Context, portID, channelID string) (types.Up } // SetUpgrade sets the proposed upgrade using the provided port and channel identifiers. -func (k *Keeper) SetUpgrade(ctx sdk.Context, portID, channelID string, upgrade types.Upgrade) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetUpgrade(ctx context.Context, portID, channelID string, upgrade types.Upgrade) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(&upgrade) - store.Set(host.ChannelUpgradeKey(portID, channelID), bz) + if err := store.Set(host.ChannelUpgradeKey(portID, channelID), bz); err != nil { + panic(err) + } } // deleteUpgrade deletes the upgrade for the provided port and channel identifiers. -func (k *Keeper) deleteUpgrade(ctx sdk.Context, portID, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(host.ChannelUpgradeKey(portID, channelID)) +func (k *Keeper) deleteUpgrade(ctx context.Context, portID, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Delete(host.ChannelUpgradeKey(portID, channelID)); err != nil { + panic(err) + } } // hasCounterpartyUpgrade returns true if a counterparty upgrade exists in store -func (k *Keeper) hasCounterpartyUpgrade(ctx sdk.Context, portID, channelID string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(host.ChannelCounterpartyUpgradeKey(portID, channelID)) +func (k *Keeper) hasCounterpartyUpgrade(ctx context.Context, portID, channelID string) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(host.ChannelCounterpartyUpgradeKey(portID, channelID)) + if err != nil { + panic(err) + } + return has } // GetCounterpartyUpgrade gets the counterparty upgrade from the store. -func (k *Keeper) GetCounterpartyUpgrade(ctx sdk.Context, portID, channelID string) (types.Upgrade, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.ChannelCounterpartyUpgradeKey(portID, channelID)) - if bz == nil { +func (k *Keeper) GetCounterpartyUpgrade(ctx context.Context, portID, channelID string) (types.Upgrade, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.ChannelCounterpartyUpgradeKey(portID, channelID)) + if err != nil { + panic(err) + } + + if len(bz) == 0 { return types.Upgrade{}, false } @@ -568,35 +647,45 @@ func (k *Keeper) GetCounterpartyUpgrade(ctx sdk.Context, portID, channelID strin } // SetCounterpartyUpgrade sets the counterparty upgrade in the store. -func (k *Keeper) SetCounterpartyUpgrade(ctx sdk.Context, portID, channelID string, upgrade types.Upgrade) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetCounterpartyUpgrade(ctx context.Context, portID, channelID string, upgrade types.Upgrade) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(&upgrade) - store.Set(host.ChannelCounterpartyUpgradeKey(portID, channelID), bz) + if err := store.Set(host.ChannelCounterpartyUpgradeKey(portID, channelID), bz); err != nil { + panic(err) + } } // deleteCounterpartyUpgrade deletes the counterparty upgrade in the store. -func (k *Keeper) deleteCounterpartyUpgrade(ctx sdk.Context, portID, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(host.ChannelCounterpartyUpgradeKey(portID, channelID)) +func (k *Keeper) deleteCounterpartyUpgrade(ctx context.Context, portID, channelID string) { + store := k.storeService.OpenKVStore(ctx) + if err := store.Delete(host.ChannelCounterpartyUpgradeKey(portID, channelID)); err != nil { + panic(err) + } } // deleteUpgradeInfo deletes all auxiliary upgrade information. -func (k *Keeper) deleteUpgradeInfo(ctx sdk.Context, portID, channelID string) { +func (k *Keeper) deleteUpgradeInfo(ctx context.Context, portID, channelID string) { k.deleteUpgrade(ctx, portID, channelID) k.deleteCounterpartyUpgrade(ctx, portID, channelID) } // SetParams sets the channel parameters. -func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetParams(ctx context.Context, params types.Params) { + store := k.storeService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(¶ms) - store.Set([]byte(types.ParamsKey), bz) + if err := store.Set([]byte(types.ParamsKey), bz); err != nil { + panic(err) + } } // GetParams returns the total set of the channel parameters. -func (k *Keeper) GetParams(ctx sdk.Context) types.Params { - store := ctx.KVStore(k.storeKey) - bz := store.Get([]byte(types.ParamsKey)) +func (k *Keeper) GetParams(ctx context.Context) types.Params { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get([]byte(types.ParamsKey)) + if err != nil { + panic(err) + } + if bz == nil { // only panic on unset params and not on empty params panic(errors.New("channel params are not set in store")) } @@ -607,8 +696,8 @@ func (k *Keeper) GetParams(ctx sdk.Context) types.Params { } // common functionality for IteratePacketCommitment and IteratePacketAcknowledgement -func (Keeper) iterateHashes(ctx sdk.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) +func (k *Keeper) iterateHashes(ctx context.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { keySplit := strings.Split(string(iterator.Key()), "/") @@ -628,27 +717,34 @@ func (Keeper) iterateHashes(ctx sdk.Context, iterator db.Iterator, cb func(portI // HasInflightPackets returns true if there are packet commitments stored at the specified // port and channel, and false otherwise. -func (k *Keeper) HasInflightPackets(ctx sdk.Context, portID, channelID string) bool { - iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), host.PacketCommitmentPrefixKey(portID, channelID)) - defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) +func (k *Keeper) HasInflightPackets(ctx context.Context, portID, channelID string) bool { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + iterator := storetypes.KVStorePrefixIterator(store, host.PacketCommitmentPrefixKey(portID, channelID)) + defer sdk.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) return iterator.Valid() } // setRecvStartSequence sets the channel's recv start sequence to the store. -func (k *Keeper) setRecvStartSequence(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) setRecvStartSequence(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set(host.RecvStartSequenceKey(portID, channelID), bz) + if err := store.Set(host.RecvStartSequenceKey(portID, channelID), bz); err != nil { + panic(err) + } } // GetRecvStartSequence gets a channel's recv start sequence from the store. // The recv start sequence will be set to the counterparty's next sequence send // upon a successful channel upgrade. It will be used for replay protection of // historical packets and as the upper bound for pruning stale packet receives. -func (k *Keeper) GetRecvStartSequence(ctx sdk.Context, portID, channelID string) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.RecvStartSequenceKey(portID, channelID)) +func (k *Keeper) GetRecvStartSequence(ctx context.Context, portID, channelID string) (uint64, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.RecvStartSequenceKey(portID, channelID)) + if err != nil { + panic(err) + } + if len(bz) == 0 { return 0, false } @@ -657,16 +753,22 @@ func (k *Keeper) GetRecvStartSequence(ctx sdk.Context, portID, channelID string) } // SetPruningSequenceStart sets a channel's pruning sequence start to the store. -func (k *Keeper) SetPruningSequenceStart(ctx sdk.Context, portID, channelID string, sequence uint64) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetPruningSequenceStart(ctx context.Context, portID, channelID string, sequence uint64) { + store := k.storeService.OpenKVStore(ctx) bz := sdk.Uint64ToBigEndian(sequence) - store.Set(host.PruningSequenceStartKey(portID, channelID), bz) + if err := store.Set(host.PruningSequenceStartKey(portID, channelID), bz); err != nil { + panic(err) + } } // GetPruningSequenceStart gets a channel's pruning sequence start from the store. -func (k *Keeper) GetPruningSequenceStart(ctx sdk.Context, portID, channelID string) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(host.PruningSequenceStartKey(portID, channelID)) +func (k *Keeper) GetPruningSequenceStart(ctx context.Context, portID, channelID string) (uint64, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.PruningSequenceStartKey(portID, channelID)) + if err != nil { + panic(err) + } + if len(bz) == 0 { return 0, false } @@ -675,9 +777,13 @@ func (k *Keeper) GetPruningSequenceStart(ctx sdk.Context, portID, channelID stri } // HasPruningSequenceStart returns true if the pruning sequence start is set for the specified channel. -func (k *Keeper) HasPruningSequenceStart(ctx sdk.Context, portID, channelID string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(host.PruningSequenceStartKey(portID, channelID)) +func (k *Keeper) HasPruningSequenceStart(ctx context.Context, portID, channelID string) bool { + store := k.storeService.OpenKVStore(ctx) + has, err := store.Has(host.PruningSequenceStartKey(portID, channelID)) + if err != nil { + panic(err) + } + return has } // PruneAcknowledgements prunes packet acknowledgements and receipts that have a sequence number less than pruning sequence end. @@ -685,7 +791,7 @@ func (k *Keeper) HasPruningSequenceStart(ctx sdk.Context, portID, channelID stri // // Pruning sequence start keeps track of the packet ack/receipt that can be pruned next. When it reaches pruningSequenceEnd, // pruning is complete. -func (k *Keeper) PruneAcknowledgements(ctx sdk.Context, portID, channelID string, limit uint64) (uint64, uint64, error) { +func (k *Keeper) PruneAcknowledgements(ctx context.Context, portID, channelID string, limit uint64) (uint64, uint64, error) { pruningSequenceStart, found := k.GetPruningSequenceStart(ctx, portID, channelID) if !found { return 0, 0, errorsmod.Wrapf(types.ErrPruningSequenceStartNotFound, "port ID (%s) channel ID (%s)", portID, channelID) diff --git a/modules/core/04-channel/keeper/packet.go b/modules/core/04-channel/keeper/packet.go index d3187727c56..bef9e7cad7c 100644 --- a/modules/core/04-channel/keeper/packet.go +++ b/modules/core/04-channel/keeper/packet.go @@ -2,6 +2,7 @@ package keeper import ( "bytes" + "context" "slices" "strconv" @@ -9,11 +10,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -21,8 +20,7 @@ import ( // The packet sequence generated for the packet to be sent is returned. An error // is returned if one occurs. func (k *Keeper) SendPacket( - ctx sdk.Context, - channelCap *capabilitytypes.Capability, + ctx context.Context, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, @@ -38,9 +36,7 @@ func (k *Keeper) SendPacket( return 0, errorsmod.Wrapf(types.ErrInvalidChannelState, "channel is not OPEN (got %s)", channel.State) } - if !k.scopedKeeper.AuthenticateCapability(ctx, channelCap, host.ChannelCapabilityPath(sourcePort, sourceChannel)) { - return 0, errorsmod.Wrapf(types.ErrChannelCapabilityNotFound, "caller does not own capability for channel, port ID (%s) channel ID (%s)", sourcePort, sourceChannel) - } + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 sequence, found := k.GetNextSequenceSend(ctx, sourcePort, sourceChannel) if !found { @@ -89,7 +85,7 @@ func (k *Keeper) SendPacket( k.SetNextSequenceSend(ctx, sourcePort, sourceChannel, sequence+1) k.SetPacketCommitment(ctx, sourcePort, sourceChannel, packet.GetSequence(), commitment) - EmitSendPacketEvent(ctx, packet, &channel, timeoutHeight) + EmitSendPacketEvent(sdkCtx, packet, &channel, timeoutHeight) k.Logger(ctx).Info( "packet sent", @@ -106,8 +102,7 @@ func (k *Keeper) SendPacket( // RecvPacket is called by a module in order to receive & process an IBC packet // sent on the corresponding channel end on the counterparty chain. func (k *Keeper) RecvPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet types.Packet, proof []byte, proofHeight exported.Height, @@ -122,7 +117,7 @@ func (k *Keeper) RecvPacket( } // If counterpartyUpgrade is stored we need to ensure that the - // packet sequence is < counterparty next sequence send. If the + // packet sequence is counterparty next sequence send. If the // counterparty is implemented correctly, this may only occur // when we are in FLUSHCOMPLETE and the counterparty has already // completed the channel upgrade. @@ -134,15 +129,6 @@ func (k *Keeper) RecvPacket( } } - // Authenticate capability to ensure caller has authority to receive packet on this channel - capName := host.ChannelCapabilityPath(packet.GetDestPort(), packet.GetDestChannel()) - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) { - return "", errorsmod.Wrapf( - types.ErrInvalidChannelCapability, - "channel capability failed authentication for capability name %s", capName, - ) - } - // packet must come from the channel's counterparty if packet.GetSourcePort() != channel.Counterparty.PortId { return "", errorsmod.Wrapf( @@ -171,7 +157,8 @@ func (k *Keeper) RecvPacket( } // check if packet timed out by comparing it with the latest height of the chain - selfHeight, selfTimestamp := clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + selfHeight, selfTimestamp := clienttypes.GetSelfHeight(sdkCtx), uint64(sdkCtx.BlockTime().UnixNano()) timeout := types.NewTimeout(packet.GetTimeoutHeight().(clienttypes.Height), packet.GetTimeoutTimestamp()) if timeout.Elapsed(selfHeight, selfTimestamp) { return "", errorsmod.Wrap(timeout.ErrTimeoutElapsed(selfHeight, selfTimestamp), "packet timeout elapsed") @@ -203,14 +190,14 @@ func (k *Keeper) RecvPacket( ) // emit an event that the relayer can query for - EmitRecvPacketEvent(ctx, packet, &channel) + EmitRecvPacketEvent(sdkCtx, packet, &channel) return channel.Version, nil } // applyReplayProtection ensures a packet has not already been received // and performs the necessary state changes to ensure it cannot be received again. -func (k *Keeper) applyReplayProtection(ctx sdk.Context, packet types.Packet, channel types.Channel) error { +func (k *Keeper) applyReplayProtection(ctx context.Context, packet types.Packet, channel types.Channel) error { // REPLAY PROTECTION: The recvStartSequence will prevent historical proofs from allowing replay // attacks on packets processed in previous lifecycles of a channel. After a successful channel // upgrade all packets under the recvStartSequence will have been processed and thus should be @@ -220,6 +207,7 @@ func (k *Keeper) applyReplayProtection(ctx sdk.Context, packet types.Packet, cha return errorsmod.Wrap(types.ErrPacketReceived, "packet already processed in previous channel upgrade") } + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 switch channel.Ordering { case types.UNORDERED: // REPLAY PROTECTION: Packet receipts will indicate that a packet has already been received @@ -227,7 +215,7 @@ func (k *Keeper) applyReplayProtection(ctx sdk.Context, packet types.Packet, cha // by the increase of the recvStartSequence. _, found := k.GetPacketReceipt(ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) if found { - EmitRecvPacketEvent(ctx, packet, &channel) + EmitRecvPacketEvent(sdkCtx, packet, &channel) // This error indicates that the packet has already been relayed. Core IBC will // treat this error as a no-op in order to prevent an entire relay transaction // from failing and consuming unnecessary fees. @@ -251,7 +239,7 @@ func (k *Keeper) applyReplayProtection(ctx sdk.Context, packet types.Packet, cha } if packet.GetSequence() < nextSequenceRecv { - EmitRecvPacketEvent(ctx, packet, &channel) + EmitRecvPacketEvent(sdkCtx, packet, &channel) // This error indicates that the packet has already been relayed. Core IBC will // treat this error as a no-op in order to prevent an entire relay transaction // from failing and consuming unnecessary fees. @@ -291,8 +279,7 @@ func (k *Keeper) applyReplayProtection(ctx sdk.Context, packet types.Packet, cha // 2) Assumes that packet receipt has been written (unordered), or nextSeqRecv was incremented (ordered) // previously by RecvPacket. func (k *Keeper) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet exported.PacketI, acknowledgement exported.Acknowledgement, ) error { @@ -305,15 +292,6 @@ func (k *Keeper) WriteAcknowledgement( return errorsmod.Wrapf(types.ErrInvalidChannelState, "expected one of [%s, %s, %s], got %s", types.OPEN, types.FLUSHING, types.FLUSHCOMPLETE, channel.State) } - // Authenticate capability to ensure caller has authority to receive packet on this channel - capName := host.ChannelCapabilityPath(packet.GetDestPort(), packet.GetDestChannel()) - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) { - return errorsmod.Wrapf( - types.ErrInvalidChannelCapability, - "channel capability failed authentication for capability name %s", capName, - ) - } - // REPLAY PROTECTION: The recvStartSequence will prevent historical proofs from allowing replay // attacks on packets processed in previous lifecycles of a channel. After a successful channel // upgrade all packets under the recvStartSequence will have been processed and thus should be @@ -356,7 +334,8 @@ func (k *Keeper) WriteAcknowledgement( "dst_channel", packet.GetDestChannel(), ) - EmitWriteAcknowledgementEvent(ctx, packet.(types.Packet), &channel, bz) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + EmitWriteAcknowledgementEvent(sdkCtx, packet.(types.Packet), &channel, bz) return nil } @@ -368,8 +347,7 @@ func (k *Keeper) WriteAcknowledgement( // which is no longer necessary since the packet has been received and acted upon. // It will also increment NextSequenceAck in case of ORDERED channels. func (k *Keeper) AcknowledgePacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet types.Packet, acknowledgement []byte, proof []byte, @@ -387,15 +365,6 @@ func (k *Keeper) AcknowledgePacket( return "", errorsmod.Wrapf(types.ErrInvalidChannelState, "packets cannot be acknowledged on channel with state (%s)", channel.State) } - // Authenticate capability to ensure caller has authority to receive packet on this channel - capName := host.ChannelCapabilityPath(packet.GetSourcePort(), packet.GetSourceChannel()) - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) { - return "", errorsmod.Wrapf( - types.ErrInvalidChannelCapability, - "channel capability failed authentication for capability name %s", capName, - ) - } - // packet must have been sent to the channel's counterparty if packet.GetDestPort() != channel.Counterparty.PortId { return "", errorsmod.Wrapf( @@ -499,10 +468,11 @@ func (k *Keeper) AcknowledgePacket( // FLUSHING state. It checks if the upgrade has timed out and if so, aborts the upgrade. If all // packets have completed their lifecycle, it sets the channel state to FLUSHCOMPLETE and // emits a channel_flush_complete event. Returns true if the upgrade was aborted, false otherwise. -func (k *Keeper) handleFlushState(ctx sdk.Context, packet types.Packet, channel types.Channel) { +func (k *Keeper) handleFlushState(ctx context.Context, packet types.Packet, channel types.Channel) { if counterpartyUpgrade, found := k.GetCounterpartyUpgrade(ctx, packet.GetSourcePort(), packet.GetSourceChannel()); found { timeout := counterpartyUpgrade.Timeout - selfHeight, selfTimestamp := clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + selfHeight, selfTimestamp := clienttypes.GetSelfHeight(sdkCtx), uint64(sdkCtx.BlockTime().UnixNano()) if timeout.Elapsed(selfHeight, selfTimestamp) { // packet flushing timeout has expired, abort the upgrade diff --git a/modules/core/04-channel/keeper/packet_test.go b/modules/core/04-channel/keeper/packet_test.go index 02586efaf4c..5eb2d43062d 100644 --- a/modules/core/04-channel/keeper/packet_test.go +++ b/modules/core/04-channel/keeper/packet_test.go @@ -9,7 +9,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -40,22 +39,17 @@ func (suite *KeeperTestSuite) TestSendPacket() { packetData []byte timeoutHeight clienttypes.Height timeoutTimestamp uint64 - channelCap *capabilitytypes.Capability ) testCases := []testCase{ {"success: UNORDERED channel", func() { path.Setup() sourceChannel = path.EndpointA.ChannelID - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success: ORDERED channel", func() { path.SetChannelOrdered() path.Setup() sourceChannel = path.EndpointA.ChannelID - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success with solomachine: UNORDERED channel", func() { path.Setup() @@ -66,8 +60,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { path.EndpointA.ClientID = clienttypes.FormatClientIdentifier(exported.Solomachine, 10) path.EndpointA.SetClientState(solomachine.ClientState()) path.EndpointA.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { c.ClientId = path.EndpointA.ClientID }) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success with solomachine: ORDERED channel", func() { path.SetChannelOrdered() @@ -80,21 +72,17 @@ func (suite *KeeperTestSuite) TestSendPacket() { path.EndpointA.SetClientState(solomachine.ClientState()) path.EndpointA.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { c.ClientId = path.EndpointA.ClientID }) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"packet basic validation failed, empty packet data", func() { path.Setup() sourceChannel = path.EndpointA.ChannelID - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) packetData = []byte{} }, false}, {"channel not found", func() { // use wrong channel naming path.Setup() sourceChannel = ibctesting.InvalidID - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel is in CLOSED state", func() { path.Setup() @@ -120,8 +108,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { sourceChannel = path.EndpointA.ChannelID path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.ConnectionHops[0] = "invalid-connection" }) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"client state not found", func() { path.Setup() @@ -129,8 +115,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { // change connection client ID path.EndpointA.UpdateConnection(func(c *connectiontypes.ConnectionEnd) { c.ClientId = ibctesting.InvalidID }) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"client state is frozen", func() { path.Setup() @@ -144,8 +128,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { // freeze client cs.FrozenHeight = clienttypes.NewHeight(0, 1) suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), connection.ClientId, cs) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"client state zero height", func() { path.Setup() @@ -162,8 +144,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { cs.LatestHeight = clienttypes.ZeroHeight() suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), connection.ClientId, cs) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"timeout height passed", func() { path.Setup() @@ -172,7 +152,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { var ok bool timeoutHeight, ok = path.EndpointA.GetClientLatestHeight().(clienttypes.Height) suite.Require().True(ok) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"timeout timestamp passed", func() { path.Setup() @@ -184,7 +163,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { timeoutHeight = disabledTimeoutHeight timeoutTimestamp = timestamp - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"timeout timestamp passed with solomachine", func() { path.Setup() @@ -202,8 +180,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { sourceChannel = path.EndpointA.ChannelID timeoutHeight = disabledTimeoutHeight timeoutTimestamp = timestamp - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"next sequence send not found", func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) @@ -216,14 +192,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, types.NewChannel(types.OPEN, types.ORDERED, types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID), []string{path.EndpointA.ConnectionID}, path.EndpointA.ChannelConfig.Version), ) - suite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - }, false}, - {"channel capability not found", func() { - path.Setup() - sourceChannel = path.EndpointA.ChannelID - - channelCap = capabilitytypes.NewCapability(5) }, false}, { "channel is in FLUSH_COMPLETE state", @@ -272,7 +240,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { // only check if nextSequenceSend exists in no error case since it is a tested error case above. expectedSequence, ok := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetNextSequenceSend(suite.chainA.GetContext(), sourcePort, sourceChannel) - sequence, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.SendPacket(suite.chainA.GetContext(), channelCap, + sequence, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.SendPacket(suite.chainA.GetContext(), sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, packetData) if tc.expPass { @@ -292,9 +260,8 @@ func (suite *KeeperTestSuite) TestSendPacket() { // verification tests need to simulate sending a packet from chainA to chainB. func (suite *KeeperTestSuite) TestRecvPacket() { var ( - path *ibctesting.Path - packet types.Packet - channelCap *capabilitytypes.Capability + path *ibctesting.Path + packet types.Packet ) testCases := []struct { @@ -311,7 +278,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, nil, }, @@ -323,7 +289,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, nil, }, @@ -337,7 +302,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, nil, }, @@ -351,7 +315,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, nil, }, @@ -367,7 +330,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) // attempts to receive packet 2 without receiving packet 1 - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, nil, }, @@ -378,7 +340,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) @@ -395,7 +356,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) }, @@ -411,7 +371,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) @@ -429,7 +388,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) err = path.EndpointB.RecvPacket(packet) @@ -444,7 +402,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { path.Setup() sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) err = path.EndpointB.RecvPacket(packet) @@ -466,7 +423,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) // attempts to receive packet 2 without receiving packet 1 - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrPacketSequenceOutOfOrder, }, @@ -476,7 +432,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { // use wrong channel naming path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrChannelNotFound, }, @@ -487,23 +442,9 @@ func (suite *KeeperTestSuite) TestRecvPacket() { packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrInvalidChannelState, }, - { - "capability cannot authenticate ORDERED", - func() { - path.SetChannelOrdered() - path.Setup() - - sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) - suite.Require().NoError(err) - packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = capabilitytypes.NewCapability(3) - }, - types.ErrInvalidChannelCapability, - }, { "packet source port ≠ channel counterparty port", func() { @@ -511,7 +452,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, ibctesting.InvalidID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrInvalidPacket, }, @@ -522,7 +462,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, ibctesting.InvalidID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrInvalidPacket, }, @@ -538,8 +477,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { types.NewChannel(types.OPEN, types.ORDERED, types.NewCounterparty(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID), []string{connIDB}, path.EndpointB.ChannelConfig.Version), ) packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - suite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, connectiontypes.ErrConnectionNotFound, }, @@ -559,8 +496,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { types.NewChannel(types.OPEN, types.ORDERED, types.NewCounterparty(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID), []string{path.EndpointB.ConnectionID}, path.EndpointB.ChannelConfig.Version), ) packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - suite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, connectiontypes.ErrInvalidConnectionState, }, @@ -570,7 +505,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrTimeoutElapsed, }, @@ -580,7 +514,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, disabledTimeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano())) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrTimeoutElapsed, }, @@ -603,9 +536,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { // manually set packet commitment suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, packet.GetSequence(), types.CommitPacket(packet)) - suite.chainB.CreateChannelCapability(suite.chainB.GetSimApp().ScopedIBCMockKeeper, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) err := path.EndpointA.UpdateClient() suite.Require().NoError(err) @@ -622,7 +552,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) // set recv seq start to indicate packet was processed in previous upgrade suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetRecvStartSequence(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sequence+1) @@ -638,7 +567,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { suite.Require().NoError(err) suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetPacketReceipt(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sequence) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, types.ErrNoOpMsg, }, @@ -648,7 +576,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { // packet commitment not set resulting in invalid proof path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, commitmenttypes.ErrInvalidProof, }, @@ -666,7 +593,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { packetKey := host.PacketCommitmentKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) proof, proofHeight := path.EndpointA.QueryProof(packetKey) - channelVersion, err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.RecvPacket(suite.chainB.GetContext(), channelCap, packet, proof, proofHeight) + channelVersion, err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.RecvPacket(suite.chainB.GetContext(), packet, proof, proofHeight) expPass := tc.expError == nil if expPass { @@ -697,10 +624,9 @@ func (suite *KeeperTestSuite) TestRecvPacket() { func (suite *KeeperTestSuite) TestWriteAcknowledgement() { var ( - path *ibctesting.Path - ack exported.Acknowledgement - packet exported.PacketI - channelCap *capabilitytypes.Capability + path *ibctesting.Path + ack exported.Acknowledgement + packet exported.PacketI ) testCases := []testCase{ @@ -710,7 +636,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, true, }, @@ -722,7 +647,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { ack = ibcmock.MockAcknowledgement path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, true, }, @@ -734,7 +658,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { ack = ibcmock.MockAcknowledgement path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHCOMPLETE }) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, true, }, @@ -743,7 +666,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, {"channel not open", func() { path.Setup() @@ -751,18 +673,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { ack = ibcmock.MockAcknowledgement path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false}, - { - "capability authentication failed", - func() { - path.Setup() - packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - ack = ibcmock.MockAcknowledgement - channelCap = capabilitytypes.NewCapability(3) - }, - false, - }, { "no-op, already acked", func() { @@ -770,7 +681,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.MockAcknowledgement suite.chainB.App.GetIBCKeeper().ChannelKeeper.SetPacketAcknowledgement(suite.chainB.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence(), ack.Acknowledgement()) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false, }, @@ -780,7 +690,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = ibcmock.NewEmptyAcknowledgement() - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false, }, @@ -790,7 +699,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) ack = nil - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) }, false, }, @@ -802,7 +710,6 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainB.GetChannelCapability(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) ack = ibcmock.MockAcknowledgement // set recv seq start to indicate packet was processed in previous upgrade @@ -819,7 +726,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { tc.malleate() - err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(suite.chainB.GetContext(), channelCap, packet, ack) + err := suite.chainB.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(suite.chainB.GetContext(), packet, ack) if tc.expPass { suite.Require().NoError(err) @@ -836,8 +743,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { path *ibctesting.Path packet types.Packet ack = ibcmock.MockAcknowledgement - - channelCap *capabilitytypes.Capability ) assertErr := func(errType *errors.Error) func(commitment []byte, channelVersion string, err error) { @@ -889,8 +794,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertSuccess(func() uint64 { return packet.GetSequence() + 1 }, "sequence not incremented in ordered channel"), }, @@ -908,8 +811,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertSuccess(func() uint64 { return uint64(1) }, "sequence incremented for UNORDERED channel"), }, @@ -928,8 +829,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) }, expResult: func(commitment []byte, channelVersion string, err error) { @@ -960,8 +859,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) counterpartyUpgrade := types.Upgrade{ @@ -1014,8 +911,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) upgrade := types.Upgrade{ @@ -1063,8 +958,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - err = path.EndpointA.AcknowledgePacket(packet, ack.Acknowledgement()) suite.Require().NoError(err) }, @@ -1085,8 +978,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - err = path.EndpointA.AcknowledgePacket(packet, ack.Acknowledgement()) suite.Require().NoError(err) }, @@ -1118,7 +1009,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(types.ErrInvalidChannelState), }, @@ -1127,7 +1017,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { malleate: func() { path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHCOMPLETE }) }, @@ -1138,25 +1027,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { suite.Require().Equal("", channelVersion) }, }, - { - name: "capability authentication failed ORDERED", - malleate: func() { - path.SetChannelOrdered() - path.Setup() - - // create packet commitment - sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) - suite.Require().NoError(err) - - // create packet receipt and acknowledgement - packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - err = path.EndpointB.RecvPacket(packet) - suite.Require().NoError(err) - - channelCap = capabilitytypes.NewCapability(3) - }, - expResult: assertErr(types.ErrInvalidChannelCapability), - }, { name: "packet destination port ≠ channel counterparty port", malleate: func() { @@ -1168,7 +1038,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(types.ErrInvalidPacket), }, @@ -1183,7 +1052,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { // use wrong channel for dest packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(types.ErrInvalidPacket), }, @@ -1204,9 +1072,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, types.NewChannel(types.OPEN, types.ORDERED, types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID), []string{"connection-1000"}, path.EndpointA.GetChannel().Version), ) - - suite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(connectiontypes.ErrConnectionNotFound), }, @@ -1231,8 +1096,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, types.NewChannel(types.OPEN, types.ORDERED, types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID), []string{path.EndpointA.ConnectionID}, path.EndpointA.GetChannel().Version), ) - suite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(connectiontypes.ErrInvalidConnectionState), }, @@ -1242,7 +1105,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { // packet commitment never written path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertNoOp, // NOTE: ibc core does not distinguish between unsent and already relayed packets. }, @@ -1258,7 +1120,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { sequence, err := path.EndpointA.SendPacket(defaultTimeoutHeight, disabledTimeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(commitmenttypes.ErrInvalidProof), }, @@ -1277,8 +1138,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { err = path.EndpointB.RecvPacket(packet) suite.Require().NoError(err) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - packet.Data = []byte("invalid packet commitment") }, expResult: assertErr(types.ErrInvalidPacket), @@ -1302,8 +1161,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { ibcStore := suite.chainA.GetContext().KVStore(storeKey) ibcStore.Delete(host.NextSequenceAckKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)) - - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(types.ErrSequenceAckNotFound), }, @@ -1324,7 +1181,6 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { // set next sequence ack wrong suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetNextSequenceAck(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 10) - channelCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, expResult: assertErr(types.ErrPacketSequenceOutOfOrder), }, @@ -1343,7 +1199,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { packetKey := host.PacketAcknowledgementKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) proof, proofHeight := path.EndpointB.QueryProof(packetKey) - channelVersion, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.AcknowledgePacket(ctx, channelCap, packet, ack.Acknowledgement(), proof, proofHeight) + channelVersion, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.AcknowledgePacket(ctx, packet, ack.Acknowledgement(), proof, proofHeight) commitment := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(ctx, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, packet.GetSequence()) tc.expResult(commitment, channelVersion, err) diff --git a/modules/core/04-channel/keeper/timeout.go b/modules/core/04-channel/keeper/timeout.go index bc7c6252409..84db359eb10 100644 --- a/modules/core/04-channel/keeper/timeout.go +++ b/modules/core/04-channel/keeper/timeout.go @@ -2,17 +2,14 @@ package keeper import ( "bytes" + "context" "strconv" errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -23,8 +20,7 @@ import ( // perform appropriate state transitions. Its intended usage is within the // ante handler. func (k *Keeper) TimeoutPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet types.Packet, proof []byte, proofHeight exported.Height, @@ -38,9 +34,6 @@ func (k *Keeper) TimeoutPacket( ) } - // NOTE: TimeoutPacket is called by the AnteHandler which acts upon the packet.Route(), - // so the capability authentication can be omitted here - if packet.GetDestPort() != channel.Counterparty.PortId { return "", errorsmod.Wrapf( types.ErrInvalidPacket, @@ -120,7 +113,7 @@ func (k *Keeper) TimeoutPacket( return "", err } - if err = k.timeoutExecuted(ctx, channel, chanCap, packet); err != nil { + if err = k.timeoutExecuted(ctx, channel, packet); err != nil { return "", err } @@ -135,19 +128,10 @@ func (k *Keeper) TimeoutPacket( // // CONTRACT: this function must be called in the IBC handler func (k *Keeper) timeoutExecuted( - ctx sdk.Context, + ctx context.Context, channel types.Channel, - chanCap *capabilitytypes.Capability, packet types.Packet, ) error { - capName := host.ChannelCapabilityPath(packet.GetSourcePort(), packet.GetSourceChannel()) - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) { - return errorsmod.Wrapf( - types.ErrChannelCapabilityNotFound, - "caller does not own capability for channel with capability name %s", capName, - ) - } - k.DeletePacketCommitment(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) // if an upgrade is in progress, handling packet flushing and update channel state appropriately @@ -192,8 +176,7 @@ func (k *Keeper) timeoutExecuted( // which an unreceived packet was addressed has been closed, so the packet will // never be received (even if the timeoutHeight has not yet been reached). func (k *Keeper) TimeoutOnClose( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet types.Packet, proof, closedProof []byte, @@ -206,14 +189,6 @@ func (k *Keeper) TimeoutOnClose( return "", errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", packet.GetSourcePort(), packet.GetSourceChannel()) } - capName := host.ChannelCapabilityPath(packet.GetSourcePort(), packet.GetSourceChannel()) - if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) { - return "", errorsmod.Wrapf( - types.ErrInvalidChannelCapability, - "channel capability failed authentication with capability name %s", capName, - ) - } - if packet.GetDestPort() != channel.Counterparty.PortId { return "", errorsmod.Wrapf( types.ErrInvalidPacket, @@ -298,7 +273,7 @@ func (k *Keeper) TimeoutOnClose( return "", err } - if err = k.timeoutExecuted(ctx, channel, chanCap, packet); err != nil { + if err = k.timeoutExecuted(ctx, channel, packet); err != nil { return "", err } diff --git a/modules/core/04-channel/keeper/timeout_test.go b/modules/core/04-channel/keeper/timeout_test.go index a5516b58221..0748e6efbd7 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -10,7 +10,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -27,7 +26,6 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { var ( path *ibctesting.Path packet types.Packet - chanCap *capabilitytypes.Capability nextSeqRecv uint64 ordered bool expError *errorsmod.Error @@ -48,8 +46,6 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { // need to update chainA's client representing chainB to prove missing ack err = path.EndpointA.UpdateClient() suite.Require().NoError(err) - - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success: UNORDERED", func() { ordered = false @@ -63,7 +59,6 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { // need to update chainA's client representing chainB to prove missing ack err = path.EndpointA.UpdateClient() suite.Require().NoError(err) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"packet already timed out: ORDERED", func() { expError = types.ErrNoOpMsg @@ -225,7 +220,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { } } - channelVersion, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.TimeoutPacket(suite.chainA.GetContext(), chanCap, packet, proof, proofHeight, nextSeqRecv) + channelVersion, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.TimeoutPacket(suite.chainA.GetContext(), packet, proof, proofHeight, nextSeqRecv) if tc.expPass { suite.Require().NoError(err) @@ -242,14 +237,13 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { } } -// TestTimeoutExecuted verifies that packet commitments are deleted on chainA after the -// channel capabilities are verified. In addition, the test verifies that the channel state +// TestTimeoutExecuted verifies that packet commitments are deleted. +// In addition, the test verifies that the channel state // after a timeout is updated accordingly. func (suite *KeeperTestSuite) TestTimeoutExecuted() { var ( - path *ibctesting.Path - packet types.Packet - chanCap *capabilitytypes.Capability + path *ibctesting.Path + packet types.Packet ) testCases := []struct { @@ -271,7 +265,6 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, func(packetCommitment []byte, err error) { suite.Require().NoError(err) @@ -283,30 +276,6 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { }, nil, }, - { - "incorrect capability ORDERED", - func() { - path.SetChannelOrdered() - path.Setup() - - timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) - timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) - - sequence, err := path.EndpointA.SendPacket(timeoutHeight, timeoutTimestamp, ibctesting.MockPacketData) - suite.Require().NoError(err) - - packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = capabilitytypes.NewCapability(100) - }, - func(packetCommitment []byte, err error) { - suite.Require().Error(err) - suite.Require().ErrorIs(err, types.ErrChannelCapabilityNotFound) - - // packet sent, never deleted. - suite.Require().NotNil(packetCommitment) - }, - nil, - }, { "set to flush complete with no inflight packets", func() { @@ -315,8 +284,6 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) path.EndpointA.SetChannelCounterpartyUpgrade(types.Upgrade{ @@ -358,7 +325,6 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) }, @@ -382,7 +348,6 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) @@ -431,7 +396,6 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) @@ -473,7 +437,6 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.FLUSHING }) @@ -512,7 +475,7 @@ func (suite *KeeperTestSuite) TestTimeoutExecuted() { tc.malleate() - err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.TimeoutExecuted(ctx, path.EndpointA.GetChannel(), chanCap, packet) + err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.TimeoutExecuted(ctx, path.EndpointA.GetChannel(), packet) pc := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) tc.expResult(pc, err) @@ -533,7 +496,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { var ( path *ibctesting.Path packet types.Packet - chanCap *capabilitytypes.Capability nextSeqRecv uint64 counterpartyUpgradeSequence uint64 ordered bool @@ -556,7 +518,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"success: UNORDERED", func() { ordered = false @@ -572,7 +533,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, disabledTimeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, true}, {"channel not found", func() { // use wrong channel naming @@ -583,13 +543,11 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { path.Setup() // use wrong port for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ibctesting.InvalidID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"packet dest channel ID ≠ channel counterparty channel ID", func() { path.Setup() // use wrong channel for dest packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, ibctesting.InvalidID, defaultTimeoutHeight, disabledTimeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"connection not found", func() { // pass channel check @@ -599,17 +557,12 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { types.NewChannel(types.OPEN, types.ORDERED, types.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID), []string{connIDA}, path.EndpointA.ChannelConfig.Version), ) packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, defaultTimeoutHeight, disabledTimeoutTimestamp) - - // create chancap - suite.chainA.CreateChannelCapability(suite.chainA.GetSimApp().ScopedIBCMockKeeper, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"packet hasn't been sent ORDERED", func() { path.SetChannelOrdered() path.Setup() packet = types.NewPacket(ibctesting.MockPacketData, 1, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano())) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"packet already received ORDERED", func() { path.SetChannelOrdered() @@ -628,7 +581,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"channel verification failed ORDERED", func() { ordered = true @@ -641,7 +593,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { sequence, err := path.EndpointA.SendPacket(timeoutHeight, timeoutTimestamp, ibctesting.MockPacketData) suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, timeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"next seq receive verification failed ORDERED", func() { // set ordered to false providing the wrong proof for ORDERED case @@ -659,7 +610,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano())) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false}, {"packet ack verification failed", func() { // set ordered to true providing the wrong proof for UNORDERED case @@ -675,25 +625,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, disabledTimeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - }, false}, - {"channel capability not found ORDERED", func() { - ordered = true - path.SetChannelOrdered() - path.Setup() - - timeoutHeight := clienttypes.GetSelfHeight(suite.chainB.GetContext()) - timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().UnixNano()) - - sequence, err := path.EndpointA.SendPacket(timeoutHeight, timeoutTimestamp, ibctesting.MockPacketData) - suite.Require().NoError(err) - path.EndpointB.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED }) - // need to update chainA's client representing chainB to prove missing ack - err = path.EndpointA.UpdateClient() - suite.Require().NoError(err) - - packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano())) - chanCap = capabilitytypes.NewCapability(100) }, false}, { "failure: invalid counterparty upgrade sequence", @@ -718,7 +649,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { suite.Require().NoError(err) packet = types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, disabledTimeoutTimestamp) - chanCap = suite.chainA.GetChannelCapability(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) }, false, }, @@ -750,7 +680,6 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { channelVersion, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.TimeoutOnClose( suite.chainA.GetContext(), - chanCap, packet, proof, closedProof, diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index 2fd44ca10b5..cee41cbf4f0 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" "reflect" "slices" @@ -20,7 +21,7 @@ import ( // ChanUpgradeInit is called by a module to initiate a channel upgrade handshake with // a module on another chain. func (k *Keeper) ChanUpgradeInit( - ctx sdk.Context, + ctx context.Context, portID string, channelID string, upgradeFields types.UpgradeFields, @@ -45,7 +46,7 @@ func (k *Keeper) ChanUpgradeInit( // WriteUpgradeInitChannel writes a channel which has successfully passed the UpgradeInit handshake step. // An event is emitted for the handshake step. -func (k *Keeper) WriteUpgradeInitChannel(ctx sdk.Context, portID, channelID string, upgrade types.Upgrade, upgradeVersion string) (types.Channel, types.Upgrade) { +func (k *Keeper) WriteUpgradeInitChannel(ctx context.Context, portID, channelID string, upgrade types.Upgrade, upgradeVersion string) (types.Channel, types.Upgrade) { defer telemetry.IncrCounter(1, "ibc", "channel", "upgrade-init") channel, found := k.GetChannel(ctx, portID, channelID) @@ -74,7 +75,7 @@ func (k *Keeper) WriteUpgradeInitChannel(ctx sdk.Context, portID, channelID stri // ChanUpgradeTry is called by a module to accept the first step of a channel upgrade handshake initiated by // a module on another chain. If this function is successful, the proposed upgrade will be returned. If the upgrade fails, the upgrade sequence will still be incremented but an error will be returned. func (k *Keeper) ChanUpgradeTry( - ctx sdk.Context, + ctx context.Context, portID, channelID string, proposedConnectionHops []string, @@ -223,7 +224,7 @@ func (k *Keeper) ChanUpgradeTry( // WriteUpgradeTryChannel writes the channel end and upgrade to state after successfully passing the UpgradeTry handshake step. // An event is emitted for the handshake step. -func (k *Keeper) WriteUpgradeTryChannel(ctx sdk.Context, portID, channelID string, upgrade types.Upgrade, upgradeVersion string) (types.Channel, types.Upgrade) { +func (k *Keeper) WriteUpgradeTryChannel(ctx context.Context, portID, channelID string, upgrade types.Upgrade, upgradeVersion string) (types.Channel, types.Upgrade) { defer telemetry.IncrCounter(1, "ibc", "channel", "upgrade-try") channel, found := k.GetChannel(ctx, portID, channelID) @@ -252,7 +253,7 @@ func (k *Keeper) WriteUpgradeTryChannel(ctx sdk.Context, portID, channelID strin // // A -> Init (OPEN), B -> Init (OPEN) -> A -> Try (FLUSHING), B -> Try (FLUSHING), A -> Ack (begins in FLUSHING) func (k *Keeper) ChanUpgradeAck( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyUpgrade types.Upgrade, @@ -340,7 +341,8 @@ func (k *Keeper) ChanUpgradeAck( } timeout := counterpartyUpgrade.Timeout - selfHeight, selfTimestamp := clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + selfHeight, selfTimestamp := clienttypes.GetSelfHeight(sdkCtx), uint64(sdkCtx.BlockTime().UnixNano()) if timeout.Elapsed(selfHeight, selfTimestamp) { return types.NewUpgradeError(channel.UpgradeSequence, errorsmod.Wrap(timeout.ErrTimeoutElapsed(selfHeight, selfTimestamp), "counterparty upgrade timeout elapsed")) @@ -352,7 +354,7 @@ func (k *Keeper) ChanUpgradeAck( // WriteUpgradeAckChannel writes a channel which has successfully passed the UpgradeAck handshake step as well as // setting the upgrade for that channel. // An event is emitted for the handshake step. -func (k *Keeper) WriteUpgradeAckChannel(ctx sdk.Context, portID, channelID string, counterpartyUpgrade types.Upgrade) (types.Channel, types.Upgrade) { +func (k *Keeper) WriteUpgradeAckChannel(ctx context.Context, portID, channelID string, counterpartyUpgrade types.Upgrade) (types.Channel, types.Upgrade) { defer telemetry.IncrCounter(1, "ibc", "channel", "upgrade-ack") channel, found := k.GetChannel(ctx, portID, channelID) @@ -383,7 +385,7 @@ func (k *Keeper) WriteUpgradeAckChannel(ctx sdk.Context, portID, channelID strin // ChanUpgradeConfirm is called on the chain which is on FLUSHING after chanUpgradeAck is called on the counterparty. // This will inform the TRY chain of the timeout set on ACK by the counterparty. If the timeout has already exceeded, we will write an error receipt and restore. func (k *Keeper) ChanUpgradeConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyChannelState types.State, @@ -462,7 +464,8 @@ func (k *Keeper) ChanUpgradeConfirm( } timeout := counterpartyUpgrade.Timeout - selfHeight, selfTimestamp := clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + selfHeight, selfTimestamp := clienttypes.GetSelfHeight(sdkCtx), uint64(sdkCtx.BlockTime().UnixNano()) if timeout.Elapsed(selfHeight, selfTimestamp) { return types.NewUpgradeError(channel.UpgradeSequence, errorsmod.Wrap(timeout.ErrTimeoutElapsed(selfHeight, selfTimestamp), "counterparty upgrade timeout elapsed")) @@ -475,7 +478,7 @@ func (k *Keeper) ChanUpgradeConfirm( // If the channel has no in-flight packets, its state is updated to indicate that flushing has completed. Otherwise, the counterparty upgrade is set // and the channel state is left unchanged. // An event is emitted for the handshake step. -func (k *Keeper) WriteUpgradeConfirmChannel(ctx sdk.Context, portID, channelID string, counterpartyUpgrade types.Upgrade) types.Channel { +func (k *Keeper) WriteUpgradeConfirmChannel(ctx context.Context, portID, channelID string, counterpartyUpgrade types.Upgrade) types.Channel { defer telemetry.IncrCounter(1, "ibc", "channel", "upgrade-confirm") channel, found := k.GetChannel(ctx, portID, channelID) @@ -498,7 +501,7 @@ func (k *Keeper) WriteUpgradeConfirmChannel(ctx sdk.Context, portID, channelID s // This method should only be called after both channels have flushed any in-flight packets. // This method should only be called directly by the core IBC message server. func (k *Keeper) ChanUpgradeOpen( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyChannelState types.State, @@ -589,7 +592,7 @@ func (k *Keeper) ChanUpgradeOpen( // WriteUpgradeOpenChannel writes the agreed upon upgrade fields to the channel, and sets the channel state back to OPEN. This can be called in one of two cases: // - In the UpgradeConfirm step of the handshake if both sides have already flushed all in-flight packets. // - In the UpgradeOpen step of the handshake. -func (k *Keeper) WriteUpgradeOpenChannel(ctx sdk.Context, portID, channelID string) types.Channel { +func (k *Keeper) WriteUpgradeOpenChannel(ctx context.Context, portID, channelID string) types.Channel { channel, found := k.GetChannel(ctx, portID, channelID) if !found { panic(fmt.Errorf("could not find existing channel when updating channel state, channelID: %s, portID: %s", channelID, portID)) @@ -651,7 +654,7 @@ func (k *Keeper) WriteUpgradeOpenChannel(ctx sdk.Context, portID, channelID stri // ChanUpgradeCancel is called by the msg server to prove that an error receipt was written on the counterparty // which constitutes a valid situation where the upgrade should be cancelled. An error is returned if sufficient evidence // for cancelling the upgrade has not been provided. -func (k *Keeper) ChanUpgradeCancel(ctx sdk.Context, portID, channelID string, errorReceipt types.ErrorReceipt, errorReceiptProof []byte, proofHeight clienttypes.Height) error { +func (k *Keeper) ChanUpgradeCancel(ctx context.Context, portID, channelID string, errorReceipt types.ErrorReceipt, errorReceiptProof []byte, proofHeight clienttypes.Height) error { channel, found := k.GetChannel(ctx, portID, channelID) if !found { return errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) @@ -709,7 +712,7 @@ func (k *Keeper) ChanUpgradeCancel(ctx sdk.Context, portID, channelID string, er // WriteUpgradeCancelChannel writes a channel which has canceled the upgrade process.Auxiliary upgrade state is // also deleted. -func (k *Keeper) WriteUpgradeCancelChannel(ctx sdk.Context, portID, channelID string, sequence uint64) { +func (k *Keeper) WriteUpgradeCancelChannel(ctx context.Context, portID, channelID string, sequence uint64) { defer telemetry.IncrCounter(1, "ibc", "channel", "upgrade-cancel") channel, found := k.GetChannel(ctx, portID, channelID) @@ -728,7 +731,7 @@ func (k *Keeper) WriteUpgradeCancelChannel(ctx sdk.Context, portID, channelID st // ChanUpgradeTimeout times out an outstanding upgrade. // This should be used by the initialising chain when the counterparty chain has not responded to an upgrade proposal within the specified timeout period. func (k *Keeper) ChanUpgradeTimeout( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyChannel types.Channel, counterpartyChannelProof []byte, @@ -824,7 +827,7 @@ func (k *Keeper) ChanUpgradeTimeout( // Auxiliary upgrade state is also deleted. // An event is emitted for the handshake step. func (k *Keeper) WriteUpgradeTimeoutChannel( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) (types.Channel, types.Upgrade) { defer telemetry.IncrCounter(1, "ibc", "channel", "upgrade-timeout") @@ -849,7 +852,7 @@ func (k *Keeper) WriteUpgradeTimeoutChannel( // startFlushing will set the upgrade last packet send and continue blocking the upgrade from continuing until all // in-flight packets have been flushed. -func (k *Keeper) startFlushing(ctx sdk.Context, portID, channelID string, upgrade *types.Upgrade) error { +func (k *Keeper) startFlushing(ctx context.Context, portID, channelID string, upgrade *types.Upgrade) error { channel, found := k.GetChannel(ctx, portID, channelID) if !found { return errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) @@ -880,13 +883,14 @@ func (k *Keeper) startFlushing(ctx sdk.Context, portID, channelID string, upgrad } // getAbsoluteUpgradeTimeout returns the absolute timeout for the given upgrade. -func (k *Keeper) getAbsoluteUpgradeTimeout(ctx sdk.Context) types.Timeout { +func (k *Keeper) getAbsoluteUpgradeTimeout(ctx context.Context) types.Timeout { upgradeTimeout := k.GetParams(ctx).UpgradeTimeout - return types.NewTimeout(clienttypes.ZeroHeight(), uint64(ctx.BlockTime().UnixNano())+upgradeTimeout.Timestamp) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + return types.NewTimeout(clienttypes.ZeroHeight(), uint64(sdkCtx.BlockTime().UnixNano())+upgradeTimeout.Timestamp) } // checkForUpgradeCompatibility checks performs stateful validation of self upgrade fields relative to counterparty upgrade. -func (k *Keeper) checkForUpgradeCompatibility(ctx sdk.Context, upgradeFields, counterpartyUpgradeFields types.UpgradeFields) error { +func (k *Keeper) checkForUpgradeCompatibility(ctx context.Context, upgradeFields, counterpartyUpgradeFields types.UpgradeFields) error { // assert that both sides propose the same channel ordering if upgradeFields.Ordering != counterpartyUpgradeFields.Ordering { return errorsmod.Wrapf(types.ErrIncompatibleCounterpartyUpgrade, "expected upgrade ordering (%s) to match counterparty upgrade ordering (%s)", upgradeFields.Ordering, counterpartyUpgradeFields.Ordering) @@ -924,7 +928,7 @@ func (k *Keeper) checkForUpgradeCompatibility(ctx sdk.Context, upgradeFields, co // - the proposed connection hops do not exist // - the proposed version is non-empty (checked in UpgradeFields.ValidateBasic()) // - the proposed connection hops are not open -func (k *Keeper) validateSelfUpgradeFields(ctx sdk.Context, proposedUpgrade types.UpgradeFields, channel types.Channel) error { +func (k *Keeper) validateSelfUpgradeFields(ctx context.Context, proposedUpgrade types.UpgradeFields, channel types.Channel) error { currentFields := extractUpgradeFields(channel) if reflect.DeepEqual(proposedUpgrade, currentFields) { @@ -973,7 +977,7 @@ func extractUpgradeFields(channel types.Channel) types.UpgradeFields { // MustAbortUpgrade will restore the channel state to its pre-upgrade state so that upgrade is aborted. // Any unnecessary state is deleted and an error receipt is written. // This function is expected to always succeed, a panic will occur if an error occurs. -func (k *Keeper) MustAbortUpgrade(ctx sdk.Context, portID, channelID string, err error) { +func (k *Keeper) MustAbortUpgrade(ctx context.Context, portID, channelID string, err error) { if err := k.abortUpgrade(ctx, portID, channelID, err); err != nil { panic(err) } @@ -983,7 +987,7 @@ func (k *Keeper) MustAbortUpgrade(ctx sdk.Context, portID, channelID string, err // All upgrade information associated with the upgrade attempt is deleted and an upgrade error // receipt is written for that upgrade attempt. This prevents the upgrade handshake from continuing // on our side and provides proof for the counterparty to safely abort the upgrade. -func (k *Keeper) abortUpgrade(ctx sdk.Context, portID, channelID string, err error) error { +func (k *Keeper) abortUpgrade(ctx context.Context, portID, channelID string, err error) error { if err == nil { return errorsmod.Wrap(types.ErrInvalidUpgradeError, "cannot abort upgrade handshake with nil error") } @@ -1011,7 +1015,7 @@ func (k *Keeper) abortUpgrade(ctx sdk.Context, portID, channelID string, err err // restoreChannel will restore the channel state to its pre-upgrade state so that upgrade is aborted. // When an upgrade attempt is aborted, the upgrade information must be deleted. This prevents us // from continuing an upgrade handshake after we cancel an upgrade attempt. -func (k *Keeper) restoreChannel(ctx sdk.Context, portID, channelID string, upgradeSequence uint64, channel types.Channel) types.Channel { +func (k *Keeper) restoreChannel(ctx context.Context, portID, channelID string, upgradeSequence uint64, channel types.Channel) types.Channel { channel.State = types.OPEN channel.UpgradeSequence = upgradeSequence @@ -1024,7 +1028,7 @@ func (k *Keeper) restoreChannel(ctx sdk.Context, portID, channelID string, upgra } // WriteErrorReceipt will write an error receipt from the provided UpgradeError. -func (k *Keeper) WriteErrorReceipt(ctx sdk.Context, portID, channelID string, upgradeError *types.UpgradeError) { +func (k *Keeper) WriteErrorReceipt(ctx context.Context, portID, channelID string, upgradeError *types.UpgradeError) { channel, found := k.GetChannel(ctx, portID, channelID) if !found { panic(errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)) diff --git a/modules/core/04-channel/types/errors.go b/modules/core/04-channel/types/errors.go index 4af002fe94a..629a074a24d 100644 --- a/modules/core/04-channel/types/errors.go +++ b/modules/core/04-channel/types/errors.go @@ -6,18 +6,16 @@ import ( // IBC channel sentinel errors var ( - ErrChannelExists = errorsmod.Register(SubModuleName, 2, "channel already exists") - ErrChannelNotFound = errorsmod.Register(SubModuleName, 3, "channel not found") - ErrInvalidChannel = errorsmod.Register(SubModuleName, 4, "invalid channel") - ErrInvalidChannelState = errorsmod.Register(SubModuleName, 5, "invalid channel state") - ErrInvalidChannelOrdering = errorsmod.Register(SubModuleName, 6, "invalid channel ordering") - ErrInvalidCounterparty = errorsmod.Register(SubModuleName, 7, "invalid counterparty channel") - ErrInvalidChannelCapability = errorsmod.Register(SubModuleName, 8, "invalid channel capability") - ErrChannelCapabilityNotFound = errorsmod.Register(SubModuleName, 9, "channel capability not found") - ErrSequenceSendNotFound = errorsmod.Register(SubModuleName, 10, "sequence send not found") - ErrSequenceReceiveNotFound = errorsmod.Register(SubModuleName, 11, "sequence receive not found") - ErrSequenceAckNotFound = errorsmod.Register(SubModuleName, 12, "sequence acknowledgement not found") - ErrInvalidPacket = errorsmod.Register(SubModuleName, 13, "invalid packet") + ErrChannelExists = errorsmod.Register(SubModuleName, 2, "channel already exists") + ErrChannelNotFound = errorsmod.Register(SubModuleName, 3, "channel not found") + ErrInvalidChannel = errorsmod.Register(SubModuleName, 4, "invalid channel") + ErrInvalidChannelState = errorsmod.Register(SubModuleName, 5, "invalid channel state") + ErrInvalidChannelOrdering = errorsmod.Register(SubModuleName, 6, "invalid channel ordering") + ErrInvalidCounterparty = errorsmod.Register(SubModuleName, 7, "invalid counterparty channel") + ErrSequenceSendNotFound = errorsmod.Register(SubModuleName, 10, "sequence send not found") + ErrSequenceReceiveNotFound = errorsmod.Register(SubModuleName, 11, "sequence receive not found") + ErrSequenceAckNotFound = errorsmod.Register(SubModuleName, 12, "sequence acknowledgement not found") + ErrInvalidPacket = errorsmod.Register(SubModuleName, 13, "invalid packet") // Deprecated: ErrPacketTimeout is deprecated and will be removed in a future release. // Please use ErrTimeoutElapsed instead. diff --git a/modules/core/04-channel/types/expected_keepers.go b/modules/core/04-channel/types/expected_keepers.go index 47ff95e4685..dfe2a5552ea 100644 --- a/modules/core/04-channel/types/expected_keepers.go +++ b/modules/core/04-channel/types/expected_keepers.go @@ -1,9 +1,8 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -11,18 +10,18 @@ import ( // ClientKeeper expected account IBC client keeper type ClientKeeper interface { - GetClientStatus(ctx sdk.Context, clientID string) exported.Status - GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) - GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) - GetClientLatestHeight(ctx sdk.Context, clientID string) clienttypes.Height - GetClientTimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) + GetClientStatus(ctx context.Context, clientID string) exported.Status + GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) + GetClientConsensusState(ctx context.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) + GetClientLatestHeight(ctx context.Context, clientID string) clienttypes.Height + GetClientTimestampAtHeight(ctx context.Context, clientID string, height exported.Height) (uint64, error) } // ConnectionKeeper expected account IBC connection keeper type ConnectionKeeper interface { - GetConnection(ctx sdk.Context, connectionID string) (connectiontypes.ConnectionEnd, bool) + GetConnection(ctx context.Context, connectionID string) (connectiontypes.ConnectionEnd, bool) VerifyChannelState( - ctx sdk.Context, + ctx context.Context, connection connectiontypes.ConnectionEnd, height exported.Height, proof []byte, @@ -31,7 +30,7 @@ type ConnectionKeeper interface { channel Channel, ) error VerifyPacketCommitment( - ctx sdk.Context, + ctx context.Context, connection connectiontypes.ConnectionEnd, height exported.Height, proof []byte, @@ -41,7 +40,7 @@ type ConnectionKeeper interface { commitmentBytes []byte, ) error VerifyPacketAcknowledgement( - ctx sdk.Context, + ctx context.Context, connection connectiontypes.ConnectionEnd, height exported.Height, proof []byte, @@ -51,7 +50,7 @@ type ConnectionKeeper interface { acknowledgement []byte, ) error VerifyPacketReceiptAbsence( - ctx sdk.Context, + ctx context.Context, connection connectiontypes.ConnectionEnd, height exported.Height, proof []byte, @@ -60,7 +59,7 @@ type ConnectionKeeper interface { sequence uint64, ) error VerifyNextSequenceRecv( - ctx sdk.Context, + ctx context.Context, connection connectiontypes.ConnectionEnd, height exported.Height, proof []byte, @@ -69,7 +68,7 @@ type ConnectionKeeper interface { nextSequenceRecv uint64, ) error VerifyChannelUpgrade( - ctx sdk.Context, + ctx context.Context, connection connectiontypes.ConnectionEnd, height exported.Height, proof []byte, @@ -78,7 +77,7 @@ type ConnectionKeeper interface { upgrade Upgrade, ) error VerifyChannelUpgradeError( - ctx sdk.Context, + ctx context.Context, connection connectiontypes.ConnectionEnd, height exported.Height, proof []byte, @@ -87,8 +86,3 @@ type ConnectionKeeper interface { errorReceipt ErrorReceipt, ) error } - -// PortKeeper expected account IBC port keeper -type PortKeeper interface { - Authenticate(ctx sdk.Context, key *capabilitytypes.Capability, portID string) bool -} diff --git a/modules/core/05-port/keeper/keeper.go b/modules/core/05-port/keeper/keeper.go index c6310ed3d4c..a35288a48c1 100644 --- a/modules/core/05-port/keeper/keeper.go +++ b/modules/core/05-port/keeper/keeper.go @@ -1,89 +1,47 @@ package keeper import ( - "fmt" + "context" + "strings" "cosmossdk.io/log" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // Keeper defines the IBC connection keeper type Keeper struct { Router *types.Router - - scopedKeeper exported.ScopedKeeper } // NewKeeper creates a new IBC connection Keeper instance -func NewKeeper(sck exported.ScopedKeeper) *Keeper { - return &Keeper{ - scopedKeeper: sck, - } +func NewKeeper() *Keeper { + return &Keeper{} } // Logger returns a module-specific logger. -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) -} - -// IsBound checks a given port ID is already bounded. -func (k *Keeper) IsBound(ctx sdk.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } -// BindPort binds to a port and returns the associated capability. -// Ports must be bound statically when the chain starts in `app.go`. -// The capability must then be passed to a module which will need to pass -// it as an extra parameter when calling functions on the IBC module. -func (k *Keeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability { - if err := host.PortIdentifierValidator(portID); err != nil { - panic(err.Error()) - } - - if k.IsBound(ctx, portID) { - panic(fmt.Errorf("port %s is already bound", portID)) - } - - key, err := k.scopedKeeper.NewCapability(ctx, host.PortPath(portID)) - if err != nil { - panic(err.Error()) - } - - k.Logger(ctx).Info("port binded", "port", portID) - return key -} +// Route returns a IBCModule for a given module, and a boolean indicating +// whether or not the route is present. +func (k *Keeper) Route(module string) (types.IBCModule, bool) { + routes, ok := k.Router.Route(module) -// Authenticate authenticates a capability key against a port ID -// by checking if the memory address of the capability was previously -// generated and bound to the port (provided as a parameter) which the capability -// is being authenticated against. -func (k *Keeper) Authenticate(ctx sdk.Context, key *capabilitytypes.Capability, portID string) bool { - if err := host.PortIdentifierValidator(portID); err != nil { - panic(err.Error()) + if ok { + return routes, true } - return k.scopedKeeper.AuthenticateCapability(ctx, key, host.PortPath(portID)) -} - -// LookupModuleByPort will return the IBCModule along with the capability associated with a given portID -func (k *Keeper) LookupModuleByPort(ctx sdk.Context, portID string) (string, *capabilitytypes.Capability, error) { - modules, capability, err := k.scopedKeeper.LookupModules(ctx, host.PortPath(portID)) - if err != nil { - return "", nil, err + for _, prefix := range k.Router.Keys() { + if strings.Contains(module, prefix) { + return k.Router.Route(prefix) + } } - return types.GetModuleOwner(modules), capability, nil -} - -// Route returns a IBCModule for a given module, and a boolean indicating -// whether or not the route is present. -func (k *Keeper) Route(module string) (types.IBCModule, bool) { - return k.Router.GetRoute(module) + return nil, false } diff --git a/modules/core/05-port/keeper/keeper_test.go b/modules/core/05-port/keeper/keeper_test.go index 8856a7e4a07..541ce96f462 100644 --- a/modules/core/05-port/keeper/keeper_test.go +++ b/modules/core/05-port/keeper/keeper_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/require" testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,11 +11,6 @@ import ( "github.com/cosmos/ibc-go/v9/testing/simapp" ) -var ( - validPort = "validportid" - invalidPort = "(invalidPortID)" -) - type KeeperTestSuite struct { testifysuite.Suite @@ -35,42 +29,3 @@ func (suite *KeeperTestSuite) SetupTest() { func TestKeeperTestSuite(t *testing.T) { testifysuite.Run(t, new(KeeperTestSuite)) } - -func (suite *KeeperTestSuite) TestBind() { - // Test that invalid portID causes panic - require.Panics(suite.T(), func() { suite.keeper.BindPort(suite.ctx, invalidPort) }, "Did not panic on invalid portID") - - // Test that valid BindPort returns capability key - capKey := suite.keeper.BindPort(suite.ctx, validPort) - require.NotNil(suite.T(), capKey, "capabilityKey is nil on valid BindPort") - - isBound := suite.keeper.IsBound(suite.ctx, validPort) - require.True(suite.T(), isBound, "port is bound successfully") - - isNotBound := suite.keeper.IsBound(suite.ctx, "not-a-port") - require.False(suite.T(), isNotBound, "port is not bound") - - // Test that rebinding the same portid causes panic - require.Panics(suite.T(), func() { suite.keeper.BindPort(suite.ctx, validPort) }, "did not panic on re-binding the same port") -} - -func (suite *KeeperTestSuite) TestAuthenticate() { - capKey := suite.keeper.BindPort(suite.ctx, validPort) - - // Require that passing in invalid portID causes panic - require.Panics(suite.T(), func() { suite.keeper.Authenticate(suite.ctx, capKey, invalidPort) }, "did not panic on invalid portID") - - // Valid authentication should return true - auth := suite.keeper.Authenticate(suite.ctx, capKey, validPort) - require.True(suite.T(), auth, "valid authentication failed") - - // Test that authenticating against incorrect portid fails - auth = suite.keeper.Authenticate(suite.ctx, capKey, "wrongportid") - require.False(suite.T(), auth, "invalid authentication failed") - - // Test that authenticating port against different valid - // capability key fails - capKey2 := suite.keeper.BindPort(suite.ctx, "otherportid") - auth = suite.keeper.Authenticate(suite.ctx, capKey2, validPort) - require.False(suite.T(), auth, "invalid authentication for different capKey failed") -} diff --git a/modules/core/05-port/types/module.go b/modules/core/05-port/types/module.go index d1afbf5820e..cc7915bb6b0 100644 --- a/modules/core/05-port/types/module.go +++ b/modules/core/05-port/types/module.go @@ -1,9 +1,10 @@ package types import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -23,12 +24,11 @@ type IBCModule interface { // If there is no default version string for the application, // it should return an error if provided version is empty string. OnChanOpenInit( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, - channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) @@ -42,12 +42,11 @@ type IBCModule interface { // must select the final version string and return it to core IBC. // OnChanOpenTry may also perform custom initialization logic OnChanOpenTry( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, - channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (version string, err error) @@ -55,7 +54,7 @@ type IBCModule interface { // OnChanOpenAck will error if the counterparty selected version string // is invalid to abort the handshake. It may also perform custom ACK logic. OnChanOpenAck( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyChannelID string, @@ -64,19 +63,19 @@ type IBCModule interface { // OnChanOpenConfirm will perform custom CONFIRM logic and may error to abort the handshake. OnChanOpenConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error OnChanCloseInit( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error OnChanCloseConfirm( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error @@ -87,14 +86,14 @@ type IBCModule interface { // otherwise the application state changes are discarded. In either case the packet is received // and the acknowledgement is written (in synchronous cases). OnRecvPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) exported.Acknowledgement OnAcknowledgementPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, @@ -102,7 +101,7 @@ type IBCModule interface { ) error OnTimeoutPacket( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, @@ -118,7 +117,7 @@ type UpgradableModule interface { // NOTE: in the case of crossing hellos, this callback may be executed on both chains. // NOTE: Any IBC application state changes made in this callback handler are not committed. OnChanUpgradeInit( - ctx sdk.Context, + ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, @@ -130,7 +129,7 @@ type UpgradableModule interface { // and connection hops. // NOTE: Any IBC application state changes made in this callback handler are not committed. OnChanUpgradeTry( - ctx sdk.Context, + ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, @@ -141,7 +140,7 @@ type UpgradableModule interface { // channel upgrade handshake. It must validate the version proposed by the counterparty. // NOTE: Any IBC application state changes made in this callback handler are not committed. OnChanUpgradeAck( - ctx sdk.Context, + ctx context.Context, portID, channelID, counterpartyVersion string, @@ -151,7 +150,7 @@ type UpgradableModule interface { // has returned to the OPEN state. Any logic associated with changing of the channel fields should be performed // in this callback. OnChanUpgradeOpen( - ctx sdk.Context, + ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, @@ -163,8 +162,7 @@ type UpgradableModule interface { // ICS4Wrapper implements the ICS4 interfaces that IBC applications use to send packets and acknowledgements. type ICS4Wrapper interface { SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, @@ -173,14 +171,13 @@ type ICS4Wrapper interface { ) (sequence uint64, err error) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet exported.PacketI, ack exported.Acknowledgement, ) error GetAppVersion( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) (string, bool) @@ -199,5 +196,5 @@ type PacketDataUnmarshaler interface { // UnmarshalPacketData unmarshals the packet data into a concrete type // ctx, portID, channelID are provided as arguments, so that (if needed) // the packet data can be unmarshaled based on the channel version. - UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) + UnmarshalPacketData(ctx context.Context, portID string, channelID string, bz []byte) (interface{}, string, error) } diff --git a/modules/core/05-port/types/router.go b/modules/core/05-port/types/router.go index b66999644f5..5c7014526f4 100644 --- a/modules/core/05-port/types/router.go +++ b/modules/core/05-port/types/router.go @@ -3,6 +3,7 @@ package types import ( "errors" "fmt" + "sort" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -57,10 +58,22 @@ func (rtr *Router) HasRoute(module string) bool { return ok } -// GetRoute returns a IBCModule for a given module. -func (rtr *Router) GetRoute(module string) (IBCModule, bool) { +// Route returns a IBCModule for a given module. +func (rtr *Router) Route(module string) (IBCModule, bool) { if !rtr.HasRoute(module) { return nil, false } return rtr.routes[module], true } + +// Keys returns the keys of the routes map. +func (rtr *Router) Keys() []string { + keys := make([]string, 0, len(rtr.routes)) + + for k := range rtr.routes { + keys = append(keys, k) + } + + sort.Strings(keys) + return keys +} diff --git a/modules/core/05-port/types/utils.go b/modules/core/05-port/types/utils.go deleted file mode 100644 index f3c51d3bdf3..00000000000 --- a/modules/core/05-port/types/utils.go +++ /dev/null @@ -1,17 +0,0 @@ -package types - -import "fmt" - -// GetModuleOwner enforces that only IBC and the module bound to port can own the capability -// while future implementations may allow multiple modules to bind to a port, currently we -// only allow one module to be bound to a port at any given time -func GetModuleOwner(modules []string) string { - if len(modules) != 2 { - panic(fmt.Errorf("capability should only be owned by port or channel owner and ibc module, multiple owners currently not supported, owners: %v", modules)) - } - - if modules[0] == "ibc" { - return modules[1] - } - return modules[0] -} diff --git a/modules/core/23-commitment/types/merkle_test.go b/modules/core/23-commitment/types/merkle_test.go index 89bfd272013..dd1ec4e6172 100644 --- a/modules/core/23-commitment/types/merkle_test.go +++ b/modules/core/23-commitment/types/merkle_test.go @@ -67,10 +67,10 @@ func (suite *MerkleTestSuite) TestVerifyMembership() { err := proof.VerifyMembership(types.GetSDKSpecs(), &root, path, tc.value) if tc.shouldPass { - //nolint: scopelint + // nolint: scopelint suite.Require().NoError(err, "test case %d should have passed", i) } else { - //nolint: scopelint + // nolint: scopelint suite.Require().Error(err, "test case %d should have failed", i) } }) @@ -131,10 +131,10 @@ func (suite *MerkleTestSuite) TestVerifyNonMembership() { err := proof.VerifyNonMembership(types.GetSDKSpecs(), &root, path) if tc.shouldPass { - //nolint: scopelint + // nolint: scopelint suite.Require().NoError(err, "test case %d should have passed", i) } else { - //nolint: scopelint + // nolint: scopelint suite.Require().Error(err, "test case %d should have failed", i) } }) diff --git a/modules/core/24-host/channel_keys.go b/modules/core/24-host/channel_keys.go index 2edf9a9ea9e..49eed183c25 100644 --- a/modules/core/24-host/channel_keys.go +++ b/modules/core/24-host/channel_keys.go @@ -5,13 +5,12 @@ import "fmt" var KeyChannelStorePrefix = []byte("channels") const ( - KeyChannelEndPrefix = "channelEnds" - KeyChannelPrefix = "channels" - KeyChannelUpgradePrefix = "channelUpgrades" - KeyUpgradePrefix = "upgrades" - KeyUpgradeErrorPrefix = "upgradeError" - KeyCounterpartyUpgrade = "counterpartyUpgrade" - KeyChannelCapabilityPrefix = "capabilities" + KeyChannelEndPrefix = "channelEnds" + KeyChannelPrefix = "channels" + KeyChannelUpgradePrefix = "channelUpgrades" + KeyUpgradePrefix = "upgrades" + KeyUpgradeErrorPrefix = "upgradeError" + KeyCounterpartyUpgrade = "counterpartyUpgrade" ) // ICS04 @@ -22,12 +21,6 @@ func ChannelKey(portID, channelID string) []byte { return []byte(fmt.Sprintf("%s/%s", KeyChannelEndPrefix, channelPath(portID, channelID))) } -// ChannelCapabilityPath defines the path under which capability keys associated -// with a channel are stored -func ChannelCapabilityPath(portID, channelID string) string { - return fmt.Sprintf("%s/%s", KeyChannelCapabilityPrefix, channelPath(portID, channelID)) -} - // ChannelUpgradeErrorKey returns the store key for a particular channelEnd used to stor the ErrorReceipt in the case that a chain does not accept the proposed upgrade func ChannelUpgradeErrorKey(portID, channelID string) []byte { return []byte(fmt.Sprintf("%s/%s/%s", KeyChannelUpgradePrefix, KeyUpgradeErrorPrefix, channelPath(portID, channelID))) diff --git a/modules/core/24-host/port_keys.go b/modules/core/24-host/port_keys.go index 9bd720065c2..22293282d8a 100644 --- a/modules/core/24-host/port_keys.go +++ b/modules/core/24-host/port_keys.go @@ -1,15 +1,8 @@ package host -import "fmt" - const ( KeyPortPrefix = "ports" ) // ICS05 // The following paths are the keys to the store as defined in https://github.com/cosmos/ibc/tree/master/spec/core/ics-005-port-allocation#store-paths - -// PortPath defines the path under which ports paths are stored on the capability module -func PortPath(portID string) string { - return fmt.Sprintf("%s/%s", KeyPortPrefix, portID) -} diff --git a/modules/core/ante/ante.go b/modules/core/ante/ante.go index 2d08ba0db16..243a25f7442 100644 --- a/modules/core/ante/ante.go +++ b/modules/core/ante/ante.go @@ -108,16 +108,10 @@ func (rrd RedundantRelayDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula // recvPacketCheckTx runs a subset of ibc recv packet logic to be used specifically within the RedundantRelayDecorator AnteHandler. // It only performs core IBC receiving logic and skips any application logic. func (rrd RedundantRelayDecorator) recvPacketCheckTx(ctx sdk.Context, msg *channeltypes.MsgRecvPacket) (*channeltypes.MsgRecvPacketResponse, error) { - // grab channel capability - _, capability, err := rrd.k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.DestinationPort, msg.Packet.DestinationChannel) - if err != nil { - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - // If the packet was already received, perform a no-op // Use a cached context to prevent accidental state changes cacheCtx, writeFn := ctx.CacheContext() - _, err = rrd.k.ChannelKeeper.RecvPacket(cacheCtx, capability, msg.Packet, msg.ProofCommitment, msg.ProofHeight) + _, err := rrd.k.ChannelKeeper.RecvPacket(cacheCtx, msg.Packet, msg.ProofCommitment, msg.ProofHeight) switch err { case nil: diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 1757d3d3534..1543e5803f4 100644 --- a/modules/core/ante/ante_test.go +++ b/modules/core/ante/ante_test.go @@ -1,6 +1,7 @@ package ante_test import ( + "context" "fmt" "testing" @@ -10,7 +11,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" @@ -351,7 +351,7 @@ func (suite *AnteTestSuite) TestAnteDecoratorCheckTx() { "success on app callback error, app callbacks are skipped for performance", func(suite *AnteTestSuite) []sdk.Msg { suite.chainB.GetSimApp().IBCMockModule.IBCApp.OnRecvPacket = func( - ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) exported.Acknowledgement { panic(fmt.Errorf("failed OnRecvPacket mock callback")) } @@ -503,15 +503,6 @@ func (suite *AnteTestSuite) TestAnteDecoratorCheckTx() { }, channeltypes.ErrRedundantTx, }, - { - "no success on recvPacket checkTx, no capability found", - func(suite *AnteTestSuite) []sdk.Msg { - msg := suite.createRecvPacketMessage(false) - msg.Packet.DestinationPort = "invalid-port" - return []sdk.Msg{msg} - }, - capabilitytypes.ErrCapabilityNotFound, - }, } for _, tc := range testCases { @@ -587,7 +578,7 @@ func (suite *AnteTestSuite) TestAnteDecoratorReCheckTx() { "success on app callback error, app callbacks are skipped for performance", func(suite *AnteTestSuite) []sdk.Msg { suite.chainB.GetSimApp().IBCMockModule.IBCApp.OnRecvPacket = func( - ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) exported.Acknowledgement { panic(fmt.Errorf("failed OnRecvPacket mock callback")) } diff --git a/modules/core/exported/client.go b/modules/core/exported/client.go index 98f18b83a04..5a0e2084af6 100644 --- a/modules/core/exported/client.go +++ b/modules/core/exported/client.go @@ -1,9 +1,9 @@ package exported import ( - "github.com/cosmos/gogoproto/proto" + "context" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" ) // Status represents the status of a client @@ -44,29 +44,29 @@ type LightClientModule interface { // Initialize is called upon client creation, it allows the client to perform validation on the client state and initial consensus state. // The light client module is responsible for setting any client-specific data in the store. This includes the client state, // initial consensus state and any associated metadata. - Initialize(ctx sdk.Context, clientID string, clientState, consensusState []byte) error + Initialize(ctx context.Context, clientID string, clientState, consensusState []byte) error // VerifyClientMessage must verify a ClientMessage. A ClientMessage could be a Header, Misbehaviour, or batch update. // It must handle each type of ClientMessage appropriately. Calls to CheckForMisbehaviour, UpdateState, and UpdateStateOnMisbehaviour // will assume that the content of the ClientMessage has been verified and can be trusted. An error should be returned // if the ClientMessage fails to verify. - VerifyClientMessage(ctx sdk.Context, clientID string, clientMsg ClientMessage) error + VerifyClientMessage(ctx context.Context, clientID string, clientMsg ClientMessage) error // Checks for evidence of a misbehaviour in Header or Misbehaviour type. It assumes the ClientMessage // has already been verified. - CheckForMisbehaviour(ctx sdk.Context, clientID string, clientMsg ClientMessage) bool + CheckForMisbehaviour(ctx context.Context, clientID string, clientMsg ClientMessage) bool // UpdateStateOnMisbehaviour should perform appropriate state changes on a client state given that misbehaviour has been detected and verified - UpdateStateOnMisbehaviour(ctx sdk.Context, clientID string, clientMsg ClientMessage) + UpdateStateOnMisbehaviour(ctx context.Context, clientID string, clientMsg ClientMessage) // UpdateState updates and stores as necessary any associated information for an IBC client, such as the ClientState and corresponding ConsensusState. // Upon successful update, a list of consensus heights is returned. It assumes the ClientMessage has already been verified. - UpdateState(ctx sdk.Context, clientID string, clientMsg ClientMessage) []Height + UpdateState(ctx context.Context, clientID string, clientMsg ClientMessage) []Height // VerifyMembership is a generic proof verification method which verifies a proof of the existence of a value at a given CommitmentPath at the specified height. // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). VerifyMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height Height, delayTimePeriod uint64, @@ -79,7 +79,7 @@ type LightClientModule interface { // VerifyNonMembership is a generic proof verification method which verifies the absence of a given CommitmentPath at a specified height. // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). VerifyNonMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height Height, delayTimePeriod uint64, @@ -89,21 +89,21 @@ type LightClientModule interface { ) error // Status must return the status of the client. Only Active clients are allowed to process packets. - Status(ctx sdk.Context, clientID string) Status + Status(ctx context.Context, clientID string) Status // LatestHeight returns the latest height of the client. If no client is present for the provided client identifier a zero value height may be returned. - LatestHeight(ctx sdk.Context, clientID string) Height + LatestHeight(ctx context.Context, clientID string) Height // TimestampAtHeight must return the timestamp for the consensus state associated with the provided height. TimestampAtHeight( - ctx sdk.Context, + ctx context.Context, clientID string, height Height, ) (uint64, error) // RecoverClient must verify that the provided substitute may be used to update the subject client. // The light client module must set the updated client and consensus states within the clientStore for the subject client. - RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error + RecoverClient(ctx context.Context, clientID, substituteClientID string) error // Upgrade functions // NOTE: proof heights are not included as upgrade to a new revision is expected to pass only on the last @@ -113,7 +113,7 @@ type LightClientModule interface { // may be cancelled or modified before the last planned height. // If the upgrade is verified, the upgraded client and consensus states must be set in the client store. VerifyUpgradeAndUpdateState( - ctx sdk.Context, + ctx context.Context, clientID string, newClient []byte, newConsState []byte, diff --git a/modules/core/exported/expected_keepers.go b/modules/core/exported/expected_keepers.go deleted file mode 100644 index f1496c7f2b2..00000000000 --- a/modules/core/exported/expected_keepers.go +++ /dev/null @@ -1,16 +0,0 @@ -package exported - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" -) - -// ScopedKeeper defines the expected x/capability scoped keeper interface -type ScopedKeeper interface { - NewCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, error) - GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool) - AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool - LookupModules(ctx sdk.Context, name string) ([]string, *capabilitytypes.Capability, error) - ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error -} diff --git a/modules/core/keeper/expected_keeper.go b/modules/core/keeper/expected_keeper.go index 31b2ca2cdb5..0f2320dd488 100644 --- a/modules/core/keeper/expected_keeper.go +++ b/modules/core/keeper/expected_keeper.go @@ -1,31 +1,27 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) type PacketHandler interface { RecvPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet channeltypes.Packet, proof []byte, proofHeight exported.Height) (string, error) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet exported.PacketI, acknowledgement exported.Acknowledgement, ) error AcknowledgePacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet channeltypes.Packet, acknowledgement []byte, proof []byte, @@ -33,8 +29,7 @@ type PacketHandler interface { ) (string, error) TimeoutPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet channeltypes.Packet, proof []byte, proofHeight exported.Height, diff --git a/modules/core/keeper/keeper.go b/modules/core/keeper/keeper.go index 49b6009ea79..665a43ee096 100644 --- a/modules/core/keeper/keeper.go +++ b/modules/core/keeper/keeper.go @@ -5,11 +5,10 @@ import ( "reflect" "strings" - storetypes "cosmossdk.io/store/types" + corestore "cosmossdk.io/core/store" "github.com/cosmos/cosmos-sdk/codec" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" clientkeeper "github.com/cosmos/ibc-go/v9/modules/core/02-client/keeper" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectionkeeper "github.com/cosmos/ibc-go/v9/modules/core/03-connection/keeper" @@ -35,28 +34,23 @@ type Keeper struct { // NewKeeper creates a new ibc Keeper func NewKeeper( - cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace types.ParamSubspace, - upgradeKeeper clienttypes.UpgradeKeeper, - scopedKeeper capabilitykeeper.ScopedKeeper, authority string, + cdc codec.BinaryCodec, storeService corestore.KVStoreService, paramSpace types.ParamSubspace, + upgradeKeeper clienttypes.UpgradeKeeper, authority string, ) *Keeper { // panic if any of the keepers passed in is empty if isEmpty(upgradeKeeper) { panic(errors.New("cannot initialize IBC keeper: empty upgrade keeper")) } - if reflect.DeepEqual(capabilitykeeper.ScopedKeeper{}, scopedKeeper) { - panic(errors.New("cannot initialize IBC keeper: empty scoped keeper")) - } - if strings.TrimSpace(authority) == "" { panic(errors.New("authority must be non-empty")) } - clientKeeper := clientkeeper.NewKeeper(cdc, key, paramSpace, upgradeKeeper) - connectionKeeper := connectionkeeper.NewKeeper(cdc, key, paramSpace, clientKeeper) - portKeeper := portkeeper.NewKeeper(scopedKeeper) - channelKeeper := channelkeeper.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper) - packetKeeper := packetserver.NewKeeper(cdc, key, channelKeeper, clientKeeper) + clientKeeper := clientkeeper.NewKeeper(cdc, storeService, paramSpace, upgradeKeeper) + connectionKeeper := connectionkeeper.NewKeeper(cdc, storeService, paramSpace, clientKeeper) + portKeeper := portkeeper.NewKeeper() + channelKeeper := channelkeeper.NewKeeper(cdc, storeService, clientKeeper, connectionKeeper) + packetKeeper := packetserver.NewKeeper(cdc, storeService, channelKeeper, clientKeeper) return &Keeper{ cdc: cdc, diff --git a/modules/core/keeper/keeper_test.go b/modules/core/keeper/keeper_test.go index ff7fb8b8f11..f03bd02a0c9 100644 --- a/modules/core/keeper/keeper_test.go +++ b/modules/core/keeper/keeper_test.go @@ -7,7 +7,8 @@ import ( upgradekeeper "cosmossdk.io/x/upgrade/keeper" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + "github.com/cosmos/cosmos-sdk/runtime" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper" @@ -44,7 +45,6 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *KeeperTestSuite) TestNewKeeper() { var ( upgradeKeeper clienttypes.UpgradeKeeper - scopedKeeper capabilitykeeper.ScopedKeeper newIBCKeeperFn func() ) @@ -63,19 +63,13 @@ func (suite *KeeperTestSuite) TestNewKeeper() { upgradeKeeper = emptyUpgradeKeeperPointer }, false}, - {"failure: empty scoped keeper", func() { - emptyScopedKeeper := capabilitykeeper.ScopedKeeper{} - - scopedKeeper = emptyScopedKeeper - }, false}, {"failure: empty authority", func() { newIBCKeeperFn = func() { ibckeeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.GetSimApp().GetSubspace(ibcexported.ModuleName), upgradeKeeper, - scopedKeeper, "", // authority ) } @@ -91,16 +85,14 @@ func (suite *KeeperTestSuite) TestNewKeeper() { newIBCKeeperFn = func() { ibckeeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), + runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.GetSimApp().GetSubspace(ibcexported.ModuleName), upgradeKeeper, - scopedKeeper, suite.chainA.App.GetIBCKeeper().GetAuthority(), ) } upgradeKeeper = suite.chainA.GetSimApp().UpgradeKeeper - scopedKeeper = suite.chainA.GetSimApp().ScopedIBCKeeper tc.malleate() diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index b80ed4d9493..29f0ad19597 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -226,24 +226,16 @@ func (k *Keeper) ConnectionOpenConfirm(goCtx context.Context, msg *connectiontyp func (k *Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgChannelOpenInit) (*channeltypes.MsgChannelOpenInitResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Lookup module by port capability - module, portCap, err := k.PortKeeper.LookupModuleByPort(ctx, msg.PortId) - if err != nil { - ctx.Logger().Error("channel open init failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - // Retrieve application callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel open init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel open init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } // Perform 04-channel verification - channelID, capability, err := k.ChannelKeeper.ChanOpenInit( - ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, - portCap, msg.Channel.Counterparty, msg.Channel.Version, + channelID, err := k.ChannelKeeper.ChanOpenInit( + ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, msg.Channel.Counterparty, msg.Channel.Version, ) if err != nil { ctx.Logger().Error("channel open init failed", "error", errorsmod.Wrap(err, "channel handshake open init failed")) @@ -251,7 +243,7 @@ func (k *Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgCha } // Perform application logic callback - version, err := cbs.OnChanOpenInit(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, capability, msg.Channel.Counterparty, msg.Channel.Version) + version, err := cbs.OnChanOpenInit(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, msg.Channel.Counterparty, msg.Channel.Version) if err != nil { ctx.Logger().Error("channel open init failed", "port-id", msg.PortId, "channel-id", channelID, "error", errorsmod.Wrap(err, "channel open init callback failed")) return nil, errorsmod.Wrapf(err, "channel open init callback failed for port ID: %s, channel ID: %s", msg.PortId, channelID) @@ -274,31 +266,22 @@ func (k *Keeper) ChannelOpenInit(goCtx context.Context, msg *channeltypes.MsgCha func (k *Keeper) ChannelOpenTry(goCtx context.Context, msg *channeltypes.MsgChannelOpenTry) (*channeltypes.MsgChannelOpenTryResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Lookup module by port capability - module, portCap, err := k.PortKeeper.LookupModuleByPort(ctx, msg.PortId) - if err != nil { - ctx.Logger().Error("channel open try failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - // Retrieve application callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel open try failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel open try failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } // Perform 04-channel verification - channelID, capability, err := k.ChannelKeeper.ChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, - portCap, msg.Channel.Counterparty, msg.CounterpartyVersion, msg.ProofInit, msg.ProofHeight, - ) + channelID, err := k.ChannelKeeper.ChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, msg.Channel.Counterparty, msg.CounterpartyVersion, msg.ProofInit, msg.ProofHeight) if err != nil { ctx.Logger().Error("channel open try failed", "error", errorsmod.Wrap(err, "channel handshake open try failed")) return nil, errorsmod.Wrap(err, "channel handshake open try failed") } // Perform application logic callback - version, err := cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, capability, msg.Channel.Counterparty, msg.CounterpartyVersion) + version, err := cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, msg.Channel.Counterparty, msg.CounterpartyVersion) if err != nil { ctx.Logger().Error("channel open try failed", "port-id", msg.PortId, "channel-id", channelID, "error", errorsmod.Wrap(err, "channel open try callback failed")) return nil, errorsmod.Wrapf(err, "channel open try callback failed for port ID: %s, channel ID: %s", msg.PortId, channelID) @@ -321,23 +304,16 @@ func (k *Keeper) ChannelOpenTry(goCtx context.Context, msg *channeltypes.MsgChan func (k *Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChannelOpenAck) (*channeltypes.MsgChannelOpenAckResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Lookup module by channel capability - module, capability, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel open ack failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - // Retrieve application callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel open ack failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel open ack failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } // Perform 04-channel verification - if err = k.ChannelKeeper.ChanOpenAck( - ctx, msg.PortId, msg.ChannelId, capability, msg.CounterpartyVersion, msg.CounterpartyChannelId, msg.ProofTry, msg.ProofHeight, + if err := k.ChannelKeeper.ChanOpenAck( + ctx, msg.PortId, msg.ChannelId, msg.CounterpartyVersion, msg.CounterpartyChannelId, msg.ProofTry, msg.ProofHeight, ); err != nil { ctx.Logger().Error("channel open ack failed", "error", err.Error()) return nil, errorsmod.Wrap(err, "channel handshake open ack failed") @@ -347,7 +323,7 @@ func (k *Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChan k.ChannelKeeper.WriteOpenAckChannel(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyVersion, msg.CounterpartyChannelId) // Perform application logic callback - if err = cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelId, msg.CounterpartyVersion); err != nil { + if err := cbs.OnChanOpenAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelId, msg.CounterpartyVersion); err != nil { ctx.Logger().Error("channel open ack failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", errorsmod.Wrap(err, "channel open ack callback failed")) return nil, errorsmod.Wrapf(err, "channel open ack callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } @@ -363,22 +339,15 @@ func (k *Keeper) ChannelOpenAck(goCtx context.Context, msg *channeltypes.MsgChan func (k *Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.MsgChannelOpenConfirm) (*channeltypes.MsgChannelOpenConfirmResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Lookup module by channel capability - module, capability, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel open confirm failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - // Retrieve application callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel open confirm failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel open confirm failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } // Perform 04-channel verification - if err = k.ChannelKeeper.ChanOpenConfirm(ctx, msg.PortId, msg.ChannelId, capability, msg.ProofAck, msg.ProofHeight); err != nil { + if err := k.ChannelKeeper.ChanOpenConfirm(ctx, msg.PortId, msg.ChannelId, msg.ProofAck, msg.ProofHeight); err != nil { ctx.Logger().Error("channel open confirm failed", "error", errorsmod.Wrap(err, "channel handshake open confirm failed")) return nil, errorsmod.Wrap(err, "channel handshake open confirm failed") } @@ -387,7 +356,7 @@ func (k *Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.Msg k.ChannelKeeper.WriteOpenConfirmChannel(ctx, msg.PortId, msg.ChannelId) // Perform application logic callback - if err = cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { + if err := cbs.OnChanOpenConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { ctx.Logger().Error("channel open confirm failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", errorsmod.Wrap(err, "channel open confirm callback failed")) return nil, errorsmod.Wrapf(err, "channel open confirm callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } @@ -401,26 +370,19 @@ func (k *Keeper) ChannelOpenConfirm(goCtx context.Context, msg *channeltypes.Msg func (k *Keeper) ChannelCloseInit(goCtx context.Context, msg *channeltypes.MsgChannelCloseInit) (*channeltypes.MsgChannelCloseInitResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Lookup module by channel capability - module, capability, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel close init failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - // Retrieve callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel close init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel close init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } - if err = cbs.OnChanCloseInit(ctx, msg.PortId, msg.ChannelId); err != nil { + if err := cbs.OnChanCloseInit(ctx, msg.PortId, msg.ChannelId); err != nil { ctx.Logger().Error("channel close init failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", errorsmod.Wrap(err, "channel close init callback failed")) return nil, errorsmod.Wrapf(err, "channel close init callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } - err = k.ChannelKeeper.ChanCloseInit(ctx, msg.PortId, msg.ChannelId, capability) + err := k.ChannelKeeper.ChanCloseInit(ctx, msg.PortId, msg.ChannelId) if err != nil { ctx.Logger().Error("channel close init failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", err.Error()) return nil, errorsmod.Wrap(err, "channel handshake close init failed") @@ -435,26 +397,19 @@ func (k *Keeper) ChannelCloseInit(goCtx context.Context, msg *channeltypes.MsgCh func (k *Keeper) ChannelCloseConfirm(goCtx context.Context, msg *channeltypes.MsgChannelCloseConfirm) (*channeltypes.MsgChannelCloseConfirmResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Lookup module by channel capability - module, capability, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel close confirm failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - // Retrieve callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel close confirm failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel close confirm failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } - if err = cbs.OnChanCloseConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { + if err := cbs.OnChanCloseConfirm(ctx, msg.PortId, msg.ChannelId); err != nil { ctx.Logger().Error("channel close confirm failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", errorsmod.Wrap(err, "channel close confirm callback failed")) return nil, errorsmod.Wrapf(err, "channel close confirm callback failed for port ID: %s, channel ID: %s", msg.PortId, msg.ChannelId) } - err = k.ChannelKeeper.ChanCloseConfirm(ctx, msg.PortId, msg.ChannelId, capability, msg.ProofInit, msg.ProofHeight, msg.CounterpartyUpgradeSequence) + err := k.ChannelKeeper.ChanCloseConfirm(ctx, msg.PortId, msg.ChannelId, msg.ProofInit, msg.ProofHeight, msg.CounterpartyUpgradeSequence) if err != nil { ctx.Logger().Error("channel close confirm failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", err.Error()) return nil, errorsmod.Wrap(err, "channel handshake close confirm failed") @@ -467,11 +422,7 @@ func (k *Keeper) ChannelCloseConfirm(goCtx context.Context, msg *channeltypes.Ms // RecvPacket defines a rpc handler method for MsgRecvPacket. func (k *Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPacket) (*channeltypes.MsgRecvPacketResponse, error) { - var ( - packetHandler PacketHandler - module string - capability *capabilitytypes.Capability - ) + var packetHandler PacketHandler ctx := sdk.UnwrapSDKContext(goCtx) relayer, err := sdk.AccAddressFromBech32(msg.Signer) @@ -480,17 +431,17 @@ func (k *Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPack return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") } - packetHandler, module, capability, err = k.getPacketHandlerAndModule(ctx, msg.Packet.ProtocolVersion, msg.Packet.DestinationPort, msg.Packet.DestinationChannel) + packetHandler, _, _, err = k.getPacketHandlerAndModule(ctx, msg.Packet.ProtocolVersion, msg.Packet.DestinationPort, msg.Packet.DestinationChannel) if err != nil { ctx.Logger().Error("receive packet failed", "port-id", msg.Packet.DestinationPort, "channel-id", msg.Packet.DestinationChannel, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") } // Retrieve callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.Packet.DestinationPort) if !ok { - ctx.Logger().Error("receive packet failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("receive packet failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.DestinationPort)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.DestinationPort) } // Perform TAO verification @@ -498,7 +449,7 @@ func (k *Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPack // If the packet was already received, perform a no-op // Use a cached context to prevent accidental state changes cacheCtx, writeFn := ctx.CacheContext() - channelVersion, err := packetHandler.RecvPacket(cacheCtx, capability, msg.Packet, msg.ProofCommitment, msg.ProofHeight) + channelVersion, err := packetHandler.RecvPacket(cacheCtx, msg.Packet, msg.ProofCommitment, msg.ProofHeight) switch err { case nil: @@ -529,7 +480,7 @@ func (k *Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPack // NOTE: IBC applications modules may call the WriteAcknowledgement asynchronously if the // acknowledgement is nil. if ack != nil { - if err := packetHandler.WriteAcknowledgement(ctx, capability, msg.Packet, ack); err != nil { + if err := packetHandler.WriteAcknowledgement(ctx, msg.Packet, ack); err != nil { return nil, err } } @@ -543,11 +494,7 @@ func (k *Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPack // Timeout defines a rpc handler method for MsgTimeout. func (k *Keeper) Timeout(goCtx context.Context, msg *channeltypes.MsgTimeout) (*channeltypes.MsgTimeoutResponse, error) { - var ( - packetHandler PacketHandler - module string - capability *capabilitytypes.Capability - ) + var packetHandler PacketHandler ctx := sdk.UnwrapSDKContext(goCtx) relayer, err := sdk.AccAddressFromBech32(msg.Signer) @@ -556,17 +503,17 @@ func (k *Keeper) Timeout(goCtx context.Context, msg *channeltypes.MsgTimeout) (* return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") } - packetHandler, module, capability, err = k.getPacketHandlerAndModule(ctx, msg.Packet.ProtocolVersion, msg.Packet.SourcePort, msg.Packet.SourceChannel) + packetHandler, _, _, err = k.getPacketHandlerAndModule(ctx, msg.Packet.ProtocolVersion, msg.Packet.SourcePort, msg.Packet.SourceChannel) if err != nil { ctx.Logger().Error("timeout failed", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") } // Retrieve callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.Packet.SourcePort) if !ok { - ctx.Logger().Error("timeout failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("timeout failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.SourcePort)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.SourcePort) } // Perform TAO verification @@ -574,7 +521,7 @@ func (k *Keeper) Timeout(goCtx context.Context, msg *channeltypes.MsgTimeout) (* // If the timeout was already received, perform a no-op // Use a cached context to prevent accidental state changes cacheCtx, writeFn := ctx.CacheContext() - channelVersion, err := packetHandler.TimeoutPacket(cacheCtx, capability, msg.Packet, msg.ProofUnreceived, msg.ProofHeight, msg.NextSequenceRecv) + channelVersion, err := packetHandler.TimeoutPacket(cacheCtx, msg.Packet, msg.ProofUnreceived, msg.ProofHeight, msg.NextSequenceRecv) switch err { case nil: @@ -612,18 +559,10 @@ func (k *Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTime return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") } - // Lookup module by channel capability - module, capability, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel) - if err != nil { - ctx.Logger().Error("timeout on close failed", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - - // Retrieve callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.Packet.SourcePort) if !ok { - ctx.Logger().Error("timeout on close failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("timeout on close failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.SourcePort)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.SourcePort) } // Perform TAO verification @@ -631,7 +570,7 @@ func (k *Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTime // If the timeout was already received, perform a no-op // Use a cached context to prevent accidental state changes cacheCtx, writeFn := ctx.CacheContext() - channelVersion, err := k.ChannelKeeper.TimeoutOnClose(cacheCtx, capability, msg.Packet, msg.ProofUnreceived, msg.ProofClose, msg.ProofHeight, msg.NextSequenceRecv, msg.CounterpartyUpgradeSequence) + channelVersion, err := k.ChannelKeeper.TimeoutOnClose(cacheCtx, msg.Packet, msg.ProofUnreceived, msg.ProofClose, msg.ProofHeight, msg.NextSequenceRecv, msg.CounterpartyUpgradeSequence) switch err { case nil: @@ -664,11 +603,7 @@ func (k *Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTime // Acknowledgement defines a rpc handler method for MsgAcknowledgement. func (k *Keeper) Acknowledgement(goCtx context.Context, msg *channeltypes.MsgAcknowledgement) (*channeltypes.MsgAcknowledgementResponse, error) { - var ( - packetHandler PacketHandler - module string - capability *capabilitytypes.Capability - ) + var packetHandler PacketHandler ctx := sdk.UnwrapSDKContext(goCtx) relayer, err := sdk.AccAddressFromBech32(msg.Signer) @@ -677,17 +612,17 @@ func (k *Keeper) Acknowledgement(goCtx context.Context, msg *channeltypes.MsgAck return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") } - packetHandler, module, capability, err = k.getPacketHandlerAndModule(ctx, msg.Packet.ProtocolVersion, msg.Packet.SourcePort, msg.Packet.SourceChannel) + packetHandler, _, _, err = k.getPacketHandlerAndModule(ctx, msg.Packet.ProtocolVersion, msg.Packet.SourcePort, msg.Packet.SourceChannel) if err != nil { ctx.Logger().Error("acknowledgement failed", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") } // Retrieve callbacks from router - cbs, ok := k.PortKeeper.Route(module) + cbs, ok := k.PortKeeper.Route(msg.Packet.SourcePort) if !ok { - ctx.Logger().Error("acknowledgement failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("acknowledgement failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.SourcePort)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.Packet.SourcePort) } // Perform TAO verification @@ -695,7 +630,7 @@ func (k *Keeper) Acknowledgement(goCtx context.Context, msg *channeltypes.MsgAck // If the acknowledgement was already received, perform a no-op // Use a cached context to prevent accidental state changes cacheCtx, writeFn := ctx.CacheContext() - channelVersion, err := packetHandler.AcknowledgePacket(cacheCtx, capability, msg.Packet, msg.Acknowledgement, msg.ProofAcked, msg.ProofHeight) + channelVersion, err := packetHandler.AcknowledgePacket(cacheCtx, msg.Packet, msg.Acknowledgement, msg.ProofAcked, msg.ProofHeight) switch err { case nil: @@ -731,22 +666,16 @@ func (k *Keeper) ChannelUpgradeInit(goCtx context.Context, msg *channeltypes.Msg return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer) } - module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel upgrade init failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - - app, ok := k.PortKeeper.Route(module) + app, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel upgrade init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel upgrade init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } cbs, ok := app.(porttypes.UpgradableModule) if !ok { - ctx.Logger().Error("channel upgrade init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to module: %s", module) + ctx.Logger().Error("channel upgrade init failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to portID: %s", msg.PortId) } upgrade, err := k.ChannelKeeper.ChanUpgradeInit(ctx, msg.PortId, msg.ChannelId, msg.Fields) @@ -779,22 +708,16 @@ func (k *Keeper) ChannelUpgradeInit(goCtx context.Context, msg *channeltypes.Msg func (k *Keeper) ChannelUpgradeTry(goCtx context.Context, msg *channeltypes.MsgChannelUpgradeTry) (*channeltypes.MsgChannelUpgradeTryResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel upgrade try failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - - app, ok := k.PortKeeper.Route(module) + app, ok := k.PortKeeper.Route(msg.PortId) if !ok { - ctx.Logger().Error("channel upgrade try failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + ctx.Logger().Error("channel upgrade try failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) } cbs, ok := app.(porttypes.UpgradableModule) if !ok { - ctx.Logger().Error("channel upgrade try failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to module: %s", module)) - return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to module: %s", module) + ctx.Logger().Error("channel upgrade try failed", "port-id", msg.PortId, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to portID: %s", msg.PortId)) + return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to portID: %s", msg.PortId) } channel, upgrade, err := k.ChannelKeeper.ChanUpgradeTry(ctx, msg.PortId, msg.ChannelId, msg.ProposedUpgradeConnectionHops, msg.CounterpartyUpgradeFields, msg.CounterpartyUpgradeSequence, msg.ProofChannel, msg.ProofUpgrade, msg.ProofHeight) @@ -840,27 +763,21 @@ func (k *Keeper) ChannelUpgradeTry(goCtx context.Context, msg *channeltypes.MsgC func (k *Keeper) ChannelUpgradeAck(goCtx context.Context, msg *channeltypes.MsgChannelUpgradeAck) (*channeltypes.MsgChannelUpgradeAckResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel upgrade ack failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - - app, ok := k.PortKeeper.Route(module) + app, ok := k.PortKeeper.Route(msg.PortId) if !ok { - err = errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + err := errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) ctx.Logger().Error("channel upgrade ack failed", "port-id", msg.PortId, "error", err) return nil, err } cbs, ok := app.(porttypes.UpgradableModule) if !ok { - err = errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to module: %s", module) + err := errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to portID: %s", msg.PortId) ctx.Logger().Error("channel upgrade ack failed", "port-id", msg.PortId, "error", err) return nil, err } - err = k.ChannelKeeper.ChanUpgradeAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyUpgrade, msg.ProofChannel, msg.ProofUpgrade, msg.ProofHeight) + err := k.ChannelKeeper.ChanUpgradeAck(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyUpgrade, msg.ProofChannel, msg.ProofUpgrade, msg.ProofHeight) if err != nil { ctx.Logger().Error("channel upgrade ack failed", "error", errorsmod.Wrap(err, "channel upgrade ack failed")) if channeltypes.IsUpgradeError(err) { @@ -906,27 +823,21 @@ func (k *Keeper) ChannelUpgradeAck(goCtx context.Context, msg *channeltypes.MsgC func (k *Keeper) ChannelUpgradeConfirm(goCtx context.Context, msg *channeltypes.MsgChannelUpgradeConfirm) (*channeltypes.MsgChannelUpgradeConfirmResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel upgrade confirm failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - - app, ok := k.PortKeeper.Route(module) + app, ok := k.PortKeeper.Route(msg.PortId) if !ok { - err = errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + err := errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) ctx.Logger().Error("channel upgrade confirm failed", "port-id", msg.PortId, "error", err) return nil, err } cbs, ok := app.(porttypes.UpgradableModule) if !ok { - err = errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to module: %s", module) + err := errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to portID: %s", msg.PortId) ctx.Logger().Error("channel upgrade confirm failed", "port-id", msg.PortId, "error", err) return nil, err } - err = k.ChannelKeeper.ChanUpgradeConfirm(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelState, msg.CounterpartyUpgrade, msg.ProofChannel, msg.ProofUpgrade, msg.ProofHeight) + err := k.ChannelKeeper.ChanUpgradeConfirm(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelState, msg.CounterpartyUpgrade, msg.ProofChannel, msg.ProofUpgrade, msg.ProofHeight) if err != nil { ctx.Logger().Error("channel upgrade confirm failed", "error", errorsmod.Wrap(err, "channel upgrade confirm failed")) if channeltypes.IsUpgradeError(err) { @@ -967,27 +878,21 @@ func (k *Keeper) ChannelUpgradeConfirm(goCtx context.Context, msg *channeltypes. func (k *Keeper) ChannelUpgradeOpen(goCtx context.Context, msg *channeltypes.MsgChannelUpgradeOpen) (*channeltypes.MsgChannelUpgradeOpenResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortId, msg.ChannelId) - if err != nil { - ctx.Logger().Error("channel upgrade open failed", "port-id", msg.PortId, "error", errorsmod.Wrap(err, "could not retrieve module from port-id")) - return nil, errorsmod.Wrap(err, "could not retrieve module from port-id") - } - - app, ok := k.PortKeeper.Route(module) + app, ok := k.PortKeeper.Route(msg.PortId) if !ok { - err = errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module) + err := errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to portID: %s", msg.PortId) ctx.Logger().Error("channel upgrade open failed", "port-id", msg.PortId, "error", err) return nil, err } cbs, ok := app.(porttypes.UpgradableModule) if !ok { - err = errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to module: %s", module) + err := errorsmod.Wrapf(porttypes.ErrInvalidRoute, "upgrade route not found to portID: %s", msg.PortId) ctx.Logger().Error("channel upgrade open failed", "port-id", msg.PortId, "error", err) return nil, err } - if err = k.ChannelKeeper.ChanUpgradeOpen(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelState, msg.CounterpartyUpgradeSequence, msg.ProofChannel, msg.ProofHeight); err != nil { + if err := k.ChannelKeeper.ChanUpgradeOpen(ctx, msg.PortId, msg.ChannelId, msg.CounterpartyChannelState, msg.CounterpartyUpgradeSequence, msg.ProofChannel, msg.ProofHeight); err != nil { ctx.Logger().Error("channel upgrade open failed", "error", errorsmod.Wrap(err, "channel upgrade open failed")) return nil, errorsmod.Wrap(err, "channel upgrade open failed") } @@ -1150,20 +1055,9 @@ func convertToErrorEvents(events sdk.Events) sdk.Events { // provided protocol version. An error is returned if the module cannot be found or if the protocol // version is not supported. func (k *Keeper) getPacketHandlerAndModule(ctx sdk.Context, protocolVersion channeltypes.IBCVersion, port, channel string) (PacketHandler, string, *capabilitytypes.Capability, error) { - var ( - module string - capability *capabilitytypes.Capability - err error - ) - switch protocolVersion { case channeltypes.IBC_VERSION_UNSPECIFIED, channeltypes.IBC_VERSION_1: - // Lookup module by channel capability - module, capability, err = k.ChannelKeeper.LookupModuleByChannel(ctx, port, channel) - if err != nil { - return nil, "", nil, err - } - return k.ChannelKeeper, module, capability, nil + return k.ChannelKeeper, "", nil, nil case channeltypes.IBC_VERSION_2: return k.PacketServerKeeper, port, nil, nil default: diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index cbed627f0b1..7f352c689eb 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "context" "errors" "fmt" @@ -11,7 +12,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -185,17 +185,11 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { _, err := suite.chainB.App.GetIBCKeeper().RecvPacket(suite.chainB.GetContext(), msg) suite.Require().NoError(err) - // check that callback state was handled correctly - _, exists := suite.chainB.GetSimApp().ScopedIBCMockKeeper.GetCapability(suite.chainB.GetContext(), ibcmock.GetMockRecvCanaryCapabilityName(packet)) if tc.expRevert { - suite.Require().False(exists, "capability exists in store even after callback reverted") - // context events should contain error events suite.Require().Contains(events, keeper.ConvertToErrorEvents(sdk.Events{ibcmock.NewMockRecvPacketEvent()})[0]) suite.Require().NotContains(events, ibcmock.NewMockRecvPacketEvent()) } else { - suite.Require().True(exists, "callback state not persisted when revert is false") - if tc.replay { // context should not contain application events suite.Require().NotContains(events, ibcmock.NewMockRecvPacketEvent()) @@ -358,17 +352,11 @@ func (suite *KeeperTestSuite) TestRecvPacketV2() { _, err := suite.chainB.App.GetIBCKeeper().RecvPacket(suite.chainB.GetContext(), msg) suite.Require().NoError(err) - // check that callback state was handled correctly - _, exists := suite.chainB.GetSimApp().ScopedIBCMockKeeper.GetCapability(suite.chainB.GetContext(), ibcmock.GetMockRecvCanaryCapabilityName(packet)) if tc.expRevert { - suite.Require().False(exists, "capability exists in store even after callback reverted") - // context events should contain error events suite.Require().Contains(events, keeper.ConvertToErrorEvents(sdk.Events{ibcmock.NewMockRecvPacketEvent()})[0]) suite.Require().NotContains(events, ibcmock.NewMockRecvPacketEvent()) } else { - suite.Require().True(exists, "callback state not persisted when revert is false") - if tc.replay { // context should not contain application events suite.Require().NotContains(events, ibcmock.NewMockRecvPacketEvent()) @@ -686,7 +674,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacketV2() { { "application callback returns error", func() { - suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnAcknowledgementPacket = func(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { + suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnAcknowledgementPacket = func(ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { return fmt.Errorf("mock app callback failed") } }, @@ -1516,12 +1504,13 @@ func (suite *KeeperTestSuite) TestChannelUpgradeInit() { path.EndpointA.Chain.GetSimApp().IBCKeeper.GetAuthority(), ) - suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeInit = func(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { + suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeInit = func(ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { storeKey := suite.chainA.GetSimApp().GetKey(exported.ModuleName) - store := ctx.KVStore(storeKey) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + store := sdkCtx.KVStore(storeKey) store.Set(ibcmock.TestKey, ibcmock.TestValue) - ctx.EventManager().EmitEvent(sdk.NewEvent(ibcmock.MockEventType)) + sdkCtx.EventManager().EmitEvent(sdk.NewEvent(ibcmock.MockEventType)) return ibcmock.UpgradeVersion, nil } }, @@ -1606,20 +1595,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, - { - "module capability not found", - func() { - msg.PortId = "invalid-port" - msg.ChannelId = "invalid-channel" - }, - func(res *channeltypes.MsgChannelUpgradeTryResponse, events []abci.Event, err error) { - suite.Require().Error(err) - suite.Require().Nil(res) - - suite.Require().ErrorIs(err, capabilitytypes.ErrCapabilityNotFound) - suite.Require().Empty(events) - }, - }, { "unsynchronized upgrade sequence writes upgrade error receipt", func() { @@ -1677,12 +1652,13 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { { "ibc application does not commit state changes in callback", func() { - suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeTry = func(ctx sdk.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, counterpartyVersion string) (string, error) { + suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeTry = func(ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, counterpartyVersion string) (string, error) { storeKey := suite.chainA.GetSimApp().GetKey(exported.ModuleName) - store := ctx.KVStore(storeKey) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + store := sdkCtx.KVStore(storeKey) store.Set(ibcmock.TestKey, ibcmock.TestValue) - ctx.EventManager().EmitEvent(sdk.NewEvent(ibcmock.MockEventType)) + sdkCtx.EventManager().EmitEvent(sdk.NewEvent(ibcmock.MockEventType)) return ibcmock.UpgradeVersion, nil } }, @@ -1821,20 +1797,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, - { - "module capability not found", - func() { - msg.PortId = ibctesting.InvalidID - msg.ChannelId = ibctesting.InvalidID - }, - func(res *channeltypes.MsgChannelUpgradeAckResponse, events []abci.Event, err error) { - suite.Require().Error(err) - suite.Require().Nil(res) - - suite.Require().ErrorIs(err, capabilitytypes.ErrCapabilityNotFound) - suite.Require().Empty(events) - }, - }, { "core handler returns error and no upgrade error receipt is written", func() { @@ -1896,10 +1858,11 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { "application callback returns error and error receipt is written", func() { suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeAck = func( - ctx sdk.Context, portID, channelID, counterpartyVersion string, + ctx context.Context, portID, channelID, counterpartyVersion string, ) error { // set arbitrary value in store to mock application state changes - store := ctx.KVStore(suite.chainA.GetSimApp().GetKey(exported.ModuleName)) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + store := sdkCtx.KVStore(suite.chainA.GetSimApp().GetKey(exported.ModuleName)) store.Set([]byte("foo"), []byte("bar")) return fmt.Errorf("mock app callback failed") } @@ -1959,7 +1922,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { { "application callback returns an upgrade error", func() { - suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeAck = func(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { + suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeAck = func(ctx context.Context, portID, channelID, counterpartyVersion string) error { return channeltypes.NewUpgradeError(10000000, ibcmock.MockApplicationCallbackError) } }, @@ -1971,12 +1934,13 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { { "ibc application does not commit state changes in callback", func() { - suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeAck = func(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { + suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeAck = func(ctx context.Context, portID, channelID, counterpartyVersion string) error { storeKey := suite.chainA.GetSimApp().GetKey(exported.ModuleName) - store := ctx.KVStore(storeKey) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + store := sdkCtx.KVStore(storeKey) store.Set(ibcmock.TestKey, ibcmock.TestValue) - ctx.EventManager().EmitEvent(sdk.NewEvent(ibcmock.MockEventType)) + sdkCtx.EventManager().EmitEvent(sdk.NewEvent(ibcmock.MockEventType)) return nil } }, @@ -2190,20 +2154,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, - { - "module capability not found", - func() { - msg.PortId = ibctesting.InvalidID - msg.ChannelId = ibctesting.InvalidID - }, - func(res *channeltypes.MsgChannelUpgradeConfirmResponse, events []abci.Event, err error) { - suite.Require().Error(err) - suite.Require().Nil(res) - - suite.Require().ErrorIs(err, capabilitytypes.ErrCapabilityNotFound) - suite.Require().Empty(events) - }, - }, { "core handler returns error and no upgrade error receipt is written", func() { @@ -2430,20 +2380,6 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() { ibctesting.AssertEvents(&suite.Suite, expEvents, events) }, }, - { - "module capability not found", - func() { - msg.PortId = ibctesting.InvalidID - msg.ChannelId = ibctesting.InvalidID - }, - func(res *channeltypes.MsgChannelUpgradeOpenResponse, events []abci.Event, err error) { - suite.Require().Error(err) - suite.Require().Nil(res) - - suite.Require().ErrorIs(err, capabilitytypes.ErrCapabilityNotFound) - suite.Require().Empty(events) - }, - }, { "core handler fails", func() { diff --git a/modules/core/migrations/v7/genesis_test.go b/modules/core/migrations/v7/genesis_test.go index 5bd598d1fee..57ceb04973f 100644 --- a/modules/core/migrations/v7/genesis_test.go +++ b/modules/core/migrations/v7/genesis_test.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ibcclient "github.com/cosmos/ibc-go/v9/modules/core/02-client" @@ -134,7 +135,7 @@ func (suite *MigrationsV7TestSuite) TestMigrateGenesisSolomachine() { // migrate store get expected genesis // store migration and genesis migration should produce identical results // NOTE: tendermint clients are not pruned in genesis so the test should not have expired tendermint clients - err := clientv7.MigrateStore(suite.chainA.GetContext(), suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) + err := clientv7.MigrateStore(suite.chainA.GetContext(), runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper) suite.Require().NoError(err) expectedClientGenState := ibcclient.ExportGenesis(suite.chainA.GetContext(), suite.chainA.App.GetIBCKeeper().ClientKeeper) diff --git a/modules/core/packet-server/keeper/keeper.go b/modules/core/packet-server/keeper/keeper.go index b881500de58..8c98d623a12 100644 --- a/modules/core/packet-server/keeper/keeper.go +++ b/modules/core/packet-server/keeper/keeper.go @@ -1,13 +1,16 @@ package keeper import ( + "context" "fmt" + corestore "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" @@ -19,39 +22,40 @@ import ( // It does not manage its own store. type Keeper struct { cdc codec.BinaryCodec - storeKey storetypes.StoreKey + storeService corestore.KVStoreService ChannelKeeper types.ChannelKeeper ClientKeeper types.ClientKeeper } // NewKeeper creates a new packet keeper -func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, channelKeeper types.ChannelKeeper, clientKeeper types.ClientKeeper) *Keeper { +func NewKeeper(cdc codec.BinaryCodec, storeService corestore.KVStoreService, channelKeeper types.ChannelKeeper, clientKeeper types.ClientKeeper) *Keeper { return &Keeper{ cdc: cdc, - storeKey: storeKey, + storeService: storeService, ChannelKeeper: channelKeeper, ClientKeeper: clientKeeper, } } // Logger returns a module-specific logger. -func (Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) +func (Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } -func (k Keeper) ChannelStore(ctx sdk.Context, channelID string) storetypes.KVStore { +func (k Keeper) ChannelStore(ctx context.Context, channelID string) storetypes.KVStore { channelPrefix := []byte(fmt.Sprintf("%s/%s/", host.KeyChannelStorePrefix, channelID)) - return prefix.NewStore(ctx.KVStore(k.storeKey), channelPrefix) + return prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), channelPrefix) } // SetCounterparty sets the Counterparty for a given client identifier. -func (k *Keeper) SetCounterparty(ctx sdk.Context, clientID string, counterparty types.Counterparty) { +func (k *Keeper) SetCounterparty(ctx context.Context, clientID string, counterparty types.Counterparty) { bz := k.cdc.MustMarshal(&counterparty) k.ChannelStore(ctx, clientID).Set([]byte(types.CounterpartyKey), bz) } // GetCounterparty gets the Counterparty for a given client identifier. -func (k *Keeper) GetCounterparty(ctx sdk.Context, clientID string) (types.Counterparty, bool) { +func (k *Keeper) GetCounterparty(ctx context.Context, clientID string) (types.Counterparty, bool) { store := k.ChannelStore(ctx, clientID) bz := store.Get([]byte(types.CounterpartyKey)) if len(bz) == 0 { diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index 7836b9c98d3..50553fd454d 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -2,13 +2,13 @@ package keeper import ( "bytes" + "context" "strconv" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channelkeeper "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -22,8 +22,7 @@ import ( // The destination channel will be filled in using the counterparty information. // The next sequence send will be initialized if this is the first packet sent for the given client. func (k Keeper) SendPacket( - ctx sdk.Context, - _ *capabilitytypes.Capability, + ctx context.Context, sourceChannel string, sourcePort string, destPort string, @@ -97,8 +96,7 @@ func (k Keeper) SendPacket( // counterparty stored a packet commitment. If successful, a packet receipt is stored // to indicate to the counterparty successful delivery. func (k Keeper) RecvPacket( - ctx sdk.Context, - _ *capabilitytypes.Capability, + ctx context.Context, packet channeltypes.Packet, proof []byte, proofHeight exported.Height, @@ -120,7 +118,8 @@ func (k Keeper) RecvPacket( } // check if packet timed out by comparing it with the latest height of the chain - selfHeight, selfTimestamp := clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + selfHeight, selfTimestamp := clienttypes.GetSelfHeight(ctx), uint64(sdkCtx.BlockTime().UnixNano()) timeout := channeltypes.NewTimeout(packet.GetTimeoutHeight().(clienttypes.Height), packet.GetTimeoutTimestamp()) if timeout.Elapsed(selfHeight, selfTimestamp) { return "", errorsmod.Wrap(timeout.ErrTimeoutElapsed(selfHeight, selfTimestamp), "packet timeout elapsed") @@ -171,8 +170,7 @@ func (k Keeper) RecvPacket( // If no acknowledgement exists for the given packet, then a commitment of the acknowledgement // is written into state. func (k Keeper) WriteAcknowledgement( - ctx sdk.Context, - _ *capabilitytypes.Capability, + ctx context.Context, packetI exported.PacketI, ack exported.Acknowledgement, ) error { @@ -230,8 +228,7 @@ func (k Keeper) WriteAcknowledgement( // the acknowledgement provided is verified to have been stored by the counterparty. // If successful, the packet commitment is deleted and the packet has completed its lifecycle. func (k Keeper) AcknowledgePacket( - ctx sdk.Context, - _ *capabilitytypes.Capability, + ctx context.Context, packet channeltypes.Packet, acknowledgement []byte, proofAcked []byte, @@ -302,8 +299,7 @@ func (k Keeper) AcknowledgePacket( // was never delivered to the counterparty. If successful, the packet commitment // is deleted and the packet has completed its lifecycle. func (k Keeper) TimeoutPacket( - ctx sdk.Context, - _ *capabilitytypes.Capability, + ctx context.Context, packet channeltypes.Packet, proof []byte, proofHeight exported.Height, diff --git a/modules/core/packet-server/keeper/relay_test.go b/modules/core/packet-server/keeper/relay_test.go index 4aa13de9c42..2fdd95fe7d8 100644 --- a/modules/core/packet-server/keeper/relay_test.go +++ b/modules/core/packet-server/keeper/relay_test.go @@ -127,7 +127,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { tc.malleate() // send packet - seq, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, + seq, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) expPass := tc.expError == nil @@ -238,7 +238,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { packetKey := host.PacketCommitmentKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) proof, proofHeight := path.EndpointA.QueryProof(packetKey) - _, err = suite.chainB.App.GetPacketServer().RecvPacket(suite.chainB.GetContext(), nil, packet, proof, proofHeight) + _, err = suite.chainB.App.GetPacketServer().RecvPacket(suite.chainB.GetContext(), packet, proof, proofHeight) expPass := tc.expError == nil if expPass { @@ -337,7 +337,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { tc.malleate() - err := suite.chainB.App.GetPacketServer().WriteAcknowledgement(suite.chainB.GetContext(), nil, packet, ack) + err := suite.chainB.App.GetPacketServer().WriteAcknowledgement(suite.chainB.GetContext(), packet, ack) expPass := tc.expError == nil if expPass { @@ -450,7 +450,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { path.EndpointA.FreezeClient() } - _, err = suite.chainA.App.GetPacketServer().AcknowledgePacket(suite.chainA.GetContext(), nil, packet, ack.Acknowledgement(), proof, proofHeight) + _, err = suite.chainA.App.GetPacketServer().AcknowledgePacket(suite.chainA.GetContext(), packet, ack.Acknowledgement(), proof, proofHeight) expPass := tc.expError == nil if expPass { @@ -482,7 +482,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "success with timeout height", func() { // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") }, @@ -496,7 +496,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { packet.TimeoutTimestamp = uint64(suite.chainB.GetContext().BlockTime().UnixNano()) // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") }, @@ -506,7 +506,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: invalid protocol version", func() { // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") @@ -519,7 +519,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: counterparty not found", func() { // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") @@ -531,7 +531,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: counterparty client identifier different than source channel", func() { // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") @@ -545,7 +545,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { packet.TimeoutHeight = defaultTimeoutHeight // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") }, @@ -560,7 +560,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: packet does not match commitment", func() { // send a different packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, []byte("different data")) suite.Require().NoError(err, "send packet failed") }, @@ -570,7 +570,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: client status invalid", func() { // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") @@ -582,7 +582,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: verify non-membership failed", func() { // send packet - _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, + _, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data) suite.Require().NoError(err, "send packet failed") @@ -625,7 +625,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { path.EndpointA.FreezeClient() } - _, err := suite.chainA.App.GetPacketServer().TimeoutPacket(suite.chainA.GetContext(), nil, packet, proof, proofHeight, 0) + _, err := suite.chainA.App.GetPacketServer().TimeoutPacket(suite.chainA.GetContext(), packet, proof, proofHeight, 0) expPass := tc.expError == nil if expPass { diff --git a/modules/core/packet-server/types/expected_keepers.go b/modules/core/packet-server/types/expected_keepers.go index 7134ab5495f..969005c4b7f 100644 --- a/modules/core/packet-server/types/expected_keepers.go +++ b/modules/core/packet-server/types/expected_keepers.go @@ -1,7 +1,7 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -10,49 +10,49 @@ import ( type ChannelKeeper interface { // SetPacketCommitment writes the commitment hash under the commitment path // This is a public path that is standardized by the IBC specification - SetPacketCommitment(ctx sdk.Context, portID string, channelID string, sequence uint64, commitment []byte) + SetPacketCommitment(ctx context.Context, portID string, channelID string, sequence uint64, commitment []byte) // GetPacketCommitment returns the packet commitment hash under the commitment path - GetPacketCommitment(ctx sdk.Context, portID string, channelID string, sequence uint64) []byte + GetPacketCommitment(ctx context.Context, portID string, channelID string, sequence uint64) []byte // DeletePacketCommitment deletes the packet commitment hash under the commitment path - DeletePacketCommitment(ctx sdk.Context, portID string, channelID string, sequence uint64) + DeletePacketCommitment(ctx context.Context, portID string, channelID string, sequence uint64) // SetNextSequenceSend writes the next send sequence under the sequence path // This is a public path that is standardized by the IBC specification - SetNextSequenceSend(ctx sdk.Context, portID, channelID string, sequence uint64) + SetNextSequenceSend(ctx context.Context, portID, channelID string, sequence uint64) // GetNextSequenceSend returns the next send sequence from the sequence path - GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) + GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) // SetPacketReceipt writes the packet receipt under the receipt path // This is a public path that is standardized by the IBC specification - SetPacketReceipt(ctx sdk.Context, portID, channelID string, sequence uint64) + SetPacketReceipt(ctx context.Context, portID, channelID string, sequence uint64) // GetPacketReceipt returns the packet receipt from the packet receipt path - GetPacketReceipt(ctx sdk.Context, portID, channelID string, sequence uint64) (string, bool) + GetPacketReceipt(ctx context.Context, portID, channelID string, sequence uint64) (string, bool) // HasPacketAcknowledgement check if the packet ack hash is already on the store - HasPacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64) bool + HasPacketAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) bool // SetPacketAcknowledgement writes the acknowledgement hash under the acknowledgement path // This is a public path that is standardized by the IBC specification - SetPacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64, ackHash []byte) + SetPacketAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64, ackHash []byte) } type ClientKeeper interface { // VerifyMembership retrieves the light client module for the clientID and verifies the proof of the existence of a key-value pair at a specified height. - VerifyMembership(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error + VerifyMembership(ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path, value []byte) error // VerifyNonMembership retrieves the light client module for the clientID and verifies the absence of a given key at a specified height. - VerifyNonMembership(ctx sdk.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path) error + VerifyNonMembership(ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, delayBlockPeriod uint64, proof []byte, path exported.Path) error // GetClientStatus returns the status of a client given the client ID - GetClientStatus(ctx sdk.Context, clientID string) exported.Status + GetClientStatus(ctx context.Context, clientID string) exported.Status // GetClientLatestHeight returns the latest height of a client given the client ID - GetClientLatestHeight(ctx sdk.Context, clientID string) clienttypes.Height + GetClientLatestHeight(ctx context.Context, clientID string) clienttypes.Height // GetClientTimestampAtHeight returns the timestamp for a given height on the client // given its client ID and height - GetClientTimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) + GetClientTimestampAtHeight(ctx context.Context, clientID string, height exported.Height) (uint64, error) // GetCreator returns the creator of the client denoted by the clientID. - GetCreator(ctx sdk.Context, clientID string) (string, bool) + GetCreator(ctx context.Context, clientID string) (string, bool) } diff --git a/modules/light-clients/06-solomachine/light_client_module.go b/modules/light-clients/06-solomachine/light_client_module.go index 8c4885c776a..2ac9d66cf22 100644 --- a/modules/light-clients/06-solomachine/light_client_module.go +++ b/modules/light-clients/06-solomachine/light_client_module.go @@ -1,12 +1,12 @@ package solomachine import ( + "context" "reflect" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -30,7 +30,7 @@ func NewLightClientModule(cdc codec.BinaryCodec, storeProvider clienttypes.Store // Initialize unmarshals the provided client and consensus states and performs basic validation. It calls into the // clientState.Initialize method. -func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientStateBz, consensusStateBz []byte) error { +func (l LightClientModule) Initialize(ctx context.Context, clientID string, clientStateBz, consensusStateBz []byte) error { var clientState ClientState if err := l.cdc.Unmarshal(clientStateBz, &clientState); err != nil { return err @@ -62,7 +62,7 @@ func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientSt } // VerifyClientMessage obtains the client state associated with the client identifier and calls into the clientState.VerifyClientMessage method. -func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) error { +func (l LightClientModule) VerifyClientMessage(ctx context.Context, clientID string, clientMsg exported.ClientMessage) error { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -73,7 +73,7 @@ func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, } // CheckForMisbehaviour obtains the client state associated with the client identifier and calls into the clientState.CheckForMisbehaviour method. -func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) bool { +func (l LightClientModule) CheckForMisbehaviour(ctx context.Context, clientID string, clientMsg exported.ClientMessage) bool { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -86,7 +86,7 @@ func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string // UpdateStateOnMisbehaviour updates state upon misbehaviour, freezing the ClientState. // This method should only be called when misbehaviour is detected as it does not perform // any misbehaviour checks. -func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) { +func (l LightClientModule) UpdateStateOnMisbehaviour(ctx context.Context, clientID string, clientMsg exported.ClientMessage) { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -98,7 +98,7 @@ func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID s } // UpdateState obtains the client state associated with the client identifier and calls into the clientState.UpdateState method. -func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height { +func (l LightClientModule) UpdateState(ctx context.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -110,7 +110,7 @@ func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientM // VerifyMembership obtains the client state associated with the client identifier and calls into the clientState.verifyMembership method. func (l LightClientModule) VerifyMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -130,7 +130,7 @@ func (l LightClientModule) VerifyMembership( // VerifyNonMembership obtains the client state associated with the client identifier and calls into the clientState.verifyNonMembership method. func (l LightClientModule) VerifyNonMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -152,7 +152,7 @@ func (l LightClientModule) VerifyNonMembership( // - Active: if `IsFrozen` is false. // - Frozen: if `IsFrozen` is true. // - Unknown: if the client state associated with the provided client identifier is not found. -func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Status { +func (l LightClientModule) Status(ctx context.Context, clientID string) exported.Status { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -169,7 +169,7 @@ func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Sta // LatestHeight returns the latest height for the client state for the given client identifier. // If no client is present for the provided client identifier a zero value height is returned. // NOTE: RevisionNumber is always 0 for solomachine client heights. -func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) exported.Height { +func (l LightClientModule) LatestHeight(ctx context.Context, clientID string) exported.Height { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) @@ -181,7 +181,7 @@ func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) export } // TimestampAtHeight obtains the client state associated with the client identifier and returns the timestamp in nanoseconds of the consensus state at the given height. -func (l LightClientModule) TimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) { +func (l LightClientModule) TimestampAtHeight(ctx context.Context, clientID string, height exported.Height) (uint64, error) { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -193,7 +193,7 @@ func (l LightClientModule) TimestampAtHeight(ctx sdk.Context, clientID string, h // RecoverClient asserts that the substitute client is a solo machine client. It obtains the client state associated with the // subject client and calls into the subjectClientState.CheckSubstituteAndUpdateState method. -func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error { +func (l LightClientModule) RecoverClient(ctx context.Context, clientID, substituteClientID string) error { substituteClientType, _, err := clienttypes.ParseClientIdentifier(substituteClientID) if err != nil { return err @@ -219,6 +219,6 @@ func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteCl } // VerifyUpgradeAndUpdateState returns an error since solomachine client does not support upgrades -func (LightClientModule) VerifyUpgradeAndUpdateState(ctx sdk.Context, clientID string, newClient, newConsState, upgradeClientProof, upgradeConsensusStateProof []byte) error { +func (LightClientModule) VerifyUpgradeAndUpdateState(ctx context.Context, clientID string, newClient, newConsState, upgradeClientProof, upgradeConsensusStateProof []byte) error { return errorsmod.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade solomachine client") } diff --git a/modules/light-clients/06-solomachine/misbehaviour_handle.go b/modules/light-clients/06-solomachine/misbehaviour_handle.go index 0b38a4cbc88..3987a4823b0 100644 --- a/modules/light-clients/06-solomachine/misbehaviour_handle.go +++ b/modules/light-clients/06-solomachine/misbehaviour_handle.go @@ -1,18 +1,19 @@ package solomachine import ( + "context" + errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" commitmenttypesv2 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // CheckForMisbehaviour returns true for type Misbehaviour (passed VerifyClientMessage check), otherwise returns false -func (ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, clientMsg exported.ClientMessage) bool { +func (ClientState) CheckForMisbehaviour(_ context.Context, _ codec.BinaryCodec, _ storetypes.KVStore, clientMsg exported.ClientMessage) bool { if _, ok := clientMsg.(*Misbehaviour); ok { return true } diff --git a/modules/light-clients/06-solomachine/proof.go b/modules/light-clients/06-solomachine/proof.go index 516b8421d0d..3a3a3cc3d2f 100644 --- a/modules/light-clients/06-solomachine/proof.go +++ b/modules/light-clients/06-solomachine/proof.go @@ -26,7 +26,7 @@ func VerifySignature(pubKey cryptotypes.PubKey, signBytes []byte, sigData signin if err := pubKey.VerifyMultisignature(func(signing.SignMode) ([]byte, error) { return signBytes, nil }, data); err != nil { - return errorsmod.Wrapf(ErrSignatureVerificationFailed, err.Error()) + return errorsmod.Wrapf(ErrSignatureVerificationFailed, "failed to verify multisignature: %s", err.Error()) } default: diff --git a/modules/light-clients/06-solomachine/proposal_handle.go b/modules/light-clients/06-solomachine/proposal_handle.go index aae18d037c1..a1a89a84279 100644 --- a/modules/light-clients/06-solomachine/proposal_handle.go +++ b/modules/light-clients/06-solomachine/proposal_handle.go @@ -1,13 +1,13 @@ package solomachine import ( + "context" "reflect" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -21,7 +21,7 @@ import ( // the substitute is not a solo machine, or the current public key equals // the new public key. func (cs ClientState) CheckSubstituteAndUpdateState( - ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore, + ctx context.Context, cdc codec.BinaryCodec, subjectClientStore, _ storetypes.KVStore, substituteClient exported.ClientState, ) error { substituteClientState, ok := substituteClient.(*ClientState) diff --git a/modules/light-clients/06-solomachine/update.go b/modules/light-clients/06-solomachine/update.go index ddc53dbb2d2..b3c1463028d 100644 --- a/modules/light-clients/06-solomachine/update.go +++ b/modules/light-clients/06-solomachine/update.go @@ -1,11 +1,12 @@ package solomachine import ( + "context" + errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -14,7 +15,7 @@ import ( // VerifyClientMessage introspects the provided ClientMessage and checks its validity // A Solomachine Header is considered valid if the currently registered public key has signed over the new public key with the correct sequence // A Solomachine Misbehaviour is considered valid if duplicate signatures of the current public key are found on two different messages at a given sequence -func (cs ClientState) VerifyClientMessage(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) error { +func (cs ClientState) VerifyClientMessage(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) error { switch msg := clientMsg.(type) { case *Header: return cs.verifyHeader(cdc, msg) @@ -78,7 +79,7 @@ func (cs ClientState) verifyHeader(cdc codec.BinaryCodec, header *Header) error // UpdateState updates the consensus state to the new public key and an incremented sequence. // A list containing the updated consensus height is returned. // If the provided clientMsg is not of type Header, the handler will no-op and return an empty slice. -func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height { +func (cs ClientState) UpdateState(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height { smHeader, ok := clientMsg.(*Header) if !ok { // clientMsg is invalid Misbehaviour, no update necessary diff --git a/modules/light-clients/07-tendermint/client_state.go b/modules/light-clients/07-tendermint/client_state.go index 2e5becea74f..89ab21128d7 100644 --- a/modules/light-clients/07-tendermint/client_state.go +++ b/modules/light-clients/07-tendermint/client_state.go @@ -1,6 +1,7 @@ package tendermint import ( + "context" "strings" "time" @@ -77,7 +78,7 @@ func (ClientState) getTimestampAtHeight( // A frozen client will become expired, so the Frozen status // has higher precedence. func (cs ClientState) status( - ctx sdk.Context, + ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, ) exported.Status { @@ -93,7 +94,8 @@ func (cs ClientState) status( return exported.Expired } - if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + if cs.IsExpired(consState.Timestamp, sdkCtx.BlockTime()) { return exported.Expired } @@ -186,7 +188,7 @@ func (cs ClientState) ZeroCustomFields() *ClientState { // initialize checks that the initial consensus state is an 07-tendermint consensus state and // sets the client state, consensus state and associated metadata in the provided client store. -func (cs ClientState) initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error { +func (cs ClientState) initialize(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error { consensusState, ok := consState.(*ConsensusState) if !ok { return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "invalid initial consensus state. expected type: %T, got: %T", @@ -204,7 +206,7 @@ func (cs ClientState) initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientS // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // If a zero proof height is passed in, it will fail to retrieve the associated consensus state. func (cs ClientState) verifyMembership( - ctx sdk.Context, + ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height, @@ -247,7 +249,7 @@ func (cs ClientState) verifyMembership( // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // If a zero proof height is passed in, it will fail to retrieve the associated consensus state. func (cs ClientState) verifyNonMembership( - ctx sdk.Context, + ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height, @@ -287,7 +289,7 @@ func (cs ClientState) verifyNonMembership( // verifyDelayPeriodPassed will ensure that at least delayTimePeriod amount of time and delayBlockPeriod number of blocks have passed // since consensus state was submitted before allowing verification to continue. -func verifyDelayPeriodPassed(ctx sdk.Context, store storetypes.KVStore, proofHeight exported.Height, delayTimePeriod, delayBlockPeriod uint64) error { +func verifyDelayPeriodPassed(ctx context.Context, store storetypes.KVStore, proofHeight exported.Height, delayTimePeriod, delayBlockPeriod uint64) error { if delayTimePeriod != 0 { // check that executing chain's timestamp has passed consensusState's processed time + delay time period processedTime, ok := GetProcessedTime(store, proofHeight) @@ -295,7 +297,8 @@ func verifyDelayPeriodPassed(ctx sdk.Context, store storetypes.KVStore, proofHei return errorsmod.Wrapf(ErrProcessedTimeNotFound, "processed time not found for height: %s", proofHeight) } - currentTimestamp := uint64(ctx.BlockTime().UnixNano()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + currentTimestamp := uint64(sdkCtx.BlockTime().UnixNano()) validTime := processedTime + delayTimePeriod // NOTE: delay time period is inclusive, so if currentTimestamp is validTime, then we return no error diff --git a/modules/light-clients/07-tendermint/light_client_module.go b/modules/light-clients/07-tendermint/light_client_module.go index e0acee6d75e..2b45ba7d917 100644 --- a/modules/light-clients/07-tendermint/light_client_module.go +++ b/modules/light-clients/07-tendermint/light_client_module.go @@ -1,12 +1,12 @@ package tendermint import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" @@ -31,7 +31,7 @@ func NewLightClientModule(cdc codec.BinaryCodec, storeProvider clienttypes.Store // Initialize unmarshals the provided client and consensus states and performs basic validation. It calls into the // clientState.initialize method. -func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientStateBz, consensusStateBz []byte) error { +func (l LightClientModule) Initialize(ctx context.Context, clientID string, clientStateBz, consensusStateBz []byte) error { var clientState ClientState if err := l.cdc.Unmarshal(clientStateBz, &clientState); err != nil { return fmt.Errorf("failed to unmarshal client state bytes into client state: %w", err) @@ -56,7 +56,7 @@ func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientSt } // VerifyClientMessage obtains the client state associated with the client identifier and calls into the clientState.VerifyClientMessage method. -func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) error { +func (l LightClientModule) VerifyClientMessage(ctx context.Context, clientID string, clientMsg exported.ClientMessage) error { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -67,7 +67,7 @@ func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, } // CheckForMisbehaviour obtains the client state associated with the client identifier and calls into the clientState.CheckForMisbehaviour method. -func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) bool { +func (l LightClientModule) CheckForMisbehaviour(ctx context.Context, clientID string, clientMsg exported.ClientMessage) bool { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -78,7 +78,7 @@ func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string } // UpdateStateOnMisbehaviour obtains the client state associated with the client identifier and calls into the clientState.UpdateStateOnMisbehaviour method. -func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) { +func (l LightClientModule) UpdateStateOnMisbehaviour(ctx context.Context, clientID string, clientMsg exported.ClientMessage) { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -89,7 +89,7 @@ func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID s } // UpdateState obtains the client state associated with the client identifier and calls into the clientState.UpdateState method. -func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height { +func (l LightClientModule) UpdateState(ctx context.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -101,7 +101,7 @@ func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientM // VerifyMembership obtains the client state associated with the client identifier and calls into the clientState.verifyMembership method. func (l LightClientModule) VerifyMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -121,7 +121,7 @@ func (l LightClientModule) VerifyMembership( // VerifyNonMembership obtains the client state associated with the client identifier and calls into the clientState.verifyNonMembership method. func (l LightClientModule) VerifyNonMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -139,7 +139,7 @@ func (l LightClientModule) VerifyNonMembership( } // Status obtains the client state associated with the client identifier and calls into the clientState.status method. -func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Status { +func (l LightClientModule) Status(ctx context.Context, clientID string) exported.Status { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -151,7 +151,7 @@ func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Sta // LatestHeight returns the latest height for the client state for the given client identifier. // If no client is present for the provided client identifier a zero value height is returned. -func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) exported.Height { +func (l LightClientModule) LatestHeight(ctx context.Context, clientID string) exported.Height { clientStore := l.storeProvider.ClientStore(ctx, clientID) clientState, found := getClientState(clientStore, l.cdc) if !found { @@ -163,7 +163,7 @@ func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) export // TimestampAtHeight obtains the client state associated with the client identifier and calls into the clientState.getTimestampAtHeight method. func (l LightClientModule) TimestampAtHeight( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, ) (uint64, error) { @@ -178,7 +178,7 @@ func (l LightClientModule) TimestampAtHeight( // RecoverClient asserts that the substitute client is a tendermint client. It obtains the client state associated with the // subject client and calls into the subjectClientState.CheckSubstituteAndUpdateState method. -func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error { +func (l LightClientModule) RecoverClient(ctx context.Context, clientID, substituteClientID string) error { substituteClientType, _, err := clienttypes.ParseClientIdentifier(substituteClientID) if err != nil { return err @@ -207,7 +207,7 @@ func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteCl // The new client and consensus states will be unmarshaled and an error is returned if the new client state is not at a height greater // than the existing client. func (l LightClientModule) VerifyUpgradeAndUpdateState( - ctx sdk.Context, + ctx context.Context, clientID string, newClient []byte, newConsState []byte, diff --git a/modules/light-clients/07-tendermint/migrations/expected_keepers.go b/modules/light-clients/07-tendermint/migrations/expected_keepers.go index b6b681d6402..48ff97e416d 100644 --- a/modules/light-clients/07-tendermint/migrations/expected_keepers.go +++ b/modules/light-clients/07-tendermint/migrations/expected_keepers.go @@ -1,18 +1,18 @@ package migrations import ( + "context" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // ClientKeeper expected account IBC client keeper type ClientKeeper interface { - GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) - IterateClientStates(ctx sdk.Context, prefix []byte, cb func(string, exported.ClientState) bool) - ClientStore(ctx sdk.Context, clientID string) storetypes.KVStore - Logger(ctx sdk.Context) log.Logger + GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) + IterateClientStates(ctx context.Context, prefix []byte, cb func(string, exported.ClientState) bool) + ClientStore(ctx context.Context, clientID string) storetypes.KVStore + Logger(ctx context.Context) log.Logger } diff --git a/modules/light-clients/07-tendermint/migrations/migrations.go b/modules/light-clients/07-tendermint/migrations/migrations.go index b1ab4f0eea6..c5457f6e684 100644 --- a/modules/light-clients/07-tendermint/migrations/migrations.go +++ b/modules/light-clients/07-tendermint/migrations/migrations.go @@ -1,10 +1,11 @@ package migrations import ( + "context" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -13,7 +14,7 @@ import ( // PruneExpiredConsensusStates prunes all expired tendermint consensus states. This function // may optionally be called during in-place store migrations. The ibc store key must be provided. -func PruneExpiredConsensusStates(ctx sdk.Context, cdc codec.BinaryCodec, clientKeeper ClientKeeper) (int, error) { +func PruneExpiredConsensusStates(ctx context.Context, cdc codec.BinaryCodec, clientKeeper ClientKeeper) (int, error) { var clientIDs []string clientKeeper.IterateClientStates(ctx, []byte(exported.Tendermint), func(clientID string, _ exported.ClientState) bool { clientIDs = append(clientIDs, clientID) diff --git a/modules/light-clients/07-tendermint/misbehaviour_handle.go b/modules/light-clients/07-tendermint/misbehaviour_handle.go index 11f5762b47e..a91cf67c29b 100644 --- a/modules/light-clients/07-tendermint/misbehaviour_handle.go +++ b/modules/light-clients/07-tendermint/misbehaviour_handle.go @@ -2,6 +2,7 @@ package tendermint import ( "bytes" + "context" "reflect" "time" @@ -19,7 +20,7 @@ import ( // CheckForMisbehaviour detects duplicate height misbehaviour and BFT time violation misbehaviour // in a submitted Header message and verifies the correctness of a submitted Misbehaviour ClientMessage -func (ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool { +func (ClientState) CheckForMisbehaviour(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool { switch msg := msg.(type) { case *Header: tmHeader := msg @@ -90,7 +91,7 @@ func (ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, // Similarly, consensusState2 is the trusted consensus state that corresponds // to misbehaviour.Header2 // Misbehaviour sets frozen height to {0, 1} since it is only used as a boolean value (zero or non-zero). -func (cs *ClientState) verifyMisbehaviour(ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, misbehaviour *Misbehaviour) error { +func (cs *ClientState) verifyMisbehaviour(ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, misbehaviour *Misbehaviour) error { // Regardless of the type of misbehaviour, ensure that both headers are valid and would have been accepted by light-client // Retrieve trusted consensus states for each Header in misbehaviour @@ -109,13 +110,14 @@ func (cs *ClientState) verifyMisbehaviour(ctx sdk.Context, clientStore storetype // NOTE: header height and commitment root assertions are checked in // misbehaviour.ValidateBasic by the client keeper and msg.ValidateBasic // by the base application. + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if err := checkMisbehaviourHeader( - cs, tmConsensusState1, misbehaviour.Header1, ctx.BlockTime(), + cs, tmConsensusState1, misbehaviour.Header1, sdkCtx.BlockTime(), ); err != nil { return errorsmod.Wrap(err, "verifying Header1 in Misbehaviour failed") } if err := checkMisbehaviourHeader( - cs, tmConsensusState2, misbehaviour.Header2, ctx.BlockTime(), + cs, tmConsensusState2, misbehaviour.Header2, sdkCtx.BlockTime(), ); err != nil { return errorsmod.Wrap(err, "verifying Header2 in Misbehaviour failed") } diff --git a/modules/light-clients/07-tendermint/proposal_handle.go b/modules/light-clients/07-tendermint/proposal_handle.go index 60f8ea4ac8b..ae83014cfec 100644 --- a/modules/light-clients/07-tendermint/proposal_handle.go +++ b/modules/light-clients/07-tendermint/proposal_handle.go @@ -1,6 +1,7 @@ package tendermint import ( + "context" "reflect" "time" @@ -8,7 +9,6 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -27,7 +27,7 @@ import ( // In case 1) before updating the client, the client will be unfrozen by resetting // the FrozenHeight to the zero Height. func (cs ClientState) CheckSubstituteAndUpdateState( - ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore, + ctx context.Context, cdc codec.BinaryCodec, subjectClientStore, substituteClientStore storetypes.KVStore, substituteClient exported.ClientState, ) error { substituteClientState, ok := substituteClient.(*ClientState) diff --git a/modules/light-clients/07-tendermint/store.go b/modules/light-clients/07-tendermint/store.go index 823ad4c55d8..ef89b8de780 100644 --- a/modules/light-clients/07-tendermint/store.go +++ b/modules/light-clients/07-tendermint/store.go @@ -2,6 +2,7 @@ package tendermint import ( "bytes" + "context" "encoding/binary" "fmt" @@ -264,7 +265,7 @@ func GetPreviousConsensusState(clientStore storetypes.KVStore, cdc codec.BinaryC // client store. If a consensus state is expired, it is deleted and its metadata // is deleted. The number of consensus states pruned is returned. func PruneAllExpiredConsensusStates( - ctx sdk.Context, clientStore storetypes.KVStore, + ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, clientState *ClientState, ) int { var heights []exported.Height @@ -274,8 +275,8 @@ func PruneAllExpiredConsensusStates( if !found { // consensus state should always be found return true } - - if clientState.IsExpired(consState.Timestamp, ctx.BlockTime()) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + if clientState.IsExpired(consState.Timestamp, sdkCtx.BlockTime()) { heights = append(heights, height) } @@ -322,8 +323,9 @@ func bigEndianHeightBytes(height exported.Height) []byte { // as this is internal tendermint light client logic. // client state and consensus state will be set by client keeper // set iteration key to provide ability for efficient ordered iteration of consensus states. -func setConsensusMetadata(ctx sdk.Context, clientStore storetypes.KVStore, height exported.Height) { - setConsensusMetadataWithValues(clientStore, height, clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano())) +func setConsensusMetadata(ctx context.Context, clientStore storetypes.KVStore, height exported.Height) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + setConsensusMetadataWithValues(clientStore, height, clienttypes.GetSelfHeight(ctx), uint64(sdkCtx.BlockTime().UnixNano())) } // setConsensusMetadataWithValues sets the consensus metadata with the provided values diff --git a/modules/light-clients/07-tendermint/update.go b/modules/light-clients/07-tendermint/update.go index aa9d03cead6..07b3dc1ec42 100644 --- a/modules/light-clients/07-tendermint/update.go +++ b/modules/light-clients/07-tendermint/update.go @@ -2,6 +2,7 @@ package tendermint import ( "bytes" + "context" "fmt" errorsmod "cosmossdk.io/errors" @@ -21,7 +22,7 @@ import ( // VerifyClientMessage checks if the clientMessage is of type Header or Misbehaviour and verifies the message func (cs *ClientState) VerifyClientMessage( - ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, + ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage, ) error { switch msg := clientMsg.(type) { @@ -43,10 +44,11 @@ func (cs *ClientState) VerifyClientMessage( // - header timestamp is past the trusting period in relation to the consensus state // - header timestamp is less than or equal to the consensus state timestamp func (cs *ClientState) verifyHeader( - ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, + ctx context.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, header *Header, ) error { - currentTimestamp := ctx.BlockTime() + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + currentTimestamp := sdkCtx.BlockTime() // Retrieve trusted consensus states for each Header in misbehaviour consState, found := GetConsensusState(clientStore, cdc, header.TrustedHeight) @@ -132,7 +134,7 @@ func (cs *ClientState) verifyHeader( // number must be the same. To update to a new revision, use a separate upgrade path // UpdateState will prune the oldest consensus state if it is expired. // If the provided clientMsg is not of type of Header then the handler will noop and empty slice is returned. -func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height { +func (cs ClientState) UpdateState(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height { header, ok := clientMsg.(*Header) if !ok { // clientMsg is invalid Misbehaviour, no update necessary @@ -141,7 +143,8 @@ func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, client // performance: do not prune in checkTx // simulation must prune for accurate gas estimation - if (!ctx.IsCheckTx() && !ctx.IsReCheckTx()) || ctx.ExecMode() == sdk.ExecModeSimulate { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + if (!sdkCtx.IsCheckTx() && !sdkCtx.IsReCheckTx()) || sdkCtx.ExecMode() == sdk.ExecModeSimulate { cs.pruneOldestConsensusState(ctx, cdc, clientStore) } @@ -176,7 +179,7 @@ func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, client // pruneOldestConsensusState will retrieve the earliest consensus state for this clientID and check if it is expired. If it is, // that consensus state will be pruned from store along with all associated metadata. This will prevent the client store from // becoming bloated with expired consensus states that can no longer be used for updates and packet verification. -func (cs ClientState) pruneOldestConsensusState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore) { +func (cs ClientState) pruneOldestConsensusState(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore) { // Check the earliest consensus state to see if it is expired, if so then set the prune height // so that we can delete consensus state and all associated metadata. var ( @@ -190,7 +193,8 @@ func (cs ClientState) pruneOldestConsensusState(ctx sdk.Context, cdc codec.Binar panic(errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "failed to retrieve consensus state at height: %s", height)) } - if cs.IsExpired(consState.Timestamp, ctx.BlockTime()) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + if cs.IsExpired(consState.Timestamp, sdkCtx.BlockTime()) { pruneHeight = height } @@ -208,7 +212,7 @@ func (cs ClientState) pruneOldestConsensusState(ctx sdk.Context, cdc codec.Binar // UpdateStateOnMisbehaviour updates state upon misbehaviour, freezing the ClientState. This method should only be called when misbehaviour is detected // as it does not perform any misbehaviour checks. -func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, _ exported.ClientMessage) { +func (cs ClientState) UpdateStateOnMisbehaviour(ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, _ exported.ClientMessage) { cs.FrozenHeight = FrozenHeight clientStore.Set(host.ClientStateKey(), clienttypes.MustMarshalClientState(cdc, &cs)) diff --git a/modules/light-clients/07-tendermint/upgrade.go b/modules/light-clients/07-tendermint/upgrade.go index 398b6652a75..9148b4f7c77 100644 --- a/modules/light-clients/07-tendermint/upgrade.go +++ b/modules/light-clients/07-tendermint/upgrade.go @@ -1,6 +1,7 @@ package tendermint import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" @@ -8,7 +9,6 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" @@ -28,7 +28,7 @@ import ( // - any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod, // and ProofSpecs do not match parameters set by committed client func (cs ClientState) VerifyUpgradeAndUpdateState( - ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, + ctx context.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState, upgradeClientProof, upgradeConsStateProof []byte, ) error { diff --git a/modules/light-clients/08-wasm/CHANGELOG.md b/modules/light-clients/08-wasm/CHANGELOG.md index ebdffb3d6cb..754f5f21685 100644 --- a/modules/light-clients/08-wasm/CHANGELOG.md +++ b/modules/light-clients/08-wasm/CHANGELOG.md @@ -40,7 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#7114](https://github.com/cosmos/ibc-go/pull/7114) Bump WasmVM to v2.1.2. * [\#6828](https://github.com/cosmos/ibc-go/pull/6828) Bump Cosmos SDK to v0.50.9. -* [\#7126](https://github.com/cosmos/ibc-go/pull/7126) Bump CometBFT to v0.38.11. +* [\#7247](https://github.com/cosmos/ibc-go/pull/7247) Bump CometBFT to v0.38.12. ### API Breaking diff --git a/modules/light-clients/08-wasm/go.mod b/modules/light-clients/08-wasm/go.mod index 281eea13ded..72b8df1f04d 100644 --- a/modules/light-clients/08-wasm/go.mod +++ b/modules/light-clients/08-wasm/go.mod @@ -16,7 +16,7 @@ require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/store v1.1.0 + cosmossdk.io/store v1.1.1 cosmossdk.io/tools/confix v0.1.2 cosmossdk.io/x/circuit v0.1.1 cosmossdk.io/x/evidence v0.1.1 @@ -24,11 +24,10 @@ require ( cosmossdk.io/x/tx v0.13.4 cosmossdk.io/x/upgrade v0.1.4 github.com/CosmWasm/wasmvm/v2 v2.1.2 - github.com/cometbft/cometbft v0.38.11 + github.com/cometbft/cometbft v0.38.12 github.com/cosmos/cosmos-db v1.0.2 - github.com/cosmos/cosmos-sdk v0.50.9 + github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ibc-go/v9 v9.0.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -37,7 +36,7 @@ require ( github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.2 ) require ( @@ -59,7 +58,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect @@ -76,7 +75,8 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect @@ -158,13 +158,13 @@ require ( github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect + github.com/rs/cors v1.11.1 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -199,7 +199,7 @@ require ( golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.186.0 // indirect google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/modules/light-clients/08-wasm/go.sum b/modules/light-clients/08-wasm/go.sum index dc93577c717..fbd65828cd4 100644 --- a/modules/light-clients/08-wasm/go.sum +++ b/modules/light-clients/08-wasm/go.sum @@ -202,8 +202,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= cosmossdk.io/tools/confix v0.1.2 h1:2hoM1oFCNisd0ltSAAZw2i4ponARPmlhuNu3yy0VwI4= cosmossdk.io/tools/confix v0.1.2/go.mod h1:7XfcbK9sC/KNgVGxgLM0BrFbVcR/+6Dg7MFfpx7duYo= cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= @@ -277,10 +277,10 @@ github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE5 github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -337,8 +337,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= -github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= +github.com/cometbft/cometbft v0.38.12 h1:OWsLZN2KcSSFe8bet9xCn07VwhBnavPea3VyPnNq1bg= +github.com/cometbft/cometbft v0.38.12/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -353,8 +353,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= -github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef h1:us0dw4egT2k00jnK4JgQ2Su6yJlBnwCfgWnKC7MIwqk= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef/go.mod h1:9l85MGxnejiuiY4gum/RzdRKfkmLZDJh5uOD3m1zxy0= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -366,8 +366,8 @@ github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -738,6 +738,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= @@ -871,8 +873,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -907,8 +909,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -1558,8 +1560,8 @@ google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGr google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1601,8 +1603,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/modules/light-clients/08-wasm/light_client_module.go b/modules/light-clients/08-wasm/light_client_module.go index d9660cec654..cd88887418e 100644 --- a/modules/light-clients/08-wasm/light_client_module.go +++ b/modules/light-clients/08-wasm/light_client_module.go @@ -2,6 +2,7 @@ package wasm import ( "bytes" + "context" "encoding/hex" "encoding/json" "fmt" @@ -38,7 +39,7 @@ func NewLightClientModule(keeper wasmkeeper.Keeper, storeProvider clienttypes.St // Initialize unmarshals the provided client and consensus states and performs basic validation. It sets the client // state and consensus state in the client store. // It also initializes the wasm contract for the client. -func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientStateBz, consensusStateBz []byte) error { +func (l LightClientModule) Initialize(ctx context.Context, clientID string, clientStateBz, consensusStateBz []byte) error { var clientState types.ClientState if err := l.keeper.Codec().Unmarshal(clientStateBz, &clientState); err != nil { return err @@ -70,7 +71,8 @@ func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientSt Checksum: clientState.Checksum, } - return l.keeper.WasmInstantiate(ctx, clientID, clientStore, &clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return l.keeper.WasmInstantiate(sdkCtx, clientID, clientStore, &clientState, payload) } // VerifyClientMessage obtains the client state associated with the client identifier, it then must verify the ClientMessage. @@ -78,7 +80,7 @@ func (l LightClientModule) Initialize(ctx sdk.Context, clientID string, clientSt // It must handle each type of ClientMessage appropriately. Calls to CheckForMisbehaviour, UpdateState, and UpdateStateOnMisbehaviour // will assume that the content of the ClientMessage has been verified and can be trusted. An error should be returned // if the ClientMessage fails to verify. -func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) error { +func (l LightClientModule) VerifyClientMessage(ctx context.Context, clientID string, clientMsg exported.ClientMessage) error { clientStore := l.storeProvider.ClientStore(ctx, clientID) cdc := l.keeper.Codec() @@ -95,13 +97,14 @@ func (l LightClientModule) VerifyClientMessage(ctx sdk.Context, clientID string, payload := types.QueryMsg{ VerifyClientMessage: &types.VerifyClientMessageMsg{ClientMessage: clientMessage.Data}, } - _, err := l.keeper.WasmQuery(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + _, err := l.keeper.WasmQuery(sdkCtx, clientID, clientStore, clientState, payload) return err } // CheckForMisbehaviour obtains the client state associated with the client identifier, it detects misbehaviour in a submitted Header // message and verifies the correctness of a submitted Misbehaviour ClientMessage. -func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) bool { +func (l LightClientModule) CheckForMisbehaviour(ctx context.Context, clientID string, clientMsg exported.ClientMessage) bool { clientStore := l.storeProvider.ClientStore(ctx, clientID) cdc := l.keeper.Codec() @@ -119,7 +122,8 @@ func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string CheckForMisbehaviour: &types.CheckForMisbehaviourMsg{ClientMessage: clientMessage.Data}, } - res, err := l.keeper.WasmQuery(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + res, err := l.keeper.WasmQuery(sdkCtx, clientID, clientStore, clientState, payload) if err != nil { return false } @@ -135,7 +139,7 @@ func (l LightClientModule) CheckForMisbehaviour(ctx sdk.Context, clientID string // UpdateStateOnMisbehaviour obtains the client state associated with the client identifier performs appropriate state changes on // a client state given that misbehaviour has been detected and verified. // Client state is updated in the store by the contract. -func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) { +func (l LightClientModule) UpdateStateOnMisbehaviour(ctx context.Context, clientID string, clientMsg exported.ClientMessage) { clientStore := l.storeProvider.ClientStore(ctx, clientID) cdc := l.keeper.Codec() @@ -153,7 +157,8 @@ func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID s UpdateStateOnMisbehaviour: &types.UpdateStateOnMisbehaviourMsg{ClientMessage: clientMessage.Data}, } - _, err := l.keeper.WasmSudo(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + _, err := l.keeper.WasmSudo(sdkCtx, clientID, clientStore, clientState, payload) if err != nil { panic(err) } @@ -161,7 +166,7 @@ func (l LightClientModule) UpdateStateOnMisbehaviour(ctx sdk.Context, clientID s // UpdateState obtains the client state associated with the client identifier and calls into the appropriate // contract endpoint. Client state and new consensus states are updated in the store by the contract. -func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height { +func (l LightClientModule) UpdateState(ctx context.Context, clientID string, clientMsg exported.ClientMessage) []exported.Height { clientStore := l.storeProvider.ClientStore(ctx, clientID) cdc := l.keeper.Codec() @@ -179,7 +184,8 @@ func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientM UpdateState: &types.UpdateStateMsg{ClientMessage: clientMessage.Data}, } - res, err := l.keeper.WasmSudo(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + res, err := l.keeper.WasmSudo(sdkCtx, clientID, clientStore, clientState, payload) if err != nil { panic(err) } @@ -202,7 +208,7 @@ func (l LightClientModule) UpdateState(ctx sdk.Context, clientID string, clientM // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // If a zero proof height is passed in, it will fail to retrieve the associated consensus state. func (l LightClientModule) VerifyMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -247,7 +253,8 @@ func (l LightClientModule) VerifyMembership( }, } - _, err := l.keeper.WasmSudo(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + _, err := l.keeper.WasmSudo(sdkCtx, clientID, clientStore, clientState, payload) return err } @@ -256,7 +263,7 @@ func (l LightClientModule) VerifyMembership( // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // If a zero proof height is passed in, it will fail to retrieve the associated consensus state. func (l LightClientModule) VerifyNonMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -299,7 +306,8 @@ func (l LightClientModule) VerifyNonMembership( }, } - _, err := l.keeper.WasmSudo(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + _, err := l.keeper.WasmSudo(sdkCtx, clientID, clientStore, clientState, payload) return err } @@ -313,7 +321,7 @@ func (l LightClientModule) VerifyNonMembership( // // A frozen client will become expired, so the Frozen status // has higher precedence. -func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Status { +func (l LightClientModule) Status(ctx context.Context, clientID string) exported.Status { clientStore := l.storeProvider.ClientStore(ctx, clientID) cdc := l.keeper.Codec() @@ -328,7 +336,8 @@ func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Sta } payload := types.QueryMsg{Status: &types.StatusMsg{}} - res, err := l.keeper.WasmQuery(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + res, err := l.keeper.WasmQuery(sdkCtx, clientID, clientStore, clientState, payload) if err != nil { return exported.Unknown } @@ -343,7 +352,7 @@ func (l LightClientModule) Status(ctx sdk.Context, clientID string) exported.Sta // LatestHeight returns the latest height for the client state for the given client identifier. // If no client is present for the provided client identifier a zero value height is returned. -func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) exported.Height { +func (l LightClientModule) LatestHeight(ctx context.Context, clientID string) exported.Height { clientStore := l.storeProvider.ClientStore(ctx, clientID) cdc := l.keeper.Codec() @@ -357,7 +366,7 @@ func (l LightClientModule) LatestHeight(ctx sdk.Context, clientID string) export // TimestampAtHeight obtains the client state associated with the client identifier and calls into the appropriate contract endpoint. // It returns the timestamp in nanoseconds of the consensus state at the given height. -func (l LightClientModule) TimestampAtHeight(ctx sdk.Context, clientID string, height exported.Height) (uint64, error) { +func (l LightClientModule) TimestampAtHeight(ctx context.Context, clientID string, height exported.Height) (uint64, error) { clientStore := l.storeProvider.ClientStore(ctx, clientID) cdc := l.keeper.Codec() @@ -377,7 +386,8 @@ func (l LightClientModule) TimestampAtHeight(ctx sdk.Context, clientID string, h }, } - res, err := l.keeper.WasmQuery(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + res, err := l.keeper.WasmQuery(sdkCtx, clientID, clientStore, clientState, payload) if err != nil { return 0, errorsmod.Wrapf(err, "height (%s)", height) } @@ -394,7 +404,7 @@ func (l LightClientModule) TimestampAtHeight(ctx sdk.Context, clientID string, h // subject client and calls into the appropriate contract endpoint. // It will verify that a substitute client state is valid and update the subject client state. // Note that this method is used only for recovery and will not allow changes to the checksum. -func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error { +func (l LightClientModule) RecoverClient(ctx context.Context, clientID, substituteClientID string) error { substituteClientType, _, err := clienttypes.ParseClientIdentifier(substituteClientID) if err != nil { return err @@ -430,7 +440,8 @@ func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteCl MigrateClientStore: &types.MigrateClientStoreMsg{}, } - _, err = l.keeper.WasmSudo(ctx, clientID, store, subjectClientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + _, err = l.keeper.WasmSudo(sdkCtx, clientID, store, subjectClientState, payload) return err } @@ -438,7 +449,7 @@ func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteCl // The new client and consensus states will be unmarshaled and an error is returned if the new client state is not at a height greater // than the existing client. On a successful verification, it expects the contract to update the new client state, consensus state, and any other client metadata. func (l LightClientModule) VerifyUpgradeAndUpdateState( - ctx sdk.Context, + ctx context.Context, clientID string, newClient []byte, newConsState []byte, @@ -478,6 +489,7 @@ func (l LightClientModule) VerifyUpgradeAndUpdateState( }, } - _, err := l.keeper.WasmSudo(ctx, clientID, clientStore, clientState, payload) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + _, err := l.keeper.WasmSudo(sdkCtx, clientID, clientStore, clientState, payload) return err } diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index 583cb82e709..aa725076150 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -105,9 +105,6 @@ import ( cmtos "github.com/cometbft/cometbft/libs/os" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" wasm "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" wasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" wasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" @@ -170,8 +167,7 @@ var ( ) // SimApp extends an ABCI application, but with most of its parameters exported. -// They are exported for convenience in creating helper functions, as object -// capabilities aren't needed for testing. +// They are exported for convenience in creating helper functions. type SimApp struct { *baseapp.BaseApp legacyAmino *codec.LegacyAmino @@ -187,7 +183,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -210,15 +205,6 @@ type SimApp struct { CircuitKeeper circuitkeeper.Keeper PacketServer *packetserverkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // make IBC modules public for test purposes // these modules are never directly routed to by the IBC Router ICAAuthModule ibcmock.IBCModule @@ -308,7 +294,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, wasmtypes.StoreKey, ) @@ -318,7 +304,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(ibcmock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -337,25 +323,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -414,11 +381,11 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // setup packet server keeper for Eureka tests - app.PacketServer = packetserverkeeper.NewKeeper(appCodec, keys[ibcexported.StoreKey], app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ClientKeeper) + app.PacketServer = packetserverkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ClientKeeper) govConfig := govtypes.DefaultConfig() /* @@ -480,27 +447,27 @@ func NewSimApp( // IBC Fee Module keeper app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( - appCodec, keys[ibcfeetypes.StoreKey], + appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // ICA Host keeper app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -512,10 +479,10 @@ func NewSimApp( // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper // since fee middleware will wrap the IBCKeeper for underlying application. app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -524,10 +491,10 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := ibcmock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName)) ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) // Create Transfer Stack @@ -556,7 +523,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule var ok bool - icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("")) app.ICAAuthModule, ok = icaControllerStack.(ibcmock.IBCModule) if !ok { panic(fmt.Errorf("cannot convert %T into %T", icaControllerStack, app.ICAAuthModule)) @@ -573,9 +540,6 @@ func NewSimApp( // Add host, controller & ica auth modules to IBC router ibcRouter. - // the ICA Controller middleware needs to be explicitly added to the IBC Router because the - // ICA controller module owns the port capability for ICA. The ICA authentication module - // owns the channel capability. AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). AddRoute(icahosttypes.SubModuleName, icaHostStack). AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerStack) // ica with mock auth module stack route to ica (top level of middleware stack) @@ -590,7 +554,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule feeWithMockModule := ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) ibcRouter.AddRoute(MockFeePort, feeWithMockModule) @@ -633,7 +597,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), @@ -688,9 +651,7 @@ func NewSimApp( // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -711,7 +672,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, feegrant.ModuleName, icatypes.ModuleName, @@ -724,11 +684,7 @@ func NewSimApp( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, @@ -846,17 +802,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } @@ -1121,11 +1066,6 @@ func (app *SimApp) GetWasmKeeper() wasmkeeper.Keeper { return app.WasmClientKeeper } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go b/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go index e2377cab7ab..a1e4677f614 100644 --- a/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go +++ b/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go @@ -142,9 +142,6 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) } autoCliOpts.ClientCtx = clientCtx - if err != nil { - return autocli.AppOptions{}, err - } return autoCliOpts, nil } diff --git a/modules/light-clients/08-wasm/types/expected_keepers.go b/modules/light-clients/08-wasm/types/expected_keepers.go index a9f8d40872e..a0a469b4c40 100644 --- a/modules/light-clients/08-wasm/types/expected_keepers.go +++ b/modules/light-clients/08-wasm/types/expected_keepers.go @@ -1,16 +1,16 @@ package types import ( - storetypes "cosmossdk.io/store/types" + "context" - sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // ClientKeeper defines the expected client keeper type ClientKeeper interface { - ClientStore(ctx sdk.Context, clientID string) storetypes.KVStore - GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) - SetClientState(ctx sdk.Context, clientID string, clientState exported.ClientState) + ClientStore(ctx context.Context, clientID string) storetypes.KVStore + GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) + SetClientState(ctx context.Context, clientID string, clientState exported.ClientState) } diff --git a/modules/light-clients/09-localhost/light_client_module.go b/modules/light-clients/09-localhost/light_client_module.go index 3095503d985..d18cbce8eef 100644 --- a/modules/light-clients/09-localhost/light_client_module.go +++ b/modules/light-clients/09-localhost/light_client_module.go @@ -2,9 +2,10 @@ package localhost import ( "bytes" + "context" + corestore "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" - storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -32,40 +33,40 @@ var _ exported.LightClientModule = (*LightClientModule)(nil) // LightClientModule implements the core IBC api.LightClientModule interface. type LightClientModule struct { - cdc codec.BinaryCodec - key storetypes.StoreKey + cdc codec.BinaryCodec + storeService corestore.KVStoreService } // NewLightClientModule creates and returns a new 09-localhost LightClientModule. -func NewLightClientModule(cdc codec.BinaryCodec, key storetypes.StoreKey) *LightClientModule { +func NewLightClientModule(cdc codec.BinaryCodec, storeService corestore.KVStoreService) *LightClientModule { return &LightClientModule{ - cdc: cdc, - key: key, + cdc: cdc, + storeService: storeService, } } // Initialize returns an error because it is stateless. -func (LightClientModule) Initialize(_ sdk.Context, _ string, _, _ []byte) error { +func (LightClientModule) Initialize(_ context.Context, _ string, _, _ []byte) error { return errorsmod.Wrap(clienttypes.ErrClientExists, "localhost is stateless and cannot be initialized") } // VerifyClientMessage is unsupported by the 09-localhost client type and returns an error. -func (LightClientModule) VerifyClientMessage(_ sdk.Context, _ string, _ exported.ClientMessage) error { +func (LightClientModule) VerifyClientMessage(_ context.Context, _ string, _ exported.ClientMessage) error { return errorsmod.Wrap(clienttypes.ErrUpdateClientFailed, "client message verification is unsupported by the localhost client") } // CheckForMisbehaviour is unsupported by the 09-localhost client type and performs a no-op, returning false. -func (LightClientModule) CheckForMisbehaviour(_ sdk.Context, _ string, _ exported.ClientMessage) bool { +func (LightClientModule) CheckForMisbehaviour(_ context.Context, _ string, _ exported.ClientMessage) bool { return false } // UpdateStateOnMisbehaviour is unsupported by the 09-localhost client type and performs a no-op. -func (LightClientModule) UpdateStateOnMisbehaviour(_ sdk.Context, _ string, _ exported.ClientMessage) { +func (LightClientModule) UpdateStateOnMisbehaviour(_ context.Context, _ string, _ exported.ClientMessage) { // no-op } // UpdateState performs a no-op and returns the context height in the updated heights return value. -func (LightClientModule) UpdateState(ctx sdk.Context, _ string, _ exported.ClientMessage) []exported.Height { +func (LightClientModule) UpdateState(ctx context.Context, _ string, _ exported.ClientMessage) []exported.Height { return []exported.Height{clienttypes.GetSelfHeight(ctx)} } @@ -73,7 +74,7 @@ func (LightClientModule) UpdateState(ctx sdk.Context, _ string, _ exported.Clien // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // The caller must provide the full IBC store. func (l LightClientModule) VerifyMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -82,7 +83,7 @@ func (l LightClientModule) VerifyMembership( path exported.Path, value []byte, ) error { - ibcStore := ctx.KVStore(l.key) + ibcStore := l.storeService.OpenKVStore(ctx) // ensure the proof provided is the expected sentinel localhost client proof if !bytes.Equal(proof, SentinelProof) { @@ -99,7 +100,10 @@ func (l LightClientModule) VerifyMembership( } // The commitment prefix (eg: "ibc") is omitted when operating on the core IBC store - bz := ibcStore.Get(merklePath.KeyPath[1]) + bz, err := ibcStore.Get(merklePath.KeyPath[1]) + if err != nil { + panic(err) + } if bz == nil { return errorsmod.Wrapf(clienttypes.ErrFailedMembershipVerification, "value not found for path %s", path) } @@ -115,7 +119,7 @@ func (l LightClientModule) VerifyMembership( // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // The caller must provide the full IBC store. func (l LightClientModule) VerifyNonMembership( - ctx sdk.Context, + ctx context.Context, clientID string, height exported.Height, delayTimePeriod uint64, @@ -123,7 +127,7 @@ func (l LightClientModule) VerifyNonMembership( proof []byte, path exported.Path, ) error { - ibcStore := ctx.KVStore(l.key) + ibcStore := l.storeService.OpenKVStore(ctx) // ensure the proof provided is the expected sentinel localhost client proof if !bytes.Equal(proof, SentinelProof) { @@ -140,7 +144,11 @@ func (l LightClientModule) VerifyNonMembership( } // The commitment prefix (eg: "ibc") is omitted when operating on the core IBC store - if ibcStore.Has(merklePath.KeyPath[1]) { + has, err := ibcStore.Has(merklePath.KeyPath[1]) + if err != nil { + return errorsmod.Wrapf(err, "error checking for value for path %s", path) + } + if has { return errorsmod.Wrapf(clienttypes.ErrFailedNonMembershipVerification, "value found for path %s", path) } @@ -148,27 +156,28 @@ func (l LightClientModule) VerifyNonMembership( } // Status always returns Active. The 09-localhost status cannot be changed. -func (LightClientModule) Status(_ sdk.Context, _ string) exported.Status { +func (LightClientModule) Status(_ context.Context, _ string) exported.Status { return exported.Active } // LatestHeight returns the context height. -func (LightClientModule) LatestHeight(ctx sdk.Context, _ string) exported.Height { +func (LightClientModule) LatestHeight(ctx context.Context, _ string) exported.Height { return clienttypes.GetSelfHeight(ctx) } // TimestampAtHeight returns the current block time retrieved from the application context. The localhost client does not store consensus states and thus // cannot provide a timestamp for the provided height. -func (LightClientModule) TimestampAtHeight(ctx sdk.Context, _ string, _ exported.Height) (uint64, error) { - return uint64(ctx.BlockTime().UnixNano()), nil +func (LightClientModule) TimestampAtHeight(ctx context.Context, _ string, _ exported.Height) (uint64, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 + return uint64(sdkCtx.BlockTime().UnixNano()), nil } // RecoverClient returns an error. The localhost cannot be modified by proposals. -func (LightClientModule) RecoverClient(_ sdk.Context, _, _ string) error { +func (LightClientModule) RecoverClient(_ context.Context, _, _ string) error { return errorsmod.Wrap(clienttypes.ErrUpdateClientFailed, "cannot update localhost client with a proposal") } // VerifyUpgradeAndUpdateState returns an error since localhost cannot be upgraded. -func (LightClientModule) VerifyUpgradeAndUpdateState(_ sdk.Context, _ string, _, _, _, _ []byte) error { +func (LightClientModule) VerifyUpgradeAndUpdateState(_ context.Context, _ string, _, _, _, _ []byte) error { return errorsmod.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade localhost client") } diff --git a/proto/capability/v1/capability.proto b/proto/capability/v1/capability.proto deleted file mode 100644 index 31136cc5de2..00000000000 --- a/proto/capability/v1/capability.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; - -package capability.v1; - -import "gogoproto/gogo.proto"; -import "amino/amino.proto"; - -option go_package = "github.com/cosmos/ibc-go/modules/capability/types"; - -// Capability defines an implementation of an object capability. The index -// provided to a Capability must be globally unique. -message Capability { - option (gogoproto.goproto_stringer) = false; - - uint64 index = 1; -} - -// Owner defines a single capability owner. An owner is defined by the name of -// capability and the module name. -message Owner { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; - - string module = 1; - string name = 2; -} - -// CapabilityOwners defines a set of owners of a single Capability. The set of -// owners must be unique. -message CapabilityOwners { - repeated Owner owners = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} diff --git a/proto/capability/v1/genesis.proto b/proto/capability/v1/genesis.proto deleted file mode 100644 index f345f6b2cf3..00000000000 --- a/proto/capability/v1/genesis.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; - -package capability.v1; - -import "gogoproto/gogo.proto"; -import "capability/v1/capability.proto"; -import "amino/amino.proto"; - -option go_package = "github.com/cosmos/ibc-go/modules/capability/types"; - -// GenesisOwners defines the capability owners with their corresponding index. -message GenesisOwners { - // index is the index of the capability owner. - uint64 index = 1; - - // index_owners are the owners at the given index. - CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} - -// GenesisState defines the capability module's genesis state. -message GenesisState { - // index is the capability global index. - uint64 index = 1; - - // owners represents a map from index to owners of the capability index - // index key is string to allow amino marshalling. - repeated GenesisOwners owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} diff --git a/simapp/app.go b/simapp/app.go index c40fc75e681..c5a9039c6ae 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -101,9 +101,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -161,8 +158,7 @@ var ( ) // SimApp extends an ABCI application, but with most of its parameters exported. -// They are exported for convenience in creating helper functions, as object -// capabilities aren't needed for testing. +// They are exported for convenience in creating helper functions. type SimApp struct { *baseapp.BaseApp legacyAmino *codec.LegacyAmino @@ -178,7 +174,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -199,15 +194,6 @@ type SimApp struct { ConsensusParamsKeeper consensusparamkeeper.Keeper CircuitKeeper circuitkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // make IBC modules public for test purposes // these modules are never directly routed to by the IBC Router IBCMockModule mock.IBCModule @@ -297,7 +283,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, ) @@ -307,7 +293,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, mock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(mock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -326,26 +312,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(mock.ModuleName) - scopedIBCMockBlockUpgradeKeeper := app.CapabilityKeeper.ScopeToModule(mock.MockBlockUpgrade) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(mock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -404,7 +370,7 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) govConfig := govtypes.DefaultConfig() @@ -425,27 +391,27 @@ func NewSimApp( // IBC Fee Module keeper app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( - appCodec, keys[ibcfeetypes.StoreKey], + appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // ICA Host keeper app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, app.AccountKeeper, - scopedICAHostKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), + app.IBCKeeper.ChannelKeeper, app.AccountKeeper, + app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -457,10 +423,10 @@ func NewSimApp( // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper // since fee middleware will wrap the IBCKeeper for underlying application. app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -469,17 +435,17 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := mock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := mock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.ModuleName)) app.IBCMockModule = mockIBCModule ibcRouter.AddRoute(mock.ModuleName, mockIBCModule) // Mock IBC app wrapped with a middleware which does not implement the UpgradeableModule interface. // NOTE: this is used to test integration with apps which do not yet fulfill the UpgradeableModule interface and error when // an upgrade is tried on the channel. - mockBlockUpgradeIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.MockBlockUpgrade, scopedIBCMockBlockUpgradeKeeper)) + mockBlockUpgradeIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.MockBlockUpgrade)) mockBlockUpgradeMw := mock.NewBlockUpgradeMiddleware(&mockModule, mockBlockUpgradeIBCModule.IBCApp) ibcRouter.AddRoute(mock.MockBlockUpgrade, mockBlockUpgradeMw) @@ -508,7 +474,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule - icaControllerStack = mock.NewIBCModule(&mockModule, mock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = mock.NewIBCModule(&mockModule, mock.NewIBCApp("")) var ok bool app.ICAAuthModule, ok = icaControllerStack.(mock.IBCModule) if !ok { @@ -526,9 +492,6 @@ func NewSimApp( // Add host, controller & ica auth modules to IBC router ibcRouter. - // the ICA Controller middleware needs to be explicitly added to the IBC Router because the - // ICA controller module owns the port capability for ICA. The ICA authentication module - // owns the channel capability. AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). AddRoute(icahosttypes.SubModuleName, icaHostStack). AddRoute(mock.ModuleName+icacontrollertypes.SubModuleName, icaControllerStack) // ica with mock auth module stack route to ica (top level of middleware stack) @@ -543,7 +506,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule feeWithMockModule := ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) ibcRouter.AddRoute(MockFeePort, feeWithMockModule) @@ -583,7 +546,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), @@ -637,9 +599,7 @@ func NewSimApp( // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -659,7 +619,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, feegrant.ModuleName, icatypes.ModuleName, @@ -671,11 +630,7 @@ func NewSimApp( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, @@ -776,17 +731,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } diff --git a/simapp/go.mod b/simapp/go.mod index df4443c1e09..0e27d1f8ac0 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -4,28 +4,24 @@ toolchain go1.22.3 module github.com/cosmos/ibc-go/simapp -replace ( - github.com/cosmos/ibc-go/modules/capability => ../modules/capability - github.com/cosmos/ibc-go/v9 => ../ -) +replace github.com/cosmos/ibc-go/v9 => ../ require ( cosmossdk.io/api v0.7.5 cosmossdk.io/client/v2 v2.0.0-beta.4 cosmossdk.io/core v0.11.1 cosmossdk.io/log v1.4.1 - cosmossdk.io/store v1.1.0 + cosmossdk.io/store v1.1.1 cosmossdk.io/tools/confix v0.1.2 cosmossdk.io/x/circuit v0.1.1 cosmossdk.io/x/evidence v0.1.1 cosmossdk.io/x/feegrant v0.1.1 cosmossdk.io/x/tx v0.13.4 cosmossdk.io/x/upgrade v0.1.4 - github.com/cometbft/cometbft v0.38.11 + github.com/cometbft/cometbft v0.38.12 github.com/cosmos/cosmos-db v1.0.2 - github.com/cosmos/cosmos-sdk v0.50.9 + github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ibc-go/v9 v9.0.0 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 @@ -55,7 +51,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect @@ -72,7 +68,8 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect @@ -156,13 +153,13 @@ require ( github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.11.0 // indirect + github.com/rs/cors v1.11.1 // indirect github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -197,8 +194,8 @@ require ( google.golang.org/api v0.186.0 // indirect google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect - google.golang.org/grpc v1.65.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.66.2 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index 440b60a2718..2c87428eded 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -202,8 +202,8 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= -cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= cosmossdk.io/tools/confix v0.1.2 h1:2hoM1oFCNisd0ltSAAZw2i4ponARPmlhuNu3yy0VwI4= cosmossdk.io/tools/confix v0.1.2/go.mod h1:7XfcbK9sC/KNgVGxgLM0BrFbVcR/+6Dg7MFfpx7duYo= cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= @@ -275,10 +275,10 @@ github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE5 github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -335,8 +335,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= -github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= +github.com/cometbft/cometbft v0.38.12 h1:OWsLZN2KcSSFe8bet9xCn07VwhBnavPea3VyPnNq1bg= +github.com/cometbft/cometbft v0.38.12/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0= github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -351,8 +351,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= -github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef h1:us0dw4egT2k00jnK4JgQ2Su6yJlBnwCfgWnKC7MIwqk= +github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef/go.mod h1:9l85MGxnejiuiY4gum/RzdRKfkmLZDJh5uOD3m1zxy0= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= @@ -362,8 +362,10 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= +github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -734,6 +736,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= @@ -867,8 +871,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -903,8 +907,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -1552,8 +1556,8 @@ google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGr google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1595,8 +1599,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index a3f2c67d5e8..496a129da46 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -140,9 +140,6 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) } autoCliOpts.ClientCtx = clientCtx - if err != nil { - return autocli.AppOptions{}, err - } return autoCliOpts, nil } diff --git a/testing/README.md b/testing/README.md index a14cbe70ef4..297a3150d3f 100644 --- a/testing/README.md +++ b/testing/README.md @@ -53,7 +53,6 @@ type TestingApp interface { GetBaseApp() *baseapp.BaseApp GetStakingKeeper() ibctestingtypes.StakingKeeper GetIBCKeeper() *keeper.Keeper - GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper GetTxConfig() client.TxConfig // Implemented by SimApp @@ -86,11 +85,6 @@ func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper { return app.IBCKeeper } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/testing/chain.go b/testing/chain.go index cda9fe83b4c..8a8dbabba0f 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -27,8 +27,6 @@ import ( cmttypes "github.com/cometbft/cometbft/types" cmtversion "github.com/cometbft/cometbft/version" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" @@ -561,61 +559,6 @@ func MakeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) cmttypes.B } } -// CreatePortCapability binds and claims a capability for the given portID if it does not -// already exist. This function will fail testing on any resulting error. -// NOTE: only creation of a capability for a transfer or mock port is supported -// Other applications must bind to the port in InitGenesis or modify this code. -func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.ScopedKeeper, portID string) { - // check if the portId is already binded, if not bind it - _, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.PortPath(portID)) - if !ok { - // create capability using the IBC capability keeper - capability, err := chain.App.GetScopedIBCKeeper().NewCapability(chain.GetContext(), host.PortPath(portID)) - require.NoError(chain.TB, err) - - // claim capability using the scopedKeeper - err = scopedKeeper.ClaimCapability(chain.GetContext(), capability, host.PortPath(portID)) - require.NoError(chain.TB, err) - } - - chain.NextBlock() -} - -// GetPortCapability returns the port capability for the given portID. The capability must -// exist, otherwise testing will fail. -func (chain *TestChain) GetPortCapability(portID string) *capabilitytypes.Capability { - capability, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.PortPath(portID)) - require.True(chain.TB, ok) - - return capability -} - -// CreateChannelCapability binds and claims a capability for the given portID and channelID -// if it does not already exist. This function will fail testing on any resulting error. The -// scoped keeper passed in will claim the new capability. -func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.ScopedKeeper, portID, channelID string) { - capName := host.ChannelCapabilityPath(portID, channelID) - // check if the portId is already binded, if not bind it - _, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), capName) - if !ok { - capability, err := chain.App.GetScopedIBCKeeper().NewCapability(chain.GetContext(), capName) - require.NoError(chain.TB, err) - err = scopedKeeper.ClaimCapability(chain.GetContext(), capability, capName) - require.NoError(chain.TB, err) - } - - chain.NextBlock() -} - -// GetChannelCapability returns the channel capability for the given portID and channelID. -// The capability must exist, otherwise testing will fail. -func (chain *TestChain) GetChannelCapability(portID, channelID string) *capabilitytypes.Capability { - capability, ok := chain.App.GetScopedIBCKeeper().GetCapability(chain.GetContext(), host.ChannelCapabilityPath(portID, channelID)) - require.True(chain.TB, ok) - - return capability -} - // GetClientLatestHeight returns the latest height for the client state with the given client identifier. // If an invalid client identifier is provided then a zero value height will be returned and testing will fail. func (chain *TestChain) GetClientLatestHeight(clientID string) exported.Height { diff --git a/testing/endpoint.go b/testing/endpoint.go index 9a398b8e3ff..736ddecacdc 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -465,7 +465,7 @@ func (endpoint *Endpoint) SendPacketV2( data []byte, ) (uint64, error) { // no need to send message, acting as a module - sequence, err := endpoint.Chain.App.GetPacketServer().SendPacket(endpoint.Chain.GetContext(), nil, endpoint.ClientID, endpoint.ChannelConfig.PortID, endpoint.Counterparty.ChannelConfig.PortID, timeoutHeight, timeoutTimestamp, version, data) + sequence, err := endpoint.Chain.App.GetPacketServer().SendPacket(endpoint.Chain.GetContext(), endpoint.ClientID, endpoint.ChannelConfig.PortID, endpoint.Counterparty.ChannelConfig.PortID, timeoutHeight, timeoutTimestamp, version, data) if err != nil { return 0, err } @@ -490,10 +490,8 @@ func (endpoint *Endpoint) SendPacket( timeoutTimestamp uint64, data []byte, ) (uint64, error) { - channelCap := endpoint.Chain.GetChannelCapability(endpoint.ChannelConfig.PortID, endpoint.ChannelID) - // no need to send message, acting as a module - sequence, err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.SendPacket(endpoint.Chain.GetContext(), channelCap, endpoint.ChannelConfig.PortID, endpoint.ChannelID, timeoutHeight, timeoutTimestamp, data) + sequence, err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.SendPacket(endpoint.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID, timeoutHeight, timeoutTimestamp, data) if err != nil { return 0, err } @@ -545,10 +543,8 @@ func (endpoint *Endpoint) RecvPacketWithResult(packet channeltypes.Packet) (*abc // WriteAcknowledgement writes an acknowledgement on the channel associated with the endpoint. // The counterparty client is updated. func (endpoint *Endpoint) WriteAcknowledgement(ack exported.Acknowledgement, packet exported.PacketI) error { - channelCap := endpoint.Chain.GetChannelCapability(packet.GetDestPort(), packet.GetDestChannel()) - // no need to send message, acting as a handler - err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), channelCap, packet, ack) + err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), packet, ack) if err != nil { return err } @@ -830,7 +826,7 @@ func (endpoint *Endpoint) ChanUpgradeCancel() error { return endpoint.Chain.sendMsgs(msg) } -// Deprecated: usage of this function should be replaced by `UpdateChannelState` +// Deprecated: usage of this function should be replaced by `UpdateChannel` // SetChannelState sets a channel state func (endpoint *Endpoint) SetChannelState(state channeltypes.State) error { channel := endpoint.GetChannel() diff --git a/testing/mock/ibc_app.go b/testing/mock/ibc_app.go index 798bd35749a..09532ac0ff5 100644 --- a/testing/mock/ibc_app.go +++ b/testing/mock/ibc_app.go @@ -1,43 +1,40 @@ package mock import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // IBCApp contains IBC application module callbacks as defined in 05-port. type IBCApp struct { - PortID string - ScopedKeeper capabilitykeeper.ScopedKeeper + PortID string OnChanOpenInit func( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, - channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) OnChanOpenTry func( - ctx sdk.Context, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, - channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (version string, err error) OnChanOpenAck func( - ctx sdk.Context, + ctx context.Context, portID, channelID string, counterpartyChannelID string, @@ -45,19 +42,19 @@ type IBCApp struct { ) error OnChanOpenConfirm func( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error OnChanCloseInit func( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error OnChanCloseConfirm func( - ctx sdk.Context, + ctx context.Context, portID, channelID string, ) error @@ -68,14 +65,14 @@ type IBCApp struct { // otherwise the application state changes are discarded. In either case the packet is received // and the acknowledgement is written (in synchronous cases). OnRecvPacket func( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) exported.Acknowledgement OnAcknowledgementPacket func( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, @@ -83,14 +80,14 @@ type IBCApp struct { ) error OnTimeoutPacket func( - ctx sdk.Context, + ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress, ) error OnChanUpgradeInit func( - ctx sdk.Context, + ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, @@ -98,7 +95,7 @@ type IBCApp struct { ) (string, error) OnChanUpgradeTry func( - ctx sdk.Context, + ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, @@ -106,14 +103,14 @@ type IBCApp struct { ) (string, error) OnChanUpgradeAck func( - ctx sdk.Context, + ctx context.Context, portID, channelID, counterpartyVersion string, ) error OnChanUpgradeOpen func( - ctx sdk.Context, + ctx context.Context, portID, channelID string, order channeltypes.Order, @@ -123,9 +120,8 @@ type IBCApp struct { } // NewIBCApp returns a IBCApp. An empty PortID indicates the mock app doesn't bind/claim ports. -func NewIBCApp(portID string, scopedKeeper capabilitykeeper.ScopedKeeper) *IBCApp { +func NewIBCApp(portID string) *IBCApp { return &IBCApp{ - PortID: portID, - ScopedKeeper: scopedKeeper, + PortID: portID, } } diff --git a/testing/mock/ibc_module.go b/testing/mock/ibc_module.go index 03c21ffce4a..5f37f5150e8 100644 --- a/testing/mock/ibc_module.go +++ b/testing/mock/ibc_module.go @@ -2,17 +2,14 @@ package mock import ( "bytes" - "fmt" + "context" "reflect" - "strconv" "strings" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -46,22 +43,15 @@ func NewIBCModule(appModule *AppModule, app *IBCApp) IBCModule { // OnChanOpenInit implements the IBCModule interface. func (im IBCModule) OnChanOpenInit( - ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, - channelID string, chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, + channelID string, counterparty channeltypes.Counterparty, version string, ) (string, error) { if strings.TrimSpace(version) == "" { version = Version } if im.IBCApp.OnChanOpenInit != nil { - return im.IBCApp.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version) - } - - if chanCap != nil { - // Claim channel capability passed back by IBC module - if err := im.IBCApp.ScopedKeeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } + return im.IBCApp.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version) } return version, nil @@ -69,25 +59,18 @@ func (im IBCModule) OnChanOpenInit( // OnChanOpenTry implements the IBCModule interface. func (im IBCModule) OnChanOpenTry( - ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, - channelID string, chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, + channelID string, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (version string, err error) { if im.IBCApp.OnChanOpenTry != nil { - return im.IBCApp.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) - } - - if chanCap != nil { - // Claim channel capability passed back by IBC module - if err := im.IBCApp.ScopedKeeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } + return im.IBCApp.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, counterparty, counterpartyVersion) } return Version, nil } // OnChanOpenAck implements the IBCModule interface. -func (im IBCModule) OnChanOpenAck(ctx sdk.Context, portID string, channelID string, counterpartyChannelID string, counterpartyVersion string) error { +func (im IBCModule) OnChanOpenAck(ctx context.Context, portID string, channelID string, counterpartyChannelID string, counterpartyVersion string) error { if im.IBCApp.OnChanOpenAck != nil { return im.IBCApp.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) } @@ -96,7 +79,7 @@ func (im IBCModule) OnChanOpenAck(ctx sdk.Context, portID string, channelID stri } // OnChanOpenConfirm implements the IBCModule interface. -func (im IBCModule) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error { +func (im IBCModule) OnChanOpenConfirm(ctx context.Context, portID, channelID string) error { if im.IBCApp.OnChanOpenConfirm != nil { return im.IBCApp.OnChanOpenConfirm(ctx, portID, channelID) } @@ -105,7 +88,7 @@ func (im IBCModule) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) } // OnChanCloseInit implements the IBCModule interface. -func (im IBCModule) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error { +func (im IBCModule) OnChanCloseInit(ctx context.Context, portID, channelID string) error { if im.IBCApp.OnChanCloseInit != nil { return im.IBCApp.OnChanCloseInit(ctx, portID, channelID) } @@ -114,7 +97,7 @@ func (im IBCModule) OnChanCloseInit(ctx sdk.Context, portID, channelID string) e } // OnChanCloseConfirm implements the IBCModule interface. -func (im IBCModule) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string) error { +func (im IBCModule) OnChanCloseConfirm(ctx context.Context, portID, channelID string) error { if im.IBCApp.OnChanCloseConfirm != nil { return im.IBCApp.OnChanCloseConfirm(ctx, portID, channelID) } @@ -123,20 +106,13 @@ func (im IBCModule) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string } // OnRecvPacket implements the IBCModule interface. -func (im IBCModule) OnRecvPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement { +func (im IBCModule) OnRecvPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement { if im.IBCApp.OnRecvPacket != nil { return im.IBCApp.OnRecvPacket(ctx, channelVersion, packet, relayer) } - // set state by claiming capability to check if revert happens return - capName := GetMockRecvCanaryCapabilityName(packet) - if _, err := im.IBCApp.ScopedKeeper.NewCapability(ctx, capName); err != nil { - // application callback called twice on same packet sequence - // must never occur - panic(err) - } - - ctx.EventManager().EmitEvent(NewMockRecvPacketEvent()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvent(NewMockRecvPacketEvent()) if bytes.Equal(MockPacketData, packet.GetData()) { return MockAcknowledgement @@ -148,43 +124,31 @@ func (im IBCModule) OnRecvPacket(ctx sdk.Context, channelVersion string, packet } // OnAcknowledgementPacket implements the IBCModule interface. -func (im IBCModule) OnAcknowledgementPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { +func (im IBCModule) OnAcknowledgementPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { if im.IBCApp.OnAcknowledgementPacket != nil { return im.IBCApp.OnAcknowledgementPacket(ctx, channelVersion, packet, acknowledgement, relayer) } - capName := GetMockAckCanaryCapabilityName(packet) - if _, err := im.IBCApp.ScopedKeeper.NewCapability(ctx, capName); err != nil { - // application callback called twice on same packet sequence - // must never occur - panic(err) - } - - ctx.EventManager().EmitEvent(NewMockAckPacketEvent()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvent(NewMockAckPacketEvent()) return nil } // OnTimeoutPacket implements the IBCModule interface. -func (im IBCModule) OnTimeoutPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) error { +func (im IBCModule) OnTimeoutPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) error { if im.IBCApp.OnTimeoutPacket != nil { return im.IBCApp.OnTimeoutPacket(ctx, channelVersion, packet, relayer) } - capName := GetMockTimeoutCanaryCapabilityName(packet) - if _, err := im.IBCApp.ScopedKeeper.NewCapability(ctx, capName); err != nil { - // application callback called twice on same packet sequence - // must never occur - panic(err) - } - - ctx.EventManager().EmitEvent(NewMockTimeoutPacketEvent()) + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 + sdkCtx.EventManager().EmitEvent(NewMockTimeoutPacketEvent()) return nil } // OnChanUpgradeInit implements the IBCModule interface -func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeInit(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) (string, error) { if im.IBCApp.OnChanUpgradeInit != nil { return im.IBCApp.OnChanUpgradeInit(ctx, portID, channelID, proposedOrder, proposedConnectionHops, proposedVersion) } @@ -193,7 +157,7 @@ func (im IBCModule) OnChanUpgradeInit(ctx sdk.Context, portID, channelID string, } // OnChanUpgradeTry implements the IBCModule interface -func (im IBCModule) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { +func (im IBCModule) OnChanUpgradeTry(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, counterpartyVersion string) (string, error) { if im.IBCApp.OnChanUpgradeTry != nil { return im.IBCApp.OnChanUpgradeTry(ctx, portID, channelID, proposedOrder, proposedConnectionHops, counterpartyVersion) } @@ -202,7 +166,7 @@ func (im IBCModule) OnChanUpgradeTry(ctx sdk.Context, portID, channelID string, } // OnChanUpgradeAck implements the IBCModule interface -func (im IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counterpartyVersion string) error { +func (im IBCModule) OnChanUpgradeAck(ctx context.Context, portID, channelID, counterpartyVersion string) error { if im.IBCApp.OnChanUpgradeAck != nil { return im.IBCApp.OnChanUpgradeAck(ctx, portID, channelID, counterpartyVersion) } @@ -211,7 +175,7 @@ func (im IBCModule) OnChanUpgradeAck(ctx sdk.Context, portID, channelID, counter } // OnChanUpgradeOpen implements the IBCModule interface -func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { +func (im IBCModule) OnChanUpgradeOpen(ctx context.Context, portID, channelID string, proposedOrder channeltypes.Order, proposedConnectionHops []string, proposedVersion string) { if im.IBCApp.OnChanUpgradeOpen != nil { im.IBCApp.OnChanUpgradeOpen(ctx, portID, channelID, proposedOrder, proposedConnectionHops, proposedVersion) } @@ -219,24 +183,9 @@ func (im IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, // UnmarshalPacketData returns the MockPacketData. This function implements the optional // PacketDataUnmarshaler interface required for ADR 008 support. -func (IBCModule) UnmarshalPacketData(ctx sdk.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { +func (IBCModule) UnmarshalPacketData(ctx context.Context, portID string, channelID string, bz []byte) (interface{}, string, error) { if reflect.DeepEqual(bz, MockPacketData) { return MockPacketData, Version, nil } return nil, "", MockApplicationCallbackError } - -// GetMockRecvCanaryCapabilityName generates a capability name for testing OnRecvPacket functionality. -func GetMockRecvCanaryCapabilityName(packet channeltypes.Packet) string { - return fmt.Sprintf("%s%s%s%s", MockRecvCanaryCapabilityName, packet.GetDestPort(), packet.GetDestChannel(), strconv.Itoa(int(packet.GetSequence()))) -} - -// GetMockAckCanaryCapabilityName generates a capability name for OnAcknowledgementPacket functionality. -func GetMockAckCanaryCapabilityName(packet channeltypes.Packet) string { - return fmt.Sprintf("%s%s%s%s", MockAckCanaryCapabilityName, packet.GetSourcePort(), packet.GetSourceChannel(), strconv.Itoa(int(packet.GetSequence()))) -} - -// GetMockTimeoutCanaryCapabilityName generates a capability name for OnTimeoutacket functionality. -func GetMockTimeoutCanaryCapabilityName(packet channeltypes.Packet) string { - return fmt.Sprintf("%s%s%s%s", MockTimeoutCanaryCapabilityName, packet.GetSourcePort(), packet.GetSourceChannel(), strconv.Itoa(int(packet.GetSequence()))) -} diff --git a/testing/mock/ibc_module_test.go b/testing/mock/ibc_module_test.go deleted file mode 100644 index dd6d09a73b9..00000000000 --- a/testing/mock/ibc_module_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package mock_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - "github.com/cosmos/ibc-go/v9/testing/mock" -) - -func TestCreateCapabilityName(t *testing.T) { - packet := channeltypes.NewPacket( - []byte{}, - 1, - mock.PortID, - "channel-0", - mock.PortID, - "channel-0", - clienttypes.NewHeight(0, 100), - 0, - ) - - name := mock.GetMockRecvCanaryCapabilityName(packet) - require.Equal(t, "mock receive canary capability namemockchannel-01", name) - - name = mock.GetMockAckCanaryCapabilityName(packet) - require.Equal(t, "mock acknowledgement canary capability namemockchannel-01", name) - - name = mock.GetMockTimeoutCanaryCapabilityName(packet) - require.Equal(t, "mock timeout canary capability namemockchannel-01", name) -} diff --git a/testing/mock/middleware.go b/testing/mock/middleware.go index 6d6a33a1a1f..7a07de0e13b 100644 --- a/testing/mock/middleware.go +++ b/testing/mock/middleware.go @@ -2,15 +2,14 @@ package mock import ( "bytes" + "context" "strings" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -37,22 +36,15 @@ func NewBlockUpgradeMiddleware(appModule *AppModule, app *IBCApp) BlockUpgradeMi // OnChanOpenInit implements the IBCModule interface. func (im BlockUpgradeMiddleware) OnChanOpenInit( - ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, - channelID string, chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, + channelID string, counterparty channeltypes.Counterparty, version string, ) (string, error) { if strings.TrimSpace(version) == "" { version = Version } if im.IBCApp.OnChanOpenInit != nil { - return im.IBCApp.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version) - } - - if chanCap != nil { - // Claim channel capability passed back by IBC module - if err := im.IBCApp.ScopedKeeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } + return im.IBCApp.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version) } return version, nil @@ -60,25 +52,18 @@ func (im BlockUpgradeMiddleware) OnChanOpenInit( // OnChanOpenTry implements the IBCModule interface. func (im BlockUpgradeMiddleware) OnChanOpenTry( - ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, - channelID string, chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, + ctx context.Context, order channeltypes.Order, connectionHops []string, portID string, + channelID string, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (version string, err error) { if im.IBCApp.OnChanOpenTry != nil { - return im.IBCApp.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) - } - - if chanCap != nil { - // Claim channel capability passed back by IBC module - if err := im.IBCApp.ScopedKeeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } + return im.IBCApp.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, counterparty, counterpartyVersion) } return Version, nil } // OnChanOpenAck implements the IBCModule interface. -func (im BlockUpgradeMiddleware) OnChanOpenAck(ctx sdk.Context, portID string, channelID string, counterpartyChannelID string, counterpartyVersion string) error { +func (im BlockUpgradeMiddleware) OnChanOpenAck(ctx context.Context, portID string, channelID string, counterpartyChannelID string, counterpartyVersion string) error { if im.IBCApp.OnChanOpenAck != nil { return im.IBCApp.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) } @@ -87,7 +72,7 @@ func (im BlockUpgradeMiddleware) OnChanOpenAck(ctx sdk.Context, portID string, c } // OnChanOpenConfirm implements the IBCModule interface. -func (im BlockUpgradeMiddleware) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error { +func (im BlockUpgradeMiddleware) OnChanOpenConfirm(ctx context.Context, portID, channelID string) error { if im.IBCApp.OnChanOpenConfirm != nil { return im.IBCApp.OnChanOpenConfirm(ctx, portID, channelID) } @@ -96,7 +81,7 @@ func (im BlockUpgradeMiddleware) OnChanOpenConfirm(ctx sdk.Context, portID, chan } // OnChanCloseInit implements the IBCModule interface. -func (im BlockUpgradeMiddleware) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error { +func (im BlockUpgradeMiddleware) OnChanCloseInit(ctx context.Context, portID, channelID string) error { if im.IBCApp.OnChanCloseInit != nil { return im.IBCApp.OnChanCloseInit(ctx, portID, channelID) } @@ -105,7 +90,7 @@ func (im BlockUpgradeMiddleware) OnChanCloseInit(ctx sdk.Context, portID, channe } // OnChanCloseConfirm implements the IBCModule interface. -func (im BlockUpgradeMiddleware) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string) error { +func (im BlockUpgradeMiddleware) OnChanCloseConfirm(ctx context.Context, portID, channelID string) error { if im.IBCApp.OnChanCloseConfirm != nil { return im.IBCApp.OnChanCloseConfirm(ctx, portID, channelID) } @@ -114,19 +99,11 @@ func (im BlockUpgradeMiddleware) OnChanCloseConfirm(ctx sdk.Context, portID, cha } // OnRecvPacket implements the IBCModule interface. -func (im BlockUpgradeMiddleware) OnRecvPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement { +func (im BlockUpgradeMiddleware) OnRecvPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement { if im.IBCApp.OnRecvPacket != nil { return im.IBCApp.OnRecvPacket(ctx, channelVersion, packet, relayer) } - // set state by claiming capability to check if revert happens return - capName := GetMockRecvCanaryCapabilityName(packet) - if _, err := im.IBCApp.ScopedKeeper.NewCapability(ctx, capName); err != nil { - // application callback called twice on same packet sequence - // must never occur - panic(err) - } - if bytes.Equal(MockPacketData, packet.GetData()) { return MockAcknowledgement } else if bytes.Equal(MockAsyncPacketData, packet.GetData()) { @@ -137,41 +114,26 @@ func (im BlockUpgradeMiddleware) OnRecvPacket(ctx sdk.Context, channelVersion st } // OnAcknowledgementPacket implements the IBCModule interface. -func (im BlockUpgradeMiddleware) OnAcknowledgementPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { +func (im BlockUpgradeMiddleware) OnAcknowledgementPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error { if im.IBCApp.OnAcknowledgementPacket != nil { return im.IBCApp.OnAcknowledgementPacket(ctx, channelVersion, packet, acknowledgement, relayer) } - capName := GetMockAckCanaryCapabilityName(packet) - if _, err := im.IBCApp.ScopedKeeper.NewCapability(ctx, capName); err != nil { - // application callback called twice on same packet sequence - // must never occur - panic(err) - } - return nil } // OnTimeoutPacket implements the IBCModule interface. -func (im BlockUpgradeMiddleware) OnTimeoutPacket(ctx sdk.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) error { +func (im BlockUpgradeMiddleware) OnTimeoutPacket(ctx context.Context, channelVersion string, packet channeltypes.Packet, relayer sdk.AccAddress) error { if im.IBCApp.OnTimeoutPacket != nil { return im.IBCApp.OnTimeoutPacket(ctx, channelVersion, packet, relayer) } - capName := GetMockTimeoutCanaryCapabilityName(packet) - if _, err := im.IBCApp.ScopedKeeper.NewCapability(ctx, capName); err != nil { - // application callback called twice on same packet sequence - // must never occur - panic(err) - } - return nil } // SendPacket implements the ICS4 Wrapper interface func (BlockUpgradeMiddleware) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, @@ -183,8 +145,7 @@ func (BlockUpgradeMiddleware) SendPacket( // WriteAcknowledgement implements the ICS4 Wrapper interface func (BlockUpgradeMiddleware) WriteAcknowledgement( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, + ctx context.Context, packet exported.PacketI, ack exported.Acknowledgement, ) error { @@ -192,6 +153,6 @@ func (BlockUpgradeMiddleware) WriteAcknowledgement( } // GetAppVersion returns the application version of the underlying application -func (BlockUpgradeMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { +func (BlockUpgradeMiddleware) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { return Version, true } diff --git a/testing/mock/mock.go b/testing/mock/mock.go index 150900664b2..0fe029ad64f 100644 --- a/testing/mock/mock.go +++ b/testing/mock/mock.go @@ -18,11 +18,9 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" feetypes "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -37,15 +35,12 @@ const ( ) var ( - MockAcknowledgement = channeltypes.NewResultAcknowledgement([]byte("mock acknowledgement")) - MockFailAcknowledgement = channeltypes.NewErrorAcknowledgement(errors.New("mock failed acknowledgement")) - MockPacketData = []byte("mock packet data") - MockFailPacketData = []byte("mock failed packet data") - MockAsyncPacketData = []byte("mock async packet data") - MockRecvCanaryCapabilityName = "mock receive canary capability name" - MockAckCanaryCapabilityName = "mock acknowledgement canary capability name" - MockTimeoutCanaryCapabilityName = "mock timeout canary capability name" - UpgradeVersion = fmt.Sprintf("%s-v2", Version) + MockAcknowledgement = channeltypes.NewResultAcknowledgement([]byte("mock acknowledgement")) + MockFailAcknowledgement = channeltypes.NewErrorAcknowledgement(errors.New("mock failed acknowledgement")) + MockPacketData = []byte("mock packet data") + MockFailPacketData = []byte("mock failed packet data") + MockAsyncPacketData = []byte("mock async packet data") + UpgradeVersion = fmt.Sprintf("%s-v2", Version) // MockApplicationCallbackError should be returned when an application callback should fail. It is possible to // test that this error was returned using ErrorIs. MockApplicationCallbackError error = &applicationCallbackError{} @@ -64,13 +59,6 @@ var ( _ porttypes.IBCModule = (*IBCModule)(nil) ) -// Expected Interface -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability - IsBound(ctx sdk.Context, portID string) bool -} - // AppModuleBasic is the mock AppModuleBasic. type AppModuleBasic struct{} @@ -123,15 +111,12 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // AppModule represents the AppModule for the mock module. type AppModule struct { AppModuleBasic - ibcApps []*IBCApp - portKeeper PortKeeper + ibcApps []*IBCApp } // NewAppModule returns a mock AppModule instance. -func NewAppModule(pk PortKeeper) AppModule { - return AppModule{ - portKeeper: pk, - } +func NewAppModule() AppModule { + return AppModule{} } // RegisterInvariants implements the AppModule interface. @@ -141,18 +126,7 @@ func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} func (AppModule) RegisterServices(module.Configurator) {} // InitGenesis implements the AppModule interface. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - for _, ibcApp := range am.ibcApps { - if ibcApp.PortID != "" && !am.portKeeper.IsBound(ctx, ibcApp.PortID) { - // bind mock portID - capability := am.portKeeper.BindPort(ctx, ibcApp.PortID) - err := ibcApp.ScopedKeeper.ClaimCapability(ctx, capability, host.PortPath(ibcApp.PortID)) - if err != nil { - panic(err) - } - } - } - +func (AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } diff --git a/testing/simapp/app.go b/testing/simapp/app.go index cb5a7d3745e..77d9de44f57 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -87,9 +87,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -146,8 +143,7 @@ var ( var _ servertypes.Application = (*SimApp)(nil) // SimApp extends an ABCI application, but with most of its parameters exported. -// They are exported for convenience in creating helper functions, as object -// capabilities aren't needed for testing. +// They are exported for convenience in creating helper functions. type SimApp struct { *baseapp.BaseApp legacyAmino *codec.LegacyAmino @@ -163,7 +159,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -180,15 +175,6 @@ type SimApp struct { ConsensusParamsKeeper consensusparamkeeper.Keeper PacketServer *packetserverkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // make IBC modules public for test purposes // these modules are never directly routed to by the IBC Router IBCMockModule ibcmock.IBCModule @@ -278,7 +264,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, - ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, ) @@ -288,7 +274,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(ibcmock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -307,26 +293,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) - scopedIBCMockBlockUpgradeKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.MockBlockUpgrade) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -369,11 +335,11 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Setup packet server to call on Eureka tests - app.PacketServer = packetserverkeeper.NewKeeper(appCodec, keys[ibcexported.StoreKey], app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ClientKeeper) + app.PacketServer = packetserverkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ClientKeeper) govConfig := govtypes.DefaultConfig() /* @@ -393,27 +359,27 @@ func NewSimApp( // IBC Fee Module keeper app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( - appCodec, keys[ibcfeetypes.StoreKey], + appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // ICA Host keeper app.ICAHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, app.AccountKeeper, - scopedICAHostKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), + app.IBCKeeper.ChannelKeeper, app.AccountKeeper, + app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -425,10 +391,10 @@ func NewSimApp( // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper // since fee middleware will wrap the IBCKeeper for underlying application. app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -437,17 +403,17 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := ibcmock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName)) app.IBCMockModule = mockIBCModule ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) // Mock IBC app wrapped with a middleware which does not implement the UpgradeableModule interface. // NOTE: this is used to test integration with apps which do not yet fulfill the UpgradeableModule interface and error when // an upgrade is tried on the channel. - mockBlockUpgradeIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.MockBlockUpgrade, scopedIBCMockBlockUpgradeKeeper)) + mockBlockUpgradeIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.MockBlockUpgrade)) mockBlockUpgradeMw := ibcmock.NewBlockUpgradeMiddleware(&mockModule, mockBlockUpgradeIBCModule.IBCApp) ibcRouter.AddRoute(ibcmock.MockBlockUpgrade, mockBlockUpgradeMw) @@ -476,7 +442,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule - icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("")) var ok bool app.ICAAuthModule, ok = icaControllerStack.(ibcmock.IBCModule) if !ok { @@ -494,9 +460,6 @@ func NewSimApp( // Add host, controller & ica auth modules to IBC router ibcRouter. - // the ICA Controller middleware needs to be explicitly added to the IBC Router because the - // ICA controller module owns the port capability for ICA. The ICA authentication module - // owns the channel capability. AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). AddRoute(icahosttypes.SubModuleName, icaHostStack). AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerStack) // ica with mock auth module stack route to ica (top level of middleware stack) @@ -511,7 +474,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule feeWithMockModule := ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) ibcRouter.AddRoute(MockFeePort, feeWithMockModule) @@ -540,7 +503,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), @@ -589,9 +551,7 @@ func NewSimApp( // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -609,7 +569,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, @@ -620,11 +579,7 @@ func NewSimApp( // NOTE: The genutils module must occur after staking so that pools are // properly initialized with tokens from genesis accounts. // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, @@ -720,17 +675,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } @@ -989,11 +933,6 @@ func (app *SimApp) GetPacketServer() *packetserverkeeper.Keeper { return app.PacketServer } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/testing/testing_app.go b/testing/testing_app.go index 925c3df388c..b25630622a7 100644 --- a/testing/testing_app.go +++ b/testing/testing_app.go @@ -27,7 +27,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" cmttypes "github.com/cometbft/cometbft/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" "github.com/cosmos/ibc-go/v9/modules/core/keeper" packetserverkeeper "github.com/cosmos/ibc-go/v9/modules/core/packet-server/keeper" "github.com/cosmos/ibc-go/v9/testing/simapp" @@ -43,7 +42,6 @@ type TestingApp interface { GetBaseApp() *baseapp.BaseApp GetStakingKeeper() ibctestingtypes.StakingKeeper GetIBCKeeper() *keeper.Keeper - GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper GetTxConfig() client.TxConfig GetPacketServer() *packetserverkeeper.Keeper diff --git a/testing/utils.go b/testing/utils.go index 773c39b420d..53d84ab559a 100644 --- a/testing/utils.go +++ b/testing/utils.go @@ -1,8 +1,10 @@ package ibctesting import ( + "errors" "fmt" "math/rand" + "strings" "testing" "github.com/stretchr/testify/require" @@ -81,3 +83,13 @@ func UnmarshalMsgResponses(cdc codec.Codec, data []byte, msgs ...codec.ProtoMars return nil } + +// RequireErrorIsOrContains verifies that the passed error is either a target error or contains its error message. +func RequireErrorIsOrContains(t *testing.T, err, targetError error, msgAndArgs ...interface{}) { + t.Helper() + require.True( + t, + errors.Is(err, targetError) || + strings.Contains(err.Error(), targetError.Error()), + msgAndArgs...) +} diff --git a/testing/values.go b/testing/values.go index 2b54588ec33..c5920910681 100644 --- a/testing/values.go +++ b/testing/values.go @@ -68,10 +68,9 @@ var ( ConnectionVersion = connectiontypes.GetCompatibleVersions()[0] - MockAcknowledgement = mock.MockAcknowledgement.Acknowledgement() - MockPacketData = mock.MockPacketData - MockFailPacketData = mock.MockFailPacketData - MockRecvCanaryCapabilityName = mock.MockRecvCanaryCapabilityName + MockAcknowledgement = mock.MockAcknowledgement.Acknowledgement() + MockPacketData = mock.MockPacketData + MockFailPacketData = mock.MockFailPacketData EmptyForwardingPacketData = ibctransfertypes.ForwardingPacketData{}