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

fix: write client ID back to config file on-the-fly #13

Merged
merged 6 commits into from
Feb 6, 2023

Conversation

SebastianElvis
Copy link
Member

Fixes BM-490

This PR introduces the mechanism to write the client ID back to config file on-the-fly after creating an IBC light client. This allows the relayer to reuse the client it created in the last run, thus saving some gas costs. The majority of the code is adapted from https://github.com/cosmos/relayer/blob/v2.2.0/cmd/appstate.go. The process of writing config file is made thread-safe by using filesystem locks. Tested locally and it works properly.

Along the way, this PR cleans up the config in the sense that 1) memo is now totally fetched from config rather than cli flags, and 2) cfg is now a field of Relayer struct thus we don't need to pass chains/paths to Relayer functions anymore.

@SebastianElvis
Copy link
Member Author

Merged for now. As per offline discussion with @philmln we will use LevelDB for storing the client ID in the future. This will be done in a subsequent PR.

@SebastianElvis SebastianElvis merged commit 42558da into dev Feb 6, 2023
@SebastianElvis SebastianElvis deleted the update-config-on-the-fly branch February 6, 2023 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants