Skip to content

Commit

Permalink
fix: Hack empty service resource endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hare committed Apr 10, 2024
1 parent a85733a commit 2c61735
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gateway/grpc/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

types "github.com/akash-network/akash-api/go/node/types/v1beta3"

"github.com/akash-network/provider"
pmanifest "github.com/akash-network/provider/manifest"
)
Expand All @@ -24,6 +26,17 @@ func (l *leaseV1) SendManifest(ctx context.Context, r *leasev1.SendManifestReque
m = r.GetManifest()
)

// HACK(andrewhare): Existing manifests expected service resource endpoints
// to be JSON serialized as [] instead of null when determining the manifest
// version hash. This forces Go to do the right thing.
for g := range m {
for s := range m[g].Services {
if len(m[g].Services[s].Resources.Endpoints) == 0 {
m[g].Services[s].Resources.Endpoints = make(types.Endpoints, 0)
}
}
}

err := l.c.Manifest().Submit(ctx, id, m)
if err == nil {
return &leasev1.SendManifestResponse{}, nil
Expand Down

0 comments on commit 2c61735

Please sign in to comment.