Skip to content

Commit

Permalink
Improve testing for PruneAcknowledgements rpc (#5508)
Browse files Browse the repository at this point in the history
* updat MsgUpgradeTimeout resp, add getter directives (#3858)

* ChanUpgradeOpen callback should not return an error. (#3899)

* chore: pr review followups (#3901)

* Remove error return from OnChanUpgradeRestore. (#3902)

* chore: refactor `chanUpgradeAck` tests to use expected errors (#3843)

* updating tests to use expError in favour of expPass bool

* move write fn under chanUpgradeAck

* make expPass construction two lines instead of one

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Charly <charly@interchain.io>

* adding result to MsgChannelUpgradeAckResponse (#3845)

Co-authored-by: Charly <charly@interchain.io>

* update upgrade seq comparison in `ChanUpgradeTimeout` (#3905)

* update upgrade seq comparison

* pr suggestions

* Implement MsgChannelUpgradeCancel message server handler (#3848)

* `ChanUpgradeTimeout` `msg_server` function (#3855)

* writeupgradetimeout method, pull in util methods

* rm Equal directive (#3908)

* feat: adding msg server implementation for `ChannelUpgradeAck` (#3849)

* adding boilerplate skeleton for chanUpgradeAck handler

* updating msg servers args

* adding test scaffolding and syncing latest changes of feat branch

* configure both proposed upgrades to use mock.UpgradeVersion

* updating chanUpgradeAck test cases

* updating var naming for consistency, adding additional testcases

* rm msg server implementation

* adding invalid flush status err and rm lint ignore comment

* adding test helpers to endpoint for get/set channel upgrade

* lint it

* adding initial msg server impl skeleton

* pull in code for WriteUpgradeAckChannel

* adding result to MsgChannelUpgradeAckResponse

* add initial test cases

* adding additional testcases

* apply testcase naming review suggestions

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* apply error return wrapping suggestions from review

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* fix error to use Wrapf and correct channel id arg, adding success log

* correct testing imports and satisy linter

* apply self suggestions for testcase context with in-line comments

* updating test func to use path.EndpointA and chainA sender acc

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* chore: make error wrapping and logging consistent for upgrade try msg server (#3913)

* make error wrapping and logging consistent for upgrade try msg server

* standardise logging

* chore: use new version return in transfer app for testing relayers (#3927)

* Remove generation of getters for upgrade types. (#3951)

* Add a check for connection state in UpgradeAck. (#3954)

* update WriteUpgradeTry to change flush status to `FLUSHCOMPLETE` if there are no packet commitments left (#3964)

* Add flush status check in SendPacket  (#3912)

* Add ChanUpgradeOpen core handler. (#3844)

* Add ChanUpgradeOpen core handler.

* Tests tests tests.

* Update upgrade open handler based on feedback.

* Reformat testing approach.

* Move counterpartyhops assignment inline.

* Check err of SetChannelState.

* Address feedback.

* Remove uneeded modification of version.

* Add flushing check to WriteUpgradeAckChannel (#3976)

* chore: adding check for in flight packets in WriteUpgradeAckChannel

* added test for TestWriteUpgradeAckChannel

* linter

* add client update to UpgradeAckChannel test

* mv test

* merge

* fix post-merge

* fix merge issues

* review comment

---------

Co-authored-by: Charly <charly@interchain.berlin>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* remove depguard from golangci-lint (#4000)

* Set channel state to NOTINFLUSH when Closing (#3995)

* Set Counterparty Last Sequence Send (#4005)

* Add FlushStatus Checks to RecvPacket (#3914)

* Add implementation for message server handling of ChanUpgradeOpen. (#3895)

* Add implementation for message server handling of ChanUpgradeOpen.

* Add tests for msg_server.

* Address review feedback.

* Remove setting of flush status.

* Apply suggestions from code review

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

* Address rest of review comments.

---------

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

* helper function for validating a counterparty upgrade against the selfupgrade (#4016)

* Make AbortUpgrade panic on failure (#4011)

* chore: update abort upgrade function to panic on error

* apply review suggestions

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Amend AcknowledgePacket to handle flushing (#3922)

* Amend Ack packet to keep acknowledging if we're in the process of flushing pre-upgrade packets.

* Use handshake to reach correct state before mutating any fields.

* Add test to verify post-ack channel state after last in-flight packet.

* Remove unecessary modifications of version for non initializing channel end.

* Test both cases: final in-flight packet and non-final one.

* Apply suggestions from code review

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Remove manual setting of flush status.

* Update test name, pass mock version to both channels.

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Amend timeout to handle in-flight packets. (#3923)

* Amend timeout to handle in-flight packets.

* Update timeout handler per spec.

* Update tests to test for toggling of flush status.

* Fix small typos in docstring.

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* change comment

* chore: adding callback for OnChanUpgradeRestore in abort scenarios (#4051)

* Pass in counterparty portID, channelID when verifying channel in ChanUpgradeOpen. (#4052)

* Pass in counterparty portid, channelid.

* use direct check on err.

* Force distinct channel identifiers when testing UpgradeOpen.

* Remove manual setting of flush status in ChanUpgradeOpen. (#4064)

* Use counterparty portid, channelid when verifying channel upgrade error. (#4063)

* feat: adding `OnChanUpgradeInit` handler implementation to `29-fee` (#4019)

* WIP: adding fee upgrade cbs and testing

* imp: allow failure expectations when using chain.SendMsgs

* fixing import errors from cherry-pick

* updating tests and rm try code

* rm diff onChanUpgradeTry

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

* adding MetadataFromVersion func to pkg types

* addressing pr feedback, disable fees on err, rename args, adding testcase

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

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

* abstract out expIsFeeEnabled check in tests

* adding additional error context to MetadataFromVersion

---------

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

* feat: adding `OnChanUpgradeTry` handler implementation for `29-fee` (#4023)

* WIP: adding fee upgrade cbs and testing

* imp: allow failure expectations when using chain.SendMsgs

* fixing import errors from cherry-pick

* updating tests and rm try code

* rm diff onChanUpgradeTry

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

* adding OnChanUpgradeTry implementation for 29-fee, adding tests

* rm CR in test expectation

* remove goconst linter as discussed async

* adding MetadataFromVersion func to pkg types

* addressing pr feedback, disable fees on err, rename args, adding testcase

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

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

* abstract out expIsFeeEnabled check in tests

* adding additional error context to MetadataFromVersion

* propagate changes from onChanUpgradeInit PR

* addressing test assertion feedback

---------

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

* feat: adding `OnChanUpgradeAck` handler implementation to `29-fee` (#4028)

* WIP: adding fee upgrade cbs and testing

* imp: allow failure expectations when using chain.SendMsgs

* fixing import errors from cherry-pick

* updating tests and rm try code

* rm diff onChanUpgradeTry

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

* adding OnChanUpgradeTry implementation for 29-fee, adding tests

* rm CR in test expectation

* remove goconst linter as discussed async

* adding onChanUpgradeAck implementation to 29-fee, adding tests

* adding MetadataFromVersion func to pkg types

* addressing pr feedback, disable fees on err, rename args, adding testcase

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

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

* abstract out expIsFeeEnabled check in tests

* adding additional error context to MetadataFromVersion

* propagate changes from onChanUpgradeInit PR

* addressing test assertion feedback

* updating to use types.MetadataFromVersion in OnChanUpgradeAck

* updating tests to add additional checks

---------

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

* Use counterparty connection hops when verifying channel state (#4074)

* use counterparty conn hops.

* Clean up tests.

* Amend inline comment slightly.

* Address nits

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* chore: adding comment to 29-fee OnChanUpgradeOpen callback (#4123)

* Add tests for WriteUpgradeOpenChannel. (#4077)

* Add tests for WriteUpgradeCancel. (#4076)

* Move channel to OPEN if all in-flight packets have been flushed in UpgradeAck. (#4075)

* Move channel to OPEN if all in-flight packets have been flushed in UpgradeAck.

* Add comment noting that counterparty flush status has been verified before usage.

* Fix failing tests.

* imp: use HasInflightPackets to check if channel has finished flushing. (#4134)

* feat: adding `OnChanUpgradeInit` implementation to transfer (#4126)

* adding transfer checks in upgrade cbs

* adding tests and reduce diff by moving code out

* add additional assertion on upgrade stored in state

* lint: single var declaration instead of block

* rename version -> upgradeVersion

* Update modules/apps/transfer/ibc_module_test.go

* rename sequence -> upgradeSequence

* updating to use NewTranferPath in test func

* address pr comment - reformat error msg

* Remove superfluous ignore directive. (#4158)

* feat: adding OnChanUpgradeTry implementation to transfer (#4137)

* adding transfer checks in upgrade cbs

* adding tests and reduce diff by moving code out

* add additional assertion on upgrade stored in state

* lint: single var declaration instead of block

* rename version -> upgradeVersion

* Update modules/apps/transfer/ibc_module_test.go

* rename sequence -> upgradeSequence

* adding onChanUpgradeTry impl for transfer app, adding tests

* updating to use NewTranferPath in test func

* restructure error formatting

* Call app callback after writting state in Cancel and Timeout. (#4166)

* helper function to clear state stored during an upgrade (#4147)

* add `IsUpgradError` func for readability (#4144)

* add IsUpgradeError function

* Update modules/core/04-channel/types/upgrade.go

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* gofumpt

* Update modules/core/04-channel/types/upgrade.go

Co-authored-by: Charly <charly@interchain.io>

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Co-authored-by: Charly <charly@interchain.io>

* add check that channel exists in upgrade gRPCs (#4156)

* add check that channel exists

* use has function instead

* consistent connection lookup calls in 04-channel (#4146)

* nit: error formatting improvements for channel upgrades (#4097)

* string formatting improvements

* fix typo

* review comment

* review comment

* review comment

* review comment

* added test for event emission (#4020)

* feat: implement `OnChanUpgradeAck` for transfer (#4215)

* feat: implement onChanUpgradeAck for transfer module

* Update modules/apps/transfer/ibc_module_test.go

* refactor: call OnChanUpgradeTry transfer callback directly in favour of full Endpoint call

* refactor: simplify OnChanUpgradeTry transfer testing to call module cbs directly (#4221)

* feat: implement onChanUpgradeAck for transfer module

* Update modules/apps/transfer/ibc_module_test.go

* refactor: call OnChanUpgradeTry transfer callback directly in favour of full Endpoint call

* refactor: simplify OnChanUpgradeTry transfer testing to call module cbs directly

* lint me

* rm duplicate test from merge

* test: adding test for events in channel upgrade try (#4226)

* Add store functions for counterparty upgrade. (#4293)

* Add store functions for counterparty upgrade.

* Apply suggestions from code review

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

---------

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

* Add FLUSHING/FLUSHCOMPLETE to Channel state. (#4300)

* feat: adding `ChannelUpgradeConfirm` rpc and msgs (#4302)

* adding protobuf msgs and rpc service definition

* adding empty boilerplate method stub

* register msg codec and add sdk.Msg impl + tests

* chore: move verification before startFlushUpgradeHandshake (#4285)

* rebase `04-channel-upgrades` branch (#4160)

* update with latest changes from main

* fix conflicts in e2e

* make invalid version constant

* fix linter by using constant instead of literal

---------

Co-authored-by: chatton <github.qpeyb@simplelogin.fr>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* Revert "rebase `04-channel-upgrades` branch (#4160)"

This reverts commit d5e63d40695adc6c1aad16160ea3bf655251825c.

* rm unnecessary test matrix file

* make lint-fix

* satisfy revive linter

* updating feature banch ci workflow for golangci-lint

* bumping golangci-lint action to v3.6.0

* define go version as string in workflow

* Delete counterparty upgrade in deleteUpgradeInfo. Move function to keeper. (#4294)

* Remove check for counterparty timeout in ChanUpgradeTry. (#4301)

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

* Store counterparty upgrade after ack finishes. (#4299)

* call verification of counterparty channel, upgrade in upgradetry. (#4310)

* Add verification calls in ChanUpgradeAck. (#4312)

* Add ChanUpgradeConfirm to endpoint. (#4314)

* Remove verification calls in StartFlushUpgradeHandshake (#4317)

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

* test: add events test for ChannelUpgradeTimeout (#4284)

* test: add event emission test for ChanUpgradeCancel (#4281)

* Check counterparty timeout hasn't elapsed in ChanUpgradeAck. (#4305)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* refactor: modify `ChannelUpgradeInit` to only store upgrade fields (#4344)

* WIP: adding initial implementation of changes

* proto format

* commenting out more failing tests from timeouts

* fix compiler error

* commenting out failing testcases due to timeout logic

* fix: reorder proto msg fields correctly

* refactor: move increment upgrade sequence to write fn, rename currentChannel -> channel

* refactor: rename msg server vars for consistency

* update FirstChannelID to FirstConnectionID in msg validate basic tests

* rename test var and use mock.UpgradeVersion

* comment out failing tests

* Add test for event emission ChanUpgradeAck (#4228)

* test: add event test for chan upgrade ack

* gofumpt file

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Adding test for events for ChanUpgradeOpen (#4230)

* test: adding test for events for chan upgrade open

* Update upgrade_test.go

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Move check to fail on incompatible upgrade after proof verification. (#4320)

* Move check to fail on incompatible upgrade after proof verification.

* Update modules/core/04-channel/keeper/upgrade_test.go

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

* lint fix

---------

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Add functions checkForUpgradeCompatibility and syncUpgradeSequence (#4352)

* refactor: modify upgrade init to not change channel state (#4357)

* WIP: adding initial implementation of changes

* proto format

* commenting out more failing tests from timeouts

* fix compiler error

* commenting out failing testcases due to timeout logic

* fix: reorder proto msg fields correctly

* refactor: move increment upgrade sequence to write fn, rename currentChannel -> channel

* refactor: rename msg server vars for consistency

* update FirstChannelID to FirstConnectionID in msg validate basic tests

* rename test var and use mock.UpgradeVersion

* comment out failing tests

* refactor upgrade init state to open. refactor crossing hellos and try verification logic

* updating godoc and error return in chanUpgradeAck2

* address nits from pr review

* refactor: cleanup upgrade init app callback args (#4359)

* WIP: adding initial implementation of changes

* proto format

* commenting out more failing tests from timeouts

* fix compiler error

* commenting out failing testcases due to timeout logic

* fix: reorder proto msg fields correctly

* refactor: move increment upgrade sequence to write fn, rename currentChannel -> channel

* refactor: rename msg server vars for consistency

* update FirstChannelID to FirstConnectionID in msg validate basic tests

* rename test var and use mock.UpgradeVersion

* comment out failing tests

* refactor upgrade init state to open. refactor crossing hellos and try verification logic

* updating godoc and error return in chanUpgradeAck2

* refactor: rm unnecessary args in application upgrade init callback

* Add WriteUpgradeConfirm function. (#4303)

* Add WriteUpgradeConfirm function.

* Add some sweet godoc for this bad boy.

* Apply suggestions from code review

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Modify startFlushUpgradeHandshake to be used as a write function (#4360)

* Remove restore logic in upgrade TRY handler (#4362)

* refactor: remove `FlushStatus` from ack handler and msg (#4364)

* chore: remove restore logic in try handler, fast forward upgrade sequence in try hander

* chore: fix linter

* refactor: remove channel flush status from ack msg and handler

* fix: address test acknowledgement failing testcase, replace flush status with channel state assertion

* fix: linter crying

* adding back failure testcase for AcknowledgePacket

* updating testcase name to be more reflective of channel state

---------

Co-authored-by: chatton <github.qpeyb@simplelogin.fr>

* Amend checkForUpgradeCompatibility to check that versions match (#4366)

* refactor: modify ack handler expected channel state (#4371)

* chore: remove restore logic in try handler, fast forward upgrade sequence in try hander

* chore: fix linter

* disable acknowledmgent test where try upgrade is called

* fixing failing msg server test for chanUpgradeTry

* wip: update write upgrade try func to no longer write channel as TRYUPGRADE. no longer set flush status

* refactor: remove channel flush status from ack msg and handler

* rm commented out lines of code in write try func

* address todo for handling packet acks in correct channel state

---------

Co-authored-by: chatton <github.qpeyb@simplelogin.fr>

* Channel Upgrade Ack (#4372)

* feat: adding `chanUpgradeConfirm` implementation to `04-channel` (#4373)

* chore: remove restore logic in try handler, fast forward upgrade sequence in try hander

* chore: fix linter

* disable acknowledmgent test where try upgrade is called

* fixing failing msg server test for chanUpgradeTry

* wip: update write upgrade try func to no longer write channel as TRYUPGRADE. no longer set flush status

* refactor: remove channel flush status from ack msg and handler

* refactor: remove channel flush status from ack msg and handler

* fix: address test acknowledgement failing testcase, replace flush status with channel state assertion

* fix: linter crying

* adding back failure testcase for AcknowledgePacket

* updating testcase name to be more reflective of channel state

* refactor: update chanUpgradeAck as per spec changes

* rm commented out lines of code in write try func

* address todo for handling packet acks in correct channel state

* chore: fixing ack tests

* chore: remove unneeded comment

* chore: removed previous state log entry

* Update modules/core/04-channel/keeper/upgrade.go

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

* block comment code to be moved and link issue, uncomment previously disabled tests

* addding ChanUpgradeConfirm implementation with test suite

---------

Co-authored-by: chatton <github.qpeyb@simplelogin.fr>
Co-authored-by: Cian Hatton <cian@interchain.io>

* feat: adding msg server implementation for `ChanUpgradeConfirm` (#4376)

* chore: remove restore logic in try handler, fast forward upgrade sequence in try hander

* chore: fix linter

* disable acknowledmgent test where try upgrade is called

* fixing failing msg server test for chanUpgradeTry

* wip: update write upgrade try func to no longer write channel as TRYUPGRADE. no longer set flush status

* refactor: remove channel flush status from ack msg and handler

* refactor: remove channel flush status from ack msg and handler

* fix: address test acknowledgement failing testcase, replace flush status with channel state assertion

* fix: linter crying

* adding back failure testcase for AcknowledgePacket

* updating testcase name to be more reflective of channel state

* refactor: update chanUpgradeAck as per spec changes

* rm commented out lines of code in write try func

* address todo for handling packet acks in correct channel state

* chore: fixing ack tests

* chore: remove unneeded comment

* chore: removed previous state log entry

* Update modules/core/04-channel/keeper/upgrade.go

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

* block comment code to be moved and link issue, uncomment previously disabled tests

* addding ChanUpgradeConfirm implementation with test suite

* adding the msg server impl for chanUpgradeConfirm, adding tests :)

---------

Co-authored-by: chatton <github.qpeyb@simplelogin.fr>
Co-authored-by: Cian Hatton <cian@interchain.io>

* Remove check on flush status for send packet. (#4384)

* Remove check on flush status for send packet.

* Rename test, remove duplicate test.

* Channel Upgrade Open (#4379)

* Implement Channel Upgrade Cancel (#4404)

* Refactor `TestWriteUpgradeCancelChannel` (#4424)

* chore: remove restore logic in try handler, fast forward upgrade sequence in try hander

* chore: fix linter

* disable acknowledmgent test where try upgrade is called

* fixing failing msg server test for chanUpgradeTry

* wip: update write upgrade try func to no longer write channel as TRYUPGRADE. no longer set flush status

* refactor: remove channel flush status from ack msg and handler

* refactor: remove channel flush status from ack msg and handler

* fix: address test acknowledgement failing testcase, replace flush status with channel state assertion

* fix: linter crying

* adding back failure testcase for AcknowledgePacket

* updating testcase name to be more reflective of channel state

* refactor: update chanUpgradeAck as per spec changes

* rm commented out lines of code in write try func

* address todo for handling packet acks in correct channel state

* chore: fixing ack tests

* chore: remove unneeded comment

* chore: removed previous state log entry

* Update modules/core/04-channel/keeper/upgrade.go

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

* block comment code to be moved and link issue, uncomment previously disabled tests

* addding ChanUpgradeConfirm implementation with test suite

* adding the msg server impl for chanUpgradeConfirm, adding tests :)

* refactor: updated ChanUpgradeOpen keeper function to match spec

* chore: fixing tests for ChannelUpgradeOpen

* chore: added test case for invalid counterparty channel state

* chore: adding new implementation for ChannelUpgradeClose

* chore: fix TestWriteUpgradeCancelChannel

* chore: addressing feedback

* chore: simplified test cases

* chore: fix linter

* chore: remove duplicate connection test

* Apply suggestions from code review

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

* refactor TestWriteUpgradeCancelChannel to use table tests

* delete unused variable

* lint

* update check panic

* update from code review

* Apply suggestions from code review

---------

Co-authored-by: chatton <github.qpeyb@simplelogin.fr>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Cian Hatton <cian@interchain.io>

* Refactor `TestWriteUpgradeOpenChannel` (#4431)

* refactor TestWriteUpgradeOpenChannel to use table tests

* Apply suggestions from code review

* lint

* revert AttributeKeyUpgradeChannelFlushStatus

---------

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

* refactor: acknowledgePacket handling flushing / flush complete state  (#4412)

* refactor: handle flush complete channel state transition in acknowledgePacket

* wip: adding testcases for acknowledgePacket with flushing state

* lint: make lint-fix

* test: adding assertFn temporarily to tests to provide after test state checks

* set counterparty upgrade on write try fn

* Add UpgradeTimeout as a params field in the channel submodule (#4411)

* Refactor TestWriteUpgradeTry to remove flush status checks (#4430)

* refactor: use `expResult` in acknowledgePacket tests (#4439)

* refactor: adapt acknowledgePacket tests to use expResult func

* cleanup: removing redundant stale tests

* fix: assert ErrInvalidProof for verification failure. modify suite.Run tc naming

* Implement ChanUpgradeTimeout with spec changes (#4438)

* Amend recvPacket as per spec. (#4386)

* Amend recvPacket as per spec.

* Update modules/core/04-channel/keeper/packet_test.go

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

* Drop usage of CounterpartyLastSequenceSend.

* Cover all cases.

* Use SetChannelCounterpartyUpgrade.

* Add expected errors, remove duplicate test.

* Remove setting of counterparty last sequence send in other test case.

* Shorthand initialization of dummy upgrade.

* Apply suggestions from code review

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

---------

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Cian Hatton <cian@interchain.io>

* Update error receipt event emission to use correct event type (#4451)

* Account for moving channel state to flush complete in timeout processing (#4425)

* Remove init, try, ack upgrade states (#4455)

* refactor: remove `FlushStatus` from channel end (#4457)

* refactor: remove flush status from channel end

* remove flush status enum

* address pr review comments and remove additional refs in comments

* Refactor channel upgradability msgs to reflect updated spec (#4456)

* Amend timeoutPacket to allow timeouts on any channel state. (#4367)

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

* Refactor recvPacket tests to use expError. (#4471)

* Refactor recvPacket tests to use expError.

* Use testify's ErrorIs.

* refactor: remove counterparty last sequence send state entry (#4473)

* Don't write channel to state when not modified. (#4495)

* refactor: rename channel upgradability flush states (#4488)

* Don't emit event information for unchanged upgrade. (#4492)

* Add tests for WriteUpgradeConfirm. (#4490)

* Allow receiving of packets if the counterparty latest sequence send has not been set (#4480)

* allow receiving of packets if the counterparty latest sequence send has not been set.

* Update modules/core/04-channel/keeper/packet_test.go

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

* Address feedback, lint fix.

* STATUS_FLUSHING -> FLUSHING

---------

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

* chore: re-enable disabled test case in `chanUpgradeTry` (#4501)

* Resolve commented out testcases for Channel Upgrades (#4474)

* refactor: adding additional upgrade fields args to onChanUpgradeOpen (#4478)

* tests: adding followup tests for in-flight packets on chanUpgradeConfirm (#4491)

* tests: adding followup tests for in-flight packets on chanUpgradeConfirm

* fix: adapt failing test and format

* fix: resolve compiler breakage of enum naming

* Use only timestamp only for upgrade timeouts. (#4482)

* Timing out packets on ordered channels when in flushing state aborts upgrade and closes channel (#4475)

* Change UpgradeTimeout to from absolute to relative (#4511)

* refactor: fee middleware onChanUpgradeInit callback (#4514)

* refactor: fee middleware onChanUpgradeTry callback (#4515)

Co-authored-by: Cian Hatton <cian@interchain.io>

* refactor: implementation for onChanUpgradeAck ics29 (#4523)

* refactor: implementation for onChanUpgradeAck ics29

* lint0r

* feat: adding fee middleware onChanUpgradeOpen callback impl (#4524)

* refactor: implementation for onChanUpgradeAck ics29

* lint0r

* feat: adding fee middleware onChanUpgradeOpen callback impl

* adding comment to discarded return arg

* test: adding integration test for fee transfer channel upgrade (#4533)

* refactor: implementation for onChanUpgradeAck ics29

* lint0r

* feat: adding fee middleware onChanUpgradeOpen callback impl

* test: adding integration test for fee transfer channel upgrade

* fix: check that `MsgChannelUpgradeInit` is signed by authority (#4773)

* Chore: consistent argument order (#4545)

* order arguments

* Revert "order arguments"

This reverts commit 2de37271e6f19b77e01cef65a1120a663486c040.

* reorder arguments of channel upgrade verify functions

* missing changes

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Add ParseProposalIDFromEvents helper function (#4942)

* add ParseProposalIDFromEvents

* update with damian suggest

* imp: remove `LatestSequenceSend` (#5108)

* del: latestsequencesend field

* fix: comment

* gofumpt

* del: tests

* del leftover tests part

* adressing comments

* addressing comment

---------

Co-authored-by: sangier <stefano@Stefanos-MacBook-Pro.local>
Co-authored-by: sangier <stefano@interchain.io>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* chore: rebase 04-channel-upgrades feature branch (#5085)

* move legacy keytable init to migration handler code (#4730)

* deps: bump SDK v0.50-rc.1 (#4763)

* test: run tests of all go.mods (#4468)

* test: run tests of all go.mods

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Remove +build directive which is deprecated, remove tparse hadnling in Makefile.

* Add sdk script, remove LINT_DIFF.

* Fix linting issues that popped up.

* Add script to run tests for all modules.

* chore: add executible permissions to script, rename to avoid shadowing dir builtin

* chore: use python3 instead of python

* chore: add venv to gitignore

* Disallow env vars not being set, clean up minor issues.

---------

Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
Co-authored-by: chatton <github.qpeyb@simplelogin.fr>
Co-authored-by: Cian Hatton <cian@interchain.io>

* docs: some more v8 migration docs (#4728)

* docs: some more migration docs

* alignment

* alignment 2

* Update docs/docs/05-migrations/11-v7-to-v8.md

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* update about proposals

* update docs after putting back legacy proposals

* add links for gov v1 messages

* update link of importable workflow

* add information about facilities to test upgrade

* add notes about cosmos sdk v0.50 upgrading guide

* Update docs/docs/05-migrations/11-v7-to-v8.md

Co-authored-by: Charly <charly@interchain.io>

* Update docs/docs/05-migrations/11-v7-to-v8.md

Co-authored-by: Charly <charly@interchain.io>

* add extra info about authority and merkle path functions that have been removed

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Co-authored-by: Charly <charly@interchain.io>

* deps: bump mod/capability to v1.0.0-rc6 (#4768)

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* Fix e2e-upgrade.yaml complaint. (#4772)

* deps(docs): bump docusaurus from v2.4.1 to v2.4.3

* Fix e2e linting issues. (#4767)

* test extra conditions for `ApplyPrefix` (#4764)

* test extra conditions

* review comment

* Add codec registrations tests for apps (#4780)

* Add test for type registration for transfer.

* Add test for type registration for fee.

* Add test for type registration for ica.

* Lint this bad boy

* Apply suggestions from code review

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

---------

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

* Save gas on capability IsInitialized (#4770)

* chore: fix broken links/rename folders (#4781)

* chore: fix broken links/rename folders

* typo

* fix link

* Use slices.ContainsFunc instead of separate contains func. (#4786)

* docs: fix links (#4787)

* chore: update changelog (#4774)

* chore: update changelog

* Apply suggestions from code review

Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

---------

Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* docs: implemented Mary's suggestions (#4775)

* docs: implemented Mary's suggestions

* imp(docs): updated the large IBC logo

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Update repo cover image (#4794)

* docs: added tutorial for Cosmoverse 2023 (#4793)

* feat(docs): added custom components

* feat(docs): added and tested custom components

* docs: fee app.go integration tutorial added

* imp(docs): added custom git diff magic comments

* deps: switched to '@saucelabs/theme-github-codeblock'

* imp(docs): improved fee wiring up and added keplr to env setup

* imp(docs): added react scaffold docs

* imp(docs): added fee mw react component

* imp(docs): finished all files of the demo

* imp(docs): updated links and styling

* docs: ran linter

* imp(docs): implemented review items

* fix: typos (#4796)

* fix typo

* fix typo

* fix typos

* fix typos

* fix typos

* fix typo

* imp!: use expected interface for legacy params subspace (#4811)

* imp: use expected interface for legacy params subspace

* chore: define GetParamSet on expected interface and rm explicit type conversions

* chore: fix fork e2es (#4813)

* chore: mergify task and e2e tests for `release/v8.0.x` (#4765)

* chore: mergify task and e2e tests for release/v8.0.x

* preventing single chain tests to run on more than one chain

* extra polishing of yaml files

* add release/v8.0.x to drop down menus

* use hermes relayer instead of rly

* docs: add changelog entry for #4835

* doc: adding migration doc info for nil legacy subspace (#4816)

* Change host relay tests to check error returned (#4161)

* Add failure case for msg failing on ValidateBasic.

* Move testing for host relay to check for error returns.

* Use similar error checking as other tests.

* Use NoError, wrap err in error message.

* fix: relay test expected result

---------

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

* build(deps): Bump golang.org/x/mod from 0.12.0 to 0.13.0 in /e2e (#4839)

Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.12.0 to 0.13.0.
- [Commits](https://github.com/golang/mod/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump github.com/spf13/viper from 1.16.0 to 1.17.0 (#4846)

* build(deps): Bump github.com/spf13/viper from 1.16.0 to 1.17.0

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Go mod tidy e2e, callbacks, capability.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>

* build(deps): Bump bufbuild/buf-setup-action from 1.26.1 to 1.27.0 (#4847)

Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.26.1 to 1.27.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.26.1...v1.27.0)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* e2e : migrate interchaintest.GetBalance to CosmosChain's GetBalance (#4683)

* build(deps): Bump google.golang.org/grpc from 1.58.2 to 1.58.3 (#4855)

* build(deps): Bump google.golang.org/grpc from 1.58.2 to 1.58.3

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.58.2 to 1.58.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.58.2...v1.58.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump grpc in e2e, go mod tidy in e2e, callbacks.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>

* imp: add go mod tidy all script (#4845)

* feat: add go mod tidy all script

* feedback

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* chores: add v4.5.0 tag and remove v5.2.x (end of life) (#4840)

* chore: fixing compatibility tests (#4876)

* build(deps): Bump cosmossdk.io/x/tx from 0.10.0 to 0.11.0 (#4889)

* build(deps): Bump cosmossdk.io/x/tx from 0.10.0 to 0.11.0

Bumps [cosmossdk.io/x/tx](https://github.com/cosmos/cosmos-sdk) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/cosmos/cosmos-sdk/releases)
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.11.0/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-sdk/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: cosmossdk.io/x/tx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* The typical dance, again.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>

* build(deps): Bump cosmossdk.io/api from 0.7.1 to 0.7.2 (#4890)

* build(deps): Bump cosmossdk.io/api from 0.7.1 to 0.7.2

Bumps [cosmossdk.io/api](https://github.com/cosmos/cosmos-sdk) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/cosmos/cosmos-sdk/releases)
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-sdk/compare/v0.7.1...api/v0.7.2)

---
updated-dependencies:
- dependency-name: cosmossdk.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* The typical dance.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* imp: add init-simapp script (#4844)

* feat: add init-simapp script

* Apply suggestions from code review

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

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* chore: fixes for legacy amino encoding for ledger signing (#4812)

* chore(wip): fixes for legacy amino encoding for ledger signing

* chore: cleanup, format and add additional fee annotations

* fix: register legacy amino codec in 29-fee

* build(deps): Bump bufbuild/buf-setup-action from 1.27.0 to 1.27.1 (#4906)

Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.27.0 to 1.27.1.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.27.0...v1.27.1)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump google.golang.org/grpc from 1.58.3 to 1.59.0 (#4904)

* build(deps): Bump google.golang.org/grpc from 1.58.3 to 1.59.0

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.58.3 to 1.59.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.58.3...v1.59.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump grpc in e2e, go mod tidy in e2e, callbacks.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>

* remove test that does not apply to v6.1.x and v6.2.x release lines

* small improvements to v8 migration docs

* Automate Discord Notification for New Releases (#4918)

* Create discord_notify.yml

Add GitHub Action for Discord release notifications

* Rename discord_notify.yml to discord-notify.yml

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>

* docs: add google analytics 4 support (#4933)

* deps(docs): ran 'npm i --save @docusaurus/plugin-google-gtag'

* feat(docs): added google analytics 4 to docs

* Add note for adding a build tag in new e2e files. (#4937)

* docs: add microsoft clarity support (#4935)

* deps(docs): ran 'npm i --save @gracefullight/docusaurus-plugin-microsoft-clarity'

* feat(docs): added microsoft clarity support

* chores for new patch releases for v4, v5, v6, v7 (#4922)

* release chores

* remove tag from tests

* remove tag from tests

* build(deps): Bump actions/setup-node from 3 to 4 (#4941)

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(msg): register proto interface (#4944)

* build(deps): Bump tj-actions/changed-files from 39 to 40 (#4962)

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 39 to 40.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/changed-files/compare/v39...v40)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: remove redundant code (#4952)

* deps(e2e): update hermes tag (#4968)

* Register message service descriptor (#4969)

* docs: fee middleware tutorial improvements (#4979)

* docs: removed duplicate code snippet

* docs: consistent use of yaml vs yml

* docs: using 'auto_register_counterparty_payee'

* docs: added Fee Middleware docs to prereqs

* docs: fixed broken link

* docs: improved fee tutorial

* imp: review item

* (mod/capability) Use AppModule directly in favour of AppModuleBasic in mod/capability (#4982)

* removing appmodulebasic and all nil/unneeded functions

* lint

* test file changes

* lint

---------

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

* deps: bump Cosmos SDK to tip of `release/v0.50.x` (#4976)

* deps: bump to Cosmos SDK @ 0469fc17e1587850e7de390af282df5215287a21

* lint

* Apply suggestions from code review

Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>

---------

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

* Add a test for 07-tendermint's GetTimestampAtHeight (#4972)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* build(deps): Bump bufbuild/buf-setup-action from 1.27.1 to 1.27.2 (#4988)

Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.27.1 to 1.27.2.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.27.1...v1.27.2)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* refactor(simapp): re-wire autocli with latest client/v2 changes (#4843)

* refactor: wire autocli

* go mod tidy all + fix textual

* removing initmodule from ica (#4977)

* remoing appmodulebasic interface from capability and initmodule function which mimicks initgenesis

* undoing capability change

* imp(statemachine)!: add length validation of string fields in messages

Co-authored-by: Jacob Gadikian <jacobgadikian@gmail.com>
Co-authored-by: Du Nguyen <dunguyen643@gmail.com>
Co-authored-by: Charly <charly@interchain.io>

* chore: EoL for v4 and v5 (#4995)

* simplifying code in packet_test (#4980)

* reducing boilerplate code

* lint

* gofumpt

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>

* build(deps): Bump cosmossdk.io/store from 1.0.0-rc.0 to 1.0.0 (#5009)

* build(deps): Bump cosmossdk.io/store from 1.0.0-rc.0 to 1.0.0

Bumps [cosmossdk.io/store](https://github.com/cosmos/cosmos-sdk) from 1.0.0-rc.0 to 1.0.0.
- [Release notes](https://github.com/cosmos/cosmos-sdk/releases)
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-sdk/compare/math/v1.0.0-rc.0...log/v1.0.0)

---
updated-dependencies:
- dependency-name: cosmossdk.io/store
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: go mod tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chatton <github.qpeyb@simplelogin.fr>

* fix: docs typos (#5014)

* Fix typos 01-overview.md

* Fix Typos 00-intro.md

Fixed typos & tweaked intro language

* style: raname sidebar Tutorials to Developer Portal

---------

Co-authored-by: srdtrk <srdtrk@hotmail.com>

* docs: fix typos (#5019)

* fix expect pointer error when unmarshalling misbehaviour file (#5020)

* fix expect pointer error when unmarshalling misbehaviour file

* Update CHANGELOG.md

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* build(deps): Bump cosmossdk.io/x/tx from 0.11.0 to 0.12.0 (#5017)

* build(deps): Bump cosmossdk.io/x/tx from 0.11.0 to 0.12.0

Bumps [cosmossdk.io/x/tx](https://github.com/cosmos/cosmos-sdk) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/cosmos/cosmos-sdk/releases)
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.12.0/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-sdk/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: cosmossdk.io/x/tx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* bump callbacks

* e2e: go mod tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* build(deps): Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#5024)

* build(deps): Bump github.com/spf13/cobra from 1.7.0 to 1.8.0

Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: make tidy-all

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* build(deps): Bump golang.org/x/mod from 0.13.0 to 0.14.0 in /e2e (#5025)

Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.13.0 to 0.14.0.
- [Commits](https://github.com/golang/mod/compare/v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump cosmossdk.io/math from 1.1.3-rc.1 to 1.2.0 (#5034)

* build(deps): Bump cosmossdk.io/math from 1.1.3-rc.1 to 1.2.0

Bumps [cosmossdk.io/math](https://github.com/cosmos/cosmos-sdk) from 1.1.3-rc.1 to 1.2.0.
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-sdk/compare/math/v1.1.3-rc.1...log/v1.2.0)

---
updated-dependencies:
- dependency-name: cosmossdk.io/math
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: tidy all

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* chore: fix error formatting of client status check in client recovery (#5039)

* deps: bump SDK v0.50.1 (#5038)

* deps: bump SDK v0.50.1

* update changelog

* deps: downgrade cosmossdk.io/core to v0.11.0

* fix interchain accounts tests

* implement app module basic correctly for capability module

* bump SDK to v0.50.1 in capability module

* downgrade cosmossdk.io/api to v0.7.2

* downgrade cosmossdk.io/api to v7.2.0 for callbacks

* Bump dependencies (#5064)

* deps: update mod/capability to v1.0.0 (#5046)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* imp: updated urls (#5031)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* docs: new social card for docs (#5080)

* docs: added new social card

* docs: updated social card

* chore: add mergify backport for 08-wasm (#5077)

* docs: add docs folder for v8.0.x (#5078)

* docs: add docs folder for v8.0.x

* fix links

* docs: fixed with absolute url links

* docs: fix more links

---------

Co-authored-by: srdtrk <srdtrk@hotmail.com>
Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Charly <charly@interchain.io>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
Co-authored-by: chatton <github.qpeyb@simplelogin.fr>
Co-authored-by: Cian Hatton <cian@interchain.io>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
Co-authored-by: Susannah Evans <65018876+womensrights@users.noreply.github.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: nguyen <144610611+trinitys7@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Adi <103246632+adiraviraj@users.noreply.github.com>
Co-authored-by: emidev98 <49301655+emidev98@users.noreply.github.com>
Co-authored-by: Muku <44918265+muku314115@users.noreply.github.com>
Co-authored-by: Jacob Gadikian <jacobgadikian@gmail.com>
Co-authored-by: Du Nguyen <dunguyen643@gmail.com>
Co-authored-by: zadkiel88 <106065297+zadkiel88@users.noreply.github.com>
Co-authored-by: srdtrk <srdtrk@hotmail.com>
Co-authored-by: shuoer86 <129674997+shuoer86@users.noreply.github.com>
Co-authored-by: mmsqe <mavis@crypto.com>

* chore: propagate IBC authority to 04-channel keeper to be used within upgrade cancellation (#5093)

* chore: add authority to function params, test flow for checking msg sender against authority

* linter

* refactor: use isAuthority bool in favour of passing signer and authority to 04-channel

---------

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

* Amend validation of upgrade fields to use variable holding supported orderings. (#5152)

* refactor: adapt testing endpoint query for channel upgrade proofs (#5165)

* test: adding test for crossing hello trys with historical proofs (#5143)

* test: adding test for crossing hello trys with historical proofs

* chore: make format

* chore: address TODO in test case with switch of proof query endpoint

* chore: replace dummy error with correct error type (#5177)

* Remove incorrect godoc (#5203)

* chore: correct returned error (#5205)

* chore: adding comment to add clarity to returned upgrade (#5214)

* Verify channel upgrade can be completed after cancellation is successful (#5163)

* Remove last packet sent from new upgrade constructor. (#5210)

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

* Reorder call to application callback so it happens after we write state. (#5230)

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

* chore: allow authorized senders to submit empty error receipt proof (#5232)

* remove incorect code (#5235)

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: Cian Hatton <cian@interchain.io>

* chore: panic instead of return err (#5246)

* chore: add comment about version assignment (#5239)

* Add  to docstring with explanation about channel state (#5236)

* Chore: replace `fmt.Sprintf` with `fmt.Errorf` in `upgrades.go` (#5291)

* replace Sprintf with Errorf in WriteUpgradeAckChannel

* replace Sprintf with Errorf in upgrade.go

* fix: add event and event emission for `FLUSHCOMPLETE` (#5245)

* add event emit

* minor

* add testing for moving to flushing complete event

* minor

* Remove setting counterparty upgrade info in upgrade try (#5238)

* chore: updated tests to reflect the timeout and ack changes

* chore: adding status check on channel when channel is flushing

* review comment

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* fix: allow error receipt to be nil in case of the msg sender is the authority (#5262)

* fix + tests

* shuffle about logic ordering

* Move events to message server layer instead of core level (#5264)

* wip: moving events up to the message server layer

* wip: move events out to message server layer

* chore: commenting out event tests

* Fix merge issue.

---------

Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
Co-authored-by: Charly <charly@interchain.io>

* imp: use MetadataFromVersion function in 27-interchain-accounts (#5300)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* remove channel id (#5307)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* remove comment that unused (#5308)

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* Implement OnChanUpgradeInit on Controller Chain for interchain-accounts (#5141)

* chore: adding controller implementation for OnChanUpgradeInit

* chore: happy path test passing

* chore: adding fail case

* chore: adding additional test cases

* chore: fix linting

* chore: improving errors

* chore: refactor to use test keeper function directly

* chore: add check for enabled controller module

* chore: call into middleware if provided

* chore: addressing PR feedback

* revert change in godoc of GetConnectionID

* fix: typo in MetadataFromVersion func

* chore: rm duplicate func

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* Add a helper function to create a mock contract. (#5162)

* docs: improved channel closure docs (#5170)

* docs: improved channel closure docs

* docs: ran linter

* chore: use `GetPrefixedDenom` to create IBC token denom (#5175)

* build(deps): Bump DavidAnson/markdownlint-cli2-action from 13 to 14 (#5176)

Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 13 to 14.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/455b6612a7b7a80f28be9e019b70abdd11696e4e"><code>455b661</code></a> Update to version 14.0.0.</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/fa0be7308fe9ed25a7d2ebaa0017dcf119c174d3"><code>fa0be73</code></a> Freshen generated index.js file.</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/1e5b6609c975f6023b335289c93acab187740b7d"><code>1e5b660</code></a> Remove &quot;command&quot; input deprecated in v11.</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/b1a3c7b34980691d7de04930b0a0e82f96e98327"><code>b1a3c7b</code></a> Add CONTRIBUTING.md.</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/feb7cc4324d395ee7746fd85e9115cb5dbca8a98"><code>feb7cc4</code></a> Freshen generated index.js file.</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/eeda66770c0f944c0c52595a2fdd5e130c0c3030"><code>eeda667</code></a> Bump markdownlint-cli2 from 0.10.0 to 0.11.0</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/4670abafb2e29f6ba1d52f1ee4dc5e35fa981963"><code>4670aba</code></a> Stop excluding generated file dist/index.js from diff check in npm test scrip...</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/404090a89e8ef8be91a2d458e120ab8636277d3c"><code>404090a</code></a> Bump eslint from 8.53.0 to 8.54.0</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/c69f13c27f4b0db012599e48dcdd3e6a216a9789"><code>c69f13c</code></a> Remove deprecated ESLint rules after version update.</li>
<li><a href="https://github.com/DavidAnson/markdownlint-cli2-action/commit/55caa5fd0a1c57994a687d53806b4cd35f5a2538"><code>55caa5f</code></a> Bump eslint from 8.52.0 to 8.53.0</li>
<li>Additional commits viewable in <a href="https://github.com/davidanson/markdownlint-cli2-action/compare/v13...v14">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=DavidAnson/markdownlint-cli2-action&package-manager=github_actions&previous-version=13&new-version=14)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

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

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

---

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

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

</details>

* docs: readme improvements (#5171)

* readme improvements

* add link

* chore(08-wasm): `Pin` code during app initialisation (#5161)

* init InitializePinnedCodes

* testing

* call Pin during app inisitalization

* linting

* update docs

* spacing

* update docs

* add extra line

* chore: update tmproto, tmos aliases to cmtproto, cmtos

* chore: use suite.Require().NoError(), rename gotErr to err

* testing: nits

* Use table driven tests for TestInitializedPinnedCodes

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>

* e2e: timeout transfer with grandpa light client (#5018)

* Change to StoreCodeUnchecked in Genesis and snapshotter (#5167)

* change to store code unchecked

* separate storeWasmCode and importWasmCode

* add parameter to storeWasmCode to pass the store function

* store code for msg server

* fix: typos in godocs

* Update modules/light-clients/08-wasm/internal/ibcwasm/expected_interfaces.go

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

* linting business

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* build(deps): Bump JamesIves/github-pages-deploy-action from 4.4.3 to 4.5.0 (#5188)

Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.4.3 to 4.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/jamesives/github-pages-deploy-action/releases">JamesIves/github-pages-deploy-action's releases</a>.</em></p>
<blockquote>
<h2>v4.5.0</h2>
<h2>What's Changed</h2>
<ul>
<li>The action is now built and run on Node 20.</li>
<li>Bump <code>@​types/node</code> from 20.4.1 to 20.4.2 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/JamesIves/github-pages-deploy-action/pull/1399">JamesIves/github-pages-deploy-action#1399</a></li>
<li>Bump eslint-plugin-jest from 27.2.2 to 27.2.3 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/JamesIves/github-pages-deploy-action/pull/1400">JamesIves/github-pages-deploy-action#1400</a></li>
<li>Bump word-wrap from 1.2.3 to 1.2.4 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/JamesIves/github-pages-deploy-action/pull/1401">JamesIves/github-pages-deploy-action#1401</a></li>
<li>Bump eslint-config-prettier from 8.8.0 to 8.9.0 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/JamesIves/github-pages-deploy-action/pull/1405">JamesIves/github-pages-deploy-action#1405</a></li>
<li>Bump <code>@​types/node</code> from 20.4.2 to 20.4.9 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a href="https://redirect.github.com/JamesIves/github-pages-deploy-action/pull/1413">JamesIves/github-pages-deploy-action#1413</a></li>…
  • Loading branch information
ThanhNhann authored and mergify[bot] committed Jan 4, 2024
1 parent 3aa49ff commit 0e1ed3b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 16 deletions.
91 changes: 75 additions & 16 deletions modules/core/04-channel/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
"success: stale packet state pruned up to limit",
func() {
// Send 10 packets from B -> A, creating 10 packet receipts and 10 packet acks on A.
suite.sendMockPackets(path, 10)
suite.sendMockPackets(path, 10, true)
},
func() {},
func(pruned, left uint64) {
Expand All @@ -616,7 +616,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
"success: stale packet state partially pruned",
func() {
// Send 10 packets from B -> A, creating 10 packet receipts and 10 packet acks on A.
suite.sendMockPackets(path, 10)
suite.sendMockPackets(path, 10, true)
},
func() {
// Prune only 6 packet acks.
Expand All @@ -632,17 +632,37 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
},
nil,
},
{
"success: stale packet state with a higher limit",
func() {
// Send 10 packets from B -> A, creating 10 packet receipts and 10 packet acks on A.
suite.sendMockPackets(path, 10, true)
},
func() {
// Prune 13 packets acks > 10 packets sent.
limit = 13
},
func(pruned, left uint64) {
// We expect 0 to be left and sequenceStart == 11.
postPruneExpState(0, 0, 11)

// We expect 10 to be pruned and 0 left.
suite.Require().Equal(uint64(10), pruned)
suite.Require().Equal(uint64(0), left)
},
nil,
},
{
"success: stale packet state pruned, two upgrades",
func() {
// Send 10 packets from B -> A, creating 10 packet receipts and 10 packet acks on A.
// This is _before_ the first upgrade.
suite.sendMockPackets(path, 10)
suite.sendMockPackets(path, 10, true)
},
func() {
// Previous upgrade is complete, send additional packets and do yet another upgrade.
// This is _after_ the first upgrade.
suite.sendMockPackets(path, 5)
suite.sendMockPackets(path, 5, true)

// Do another upgrade.
upgradeFields = types.UpgradeFields{Version: fmt.Sprintf("%s-v3", ibcmock.Version)}
Expand All @@ -669,7 +689,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
func() {
// Send 10 packets from B -> A, creating 10 packet receipts and 10 packet acks on A.
// This is _before_ the first upgrade.
suite.sendMockPackets(path, 10)
suite.sendMockPackets(path, 10, true)
},
func() {
// Prune 5 on A.
Expand All @@ -690,7 +710,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {

// Previous upgrade is complete, send additional packets and do yet another upgrade.
// This is _after_ the first upgrade.
suite.sendMockPackets(path, 10)
suite.sendMockPackets(path, 10, true)

// Do another upgrade.
upgradeFields = types.UpgradeFields{Version: fmt.Sprintf("%s-v3", ibcmock.Version)}
Expand All @@ -713,14 +733,14 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
func() {
// Send 5 packets from B -> A, creating 5 packet receipts and 5 packet acks on A.
// This is _before_ the first upgrade.
suite.sendMockPackets(path, 5)
suite.sendMockPackets(path, 5, true)

// Set Order for upgrade to Ordered.
upgradeFields = types.UpgradeFields{Version: fmt.Sprintf("%s-v2", ibcmock.Version), Ordering: types.ORDERED}
},
func() {
// Previous upgrade is complete, send additional packets now on ordered channel (only acks!)
suite.sendMockPackets(path, 10)
suite.sendMockPackets(path, 10, true)

// Do another upgrade (go back to Unordered)
upgradeFields = types.UpgradeFields{Version: fmt.Sprintf("%s-v3", ibcmock.Version), Ordering: types.UNORDERED}
Expand All @@ -740,7 +760,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
"success: packets sent before upgrade are pruned, after upgrade are not",
func() {
// Send 5 packets from B -> A, creating 5 packet receipts and 5 packet acks on A.
suite.sendMockPackets(path, 5)
suite.sendMockPackets(path, 5, true)
},
func() {},
func(pruned, left uint64) {
Expand All @@ -749,7 +769,7 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
suite.Require().Equal(uint64(0), left)

// channel upgraded, send additional packets and try and prune.
suite.sendMockPackets(path, 12)
suite.sendMockPackets(path, 12, true)

// attempt to prune 5.
pruned, left, err := suite.chainA.App.GetIBCKeeper().ChannelKeeper.PruneAcknowledgements(
Expand All @@ -768,6 +788,29 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
},
nil,
},
{
"success: packets sent with 2 middle sequences that don't have an ack stored",
func() {
// Send 12 packets from B -> A with 2 packets that timeout
suite.sendMockPackets(path, 5, true)
suite.sendMockPackets(path, 2, false)
suite.sendMockPackets(path, 5, true)
},
func() {
limit = 7
},
func(pruned, left uint64) {
// After pruning 7 sequences we should be left with 5 acks and 5 receipts,
// because the 2 packets that timeout are still counted as pruned, even though
// there was nothing to prune since both packets timed out
postPruneExpState(5, 5, 8)

// We expect 7 to be pruned and 5 left.
suite.Require().Equal(uint64(7), pruned)
suite.Require().Equal(uint64(5), left)
},
nil,
},
{
"failure: packet sequence start not set",
func() {},
Expand Down Expand Up @@ -849,16 +892,32 @@ func (suite *KeeperTestSuite) UpgradeChannel(path *ibctesting.Path, upgradeField
suite.Require().NoError(err)
}

// sendMockPacket sends a packet from source to dest and acknowledges it on the source (completing the packet lifecycle).
// sendMockPacket sends a packet from source to dest and acknowledges it on the source (completing the packet lifecycle)
// if acknowledge is true. If acknowledge is false, then the packet will be sent, but timed out.
// Question(jim): find a nicer home for this?
func (suite *KeeperTestSuite) sendMockPackets(path *ibctesting.Path, numPackets int) {
func (suite *KeeperTestSuite) sendMockPackets(path *ibctesting.Path, numPackets int, acknowledge bool) {
for i := 0; i < numPackets; i++ {

sequence, err := path.EndpointB.SendPacket(clienttypes.NewHeight(1, 1000), disabledTimeoutTimestamp, ibctesting.MockPacketData)
suite.Require().NoError(err)
timeoutHeight := clienttypes.NewHeight(1, 1000)
timeoutTimestamp := disabledTimeoutTimestamp
if !acknowledge {
timeoutTimestamp = uint64(suite.chainA.GetContext().BlockTime().UnixNano())
}

packet := types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, clienttypes.NewHeight(1, 1000), disabledTimeoutTimestamp)
err = path.RelayPacket(packet)
sequence, err := path.EndpointB.SendPacket(timeoutHeight, timeoutTimestamp, ibctesting.MockPacketData)
suite.Require().NoError(err)

packet := types.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, timeoutHeight, timeoutTimestamp)

if acknowledge {
err = path.RelayPacket(packet)
suite.Require().NoError(err)
} else {
err = path.EndpointB.UpdateClient()
suite.Require().NoError(err)

err = path.EndpointB.TimeoutPacket(packet)
suite.Require().NoError(err)
}
}
}
2 changes: 2 additions & 0 deletions modules/core/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,8 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() {
if tc.expErr == nil {
suite.Require().NoError(err)
suite.Require().NotNil(resp)
suite.Require().Equal(uint64(0), resp.TotalPrunedSequences)
suite.Require().Equal(uint64(0), resp.TotalRemainingSequences)
} else {
suite.Require().Error(err)
suite.Require().Nil(resp)
Expand Down

0 comments on commit 0e1ed3b

Please sign in to comment.