Skip to content

Commit

Permalink
fix: bridge command service error (#115)
Browse files Browse the repository at this point in the history
* fix: bridge error issues

* fix: typo in error message

* chore: bump dive cli version for release
  • Loading branch information
shreyasbhat0 authored Aug 14, 2023
1 parent a5dc582 commit 444cab4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
27 changes: 17 additions & 10 deletions cli/commands/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,16 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command {
srcChainServiceResponse, dstChainServiceResponse, err := chains.getServicesResponse()

if err != nil {
diveContext.FatalError("Failed To read ServiceFile", err.Error())
diveContext.FatalError("failed to get service data", err.Error())
}

if chains.chainB == "icon" {
runBtpSetupForAlreadyRunningNodes(diveContext, enclaveCtx, runbridgeicon2ethhardhat, chains.chainB, chains.chainA, chains.chainBServiceName, chains.chainAServiceName, bridge, dstChainServiceResponse, srcChainServiceResponse)
} else {

runBtpSetupForAlreadyRunningNodes(diveContext, enclaveCtx, runbridgeicon2ethhardhat, chains.chainA, chains.chainB, chains.chainAServiceName, chains.chainBServiceName, bridge, srcChainServiceResponse, dstChainServiceResponse)

}
runBtpSetupForAlreadyRunningNodes(diveContext, enclaveCtx, runbridgeicon2ethhardhat, chains.chainA, chains.chainB, chains.chainAServiceName, chains.chainBServiceName, bridge, srcChainServiceResponse, dstChainServiceResponse)
} else if (chains.chainAServiceName == "" && chains.chainBServiceName != "") || (chains.chainAServiceName != "" && chains.chainBServiceName == "") {

var chainAServiceResponse string
Expand All @@ -147,50 +154,50 @@ func btpBridgeCmd(diveContext *common.DiveContext) *cobra.Command {

serviceConfig, err := common.ReadServiceJsonFile()
if err != nil {
diveContext.FatalError("Failed To Get Service Data", err.Error())
diveContext.FatalError("failed to get service data", err.Error())
}

if chains.chainAServiceName == "" {

chainBserviceresponse, OK := serviceConfig[chains.chainBServiceName]
if !OK {
diveContext.FatalError("Failed To Get Service Data", fmt.Sprint("service name not found:", chains.chainBServiceName))
diveContext.FatalError("failed to get service data", fmt.Sprint("service name not found:", chains.chainBServiceName))
}
chainBServiceName = chainBserviceresponse.ServiceName

chainBServiceResponse, err = chainBserviceresponse.EncodeToString()

if err != nil {
diveContext.FatalError("Failed To Get Service Data", err.Error())
diveContext.FatalError("failed to get service data", err.Error())
}

response := runChain[chains.chainA](diveContext)
chainAServiceName = response.ServiceName
chainAServiceResponse, err = response.EncodeToString()
if err != nil {
diveContext.FatalError("Failed To Get Service Data", err.Error())
diveContext.FatalError("failed to get service data", err.Error())
}

} else if chains.chainBServiceName == "" {

chainAserviceresponse, OK := serviceConfig[chains.chainAServiceName]
if !OK {
diveContext.FatalError("Failed To Get Service Data", fmt.Sprint("service name not found:", chains.chainAServiceName))
diveContext.FatalError("failed to get service data", fmt.Sprint("service name not found:", chains.chainAServiceName))
}

chainAServiceName = chainAserviceresponse.ServiceName

chainAServiceResponse, err = chainAserviceresponse.EncodeToString()

if err != nil {
diveContext.FatalError("Failed To Get Service Data", err.Error())
diveContext.FatalError("failed to get service data", err.Error())
}

response := runChain[chains.chainB](diveContext)
chainBServiceName = response.ServiceName
chainBServiceResponse, err = response.EncodeToString()
if err != nil {
diveContext.FatalError("Failed To Get Service Data", err.Error())
diveContext.FatalError("failed to get service data", err.Error())

}
}
Expand Down Expand Up @@ -285,7 +292,7 @@ func (chains *Chains) getServicesResponse() (string, string, error) {
if !OK {
return "", "", fmt.Errorf("service name not found")
}
chainBServiceResponse, OK := serviceConfig[chains.chainAServiceName]
chainBServiceResponse, OK := serviceConfig[chains.chainBServiceName]
if !OK {
return "", "", fmt.Errorf("service name not found")
}
Expand Down
2 changes: 1 addition & 1 deletion cli/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package common
var DiveLogs bool

// !!!!!!!!!!! DO NOT UPDATE! WILL BE UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!!
var DiveVersion = "v0.0.5-beta"
var DiveVersion = "v0.0.6-beta"

const (
DiveEnclave = "dive"
Expand Down

0 comments on commit 444cab4

Please sign in to comment.