Adjust logic selecting node#90
Conversation
There was a problem hiding this comment.
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.Transportwith shortenedIdleConnTimeoutfor 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.
There was a problem hiding this comment.
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 ifhttp.DefaultTransporthas been replaced with a non-*http.Transport RoundTripper. Consider guarding the type assertion (and falling back to a newhttp.Transport{}or a known-good default) before callingClone()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 fencedshblock. 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>
| 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(), | ||
| } |
| module github.com/bandprotocol/falcon | ||
|
|
||
| go 1.24.3 | ||
| go 1.25.3 | ||
|
|
Fixed: #XXXX
Implementation details
Please ensure the following requirements are met before submitting a pull request:
CHANGELOG_UNRELEASED.mdFiles changedtab in the Github PR explorer)