From 2c61735c3d0eee58700fe508c98ff5c3494c1e26 Mon Sep 17 00:00:00 2001 From: Andrew Hare Date: Wed, 10 Apr 2024 13:13:22 -0600 Subject: [PATCH] fix: Hack empty service resource endpoints --- gateway/grpc/lease.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gateway/grpc/lease.go b/gateway/grpc/lease.go index 78a2bcb4..329f514e 100644 --- a/gateway/grpc/lease.go +++ b/gateway/grpc/lease.go @@ -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" ) @@ -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