...

Package endorser

import "github.com/hyperledger/fabric/core/endorser"
Overview
Index
Subdirectories

Overview ▾

Index ▾

type ChannelState
    func (cs *ChannelState) FetchState() (endorsement.State, error)
type ChannelStateRetriever
type CollectionConfigRetriever
type Context
    func (c Context) String() string
type Endorser
    func NewEndorserServer(privDist privateDataDistributor, s Support, pr *platforms.Registry, metricsProv metrics.Provider) *Endorser
    func (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedProposal) (*pb.ProposalResponse, error)
    func (e *Endorser) SanitizeUserCDS(userCDS *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)
    func (e *Endorser) SimulateProposal(txParams *ccprovider.TransactionParams, cid *pb.ChaincodeID) (ccprovider.ChaincodeDefinition, *pb.Response, []byte, *pb.ChaincodeEvent, error)
type EndorserMetrics
    func NewEndorserMetrics(p metrics.Provider) *EndorserMetrics
type MapBasedPluginMapper
    func (m MapBasedPluginMapper) PluginFactoryByName(name PluginName) endorsement.PluginFactory
type PluginEndorser
    func NewPluginEndorser(ps *PluginSupport) *PluginEndorser
    func (pe *PluginEndorser) EndorseWithPlugin(ctx Context) (*pb.ProposalResponse, error)
type PluginMapper
type PluginName
type PluginSupport
type PvtRWSetAssembler
type QueryCreator
type StateContext
    func (sc *StateContext) GetTransientByTXID(txID string) ([]*rwset.TxPvtReadWriteSet, error)
type Support
type SupportImpl
    func (s *SupportImpl) CheckACL(signedProp *pb.SignedProposal, chdr *common.ChannelHeader, shdr *common.SignatureHeader, hdrext *pb.ChaincodeHeaderExtension) error
    func (s *SupportImpl) CheckInstantiationPolicy(name, version string, cd ccprovider.ChaincodeDefinition) error
    func (s *SupportImpl) Execute(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, input *pb.ChaincodeInput) (*pb.Response, *pb.ChaincodeEvent, error)
    func (s *SupportImpl) ExecuteLegacyInit(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, cds *pb.ChaincodeDeploymentSpec) (*pb.Response, *pb.ChaincodeEvent, error)
    func (s *SupportImpl) GetApplicationConfig(cid string) (channelconfig.Application, bool)
    func (s *SupportImpl) GetChaincodeDefinition(chaincodeName string, txsim ledger.QueryExecutor) (ccprovider.ChaincodeDefinition, error)
    func (s *SupportImpl) GetChaincodeDeploymentSpecFS(cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)
    func (s *SupportImpl) GetHistoryQueryExecutor(ledgername string) (ledger.HistoryQueryExecutor, error)
    func (s *SupportImpl) GetLedgerHeight(channelID string) (uint64, error)
    func (s *SupportImpl) GetTransactionByID(chid, txID string) (*pb.ProcessedTransaction, error)
    func (s *SupportImpl) GetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error)
    func (s *SupportImpl) IsJavaCC(buf []byte) (bool, error)
    func (s *SupportImpl) IsSysCC(name string) bool
    func (s *SupportImpl) IsSysCCAndNotInvokableExternal(name string) bool
    func (s *SupportImpl) NewQueryCreator(channel string) (QueryCreator, error)
    func (s *SupportImpl) SigningIdentityForRequest(*pb.SignedProposal) (SigningIdentity, error)
type TransientStoreRetriever

Package files

endorser.go metrics.go plugin_endorser.go pvtrwset_assembler.go state.go support.go

type ChannelState

ChannelState defines state operations

type ChannelState struct {
    transientstore.Store
    QueryCreator
}

func (*ChannelState) FetchState

func (cs *ChannelState) FetchState() (endorsement.State, error)

FetchState fetches state

type ChannelStateRetriever

ChannelStateRetriever retrieves Channel state

type ChannelStateRetriever interface {
    // NewQueryCreator returns a QueryCreator for the given Channel
    NewQueryCreator(channel string) (QueryCreator, error)
}

type CollectionConfigRetriever

CollectionConfigRetriever encapsulates sub-functionality of ledger.TxSimulator to abstract minimum required functions set

