From ebfa294049ec51fb777071788b0bc066abe093c3 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Thu, 11 May 2023 15:11:47 +0800 Subject: [PATCH] chore: upgrade venus and venus-auth --- api/messager_impl.go | 5 ++--- api/modules.go | 3 ++- go.mod | 4 ++-- go.sum | 9 ++++----- service/address_service.go | 3 ++- service/message_service.go | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/api/messager_impl.go b/api/messager_impl.go index e23beac6..e972b5a7 100644 --- a/api/messager_impl.go +++ b/api/messager_impl.go @@ -11,7 +11,6 @@ import ( "go.uber.org/fx" "github.com/filecoin-project/go-address" - "github.com/filecoin-project/go-jsonrpc/auth" "github.com/filecoin-project/venus-messager/publisher/pubsub" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" "github.com/filecoin-project/venus/venus-shared/api/messager" @@ -428,13 +427,13 @@ func (m *MessageImp) LogList(ctx context.Context) ([]string, error) { // isAdmin check if the user is admin and return signers of the user func isAdmin(ctx context.Context) bool { - return auth.HasPerm(ctx, nil, core.PermAdmin) + return core.HasPerm(ctx, nil, core.PermAdmin) } func getSigners(ctx context.Context, client jwtclient.IAuthClient) ([]address.Address, error) { signers := []address.Address{} - user, exit := jwtclient.CtxGetName(ctx) + user, exit := core.CtxGetName(ctx) if !exit { return nil, fmt.Errorf("user not found") } diff --git a/api/modules.go b/api/modules.go index 773d86ab..98d00133 100644 --- a/api/modules.go +++ b/api/modules.go @@ -8,6 +8,7 @@ import ( "github.com/etherlabsio/healthcheck/v2" "github.com/filecoin-project/go-jsonrpc" + "github.com/filecoin-project/venus-auth/core" "github.com/filecoin-project/venus-auth/jwtclient" "github.com/filecoin-project/venus/venus-shared/api/messager" "github.com/filecoin-project/venus/venus-shared/api/permission" @@ -28,7 +29,7 @@ func BindRateLimit(msgImp *MessageImp, remoteAuthCli jwtclient.IAuthClient, rate limiter, err := ratelimit.NewRateLimitHandler( rateLimitCfg.Redis, nil, - &jwtclient.ValueFromCtx{}, + &core.ValueFromCtx{}, jwtclient.WarpLimitFinder(remoteAuthCli), logging.Logger("rate-limit"), ) diff --git a/go.mod b/go.mod index 8305af7e..cef590c5 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( github.com/filecoin-project/go-jsonrpc v0.1.5 github.com/filecoin-project/go-state-types v0.11.1 github.com/filecoin-project/specs-actors/v5 v5.0.6 - github.com/filecoin-project/venus v1.11.0 - github.com/filecoin-project/venus-auth v1.11.0 + github.com/filecoin-project/venus v1.11.2-0.20230511060025-c6ed196f613c + github.com/filecoin-project/venus-auth v1.11.1-0.20230511013901-7829b3effbcd github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/hunjixin/automapper v0.0.0-20191127090318-9b979ce72ce2 diff --git a/go.sum b/go.sum index 71aee318..2b345c61 100644 --- a/go.sum +++ b/go.sum @@ -421,11 +421,11 @@ github.com/filecoin-project/specs-storage v0.2.2/go.mod h1:6cc/lncmAxMUocPi0z1EP github.com/filecoin-project/storetheindex v0.3.5/go.mod h1:0r3d0kSpK63O6AvLr1CjAINLi+nWD49clzcnKV+GLpI= github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E= github.com/filecoin-project/venus v1.2.4/go.mod h1:hJULXHGAnWuq5S5KRtPkwbT8DqgM9II7NwyNU7t59D0= -github.com/filecoin-project/venus v1.11.0 h1:cH7ydd+O2dw7zg8tKfeiuwVd5SokZ8TBu+WoBU60pAA= -github.com/filecoin-project/venus v1.11.0/go.mod h1:H8A3djsrHKRWuKnJI/8Y6xZRudbV9V2x5NIP8/PVPfQ= +github.com/filecoin-project/venus v1.11.2-0.20230511060025-c6ed196f613c h1:f8ZwGwjnGTa4mlH8x7yqKTdw+AIcHMUd6hO2AtwRokQ= +github.com/filecoin-project/venus v1.11.2-0.20230511060025-c6ed196f613c/go.mod h1:DA73O3dB54B9dxxxQncq0ZGy5f+zwY+hRMgnaiHdhrk= github.com/filecoin-project/venus-auth v1.3.2/go.mod h1:m5Jog2GYxztwP7w3m/iJdv/V1/bTcAVU9rm/CbhxRQU= -github.com/filecoin-project/venus-auth v1.11.0 h1:9PBswWxc113vqaHABMcRyMm+1BtlJCwOFTPQJg/OVtQ= -github.com/filecoin-project/venus-auth v1.11.0/go.mod h1:aBfIfNxQkdcY8Rk5wrQn9qRtJpH4RTDdc10Ac+ferzs= +github.com/filecoin-project/venus-auth v1.11.1-0.20230511013901-7829b3effbcd h1:l02UJuEbSUIBi3NC/+17K2gBbAzsUNQg42rNCXskOBc= +github.com/filecoin-project/venus-auth v1.11.1-0.20230511013901-7829b3effbcd/go.mod h1:PoTmfEn5lljjAQThBzX0+friJYGgi7Z3VLLujkOkCT4= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= @@ -2840,7 +2840,6 @@ gorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.21.9/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= gorm.io/gorm v1.21.12 h1:3fQM0Eiz7jcJEhPggHEpoYnsGZqynMzverL77DV40RM= gorm.io/gorm v1.21.12/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/service/address_service.go b/service/address_service.go index 45bf3ec6..8b3cd590 100644 --- a/service/address_service.go +++ b/service/address_service.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/venus-auth/core" "github.com/filecoin-project/venus-auth/jwtclient" gatewayAPI "github.com/filecoin-project/venus/venus-shared/api/gateway/v2" @@ -92,7 +93,7 @@ func (addressService *AddressService) WalletHas(ctx context.Context, addr addres } bExist := false - name, _ := jwtclient.CtxGetName(ctx) + name, _ := core.CtxGetName(ctx) for _, account := range accounts { if name == account { bExist = true diff --git a/service/message_service.go b/service/message_service.go index abdfafa9..6820acb5 100644 --- a/service/message_service.go +++ b/service/message_service.go @@ -17,7 +17,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/venus-auth/jwtclient" + "github.com/filecoin-project/venus-auth/core" "github.com/filecoin-project/venus/pkg/constants" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" @@ -232,7 +232,7 @@ func (ms *MessageService) PushMessage(ctx context.Context, msg *venusTypes.Messa } func (ms *MessageService) PushMessageWithId(ctx context.Context, id string, msg *venusTypes.Message, meta *types.SendSpec) (string, error) { - account, _ := jwtclient.CtxGetName(ctx) + account, _ := core.CtxGetName(ctx) if err := ms.pushMessage(ctx, &types.Message{ ID: id, Message: *msg,