Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit b4bade9

Browse files
committed
Fix grpcurl enforcer status check, update btc conf
* Fix grpcurl request to check on enforcer. Use cusf.mainchain.v1.ValidatorService.GetChainTip * Add signet setting to bitcoin.conf
1 parent 199fac7 commit b4bade9

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

cusf_launcher/scene/main_window.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ layout_mode = 2
503503
[connection signal="configuration_complete" from="Configuration" to="." method="_on_configuration_complete"]
504504
[connection signal="btc_new_block_count" from="RPCClient" to="." method="_on_rpc_client_btc_new_block_count"]
505505
[connection signal="btc_rpc_failed" from="RPCClient" to="." method="_on_rpc_client_btc_rpc_failed"]
506-
[connection signal="cusf_drivechain_new_block_count" from="RPCClient" to="." method="_on_rpc_client_cusf_drivechain_new_block_count"]
506+
[connection signal="cusf_drivechain_responded" from="RPCClient" to="." method="_on_rpc_client_cusf_drivechain_responded"]
507507
[connection signal="cusf_drivechain_rpc_failed" from="RPCClient" to="." method="_on_rpc_client_cusf_drivechain_rpc_failed"]
508508
[connection signal="thunder_cli_failed" from="RPCClient" to="." method="_on_rpc_client_thunder_cli_failed"]
509509
[connection signal="thunder_new_block_count" from="RPCClient" to="." method="_on_rpc_client_thunder_new_block_count"]

