Documentation ¶
Index ¶
- Variables
- func GetBatchID(beaconHeight uint64, unshieldIDs []string) string
- func GetMaxKeyValue(input map[uint64]statedb.ExternalFeeInfo) (max uint64)
- func HandlePortalInstsV4(bc metadata.ChainRetriever, stateDB *statedb.StateDB, beaconHeight uint64, ...) ([][]string, error)
- func StorePortalV4StateToDB(stateDB *statedb.StateDB, currentPortalState *CurrentPortalStateV4, ...) error
- func UpdateNewStatusBatchUnshield(batchID string, newStatus byte, ...) error
- func UpdateNewStatusUnshieldRequest(unshieldID string, newStatus int, externalTxID string, externalFee uint64, ...) error
- type CurrentPortalStateV4
- func (s *CurrentPortalStateV4) AddBatchProcessedUnshieldRequest(batchID string, utxos []*statedb.UTXO, beaconHeight uint64, externalFee uint, ...)
- func (s *CurrentPortalStateV4) AddExternalFeeForBatchProcessedUnshieldRequest(batchID string, tokenID string, externalFee uint, beaconHeight uint64, ...)
- func (s *CurrentPortalStateV4) AddShieldingExternalTx(tokenID string, shieldingProofTxHash string, shieldingExternalTxHash string, ...)
- func (s *CurrentPortalStateV4) AddUTXOs(utxos []*statedb.UTXO, tokenID string)
- func (s *CurrentPortalStateV4) AddWaitingUnshieldRequest(unshieldID string, tokenID string, remoteAddress string, unshieldAmt uint64, ...)
- func (s *CurrentPortalStateV4) Copy() *CurrentPortalStateV4
- func (s *CurrentPortalStateV4) IsExistedShieldingExternalTx(tokenID string, shieldingProofTxHash string) bool
- func (s *CurrentPortalStateV4) RemoveBatchProcessedUnshieldRequest(tokenIDStr string, batchKey common.Hash)
- func (s *CurrentPortalStateV4) RemoveUTXOs(utxos []*statedb.UTXO, tokenID string)
- func (s *CurrentPortalStateV4) RemoveWaitingUnshieldReqs(unshieldIDs []string, tokenID string)
- func (s *CurrentPortalStateV4) UpdatePortalStateAfterProcessBatchUnshieldRequest(batchID string, utxos []*statedb.UTXO, beaconHeight uint64, externalFee uint, ...)
- type PortalConvertVaultRequestProcessor
- func (p *PortalConvertVaultRequestProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalConvertVaultRequestProcessor) GetActions() map[byte][][]string
- func (p *PortalConvertVaultRequestProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string, ...) (map[string]interface{}, error)
- func (p *PortalConvertVaultRequestProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalConvertVaultRequestProcessor) PutAction(action []string, shardID byte)
- type PortalFeeReplacementRequestProcessor
- func (p *PortalFeeReplacementRequestProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalFeeReplacementRequestProcessor) GetActions() map[byte][][]string
- func (p *PortalFeeReplacementRequestProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string, ...) (map[string]interface{}, error)
- func (p *PortalFeeReplacementRequestProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalFeeReplacementRequestProcessor) PutAction(action []string, shardID byte)
- type PortalInstProcessorV4
- type PortalInstructionProcessorV4
- type PortalProcessLoggerV4
- type PortalShieldingRequestProcessor
- func (p *PortalShieldingRequestProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalShieldingRequestProcessor) GetActions() map[byte][][]string
- func (p *PortalShieldingRequestProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string, ...) (map[string]interface{}, error)
- func (p *PortalShieldingRequestProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalShieldingRequestProcessor) PutAction(action []string, shardID byte)
- type PortalSig
- type PortalSubmitConfirmedTxProcessor
- func (p *PortalSubmitConfirmedTxProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalSubmitConfirmedTxProcessor) GetActions() map[byte][][]string
- func (p *PortalSubmitConfirmedTxProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string, ...) (map[string]interface{}, error)
- func (p *PortalSubmitConfirmedTxProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalSubmitConfirmedTxProcessor) PutAction(action []string, shardID byte)
- type PortalUnshieldBatchingProcessor
- func (p *PortalUnshieldBatchingProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalUnshieldBatchingProcessor) GetActions() map[byte][][]string
- func (p *PortalUnshieldBatchingProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string, ...) (map[string]interface{}, error)
- func (p *PortalUnshieldBatchingProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalUnshieldBatchingProcessor) PutAction(action []string, shardID byte)
- type PortalUnshieldRequestProcessor
- func (p *PortalUnshieldRequestProcessor) BuildNewInsts(bc metadata.ChainRetriever, contentStr string, shardID byte, ...) ([][]string, error)
- func (p *PortalUnshieldRequestProcessor) GetActions() map[byte][][]string
- func (p *PortalUnshieldRequestProcessor) PrepareDataForBlockProducer(stateDB *statedb.StateDB, contentStr string, ...) (map[string]interface{}, error)
- func (p *PortalUnshieldRequestProcessor) ProcessInsts(stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, ...) error
- func (p *PortalUnshieldRequestProcessor) PutAction(action []string, shardID byte)
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger = PortalProcessLoggerV4{}
Global instant to use
Functions ¶
func GetBatchID ¶
batchID is hash of current beacon height and unshieldIDs that processed
func GetMaxKeyValue ¶
func GetMaxKeyValue(input map[uint64]statedb.ExternalFeeInfo) (max uint64)
get latest beaconheight
func HandlePortalInstsV4 ¶
func HandlePortalInstsV4( bc metadata.ChainRetriever, stateDB *statedb.StateDB, beaconHeight uint64, shardHeights map[byte]uint64, currentPortalState *CurrentPortalStateV4, portalParams portalv4.PortalParams, ppv4 map[int]PortalInstructionProcessorV4, ) ([][]string, error)
handle portal instructions for block producer
func StorePortalV4StateToDB ¶
func StorePortalV4StateToDB( stateDB *statedb.StateDB, currentPortalState *CurrentPortalStateV4, portalParamV4 portalv4.PortalParams, ) error
Types ¶
type CurrentPortalStateV4 ¶
type CurrentPortalStateV4 struct { UTXOs map[string]map[string]*statedb.UTXO // tokenID : hash(tokenID || walletAddress || txHash || index) : value ShieldingExternalTx map[string]map[string]*statedb.ShieldingRequest // tokenID : hash(tokenID || proofHash) : value WaitingUnshieldRequests map[string]map[string]*statedb.WaitingUnshieldRequest // tokenID : hash(tokenID || unshieldID) : value ProcessedUnshieldRequests map[string]map[string]*statedb.ProcessedUnshieldRequestBatch // tokenID : hash(tokenID || batchID) : value DeletedUTXOKeyHashes []common.Hash DeletedWaitingUnshieldReqKeyHashes []common.Hash DeletedProcessedUnshieldReqKeyHashes []common.Hash }
func InitCurrentPortalStateV4FromDB ¶
func InitCurrentPortalStateV4FromDB( stateDB *statedb.StateDB, lastState *CurrentPortalStateV4, portalParamV4 portalv4.PortalParams, ) (*CurrentPortalStateV4, error)
func ProcessPortalInstsV4 ¶
func ProcessPortalInstsV4( portalStateDB *statedb.StateDB, lastState *CurrentPortalStateV4, portalParams portalv4.PortalParams, beaconHeight uint64, instructions [][]string, ppv4 map[int]PortalInstructionProcessorV4, epoch uint64) (*CurrentPortalStateV4, error)
func (*CurrentPortalStateV4) AddBatchProcessedUnshieldRequest ¶
func (*CurrentPortalStateV4) AddExternalFeeForBatchProcessedUnshieldRequest ¶
func (*CurrentPortalStateV4) AddShieldingExternalTx ¶
func (*CurrentPortalStateV4) AddUTXOs ¶
func (s *CurrentPortalStateV4) AddUTXOs(utxos []*statedb.UTXO, tokenID string)
func (*CurrentPortalStateV4) AddWaitingUnshieldRequest ¶
func (*CurrentPortalStateV4) Copy ¶
func (s *CurrentPortalStateV4) Copy() *CurrentPortalStateV4
func (*CurrentPortalStateV4) IsExistedShieldingExternalTx ¶
func (s *CurrentPortalStateV4) IsExistedShieldingExternalTx(tokenID string, shieldingProofTxHash string) bool
func (*CurrentPortalStateV4) RemoveBatchProcessedUnshieldRequest ¶
func (s *CurrentPortalStateV4) RemoveBatchProcessedUnshieldRequest(tokenIDStr string, batchKey common.Hash)
func (*CurrentPortalStateV4) RemoveUTXOs ¶
func (s *CurrentPortalStateV4) RemoveUTXOs(utxos []*statedb.UTXO, tokenID string)
func (*CurrentPortalStateV4) RemoveWaitingUnshieldReqs ¶
func (s *CurrentPortalStateV4) RemoveWaitingUnshieldReqs(unshieldIDs []string, tokenID string)
func (*CurrentPortalStateV4) UpdatePortalStateAfterProcessBatchUnshieldRequest ¶
type PortalConvertVaultRequestProcessor ¶
type PortalConvertVaultRequestProcessor struct {
*PortalInstProcessorV4
}
func (*PortalConvertVaultRequestProcessor) BuildNewInsts ¶
func (p *PortalConvertVaultRequestProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalStateV4, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv4.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalConvertVaultRequestProcessor) GetActions ¶
func (p *PortalConvertVaultRequestProcessor) GetActions() map[byte][][]string
func (*PortalConvertVaultRequestProcessor) PrepareDataForBlockProducer ¶
func (p *PortalConvertVaultRequestProcessor) PrepareDataForBlockProducer( stateDB *statedb.StateDB, contentStr string, portalParams portalv4.PortalParams, ) (map[string]interface{}, error)
func (*PortalConvertVaultRequestProcessor) ProcessInsts ¶
func (p *PortalConvertVaultRequestProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalStateV4, portalParams portalv4.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalConvertVaultRequestProcessor) PutAction ¶
func (p *PortalConvertVaultRequestProcessor) PutAction(action []string, shardID byte)
type PortalFeeReplacementRequestProcessor ¶
type PortalFeeReplacementRequestProcessor struct {
*PortalInstProcessorV4
}
func (*PortalFeeReplacementRequestProcessor) BuildNewInsts ¶
func (p *PortalFeeReplacementRequestProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalV4State *CurrentPortalStateV4, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv4.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalFeeReplacementRequestProcessor) GetActions ¶
func (p *PortalFeeReplacementRequestProcessor) GetActions() map[byte][][]string
func (*PortalFeeReplacementRequestProcessor) PrepareDataForBlockProducer ¶
func (p *PortalFeeReplacementRequestProcessor) PrepareDataForBlockProducer( stateDB *statedb.StateDB, contentStr string, portalParams portalv4.PortalParams, ) (map[string]interface{}, error)
func (*PortalFeeReplacementRequestProcessor) ProcessInsts ¶
func (p *PortalFeeReplacementRequestProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalV4State *CurrentPortalStateV4, portalParams portalv4.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalFeeReplacementRequestProcessor) PutAction ¶
func (p *PortalFeeReplacementRequestProcessor) PutAction(action []string, shardID byte)
type PortalInstProcessorV4 ¶
type PortalInstructionProcessorV4 ¶
type PortalInstructionProcessorV4 interface { GetActions() map[byte][][]string PutAction(action []string, shardID byte) // get necessary db from stateDB to verify instructions when producing new block PrepareDataForBlockProducer( stateDB *statedb.StateDB, contentStr string, portalParams portalv4.PortalParams, ) (map[string]interface{}, error) // validate and create new instructions in new beacon blocks BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalStateV4, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv4.PortalParams, optionalData map[string]interface{}, ) ([][]string, error) // process instructions that confirmed in beacon blocks ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalStateV4, portalParams portalv4.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error }
interface for portal instruction processor v3
type PortalProcessLoggerV4 ¶
type PortalProcessLoggerV4 struct {
// contains filtered or unexported fields
}
func (*PortalProcessLoggerV4) Init ¶
func (p *PortalProcessLoggerV4) Init(inst common.Logger)
type PortalShieldingRequestProcessor ¶
type PortalShieldingRequestProcessor struct {
*PortalInstProcessorV4
}
func (*PortalShieldingRequestProcessor) BuildNewInsts ¶
func (p *PortalShieldingRequestProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalState *CurrentPortalStateV4, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv4.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalShieldingRequestProcessor) GetActions ¶
func (p *PortalShieldingRequestProcessor) GetActions() map[byte][][]string
func (*PortalShieldingRequestProcessor) PrepareDataForBlockProducer ¶
func (p *PortalShieldingRequestProcessor) PrepareDataForBlockProducer( stateDB *statedb.StateDB, contentStr string, portalParams portalv4.PortalParams, ) (map[string]interface{}, error)
func (*PortalShieldingRequestProcessor) ProcessInsts ¶
func (p *PortalShieldingRequestProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalState *CurrentPortalStateV4, portalParams portalv4.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalShieldingRequestProcessor) PutAction ¶
func (p *PortalShieldingRequestProcessor) PutAction(action []string, shardID byte)
type PortalSig ¶
type PortalSig struct { TokenID string RawTxHash string Sigs [][]byte // array of sigs for all TxIn }
PortalSig defines sigs of one beacon validator on unshield external tx
func CheckAndSignPortalUnshieldExternalTx ¶
func CheckAndSignPortalUnshieldExternalTx(seedKey []byte, insts [][]string, portalParam portalv4.PortalParams) ([]*PortalSig, error)
CheckAndSignPortalUnshieldExternalTx checks portal instructions need beacons sign on
type PortalSubmitConfirmedTxProcessor ¶
type PortalSubmitConfirmedTxProcessor struct {
*PortalInstProcessorV4
}
func (*PortalSubmitConfirmedTxProcessor) BuildNewInsts ¶
func (p *PortalSubmitConfirmedTxProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalV4State *CurrentPortalStateV4, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv4.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalSubmitConfirmedTxProcessor) GetActions ¶
func (p *PortalSubmitConfirmedTxProcessor) GetActions() map[byte][][]string
func (*PortalSubmitConfirmedTxProcessor) PrepareDataForBlockProducer ¶
func (p *PortalSubmitConfirmedTxProcessor) PrepareDataForBlockProducer( stateDB *statedb.StateDB, contentStr string, portalParams portalv4.PortalParams, ) (map[string]interface{}, error)
func (*PortalSubmitConfirmedTxProcessor) ProcessInsts ¶
func (p *PortalSubmitConfirmedTxProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalV4State *CurrentPortalStateV4, portalParams portalv4.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalSubmitConfirmedTxProcessor) PutAction ¶
func (p *PortalSubmitConfirmedTxProcessor) PutAction(action []string, shardID byte)
type PortalUnshieldBatchingProcessor ¶
type PortalUnshieldBatchingProcessor struct {
*PortalInstProcessorV4
}
=======
Portal Unshield Request Batching Processor =======
func (*PortalUnshieldBatchingProcessor) BuildNewInsts ¶
func (p *PortalUnshieldBatchingProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalStateV4 *CurrentPortalStateV4, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv4.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalUnshieldBatchingProcessor) GetActions ¶
func (p *PortalUnshieldBatchingProcessor) GetActions() map[byte][][]string
func (*PortalUnshieldBatchingProcessor) PrepareDataForBlockProducer ¶
func (p *PortalUnshieldBatchingProcessor) PrepareDataForBlockProducer( stateDB *statedb.StateDB, contentStr string, portalParams portalv4.PortalParams, ) (map[string]interface{}, error)
func (*PortalUnshieldBatchingProcessor) ProcessInsts ¶
func (p *PortalUnshieldBatchingProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalStateV4 *CurrentPortalStateV4, portalParams portalv4.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalUnshieldBatchingProcessor) PutAction ¶
func (p *PortalUnshieldBatchingProcessor) PutAction(action []string, shardID byte)
type PortalUnshieldRequestProcessor ¶
type PortalUnshieldRequestProcessor struct {
*PortalInstProcessorV4
}
=======
Portal Unshield Request Processor =======
func (*PortalUnshieldRequestProcessor) BuildNewInsts ¶
func (p *PortalUnshieldRequestProcessor) BuildNewInsts( bc metadata.ChainRetriever, contentStr string, shardID byte, currentPortalStateV4 *CurrentPortalStateV4, beaconHeight uint64, shardHeights map[byte]uint64, portalParams portalv4.PortalParams, optionalData map[string]interface{}, ) ([][]string, error)
func (*PortalUnshieldRequestProcessor) GetActions ¶
func (p *PortalUnshieldRequestProcessor) GetActions() map[byte][][]string
func (*PortalUnshieldRequestProcessor) PrepareDataForBlockProducer ¶
func (p *PortalUnshieldRequestProcessor) PrepareDataForBlockProducer( stateDB *statedb.StateDB, contentStr string, portalParams portalv4.PortalParams, ) (map[string]interface{}, error)
func (*PortalUnshieldRequestProcessor) ProcessInsts ¶
func (p *PortalUnshieldRequestProcessor) ProcessInsts( stateDB *statedb.StateDB, beaconHeight uint64, instructions []string, currentPortalStateV4 *CurrentPortalStateV4, portalParams portalv4.PortalParams, updatingInfoByTokenID map[common.Hash]metadata.UpdatingInfo, ) error
func (*PortalUnshieldRequestProcessor) PutAction ¶
func (p *PortalUnshieldRequestProcessor) PutAction(action []string, shardID byte)
Click to show internal directories.
Click to hide internal directories.