Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement client recovery feature #1127

Merged
merged 66 commits into from
Apr 3, 2024
Merged

Conversation

seanchen1991
Copy link
Contributor

@seanchen1991 seanchen1991 commented Mar 15, 2024

Closes: #1110
Closes: #1111
Closes: #1112

Description


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

seanchen1991 and others added 30 commits March 1, 2024 13:33
@rnbguy rnbguy changed the title (feat) Implement client recovery feature feat: implement client recovery feature Mar 27, 2024
Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

Great work @seanchen1991 ! Good to get it merged.

I added a last commit following @Farhad-Shabani 's comments.

Copy link
Member

@Farhad-Shabani Farhad-Shabani left a comment

Choose a reason for hiding this comment

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

Great job @seanchen1991 on this PR, and big thanks to @rnbguy for the thorough reviews. Much appreciated!

Let's proceed with merging the PR once we've incorporated the changes and run integration tests on the basecoin-rs.

Additionally, it would be great to include adequate unit tests as well, though perhaps in a follow-up PR?

@Farhad-Shabani Farhad-Shabani added this to the 0.52.0 milestone Mar 27, 2024
@rnbguy
Copy link
Member

rnbguy commented Mar 27, 2024

If the tests are in separate PR, please add the changelog entries before merging 🙂

@rnbguy
Copy link
Member

rnbguy commented Apr 3, 2024

Is there anything pending for this PR? otherwise, we can wrap it us by adding changelog entries 🙂

* Initial scaffolding for testing client recovery

* Add MsgRecoverClient variant to ClientMsg

* Stub out `test_recover_client_ok`

* Update recover client test fixture

* Perform client updates on subject and substitute clients

* Create mock headers with timestamps

* Extend substitute client state's trusting period

* Remove eprintln statements

* Add some more tests

* Refactor to not require call to `sleep`

* Add docstring for `MockClientState::new`

* Formatting

* Remove recover_client validate and execute calls from dispatch

* Remove recover_client validate and execute calls from dispatch

* Call recover_client::validate and execute correctly

* Change MockClientState default trusting period to 10 seconds
@seanchen1991 seanchen1991 added this pull request to the merge queue Apr 3, 2024
@seanchen1991 seanchen1991 removed this pull request from the merge queue due to a manual request Apr 3, 2024
@seanchen1991 seanchen1991 added this pull request to the merge queue Apr 3, 2024
Merged via the queue into main with commit 2b9de34 Apr 3, 2024
18 checks passed
@seanchen1991 seanchen1991 deleted the sean/client-recovery branch April 3, 2024 21:25
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
* Add `MsgRecoverClient` domain type

* Working on client recovery validation handler logic

* Implement recover_client::validate function

* Add ClientStateValidation::check_substitute function

* Working on `recover_client::execute` function

* Stub out `update_on_recovery` function

* Implement standalone `update_on_recovery` function

* Change `update_on_recovery` function param

* Remove `ClientState::initialise` call from `execute`

* Implement `check_substitute` in ics07

* Update `update_on_recovery` function

* Add `MsgRecoverClient` domain type

* Working on client recovery validation handler logic

* Implement recover_client::validate function

* Add ClientStateValidation::check_substitute function

* Working on `recover_client::execute` function

* Stub out `update_on_recovery` function

* Implement standalone `update_on_recovery` function

* Change `update_on_recovery` function param

* Remove `ClientState::initialise` call from `execute`

* Implement `check_substitute` in ics07

* Update `update_on_recovery` function

* Resolve errors upon rebasing

* Add additional bounds on `check_substitute` and `update_on_recovery`

* Implement TryFrom<AnyClientState> for ClientStateType

* Attempt to implement check_substitute and update_on_recovery in ibc-derive

* fix: introduce fully-qualified path to get ibc-derive work

* Change substitute client state function params to Any

* Update change_substitute and update_on_recovery call sites

* Add additional bounds on other validation and execution context methods

* Implement `update_on_recovery` for MockClientState

* Silence unused variables warning

* Add missing MockClientState fields

* Fix some typos in doc comments

* Remove unnecessary trait bound

* Change `upgrade_client_proposal_handler` -> `execute_upgrade_client_proposal`

* Add upgrade proposal type url

* Remove commented-out trait bounds

* Convert Any to ClientState instead of ClientStateType

* Improve error message wording

* Improve error message wording

* Remove unnused function paramter

* Replace `self` with `&self`

* Convert substitute client state to MockClientState instead of Tm client state

* Update ClientNotInactive error variant message

* Improve `check_substitute` implementation

* Make `Status` type `Copy`

* Remove some imports and streamline mock client state initialization

* rm redundant methods

* Remove unnecessary TryFrom impl

* tests: add unit tests for client recovery (#1151)

* Initial scaffolding for testing client recovery

* Add MsgRecoverClient variant to ClientMsg

* Stub out `test_recover_client_ok`

* Update recover client test fixture

* Perform client updates on subject and substitute clients

* Create mock headers with timestamps

* Extend substitute client state's trusting period

* Remove eprintln statements

* Add some more tests

* Refactor to not require call to `sleep`

* Add docstring for `MockClientState::new`

* Formatting

* Remove recover_client validate and execute calls from dispatch

* Remove recover_client validate and execute calls from dispatch

* Call recover_client::validate and execute correctly

* Change MockClientState default trusting period to 10 seconds

* Add changelog entry

---------

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