Skip to content

Adjust logic selecting node#90

Merged
RogerKSI merged 6 commits into
mainfrom
adjust-logic-selecting-node
May 20, 2026
Merged

Adjust logic selecting node#90
RogerKSI merged 6 commits into
mainfrom
adjust-logic-selecting-node

Conversation

@RogerKSI
Copy link
Copy Markdown
Member

Fixed: #XXXX

Implementation details

Please ensure the following requirements are met before submitting a pull request:

  • The pull request is targeted against the correct target branch
  • The pull request is linked to an issue with appropriate discussion and an accepted design OR is linked to a spec that describes the work.
  • The pull request includes a description of the implementation/work done in detail.
  • The pull request includes any and all appropriate unit/integration tests
  • You have added a relevant changelog entry to CHANGELOG_UNRELEASED.md
  • You have re-reviewed the files affected by the pull request (e.g. using the Files changed tab in the Github PR explorer)

Copy link
Copy Markdown

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 updates the relayer’s per-chain client endpoint selection strategy to avoid strictly picking the single highest-height endpoint and instead choose an endpoint that is “close enough” to the head height, biased toward faster responders. It also adds an HTTP transport idle-connection timeout for XRPL to reduce stale keep-alive reuse issues.

Changes:

  • Add per-client BlockConfirmation (or equivalent) and adjust endpoint selection to first-come-first-serve within [maxHeight - BlockConfirmation, maxHeight] (or ledger equivalent).
  • XRPL: introduce a custom http.Transport with shortened IdleConnTimeout for RPC calls.
  • Align similar selection logic changes across EVM, Flow, ICON, Secret, Soroban, and XRPL clients.

Reviewed changes

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

Show a summary per file
File Description
relayer/chains/xrpl/client.go Adds HTTP transport idle timeout; changes endpoint selection to first-arrival within a ledger-index window.
relayer/chains/soroban/client.go Changes Horizon endpoint selection to first-arrival within an ingested-ledger window.
relayer/chains/secret/client.go Changes endpoint selection to first-arrival within a block-height window.
relayer/chains/icon/client.go Changes ICON endpoint selection to first-arrival within a block-height window.
relayer/chains/flow/client.go Changes Flow endpoint selection to first-arrival within a block-height window.
relayer/chains/evm/client.go Changes EVM endpoint selection to first-arrival within a block-height window and ties the window size to cfg.BlockConfirmation.

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

Comment thread relayer/chains/evm/client.go Outdated
Comment thread relayer/chains/evm/client.go Outdated
Copy link
Copy Markdown

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 6 out of 6 changed files in this pull request and generated 6 comments.

Comment thread relayer/chains/xrpl/client.go Outdated
Comment thread relayer/chains/flow/client.go Outdated
Comment thread relayer/chains/soroban/client.go Outdated
Comment thread relayer/chains/secret/client.go Outdated
Comment thread relayer/chains/icon/client.go Outdated
Comment thread relayer/chains/evm/client.go Outdated
Copy link
Copy Markdown

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 9 out of 10 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (4)

relayer/chains/xrpl/client.go:107

  • http.DefaultTransport.(*http.Transport) can panic if http.DefaultTransport has been replaced with a non-*http.Transport RoundTripper. Consider guarding the type assertion (and falling back to a new http.Transport{} or a known-good default) before calling Clone() so Connect can't crash the relayer.
			transport := http.DefaultTransport.(*http.Transport).Clone()
			transport.IdleConnTimeout = idleConnTimeout
			opts := []rpc.ConfigOpt{
				rpc.WithHTTPClient(&http.Client{Transport: transport}),
			}

README.md:281

  • There is a stray standalone > line under this heading, which will render as a Markdown blockquote and looks accidental. It should likely be removed (or moved inside a fenced code block if it is meant to be a CLI prompt).
### 7. Check that the keys for the configured chains are funded
>

You can query the balance of each configured key by running:

README.md:301

  • This standalone > line between prose and the fenced code block renders as a blockquote and looks accidental. Consider removing it to keep the Markdown formatting clean.
## Generate Go Protobuf Code
Falcon uses gRPC and Protocol Buffers for its internal APIs.
If you modify any `.proto` files under the `proto/` directory, regenerate the Go code by running:
> 
```sh
make proto

README.md:333

  • In the migration command examples, the SQLite commands are prefixed with > inside the fenced sh block. That looks like an accidental blockquote/prompt marker and will break copy/paste—consider removing the > prefixes so the commands are valid as-is.
```sh 
# Postgres
goose -dir relayer/db/migrations/postgres postgres "postgres://user:password@localhost:5432/falcon?sslmode=disable" up

> # SQLite
> goose -dir relayer/db/migrations/sqlite sqlite "gorm.db" up
</details>

Comment thread relayer/chains/xrpl/client.go
Comment thread relayer/chains/flow/client.go
Comment thread relayer/chains/icon/client.go
Comment thread relayer/chains/soroban/client.go
Comment thread relayer/chains/secret/client.go
Comment thread README.md
Comment thread README.md Outdated
@RogerKSI RogerKSI requested a review from Copilot May 20, 2026 06:59
@RogerKSI RogerKSI marked this pull request as draft May 20, 2026 06:59
@RogerKSI RogerKSI marked this pull request as ready for review May 20, 2026 07:00
@RogerKSI RogerKSI merged commit 99f21ea into main May 20, 2026
4 checks passed
@RogerKSI RogerKSI deleted the adjust-logic-selecting-node branch May 20, 2026 07:02
Copy link
Copy Markdown

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 10 out of 11 changed files in this pull request and generated 8 comments.

Comment on lines 72 to 80
func NewClient(chainName string, cfg *XRPLChainProviderConfig, log logger.Logger, alert alert.Alert) Client {
return &client{
ChainName: chainName,
Endpoints: cfg.Endpoints,
Log: log.With("chain_name", chainName),
alert: alert,
clients: NewXRPLClients(),
ChainName: chainName,
Endpoints: cfg.Endpoints,
BlockConfirmation: 5,
Log: log.With("chain_name", chainName),
alert: alert,
clients: NewXRPLClients(),
}
Comment thread relayer/chains/xrpl/client.go
Comment thread relayer/chains/xrpl/client.go
Comment thread relayer/chains/soroban/client.go
Comment thread relayer/chains/secret/client.go
Comment thread relayer/chains/icon/client.go
Comment thread relayer/chains/flow/client.go
Comment thread go.mod
Comment on lines 1 to 4
module github.com/bandprotocol/falcon

go 1.24.3
go 1.25.3

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