Skip to content

Commit 37245a2

Browse files
committed
allow verifreg commands in lotus-shed to be run against a gateway
They still expect a 'full node api', but are in practice used with a gateway. Changes to the primary gateway to restrict available methods mean that it's preferable to have only the methods available on the gateay in use for these commands
1 parent 168e48d commit 37245a2

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

cmd/lotus-shed/verifreg.go

+28-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,20 @@ var verifRegAddVerifierFromMsigCmd = &cli.Command{
8080
api := srv.FullNodeAPI()
8181
ctx := lcli.ReqContext(cctx)
8282

83-
vrk, err := api.StateVerifiedRegistryRootKey(ctx, types.EmptyTSK)
83+
vact, err := api.StateGetActor(ctx, verifreg.Address, types.EmptyTSK)
84+
if err != nil {
85+
return err
86+
}
87+
88+
apibs := blockstore.NewAPIBlockstore(api)
89+
store := adt.WrapStore(ctx, cbor.NewCborStore(apibs))
90+
91+
vst, err := verifreg.Load(store, vact)
92+
if err != nil {
93+
return err
94+
}
95+
96+
vrk, err := vst.RootKey()
8497
if err != nil {
8598
return err
8699
}
@@ -460,18 +473,28 @@ var verifRegRemoveVerifiedClientDataCapCmd = &cli.Command{
460473
return err
461474
}
462475

463-
vrk, err := api.StateVerifiedRegistryRootKey(ctx, types.EmptyTSK)
476+
vact, err := api.StateGetActor(ctx, verifreg.Address, types.EmptyTSK)
464477
if err != nil {
465478
return err
466479
}
467480

468-
vrkState, err := api.StateGetActor(ctx, vrk, types.EmptyTSK)
481+
apibs := blockstore.NewAPIBlockstore(api)
482+
store := adt.WrapStore(ctx, cbor.NewCborStore(apibs))
483+
484+
vst, err := verifreg.Load(store, vact)
469485
if err != nil {
470486
return err
471487
}
472488

473-
apibs := blockstore.NewAPIBlockstore(api)
474-
store := adt.WrapStore(ctx, cbor.NewCborStore(apibs))
489+
vrk, err := vst.RootKey()
490+
if err != nil {
491+
return err
492+
}
493+
494+
vrkState, err := api.StateGetActor(ctx, vrk, types.EmptyTSK)
495+
if err != nil {
496+
return err
497+
}
475498

476499
st, err := multisig.Load(store, vrkState)
477500
if err != nil {

0 commit comments

Comments
 (0)