type CollectionConfigRetriever interface {
    // GetState gets the value for given namespace and key. For a chaincode, the namespace corresponds to the chaincodeId
    GetState(namespace string, key string) ([]byte, error)
}

type Context

Context defines the data that is related to an in-flight endorsement

type Context struct {
    PluginName     string
    Channel        string
    TxID           string
    Proposal       *pb.Proposal
    SignedProposal *pb.SignedProposal
    Visibility     []byte
    Response       *pb.Response
    Event          []byte
    ChaincodeID    *pb.ChaincodeID
    SimRes         []byte
}

func (Context) String

func (c Context) String() string

String returns a text representation of this context

type Endorser

Endorser provides the Endorser service ProcessProposal

type Endorser struct {
    PlatformRegistry *platforms.Registry
    PvtRWSetAssembler
    Metrics *EndorserMetrics
    // contains filtered or unexported fields
}

func NewEndorserServer

func NewEndorserServer(privDist privateDataDistributor, s Support, pr *platforms.Registry, metricsProv metrics.Provider) *Endorser

NewEndorserServer creates and returns a new Endorser server instance.

func (*Endorser) ProcessProposal

func (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedProposal) (*pb.ProposalResponse, error)

ProcessProposal process the Proposal

func (*Endorser) SanitizeUserCDS

func (e *Endorser) SanitizeUserCDS(userCDS *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)

func (*Endorser) SimulateProposal

func (e *Endorser) SimulateProposal(txParams *ccprovider.TransactionParams, cid *pb.ChaincodeID) (ccprovider.ChaincodeDefinition, *pb.Response, []byte, *pb.ChaincodeEvent, error)

SimulateProposal simulates the proposal by calling the chaincode

type EndorserMetrics

type EndorserMetrics struct {
    ProposalDuration         metrics.Histogram
    ProposalsReceived        metrics.Counter
    SuccessfulProposals      metrics.Counter
    ProposalValidationFailed metrics.Counter
    ProposalACLCheckFailed   metrics.Counter
    InitFailed               metrics.Counter
    EndorsementsFailed       metrics.Counter
    DuplicateTxsFailure      metrics.Counter
}

func NewEndorserMetrics

func NewEndorserMetrics(p metrics.Provider) *EndorserMetrics

type MapBasedPluginMapper

MapBasedPluginMapper maps plugin names to their corresponding factories

type MapBasedPluginMapper map[string]endorsement.PluginFactory

func (MapBasedPluginMapper) PluginFactoryByName

func (m MapBasedPluginMapper) PluginFactoryByName(name PluginName) endorsement.PluginFactory

PluginFactoryByName returns a plugin factory for the given plugin name, or nil if not found

type PluginEndorser

PluginEndorser endorsers proposal responses using plugins

type PluginEndorser struct {
    sync.Mutex
    PluginMapper

    ChannelStateRetriever
    endorsement3.SigningIdentityFetcher
    TransientStoreRetriever
    // contains filtered or unexported fields
}

func NewPluginEndorser

func NewPluginEndorser(ps *PluginSupport) *PluginEndorser

NewPluginEndorser endorses with using a plugin

func (*PluginEndorser) EndorseWithPlugin

func (pe *PluginEndorser) EndorseWithPlugin(ctx Context) (*pb.ProposalResponse, error)

EndorseWithPlugin endorses the response with a plugin

type PluginMapper

PluginMapper maps plugin names to their corresponding factories

type PluginMapper interface {
    PluginFactoryByName(name PluginName) endorsement.PluginFactory
}

type PluginName

PluginName defines the name of the plugin as it appears in the configuration

type PluginName string

type PluginSupport

PluginSupport aggregates the support interfaces needed for the operation of the plugin endorser

type PluginSupport struct {
    ChannelStateRetriever
    endorsement3.SigningIdentityFetcher
    PluginMapper
    TransientStoreRetriever
}

type PvtRWSetAssembler

PvtRWSetAssembler assembles private read write set for distribution augments with additional information if needed

type PvtRWSetAssembler interface {
    // AssemblePvtRWSet prepares TxPvtReadWriteSet for distribution
    // augmenting it into TxPvtReadWriteSetWithConfigInfo adding
    // information about collections config available related
    // to private read-write set
    AssemblePvtRWSet(privData *rwset.TxPvtReadWriteSet, txsim CollectionConfigRetriever) (*transientstore.TxPvtReadWriteSetWithConfigInfo, error)
}

