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
const (
MTUnknown = "unknown"

View File

@ -363,14 +363,14 @@ type WorkerStruct struct {
type WalletStruct struct {
Internal struct {
WalletNew func(context.Context, crypto.SigType) (address.Address, error) `perm:"write"`
WalletHas func(context.Context, address.Address) (bool, 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"`
WalletSignMessage func(context.Context, address.Address, *types.Message) (*types.SignedMessage, error) `perm:"sign"`
WalletExport func(context.Context, address.Address) (*types.KeyInfo, error) `perm:"admin"`
WalletImport func(context.Context, *types.KeyInfo) (address.Address, error) `perm:"admin"`
WalletDelete func(context.Context, 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"`
WalletList func(context.Context) ([]address.Address, error) `perm:"write"`
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"`
WalletExport func(context.Context, address.Address) (*types.KeyInfo, error) `perm:"admin"`
WalletImport func(context.Context, *types.KeyInfo) (address.Address, error) `perm:"admin"`
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) {
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{
Type: api.MTUnknown, // testing
Type: api.MTUnknown, // testing
})
if err != nil {
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) {
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{
Type: api.MTBlock,
Type: api.MTBlock,
})
if err != nil {
return nil, xerrors.Errorf("failed to sign new block: %w", err)

View File

@ -48,4 +48,4 @@ func SetupRemoteWallet(url string) func(mctx helpers.MetricsCtx, lc fx.Lifecycle
return &RemoteWallet{wapi}, nil
}
}
}

View File

@ -59,4 +59,4 @@ func (c *LoggedWallet) WalletDelete(ctx context.Context, addr address.Address) e
log.Infow("WalletDelete", "address", addr)
return c.under.WalletDelete(ctx, addr)
}
}

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{
Type: api.MTDealProposal,
Type: api.MTDealProposal,
})
if err != nil {
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{
Type: api.MTUnknown, // TODO: pass type here
Type: api.MTUnknown, // TODO: pass type here
})
if err != nil {
return nil, err

View File

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