fix(solana): align network-fee buckets and deterministic samples
Problem
SOL network-fee votes are keyed by chain, exact reporting slot, fee rate and transaction size. Bifrost can produce different votes from otherwise identical finalized chain data:
- The scanner jumps directly to the latest 50-slot boundary, skipping intermediate boundaries after delayed scans.
- The fee estimator combines the new sample with a rolling cache populated by that node's previous scans. Different scan histories can yield different fees for the same reporting slot.
- The deferred fee publication runs even when sampling fails, relabeling stale or partial cache data with a new slot. The scheduling cursor was already advanced, preventing a retry of that bucket.
Changes
- Sample deterministic finalized history for each report, with no rolling cross-report cache. Keep the existing median-of-block-medians and lamport rounding, using
GasCacheBlocksas the SOL eligible-transaction target withinFeeSampleSlots. - Process crossed boundaries in order with one sampling attempt per scanner pass. Bound catch-up to the two most recent crossed boundaries so a long outage does not replay ancient fee reports. Startup anchors near the finalized tip instead of replaying from zero.
- Advance the fee cursor only after successful handling. Temporary RPC, block or agreed-fee lookup failures preserve the pending boundary for retry. Never publish a partial or previous sample under a new slot.
- A complete sparse window can produce a fee without reaching the transaction target; verify retained-history coverage before accepting that fallback. Empty windows advance without inventing a fee. Missing blocks listed by the RPC are errors, not silently dropped samples.
- Reject null/missing
getFirstAvailableBlockresults instead of treating unknown coverage as a valid genesis retention floor. A real zero remains valid. - Preserve no-change suppression against a fresh THORChain agreed fee. Do not publish unchanged fees every bucket or use the previous local report as the suppression baseline.
- Keep vault/solvency scanning independent of fee-sampling failures and make blocked fee publication interruptible on shutdown.
No protocol state, voter identity, slash/refund rules, transaction construction, signing or production configuration changes. This does not include the scanner-sleep change in !5277 (merged). The sequential-boundary idea has a related solvency-only precedent in !4920 (merged).
Verification
Regression tests were written first and reproduced the original failures before implementation. They exercise the scanner and actual JSON-RPC client against local HTTP fixtures, rather than a separate model of the algorithm.
All selected local checks passed with Go 1.26.10:
go test -race -tags=mocknet ./bifrost/pkg/chainclients/solana/... -count=1 -timeout=10m
go test -tags=mainnet ./bifrost/pkg/chainclients/solana/... -run '^$' -timeout=10m
go vet -tags=mocknet ./bifrost/pkg/chainclients/solana/...
golangci-lint run --config .trunk/configs/.golangci.yaml --build-tags mocknet \
--timeout 10m --concurrency 2 --exclude gofmt --allow-parallel-runners \
./bifrost/pkg/chainclients/solana/...
git diff --checkFormatting was checked separately with gofumpt -d on all five changed Go files (no output). The lint check used the repository-pinned golangci-lint 1.63.4, built with Go 1.26.10. The mainnet command is compilation only, not a mainnet test execution.
Added 19 fee-reporting test cases and a table-driven retention-result decoder regression, alongside adapted existing fee tests. Coverage includes different prior histories, skipped boundaries, catch-up bounds, sampling and agreed-fee failures, partial/pruned/empty windows, malformed listings, unchanged-fee suppression, shutdown backpressure, and startup/recovery. The full Solana package tree passed under the race detector. Independent review has no remaining blocking findings.
Full-repository CI, simulation and live multi-validator convergence were not run locally. The dependency qualification below applies to every Go-based local check.
Rollout And Limits
- The estimator intentionally no longer smooths over a node's historical cache. It uses only the report's finalized lookback, so fee responsiveness changes and old/new Bifrost instances can disagree during rollout. Coordinate adoption through an upstream release; this is not a recommendation to deploy a custom build on one validator.
- Sampling contents are deterministic for matching configuration and complete, consistent finalized RPC data. Participation still depends on when each node reads THORChain's agreed fee; this MR does not guarantee every fee vote reaches quorum or eliminate every SOL slash.
- The two-boundary limit deliberately skips obsolete buckets after a long outage. It does not change THORNode's handling of out-of-order quorums or provide durable queue acknowledgements.
- Local dependency-based checks use the verified reconstructed RC6 TSS library through an external Go workspace. This is a best local approximation, not exact organization CI or production signing compatibility. Tracked dependency files are unchanged; the reconstructed source is not included.
- No running validator or RPC routing was changed.