Skip to content

Commit

Permalink
Lavavisor staging version switch fix (#789)
Browse files Browse the repository at this point in the history
* version monitor fix

* service file type fix
  • Loading branch information
candostyavuz authored Sep 14, 2023
1 parent 5ab38c9 commit 0ecd13d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ecosystem/lavavisor/cmd/create-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func CreateServiceFile(serviceParams *ServiceParams, createLink bool) (string, e
} else if serviceParams.ServiceType == "provider" {
content += " ExecStart=" + workingDir + "lavap rpcprovider "
}
content += ".lavavisor/services/service_configs/" + filepath.Base(serviceParams.ServiceConfigFile) + " --from " + serviceParams.FromUser + " --keyring-backend " + serviceParams.KeyringBackend + "--parallel-connections" + fmt.Sprint(serviceParams.ParallelConnection) + " --chain-id " + serviceParams.ChainID + " --geolocation " + fmt.Sprint(serviceParams.GeoLocation) + " --log_level " + serviceParams.LogLevel + " --node " + serviceParams.Node + "\n"
content += ".lavavisor/services/service_configs/" + filepath.Base(serviceParams.ServiceConfigFile) + " --from " + serviceParams.FromUser + " --keyring-backend " + serviceParams.KeyringBackend + " --parallel-connections " + fmt.Sprint(serviceParams.ParallelConnection) + " --chain-id " + serviceParams.ChainID + " --geolocation " + fmt.Sprint(serviceParams.GeoLocation) + " --log_level " + serviceParams.LogLevel + " --node " + serviceParams.Node + "\n"

content += " User=ubuntu\n"
content += " Restart=always\n"
Expand Down
9 changes: 6 additions & 3 deletions ecosystem/lavavisor/pkg/process/version_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ func (vm *VersionMonitor) ValidateProtocolVersion(incoming *protocoltypes.Versio
minVersionMismatch := (protocolversion.HasVersionMismatch(incoming.ConsumerMin, binaryVersion) || protocolversion.HasVersionMismatch(incoming.ProviderMin, binaryVersion))
targetVersionMismatch := (protocolversion.HasVersionMismatch(incoming.ConsumerTarget, binaryVersion) || protocolversion.HasVersionMismatch(incoming.ProviderTarget, binaryVersion))

// Take action only if both mismatches are detected
if minVersionMismatch && targetVersionMismatch {
if minVersionMismatch || targetVersionMismatch {
select {
case vm.updateTriggered <- true:
default:
}
vm.mismatchType = lvutil.MinVersionMismatch
if minVersionMismatch {
vm.mismatchType = lvutil.MinVersionMismatch
} else {
vm.mismatchType = lvutil.TargetVersionMismatch
}
vm.lastknownversion = incoming
return utils.LavaFormatError("Version mismatch detected!", nil)
}
Expand Down

0 comments on commit 0ecd13d

Please sign in to comment.