Skip to content

fix: client didn't get rotated when creating a new pool#748

Open
patricios-space wants to merge 4 commits into
mainfrom
fix/relayer/client-rotation
Open

fix: client didn't get rotated when creating a new pool#748
patricios-space wants to merge 4 commits into
mainfrom
fix/relayer/client-rotation

Conversation

@patricios-space
Copy link
Copy Markdown
Collaborator

No description provided.

@patricios-space patricios-space marked this pull request as ready for review May 28, 2026 15:13
Copilot AI review requested due to automatic review settings May 28, 2026 15:13
@patricios-space patricios-space requested a review from a team as a code owner May 28, 2026 15:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes TON client rotation when creating/using connection pools by moving from a single shared ConnectionPool to per-node pools keyed by node index, ensuring each node can maintain its own long-lived pool.

Changes:

  • Replace chain.pool with chain.pools map[int]*liteclient.ConnectionPool to track pools per node.
  • Update pool lifecycle management: create pools per node on demand and stop all pools on Close().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/relay/chain.go
Comment thread pkg/relay/chain.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread pkg/relay/chain.go
Comment thread pkg/relay/chain.go Outdated
Comment thread pkg/relay/chain.go Outdated
Comment on lines +460 to +462
{ // restrict scope of read lock
c.cacheMu.RLock()
defer c.cacheMu.RUnlock()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This scoped { does not release the read lock at the end of the } block, defer is only triggered when functions return, so i think this will deadlock on line 475 with c.cacheMu.Lock()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

tested this in go playground: https://goplay.tools/snippet/w5sy6rGXJLA

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good to know. Thought this worked differently. Too much Rust 🦀

Copy link
Copy Markdown
Collaborator

@ogtownsend ogtownsend left a comment

Choose a reason for hiding this comment

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

RC for the potential deadlock

@ogtownsend ogtownsend requested a review from a team May 28, 2026 16:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

3 participants