Documentation
¶
Index ¶
- Constants
- Variables
- func CheckMsgEnum(me MsgEnum) error
- func ContainMsgType(multiME MsgEnum, mt MsgType) bool
- func ContextStrategyToken(ctx context.Context) string
- func FindCode(enum MsgEnum) []int
- func GetMethodName(actCode Cid, method MethodNum) (string, error)
- func GetSignBytes(toSign []byte, meta MsgMeta) (interface{}, []byte, error)
- func MsgEnumCode(me MsgEnum) int
- func RegistSupportedMsgTypes(msgType MsgType, p reflect.Type, fGetSignBytes FGetSignBytes, ...) (replaced bool)
- type Address
- type AddressScope
- type BeaconEntry
- type Block
- type Cid
- type ContextKey
- type DrawRandomParams
- type ElectionProof
- type EmptyValue
- type FGetSignBytes
- type FParseObj
- type KeyInfo
- type KeyType
- type Message
- type MethodMeta
- type MethodName
- type MethodNum
- type MsgEnum
- type MsgMeta
- type MsgType
- type SigType
- type Signature
- type SignedMessage
- type StrategyLevel
- type Ticket
- type TipSetKey
- type TokenAmount
- type Types
- type VRFPi
Constants ¶
View Source
const ( MethodSend = builtin.MethodSend MethodConstructor = builtin.MethodConstructor )
View Source
const ( MTUnknown = MsgType("unknown") // Signing message CID. MsgMeta.Extra contains raw cbor message bytes MTChainMsg = MsgType("message") // Signing a blockheader. signing raw cbor block bytes (MsgMeta.Extra is empty) MTBlock = MsgType("block") // Signing a deal proposal. signing raw cbor proposal bytes (MsgMeta.Extra is empty) MTDealProposal = MsgType("dealproposal") // extra is nil, 'toSign' is cbor raw bytes of 'DrawRandomParams' // following types follow above rule MTDrawRandomParam = MsgType("drawrandomparam") MTSignedVoucher = MsgType("signedvoucher") MTStorageAsk = MsgType("storageask") MTAskResponse = MsgType("askresponse") MTNetWorkResponse = MsgType("networkresposne") // reference : storagemarket/impl/remotecli.go:330 // sign storagemarket.ClientDeal.ProposalCid, // MsgMeta.Extra is nil, 'toSign' is market.ClientDealProposal // storagemarket.ClientDeal.ProposalCid equals cborutil.AsIpld(market.ClientDealProposal).Cid() MTClientDeal = MsgType("clientdeal") MTProviderDealState = MsgType("providerdealstate") )
View Source
const ( SigTypeUnknown = SigType(math.MaxUint8) SigTypeSecp256k1 = SigType(iota) SigTypeBLS )
View Source
const BLAKE2B_MIN = 0xb201
View Source
const DefaultHashFunction = uint64(BLAKE2B_MIN + 31)
The multihash function identifier to use for content addresses.
View Source
const MessageVersion = 0
View Source
const StringEmpty = ""
Variables ¶
View Source
var DefaultCidBuilder = cid.V1Builder{Codec: cid.DagCBOR, MhType: DefaultHashFunction}
A builder for all blockchain CIDs. Note that sector commitments use a different scheme.
View Source
var (
ErrCodeOverflow = errors.New("code over flow")
)
View Source
var MaxMsgEnumCode = len(MsgEnumPool) - 1
View Source
var MethodNameList []MethodName
View Source
var MethodNamesMap = make(map[string]struct{})
View Source
var MethodsMap = map[Cid]map[MethodNum]MethodMeta{}
View Source
var MsgEnumPool = []struct { Code int Name string }{ {Code: MsgEnumCode(MEUnknown), Name: "unknown"}, {Code: MsgEnumCode(MEChainMsg), Name: "chainMsg"}, {Code: MsgEnumCode(MEBlock), Name: "block"}, {Code: MsgEnumCode(MEDealProposal), Name: "dealProposal"}, {Code: MsgEnumCode(MEDrawRandomParam), Name: "drawRandomParam"}, {Code: MsgEnumCode(MESignedVoucher), Name: "signedVoucher"}, {Code: MsgEnumCode(MEStorageAsk), Name: "storageAsk"}, {Code: MsgEnumCode(MEAskResponse), Name: "askResponse"}, {Code: MsgEnumCode(MENetWorkResponse), Name: "netWorkResponse"}, {Code: MsgEnumCode(MEProviderDealState), Name: "providerDealState"}, {Code: MsgEnumCode(MEClientDeal), Name: "clientDeal"}, }
View Source
var (
NilAddress = Address{}
)
View Source
var SupportedMsgTypes = map[MsgType]*Types{ MTDealProposal: {reflect.TypeOf(market.DealProposal{}), func(i interface{}) ([]byte, error) { return cborutil.Dump(i) }, nil}, MTClientDeal: {reflect.TypeOf(market.ClientDealProposal{}), func(in interface{}) ([]byte, error) { ni, err := cborutil.AsIpld(in) if err != nil { return nil, err } return ni.Cid().Bytes(), nil }, nil}, MTDrawRandomParam: {reflect.TypeOf(DrawRandomParams{}), func(in interface{}) ([]byte, error) { param := in.(*DrawRandomParams) return param.SignBytes() }, nil}, MTSignedVoucher: {reflect.TypeOf(paych.SignedVoucher{}), func(in interface{}) ([]byte, error) { return (in.(*paych.SignedVoucher)).SigningBytes() }, nil}, MTStorageAsk: {reflect.TypeOf(storagemarket.StorageAsk{}), func(in interface{}) ([]byte, error) { return cborutil.Dump(in) }, nil}, MTAskResponse: {Type: reflect.TypeOf(network.AskResponse{}), /* contains filtered or unexported fields */}, MTNetWorkResponse: {reflect.TypeOf(network.Response{}), func(in interface{}) ([]byte, error) { return cborutil.Dump(in) }, nil}, MTBlock: {reflect.TypeOf(Block{}), func(in interface{}) ([]byte, error) { return in.(*Block).SignatureData(), nil }, nil}, MTChainMsg: {reflect.TypeOf(Message{}), func(in interface{}) ([]byte, error) { msg := in.(*Message) return msg.Cid().Bytes(), nil }, nil}, MTProviderDealState: {reflect.TypeOf(storagemarket.ProviderDealState{}), func(in interface{}) ([]byte, error) { return cborutil.Dump(in) }, nil, }, MTUnknown: {reflect.TypeOf([]byte{}), func(in interface{}) ([]byte, error) { msg, isok := in.([]byte) if !isok { return nil, fmt.Errorf("MTUnkown must be []byte") } return msg, nil }, func(in []byte, meta MsgMeta) (interface{}, error) { if meta.Type == MTUnknown { return in, nil } return nil, fmt.Errorf("un-expected MsgType:%s", meta.Type) }}, }
signature type factory
Functions ¶
func CheckMsgEnum ¶
func ContainMsgType ¶
func ContextStrategyToken ¶
func GetSignBytes ¶
Matches the type and returns the data that needs to be signed
func MsgEnumCode ¶
func RegistSupportedMsgTypes ¶
Types ¶
type AddressScope ¶
type BeaconEntry ¶
func (*BeaconEntry) MarshalCBOR ¶
func (t *BeaconEntry) MarshalCBOR(w io.Writer) error
func (*BeaconEntry) UnmarshalCBOR ¶
func (t *BeaconEntry) UnmarshalCBOR(r io.Reader) error
type Block ¶
type Block struct { // Miner is the address of the miner actor that mined this block. Miner Address `json:"miner"` // Ticket is the ticket submitted with this block. Ticket Ticket `json:"ticket"` // ElectionProof is the vrf proof giving this block's miner authoring rights ElectionProof *ElectionProof `json:"electionProof"` // BeaconEntries contain the verifiable oracle randomness used to elect // this block's author leader BeaconEntries []*BeaconEntry `json:"beaconEntries"` // WinPoStProof are the winning post proofs WinPoStProof []proof2.PoStProof `json:"winPoStProof"` // Parents is the set of parents this block was based on. Typically one, // but can be several in the case where there were multiple winning ticket- // holders for an epoch. Parents TipSetKey `json:"parents"` // ParentWeight is the aggregate chain weight of the parent set. ParentWeight fbig.Int `json:"parentWeight"` // Height is the chain height of this block. Height abi.ChainEpoch `json:"height"` // ParentStateRoot is the CID of the root of the state tree after application of the messages in the parent tipset // to the parent tipset's state root. ParentStateRoot Cid `json:"parentStateRoot,omitempty"` // ParentMessageReceipts is a list of receipts corresponding to the application of the messages in the parent tipset // to the parent tipset's state root (corresponding to this block's ParentStateRoot). ParentMessageReceipts Cid `json:"parentMessageReceipts,omitempty"` // Messages is the set of messages included in this block Messages Cid `json:"messages,omitempty"` // The aggregate signature of all BLS signed messages in the block BLSAggregate *Signature `json:"BLSAggregate"` // The timestamp, in seconds since the Unix epoch, at which this block was created. Timestamp uint64 `json:"timestamp"` // The signature of the miner's worker key over the block BlockSig *Signature `json:"blocksig"` // ForkSignaling is extra data used by miners to communicate ForkSignaling uint64 `json:"forkSignaling"` ParentBaseFee TokenAmount `json:"parentBaseFee"` }
Block is a block in the blockchain.
func (*Block) SignatureData ¶
type ContextKey ¶
type ContextKey string
const CtxKeyStrategy ContextKey = "strategy"
ctx key of strategy token
type DrawRandomParams ¶
type DrawRandomParams struct { Rbase []byte Pers crypto.DomainSeparationTag Round abi.ChainEpoch Entropy []byte }
func (*DrawRandomParams) MarshalCBOR ¶
func (dr *DrawRandomParams) MarshalCBOR(w io.Writer) error
func (*DrawRandomParams) SignBytes ¶
func (dr *DrawRandomParams) SignBytes() ([]byte, error)
return store.DrawRandomness(dr.Rbase, dr.Pers, dr.Round, dr.Entropy)
func (*DrawRandomParams) UnmarshalCBOR ¶
func (dr *DrawRandomParams) UnmarshalCBOR(r io.Reader) error
type ElectionProof ¶
type ElectionProof struct { WinCount int64 // A proof output by running a VRF on the VRFProof of the parent ticket VRFProof VRFPi }
func (*ElectionProof) MarshalCBOR ¶
func (t *ElectionProof) MarshalCBOR(w io.Writer) error
func (*ElectionProof) UnmarshalCBOR ¶
func (t *ElectionProof) UnmarshalCBOR(r io.Reader) error
type EmptyValue ¶
type EmptyValue struct{}
type FGetSignBytes ¶
type KeyType ¶
type KeyType string
KeyType defines a type of a key
func SignType2Key ¶
func (*KeyType) UnmarshalJSON ¶
type Message ¶
type Message struct { Version uint64 To Address From Address Nonce uint64 Value TokenAmount GasLimit int64 GasFeeCap TokenAmount GasPremium TokenAmount Method MethodNum Params []byte }
filecoin message
func DecodeMessage ¶
type MethodName ¶
type MethodName = string
func AggregateMethodNames ¶
func AggregateMethodNames(methods []MethodName) ([]MethodName, error)
type SigType ¶
func KeyType2Sign ¶
type SignedMessage ¶
func (*SignedMessage) MarshalCBOR ¶
func (t *SignedMessage) MarshalCBOR(w io.Writer) error
func (*SignedMessage) UnmarshalCBOR ¶
func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error
type StrategyLevel ¶
type StrategyLevel = uint8
const ( // default level, no strategy SLDisable StrategyLevel = iota // level 1, check struct type SLMetaType // level 2, check struct type and method in msg SLMethod )
var WalletStrategyLevel StrategyLevel
wallet strategy level, it will be initialized from config at startup
type Ticket ¶
type Ticket struct { // A proof output by running a VRF on the VRFProof of the parent ticket VRFProof VRFPi }
type TipSetKey ¶
type TipSetKey struct {
// contains filtered or unexported fields
}
type TokenAmount ¶
type TokenAmount = abi.TokenAmount
Click to show internal directories.
Click to hide internal directories.