type QueryCreator

go:generate mockery -dir . -name QueryCreator -case underscore -output mocks/ QueryCreator creates new QueryExecutors

type QueryCreator interface {
    NewQueryExecutor() (ledger.QueryExecutor, error)
}

type StateContext

StateContext defines an execution context that interacts with the state

type StateContext struct {
    transientstore.Store
    ledger.QueryExecutor
}

func (*StateContext) GetTransientByTXID

func (sc *StateContext) GetTransientByTXID(txID string) ([]*rwset.TxPvtReadWriteSet, error)

GetTransientByTXID returns the private data associated with this transaction ID.

type Support

Support contains functions that the endorser requires to execute its tasks

type Support interface {
    crypto.SignerSupport
    // IsSysCCAndNotInvokableExternal returns true if the supplied chaincode is
    // a system chaincode and it NOT invokable
    IsSysCCAndNotInvokableExternal(name string) bool

    // GetTxSimulator returns the transaction simulator for the specified ledger
    // a client may obtain more than one such simulator; they are made unique
    // by way of the supplied txid
    GetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error)

    // GetHistoryQueryExecutor gives handle to a history query executor for the
    // specified ledger
    GetHistoryQueryExecutor(ledgername string) (ledger.HistoryQueryExecutor, error)

    // GetTransactionByID retrieves a transaction by id
    GetTransactionByID(chid, txID string) (*pb.ProcessedTransaction, error)

    // IsSysCC returns true if the name matches a system chaincode's
    // system chaincode names are system, chain wide
    IsSysCC(name string) bool

    // Execute - execute proposal, return original response of chaincode
    Execute(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, input *pb.ChaincodeInput) (*pb.Response, *pb.ChaincodeEvent, error)

    // ExecuteLegacyInit - executes a deployment proposal, return original response of chaincode
    ExecuteLegacyInit(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, spec *pb.ChaincodeDeploymentSpec) (*pb.Response, *pb.ChaincodeEvent, error)

    // GetChaincodeDefinition returns ccprovider.ChaincodeDefinition for the chaincode with the supplied name
    GetChaincodeDefinition(chaincodeID string, txsim ledger.QueryExecutor) (ccprovider.ChaincodeDefinition, error)

    // CheckACL checks the ACL for the resource for the channel using the
    // SignedProposal from which an id can be extracted for testing against a policy
    CheckACL(signedProp *pb.SignedProposal, chdr *common.ChannelHeader, shdr *common.SignatureHeader, hdrext *pb.ChaincodeHeaderExtension) error

    // IsJavaCC returns true if the CDS package bytes describe a chaincode
    // that requires the java runtime environment to execute
    IsJavaCC(buf []byte) (bool, error)

    // CheckInstantiationPolicy returns an error if the instantiation in the supplied
    // ChaincodeDefinition differs from the instantiation policy stored on the ledger
    CheckInstantiationPolicy(name, version string, cd ccprovider.ChaincodeDefinition) error

    // GetChaincodeDeploymentSpecFS returns the deploymentspec for a chaincode from the fs
    GetChaincodeDeploymentSpecFS(cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)

    // GetApplicationConfig returns the configtxapplication.SharedConfig for the Channel
    // and whether the Application config exists
    GetApplicationConfig(cid string) (channelconfig.Application, bool)

    // NewQueryCreator creates a new QueryCreator
    NewQueryCreator(channel string) (QueryCreator, error)

    // EndorseWithPlugin endorses the response with a plugin
    EndorseWithPlugin(ctx Context) (*pb.ProposalResponse, error)

    // GetLedgerHeight returns ledger height for given channelID
    GetLedgerHeight(channelID string) (uint64, error)
}

type SupportImpl

SupportImpl provides an implementation of the endorser.Support interface issuing calls to various static methods of the peer

type SupportImpl struct {
    *PluginEndorser
    crypto.SignerSupport
    Peer             peer.Operations
    PeerSupport      peer.Support
    ChaincodeSupport *chaincode.ChaincodeSupport
    SysCCProvider    *scc.Provider
    ACLProvider      aclmgmt.ACLProvider
}

func (*SupportImpl) CheckACL

