From ae67cbdb4d0dc6be66cc3f566c336bfba05f25a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 4 Dec 2023 14:10:24 +0100 Subject: [PATCH] lotus-provider: fix RPC construction --- api/permissioned.go | 4 ++-- cmd/lotus-provider/rpc/rpc.go | 4 ++-- metrics/proxy/proxy.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/permissioned.go b/api/permissioned.go index 30fd6b75c..cef5a5478 100644 --- a/api/permissioned.go +++ b/api/permissioned.go @@ -41,8 +41,8 @@ func PermissionedWorkerAPI(a Worker) Worker { return &out } -func PermissionedAPI[T any](a T) T { - var out T +func PermissionedAPI[T, P any](a T) P { + var out P permissionedProxies(a, &out) return out } diff --git a/cmd/lotus-provider/rpc/rpc.go b/cmd/lotus-provider/rpc/rpc.go index e44c6724f..3ae3e2a1f 100644 --- a/cmd/lotus-provider/rpc/rpc.go +++ b/cmd/lotus-provider/rpc/rpc.go @@ -26,9 +26,9 @@ func LotusProviderHandler( readerHandler, readerServerOpt := rpcenc.ReaderParamDecoder() rpcServer := jsonrpc.NewServer(jsonrpc.WithServerErrors(api.RPCErrors), readerServerOpt) - wapi := proxy.MetricedAPI(a) + wapi := proxy.MetricedAPI[api.LotusProvider, api.LotusProviderStruct](a) if permissioned { - wapi = api.PermissionedAPI(wapi) + wapi = api.PermissionedAPI[api.LotusProvider, api.LotusProviderStruct](wapi) } rpcServer.Register("Filecoin", wapi) diff --git a/metrics/proxy/proxy.go b/metrics/proxy/proxy.go index 770cf679c..ada1a3352 100644 --- a/metrics/proxy/proxy.go +++ b/metrics/proxy/proxy.go @@ -10,8 +10,8 @@ import ( "github.com/filecoin-project/lotus/metrics" ) -func MetricedAPI[T any](a T) T { - var out T +func MetricedAPI[T, P any](a T) P { + var out P proxy(a, &out) return out }