This commit is contained in:
Łukasz Magiera 2020-10-09 01:27:49 +02:00
parent f3dc730b05
commit 6e8efb9d2c
8 changed files with 18 additions and 17 deletions

View File

@ -10,6 +10,7 @@ import (
) )
type MsgType string type MsgType string
const ( const (
MTUnknown = "unknown" MTUnknown = "unknown"

View File

@ -363,14 +363,14 @@ type WorkerStruct struct {
type WalletStruct struct { type WalletStruct struct {
Internal struct { Internal struct {
WalletNew func(context.Context, crypto.SigType) (address.Address, error) `perm:"write"` WalletNew func(context.Context, crypto.SigType) (address.Address, error) `perm:"write"`
WalletHas func(context.Context, address.Address) (bool, error) `perm:"write"` WalletHas func(context.Context, address.Address) (bool, error) `perm:"write"`
WalletList func(context.Context) ([]address.Address, error) `perm:"write"` WalletList func(context.Context) ([]address.Address, error) `perm:"write"`
WalletSign func(context.Context, address.Address, []byte, api.MsgMeta) (*crypto.Signature, error) `perm:"sign"` WalletSign func(context.Context, address.Address, []byte, api.MsgMeta) (*crypto.Signature, error) `perm:"sign"`
WalletSignMessage func(context.Context, address.Address, *types.Message) (*types.SignedMessage, error) `perm:"sign"` WalletSignMessage func(context.Context, address.Address, *types.Message) (*types.SignedMessage, error) `perm:"sign"`
WalletExport func(context.Context, address.Address) (*types.KeyInfo, error) `perm:"admin"` WalletExport func(context.Context, address.Address) (*types.KeyInfo, error) `perm:"admin"`
WalletImport func(context.Context, *types.KeyInfo) (address.Address, error) `perm:"admin"` WalletImport func(context.Context, *types.KeyInfo) (address.Address, error) `perm:"admin"`
WalletDelete func(context.Context, address.Address) error `perm:"write"` WalletDelete func(context.Context, address.Address) error `perm:"write"`
} }
} }

View File

@ -376,7 +376,7 @@ func (cg *ChainGen) nextBlockProof(ctx context.Context, pts *types.TipSet, m add
sf := func(ctx context.Context, a address.Address, i []byte) (*crypto.Signature, error) { sf := func(ctx context.Context, a address.Address, i []byte) (*crypto.Signature, error) {
return cg.w.WalletSign(ctx, a, i, api.MsgMeta{ return cg.w.WalletSign(ctx, a, i, api.MsgMeta{
Type: api.MTUnknown, Type: api.MTUnknown,
}) })
} }
@ -535,7 +535,7 @@ func getRandomMessages(cg *ChainGen) ([]*types.SignedMessage, error) {
} }
sig, err := cg.w.WalletSign(context.TODO(), cg.banker, msg.Cid().Bytes(), api.MsgMeta{ sig, err := cg.w.WalletSign(context.TODO(), cg.banker, msg.Cid().Bytes(), api.MsgMeta{
Type: api.MTUnknown, // testing Type: api.MTUnknown, // testing
}) })
if err != nil { if err != nil {
return nil, err return nil, err
@ -597,7 +597,7 @@ func (mca mca) MinerGetBaseInfo(ctx context.Context, maddr address.Address, epoc
func (mca mca) WalletSign(ctx context.Context, a address.Address, v []byte) (*crypto.Signature, error) { func (mca mca) WalletSign(ctx context.Context, a address.Address, v []byte) (*crypto.Signature, error) {
return mca.w.WalletSign(ctx, a, v, api.MsgMeta{ return mca.w.WalletSign(ctx, a, v, api.MsgMeta{
Type: api.MTUnknown, Type: api.MTUnknown,
}) })
} }

View File

@ -131,7 +131,7 @@ func MinerCreateBlock(ctx context.Context, sm *stmgr.StateManager, w api.WalletA
} }
sig, err := w.WalletSign(ctx, waddr, nosigbytes, api.MsgMeta{ sig, err := w.WalletSign(ctx, waddr, nosigbytes, api.MsgMeta{
Type: api.MTBlock, Type: api.MTBlock,
}) })
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to sign new block: %w", err) return nil, xerrors.Errorf("failed to sign new block: %w", err)

View File

@ -424,7 +424,7 @@ func (c *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Add
} }
sig, err := c.Wallet.WalletSign(ctx, signer, buf, api.MsgMeta{ sig, err := c.Wallet.WalletSign(ctx, signer, buf, api.MsgMeta{
Type: api.MTDealProposal, Type: api.MTDealProposal,
}) })
if err != nil { if err != nil {
return nil, err return nil, err
@ -479,7 +479,7 @@ func (c *ClientNodeAdapter) SignBytes(ctx context.Context, signer address.Addres
} }
localSignature, err := c.Wallet.WalletSign(ctx, signer, b, api.MsgMeta{ localSignature, err := c.Wallet.WalletSign(ctx, signer, b, api.MsgMeta{
Type: api.MTUnknown, // TODO: pass type here Type: api.MTUnknown, // TODO: pass type here
}) })
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -44,7 +44,7 @@ type StateAPI struct {
// TODO: the wallet here is only needed because we have the MinerCreateBlock // TODO: the wallet here is only needed because we have the MinerCreateBlock
// API attached to the state API. It probably should live somewhere better // API attached to the state API. It probably should live somewhere better
Wallet api.WalletAPI Wallet api.WalletAPI
DefWallet wallet.Default DefWallet wallet.Default
ProofVerifier ffiwrapper.Verifier ProofVerifier ffiwrapper.Verifier