Skip to content

Commit a7ef15a

Browse files
committed
feat: add insecure http feat to bridge service requests
Signed-off-by: Ji Hwan <[email protected]>
1 parent acb77dd commit a7ef15a

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

cmd/ulxly/ulxly.go

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,8 +1865,25 @@ func generateTransactionPayload(ctx context.Context, client *ethclient.Client, u
18651865
return bridgeV2, toAddress, opts, err
18661866
}
18671867

1868+
// Helper function to get the appropriate HTTP client
1869+
func getHTTPClient() *http.Client {
1870+
if inputUlxlyArgs.insecure != nil && *inputUlxlyArgs.insecure {
1871+
log.Warn().Msg("WARNING: Using insecure HTTP client for bridge service requests")
1872+
return &http.Client{
1873+
Timeout: 30 * time.Second,
1874+
Transport: &http.Transport{
1875+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
1876+
},
1877+
}
1878+
}
1879+
return &http.Client{
1880+
Timeout: 30 * time.Second,
1881+
}
1882+
}
1883+
18681884
func getMerkleProofsExitRoots(bridgeServiceProofEndpoint string) (merkleProofArray [32][32]byte, rollupMerkleProofArray [32][32]byte, mainExitRoot []byte, rollupExitRoot []byte) {
1869-
reqBridgeProof, err := http.Get(bridgeServiceProofEndpoint)
1885+
client := getHTTPClient()
1886+
reqBridgeProof, err := client.Get(bridgeServiceProofEndpoint)
18701887
if err != nil {
18711888
log.Error().Err(err)
18721889
return
@@ -1914,7 +1931,8 @@ func getMerkleProofsExitRoots(bridgeServiceProofEndpoint string) (merkleProofArr
19141931
}
19151932

19161933
func getDeposit(bridgeServiceDepositsEndpoint string) (globalIndex *big.Int, originAddress common.Address, amount *big.Int, metadata []byte, leafType uint8, claimDestNetwork, claimOriginalNetwork uint32, err error) {
1917-
reqBridgeDeposit, err := http.Get(bridgeServiceDepositsEndpoint)
1934+
client := getHTTPClient()
1935+
reqBridgeDeposit, err := client.Get(bridgeServiceDepositsEndpoint)
19181936
if err != nil {
19191937
log.Error().Err(err)
19201938
return
@@ -1972,7 +1990,8 @@ func getDepositsForAddress(bridgeRequestUrl string) ([]BridgeDeposit, error) {
19721990
Deposits []BridgeDeposit `json:"deposits"`
19731991
Total int `json:"total_cnt,string"`
19741992
}
1975-
httpResp, err := http.Get(bridgeRequestUrl)
1993+
client := getHTTPClient()
1994+
httpResp, err := client.Get(bridgeRequestUrl)
19761995
if err != nil {
19771996
return nil, err
19781997
}

0 commit comments

Comments
 (0)