cusf_launcher/script/configuration.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ signetchallenge=00141f61d57873d70d28bd28b3c9f9d6bf818b5a0d6a
88
zmqpubsequence=tcp://0.0.0.0:29000
99
txindex=1
1010
server=1
11+
signet=1
1112
'''
1213

1314
signal configuration_complete

cusf_launcher/script/main_window.gd

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ func kill_started_pid() -> void:
3737

3838

3939
func check_running_status() -> void:
40-
# TODO re - enable
41-
return
42-
4340
$RPCClient.rpc_bitcoin_getblockcount()
44-
$RPCClient.grpc_enforcer_getmainblockcount()
41+
$RPCClient.grpc_enforcer_gettip()
4542
$RPCClient.cli_thunder_getblockcount()
4643

4744

@@ -168,16 +165,18 @@ func _on_button_start_l1_pressed() -> void:
168165
var user_dir : String = OS.get_user_data_dir()
169166

170167
# Start bitcoin
171-
var ret : int = OS.create_process(str(user_dir, "/L1-bitcoin-patched-latest-x86_64-unknown-linux-gnu/qt/bitcoin-qt"), ["--connect=0", "--signet"])
168+
var ret : int = OS.create_process(str(user_dir, "/L1-bitcoin-patched-latest-x86_64-unknown-linux-gnu/qt/bitcoin-qt"), [])
172169
if ret == -1:
173170
printerr("Failed to start bitcoin")
174171
return
175172
else:
176173
started_pid.push_back(ret)
177174
print("started bitcoin with pid: ", ret)
178175

176+
await get_tree().create_timer(5).timeout
177+
179178
# Start bip300-301 enforcer
180-
ret = OS.create_process(str(user_dir, "/bip300301-enforcer-latest-x86_64-unknown-linux-gnu/bip300301_enforcer-0.1.0-x86_64-unknown-linux-gnu"), ["--node-rpc-addr=127.0.01:38332", "--node-rpc-user=user", "--node-rpc-pass=password", "--node-zmq-addr-sequence=tcp://0.0.0.0:29000"])
179+
ret = OS.create_process(str(user_dir, "/bip300301-enforcer-latest-x86_64-unknown-linux-gnu/bip300301_enforcer-0.1.0-x86_64-unknown-linux-gnu"), ["--node-rpc-addr=localhost:38332", "--node-rpc-user=user", "--node-rpc-pass=password", "--node-zmq-addr-sequence=tcp://0.0.0.0:29000"])
181180
if ret == -1:
182181
printerr("Failed to start enforcer")
183182
return
@@ -227,7 +226,7 @@ func _on_rpc_client_btc_rpc_failed() -> void:
227226
$MarginContainer/VBoxContainer/HBoxContainerPageAndPageButtons/PanelContainerPages/OverviewPage/GridContainer/PanelContainerL1/VBoxContainer/LabelL1RunStatusBTC.text = "Failed to contact BTC!"
228227

229228

230-
func _on_rpc_client_cusf_drivechain_new_block_count(height: int) -> void:
229+
func _on_rpc_client_cusf_drivechain_responded() -> void:
231230
$MarginContainer/VBoxContainer/HBoxContainerPageAndPageButtons/PanelContainerPages/OverviewPage/GridContainer/PanelContainerL1/VBoxContainer/LabelL1RunStatusEnforcer.text = "Drivechain Enforcer Running!"
232231

233232

cusf_launcher/script/resource_downloader.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const URL_300301_ENFORCER_LIN : String = "https://releases.drivechain.info/bip3
1010
const URL_300301_ENFORCER_WIN : String = "https://releases.drivechain.info/bip300301-enforcer-latest-x86_64-pc-windows-gnu.zip"
1111
const URL_300301_ENFORCER_OSX : String = "https://releases.drivechain.info/bip300301-enforcer-latest-x86_64-apple-darwin.zip"
1212

13-
# TODO this is the wrong version for the enforcer, but I'm not sure what is correct anymore.
1413
const URL_BITCOIN_PATCHED_LIN : String = "https://releases.drivechain.info/L1-bitcoin-patched-latest-x86_64-unknown-linux-gnu.zip"
1514
const URL_BITCOIN_PATCHED_WIN : String = "https://releases.drivechain.info/L1-bitcoin-patched-latest-x86_64-w64-mingw32.zip"
1615
const URL_BITCOIN_PATCHED_OSX : String = "https://releases.drivechain.info/L1-bitcoin-patched-latest-x86_64-apple-darwin.zip"

cusf_launcher/script/rpc_client.gd

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ const DEFAULT_CUSF_DRIVECHAIN_RPC_PORT : int = 50051
77

88
const DEBUG_REQUESTS : bool = true
99

10-
const GRPC_CUSF_DRIVECHAIN_GET_HEIGHT : String = "validator.Validator/GetMainBlockHeight"
10+
const GRPC_CUSF_DRIVECHAIN_GET_TIP : String = "cusf.mainchain.v1.ValidatorService.GetChainTip"
1111

1212
# Signals that should be emitted regularly if connections are working
1313
signal btc_new_block_count(height : int)
14-
signal cusf_drivechain_new_block_count(height : int)
14+
signal cusf_drivechain_responded()
1515
signal thunder_new_block_count(height : int)
1616

1717
# Signals that indicate connection failure to one of the backend softwares
@@ -25,13 +25,12 @@ var core_auth_cookie : String = "user:password"
2525

2626
@onready var http_rpc_btc_get_block_count: HTTPRequest = $BitcoinCoreRPC/HTTPRPCBTCGetBlockCount
2727

28-
2928
func rpc_bitcoin_getblockcount() -> void:
3029
make_rpc_request(DEFAULT_BITCOIN_RPC_PORT, "getblockcount", [], http_rpc_btc_get_block_count)
3130

3231

33-
func grpc_enforcer_getmainblockcount() -> void:
34-
make_grpc_request(GRPC_CUSF_DRIVECHAIN_GET_HEIGHT)
32+
func grpc_enforcer_gettip() -> void:
33+
make_grpc_request(GRPC_CUSF_DRIVECHAIN_GET_TIP)
3534

3635

3736
func cli_thunder_getblockcount() -> void:
@@ -56,12 +55,8 @@ func make_grpc_request(request : String) -> void:
5655
var user_dir = OS.get_user_data_dir()
5756
var output = []
5857
var ret : int = OS.execute(str(user_dir, "/grpcurl"),
59-
["--plaintext",
60-
"--import-path",
61-
user_dir,
62-
"--proto",
63-
str(user_dir, "/validator.proto"),
64-
"[::1]:50051",
58+
["-plaintext",
59+
"localhost:50051",
6560
request],
6661
output,
6762
true)
@@ -70,8 +65,10 @@ func make_grpc_request(request : String) -> void:
7065
print("ret ", ret)
7166
print("output ", output)
7267

73-
# TODO check ret code
74-
cusf_drivechain_rpc_failed.emit()
68+
if ret != 0:
69+
cusf_drivechain_rpc_failed.emit()
70+
else:
71+
cusf_drivechain_responded.emit()
7572

7673

7774
func make_rpc_request(port : int, method: String, params: Variant, http_request: HTTPRequest) -> void:

0 commit comments

Comments
 (0)