Skip to content

Commit

Permalink
Merge pull request #345 from filecoin-project/chore/update-auth
Browse files Browse the repository at this point in the history
chore: upgrade venus and venus-auth
  • Loading branch information
hunjixin authored May 12, 2023
2 parents 5cccab6 + ebfa294 commit d3d736d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
5 changes: 2 additions & 3 deletions api/messager_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
}
Expand Down
3 changes: 2 additions & 1 deletion api/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"),
)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
3 changes: 2 additions & 1 deletion service/address_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions service/message_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d3d736d

Please sign in to comment.