Skip to content

Commit eaa09cc

Browse files
committed
chore: deprecation of trezord-go
1 parent d699116 commit eaa09cc

File tree

9 files changed

+30
-214
lines changed

9 files changed

+30
-214
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ Supported platforms are Linux and macOS (both Intel and Silicon).
4545
- Service running on *localhost:21325*
4646
- Connection between the trezor device (or running emulator) and the host
4747
- Used by applications needing to communicate with trezor device (for example Suite)
48-
- **Bridge proxy**
49-
- Proxies requests to the bridge
5048
- **Bitcoin regtest**
5149
- Bitcoind with [blockbook](https://github.com/trezor/blockbook) running in regtest mode
5250
- Default credentials for bitcoin backend

docker/compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ services:
2020
ports:
2121
- "9001:9001"
2222
- "9002:9002"
23-
- "21326:21326"
24-
- "127.0.0.1:21325:21326" # macos needs proxy to override the "origin" of the trezord request
23+
# 21325 is the legacy bridge port. It will not work on macOS (see bridge-proxy before this commit).
24+
- "21328:21328" # new bridge port
2525
environment:
2626
- DISPLAY=docker.for.mac.host.internal:0
2727
- REGTEST_RPC_URL=http://host.docker.internal:18021

src/binaries.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
BRIDGES: List[str] = []
4242

4343
IS_ARM = os.uname().machine.startswith(("aarch64", "arm"))
44+
IS_MAC = os.uname().sysname == "Darwin"
4445
ARM_IDENTIFIER = "-arm"
4546

46-
DEFAULT_BRIDGE = "2.0.33" if not IS_ARM else f"2.0.33{ARM_IDENTIFIER}"
47+
DEFAULT_BRIDGE = NODE_BRIDGE_ID
4748

4849

4950
def register_new_firmware(model: Model, version: str, location: str) -> None:
@@ -151,12 +152,14 @@ def sort_firmwares(version: str) -> Tuple[int, ...]:
151152

152153
def explore_bridges() -> None:
153154
# Send only suitable bridges for ARM/non-ARM
154-
if IS_ARM:
155-
BRIDGES.append(f"2.0.33{ARM_IDENTIFIER}")
156-
BRIDGES.append(f"2.0.32{ARM_IDENTIFIER}")
157-
else:
158-
BRIDGES.append("2.0.33")
159-
BRIDGES.append("2.0.32")
155+
# Also legacy trezord-go doesn't work in docker correctly so skip it for this case too.
156+
if not IS_MAC:
157+
if IS_ARM:
158+
BRIDGES.append(f"2.0.33{ARM_IDENTIFIER}")
159+
BRIDGES.append(f"2.0.32{ARM_IDENTIFIER}")
160+
else:
161+
BRIDGES.append("2.0.33")
162+
BRIDGES.append("2.0.32")
160163

161164
if NODE_BRIDGE_BIN_JS.exists():
162165
BRIDGES.append(NODE_BRIDGE_ID)

src/bridge.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
from psutil import Popen
1111

1212
import binaries
13-
import bridge_proxy
1413
import helpers
15-
from bridge_proxy import PORT as BRIDGE_PROXY_PORT
1614

1715
if TYPE_CHECKING:
1816
from typing_extensions import TypedDict
@@ -61,13 +59,12 @@ def is_port_in_use(port: int) -> bool:
6159
return s.connect_ex(("0.0.0.0", port)) == 0
6260

6361

64-
def check_bridge_and_proxy_status() -> None:
65-
"""Reporting the status of bridge and proxy, for debugging purposes"""
62+
def check_bridge_status() -> None:
63+
"""Reporting the status of bridge, for debugging purposes"""
6664
log(f"Is bridge running - {is_port_in_use(BRIDGE_PORT)}")
67-
log(f"Is bridge proxy running - {is_port_in_use(BRIDGE_PROXY_PORT)}")
6865

6966

70-
def start(version: str, proxy: bool = False, output_to_logfile: bool = True) -> None:
67+
def start(version: str, output_to_logfile: bool = True) -> None:
7168
log("Starting")
7269
global BRIDGE
7370
global VERSION_RUNNING
@@ -87,7 +84,7 @@ def start(version: str, proxy: bool = False, output_to_logfile: bool = True) ->
8784
# not to still think the bridge is running
8885
if BRIDGE is not None and not is_running():
8986
log("Bridge was probably killed by user manually, resetting local state")
90-
stop(proxy=proxy)
87+
stop()
9188

9289
if BRIDGE is not None:
9390
log("WARNING: Bridge is already running, not spawning a new one", "red")
@@ -158,14 +155,11 @@ def get_command_list() -> list[str]:
158155

159156
VERSION_RUNNING = version
160157

161-
if proxy:
162-
bridge_proxy.start()
163-
164158
time.sleep(0.5)
165-
check_bridge_and_proxy_status()
159+
check_bridge_status()
166160

167161

168-
def stop(proxy: bool = True) -> None:
162+
def stop() -> None:
169163
log("Stopping")
170164
global BRIDGE
171165
global VERSION_RUNNING
@@ -190,8 +184,5 @@ def stop(proxy: bool = True) -> None:
190184
BRIDGE = None
191185
VERSION_RUNNING = None
192186

193-
if proxy:
194-
bridge_proxy.stop()
195-
196187
time.sleep(0.5)
197-
check_bridge_and_proxy_status()
188+
check_bridge_status()

src/bridge_proxy.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/bridge_proxy_server.py

Lines changed: 0 additions & 105 deletions
This file was deleted.

src/controller.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class BackgroundCheckResponse(TypedDict):
4242
IP = "0.0.0.0"
4343
PORT = 9001
4444
LOG_COLOR = "blue"
45-
BRIDGE_PROXY = False # is being set in main.py (when not disabled, will be True)
4645
REGTEST_RPC = BTCJsonRPC(
4746
url=os.getenv("REGTEST_RPC_URL") or "http://0.0.0.0:18021",
4847
user="rpc",
@@ -148,17 +147,13 @@ def run_bridge_command(self) -> "ResponseType":
148147
version = self.request_dict.get("version", binaries.DEFAULT_BRIDGE)
149148
output_to_logfile = self.request_dict.get("output_to_logfile", True)
150149
bridge.start(
151-
version, proxy=BRIDGE_PROXY, output_to_logfile=output_to_logfile
150+
version, output_to_logfile=output_to_logfile
152151
)
153152
response_text = f"Bridge version {version} started"
154-
if BRIDGE_PROXY:
155-
response_text += " with bridge proxy"
156153
return {"response": response_text}
157154
elif self.command == "bridge-stop":
158-
bridge.stop(proxy=BRIDGE_PROXY)
155+
bridge.stop()
159156
response_text = "Stopping bridge"
160-
if BRIDGE_PROXY:
161-
response_text += " + stopping bridge proxy"
162157
return {"response": response_text}
163158
else:
164159
return {

src/dashboard/js/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,14 @@ const app = createApp({
200200
this.emulators.versions[model].versions = options;
201201
this.emulators.versions[model].selected = options[0];
202202
}
203-
this.bridges.selected = dataObject.bridges[0];
204-
this.bridges.versions = dataObject.bridges;
203+
const nodebridge = [];
204+
const legacy = [];
205+
dataObject.bridges.forEach((b) =>
206+
b.startsWith("2.") ? legacy.push(b) : nodebridge.push(b)
207+
);
208+
this.bridges.versions = nodebridge.concat(legacy);
209+
this.bridges.selected = this.bridges.versions[0];
210+
205211
this.bridges.hasSuiteLocal = dataObject.bridges.includes(
206212
"local-suite-node-bridge"
207213
);

src/main.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def log(text: str, color: str = LOG_COLOR) -> None:
3030
parser = argparse.ArgumentParser()
3131
parser.add_argument("-v", "--verbosity", action="count", default=0)
3232
parser.add_argument("--work-dir")
33-
parser.add_argument("--disable-bridge-proxy", action="store_true")
3433
args = parser.parse_args()
3534

3635
effective_work_dir = args.work_dir
@@ -48,16 +47,7 @@ def log(text: str, color: str = LOG_COLOR) -> None:
4847

4948
binaries.explore(args)
5049
dashboard.start()
51-
52-
if args.disable_bridge_proxy:
53-
log(
54-
"Bridge proxy disabled. "
55-
"Communication with Bridge needs to be done directly."
56-
)
57-
else:
58-
log("Will create bridge proxy when spawning a bridge.")
59-
controller.BRIDGE_PROXY = True
60-
50+
6151
if helpers.physical_trezor():
6252
log("Will support physical Trezor.")
6353
else:

0 commit comments

Comments
 (0)