Skip to content

Conversation

@sanity
Copy link
Collaborator

@sanity sanity commented Sep 5, 2025

Summary

This PR fixes an issue where users would continue connecting to old/disabled gateways even after the gateway list was updated on the server. Users were getting errors like "Protocol version mismatch: expected 0.1.21, got 0.1.23" because they were still connecting to the old vega gateway.

The Problem

  1. The remote gateways.toml correctly lists only nova (running v0.1.23)
  2. Users' local gateways.toml files still contained vega (running v0.1.21)
  3. The code was merging remote and local gateways instead of replacing them
  4. This meant disabled gateways would persist forever in users' configurations

The Solution

When gateways are successfully fetched from the network:

  • Replace the local gateways entirely with the remote ones (don't merge)
  • Save the updated gateway list to the local gateways.toml file
  • Log the replacement for visibility

When --skip-load-from-network is used:

  • Continue using local gateways as before
  • This preserves the ability to test with custom gateways

Changes

  • Modified gateway loading logic to replace instead of merge when fetching from network
  • Added save_to_file() call to persist the updated gateways
  • Added logging to indicate when gateways are being replaced
  • Added TODO comment noting this behavior may change after stable release

Testing

The fix ensures that:

  1. Users will automatically switch to nova gateway (v0.1.23)
  2. The old vega gateway will be removed from their local config
  3. Future gateway updates will be applied automatically

This is especially important during alpha testing when we frequently update gateway versions.

[AI-assisted debugging and comment]

🤖 Generated with Claude Code

This fixes an issue where users would continue connecting to old/disabled
gateways (like vega running v0.1.21) even after the gateway list was
updated on the server.

Changes:
- When gateways are successfully fetched from the network, completely
  replace the local gateways instead of merging them
- Save the updated gateway list to the local gateways.toml file
- When --skip-load-from-network is used, continue using local gateways
- Added logging to indicate when gateways are being replaced

This ensures users always connect to the current active gateways during
the alpha testing phase. The behavior may change once we release a
stable version.

Fixes the issue where users were getting "Protocol version mismatch:
expected 0.1.21, got 0.1.23" because they were still connecting to
the old vega gateway.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sanity sanity enabled auto-merge September 5, 2025 16:35
@sanity sanity added this pull request to the merge queue Sep 5, 2025
Merged via the queue into main with commit af68ad3 Sep 5, 2025
6 checks passed
@sanity sanity deleted the fix-gateway-update-behavior branch September 5, 2025 16:51
sanity added a commit that referenced this pull request Sep 6, 2025
## Changes
- fix: Check local storage directly in request_get() before network operations (#1806)
- feat: Client connection refactor infrastructure (Phase 0) (#1813)
- chore: Remove leftover script and config files (#1809)
- fix: Duplicate file extension in config log output (#1808)
- debug: Add logging to diagnose PUT contract key/hash mismatch (#1807)
- deps: Update freenet-stdlib 0.1.14, rand 0.9, tokio-tungstenite 0.27 (#1795)
- fix: Replace local gateways with remote ones when fetched from network (#1804)
- fix: Improve protocol version mismatch error messages (#1803)
@sanity sanity mentioned this pull request Sep 6, 2025
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