func (s *SupportImpl) CheckACL(signedProp *pb.SignedProposal, chdr *common.ChannelHeader, shdr *common.SignatureHeader, hdrext *pb.ChaincodeHeaderExtension) error

CheckACL checks the ACL for the resource for the Channel using the SignedProposal from which an id can be extracted for testing against a policy

func (*SupportImpl) CheckInstantiationPolicy

func (s *SupportImpl) CheckInstantiationPolicy(name, version string, cd ccprovider.ChaincodeDefinition) error

CheckInstantiationPolicy returns an error if the instantiation in the supplied ChaincodeDefinition differs from the instantiation policy stored on the ledger

func (*SupportImpl) Execute

func (s *SupportImpl) Execute(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, input *pb.ChaincodeInput) (*pb.Response, *pb.ChaincodeEvent, error)

Execute a proposal and return the chaincode response

func (*SupportImpl) ExecuteLegacyInit

func (s *SupportImpl) ExecuteLegacyInit(txParams *ccprovider.TransactionParams, cid, name, version, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, cds *pb.ChaincodeDeploymentSpec) (*pb.Response, *pb.ChaincodeEvent, error)

ExecuteInit a deployment proposal and return the chaincode response

func (*SupportImpl) GetApplicationConfig

func (s *SupportImpl) GetApplicationConfig(cid string) (channelconfig.Application, bool)

GetApplicationConfig returns the configtxapplication.SharedConfig for the Channel and whether the Application config exists

func (*SupportImpl) GetChaincodeDefinition

func (s *SupportImpl) GetChaincodeDefinition(chaincodeName string, txsim ledger.QueryExecutor) (ccprovider.ChaincodeDefinition, error)

GetChaincodeDefinition returns ccprovider.ChaincodeDefinition for the chaincode with the supplied name

func (*SupportImpl) GetChaincodeDeploymentSpecFS

func (s *SupportImpl) GetChaincodeDeploymentSpecFS(cds *pb.ChaincodeDeploymentSpec) (*pb.ChaincodeDeploymentSpec, error)

GetChaincode returns the CCPackage from the fs

func (*SupportImpl) GetHistoryQueryExecutor

func (s *SupportImpl) GetHistoryQueryExecutor(ledgername string) (ledger.HistoryQueryExecutor, error)

GetHistoryQueryExecutor gives handle to a history query executor for the specified ledger

func (*SupportImpl) GetLedgerHeight

func (s *SupportImpl) GetLedgerHeight(channelID string) (uint64, error)

GetLedgerHeight returns ledger height for given channelID

func (*SupportImpl) GetTransactionByID

func (s *SupportImpl) GetTransactionByID(chid, txID string) (*pb.ProcessedTransaction, error)

GetTransactionByID retrieves a transaction by id

func (*SupportImpl) GetTxSimulator

func (s *SupportImpl) GetTxSimulator(ledgername string, txid string) (ledger.TxSimulator, error)

GetTxSimulator returns the transaction simulator for the specified ledger a client may obtain more than one such simulator; they are made unique by way of the supplied txid

func (*SupportImpl) IsJavaCC

func (s *SupportImpl) IsJavaCC(buf []byte) (bool, error)

IsJavaCC returns true if the CDS package bytes describe a chaincode that requires the java runtime environment to execute

func (*SupportImpl) IsSysCC

func (s *SupportImpl) IsSysCC(name string) bool

IsSysCC returns true if the name matches a system chaincode's system chaincode names are system, chain wide

func (*SupportImpl) IsSysCCAndNotInvokableExternal

func (s *SupportImpl) IsSysCCAndNotInvokableExternal(name string) bool

IsSysCCAndNotInvokableExternal returns true if the supplied chaincode is ia system chaincode and it NOT invokable

func (*SupportImpl) NewQueryCreator

func (s *SupportImpl) NewQueryCreator(channel string) (QueryCreator, error)

func (*SupportImpl) SigningIdentityForRequest

func (s *SupportImpl) SigningIdentityForRequest(*pb.SignedProposal) (SigningIdentity, error)

type TransientStoreRetriever

TransientStoreRetriever retrieves transient stores

type TransientStoreRetriever interface {
    // StoreForChannel returns the transient store for the given channel
    StoreForChannel(channel string) transientstore.Store
}

Subdirectories

Name Synopsis
..
mocks Code generated by mockery v1.0.0