signer

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SignOperator is the type of signature signed by the operator account
	SignOperator SignType = "operator"

	// SignSeal is the type of signature signed by the seal account
	SignSeal SignType = "seal"

	// SignApproval is the type of signature signed by the approval account
	SignApproval SignType = "approval"

	// SignGc is the type of signature signed by the gc account
	SignGc SignType = "gc"

	// BroadcastTxRetry defines the max retry for broadcasting tx on-chain
	BroadcastTxRetry = 3

	Seal                     GasInfoType = "Seal"
	RejectSeal               GasInfoType = "RejectSeal"
	DiscontinueBucket        GasInfoType = "DiscontinueBucket"
	CreateGlobalVirtualGroup GasInfoType = "CreateGlobalVirtualGroup"
	CompleteMigrateBucket    GasInfoType = "CompleteMigrateBucket"
	SwapOut                  GasInfoType = "SwapOut"
	CompleteSwapOut          GasInfoType = "CompleteSwapOut"
	SPExit                   GasInfoType = "SPExit"
	CompleteSPExit           GasInfoType = "CompleteSPExit"
	UpdateSPPrice            GasInfoType = "UpdateSPPrice"
)
View Source
const (
	DefaultSealGasLimit                      = 1200 // fix gas limit for MsgSealObject is 1200
	DefaultSealFeeAmount                     = 6000000000000
	DefaultRejectSealGasLimit                = 12000 // fix gas limit for MsgRejectSealObject is 12000
	DefaultRejectSealFeeAmount               = 60000000000000
	DefaultDiscontinueBucketGasLimit         = 2400 // fix gas limit for MsgDiscontinueBucket is 2400
	DefaultDiscontinueBucketFeeAmount        = 12000000000000
	DefaultCreateGlobalVirtualGroupGasLimit  = 1200 // fix gas limit for MsgCreateGlobalVirtualGroup is 1200
	DefaultCreateGlobalVirtualGroupFeeAmount = 6000000000000
	DefaultCompleteMigrateBucketGasLimit     = 1200 // fix gas limit for MsgCompleteMigrateBucket is 1200
	DefaultCompleteMigrateBucketFeeAmount    = 6000000000000

	// SpOperatorPrivKey defines env variable name for sp operator private key
	SpOperatorPrivKey = "SIGNER_OPERATOR_PRIV_KEY"
	// SpApprovalPrivKey defines env variable name for sp approval private key
	SpApprovalPrivKey = "SIGNER_APPROVAL_PRIV_KEY"
	// SpSealPrivKey defines env variable name for sp seal private key
	SpSealPrivKey = "SIGNER_SEAL_PRIV_KEY"
	// SpBlsPrivKey defines env variable name for sp bls private key
	SpBlsPrivKey = "SIGNER_BLS_PRIV_KEY"
	// SpGcPrivKey defines env variable name for sp gc private key
	SpGcPrivKey = "SIGNER_GC_PRIV_KEY"
)

Variables

View Source
var (
	ErrSignMsg                            = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120001, "sign message with private key failed")
	ErrSealObjectOnChain                  = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120002, "send sealObject msg failed")
	ErrRejectUnSealObjectOnChain          = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120003, "send rejectUnSealObject msg failed")
	ErrDiscontinueBucketOnChain           = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120004, "send discontinueBucket msg failed")
	ErrDanglingPointer                    = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120005, "sign or tx msg pointer dangling")
	ErrCreateGVGOnChain                   = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120006, "send create gvg msg failed")
	ErrCompleteMigrateBucketOnChain       = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120007, "send complete migrate bucket failed")
	ErrSwapOutOnChain                     = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120008, "send swap out failed")
	ErrCompleteSwapOutOnChain             = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120009, "send complete swap out failed")
	ErrSPExitOnChain                      = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120010, "send sp exit failed")
	ErrCompleteSPExitOnChain              = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120011, "send complete sp exit failed")
	ErrUpdateSPPriceOnChain               = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120012, "send update sp price failed")
	ErrRejectMigrateBucketOnChain         = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120013, "send reject migrate bucket failed")
	ErrDepositOnChain                     = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120014, "send deposit failed")
	ErrDeleteGVGOnChain                   = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120015, "send delete GVG failed")
	ErrReserveSwapIn                      = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120016, "send reserve swap in failed")
	ErrCompleteSwapIn                     = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120017, "send complete swap in failed")
	ErrCancelSwapIn                       = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120018, "send cancel swap in failed")
	ErrDelegateUpdateObjectContentOnChain = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120019, "send DelegateUpdateObjectContent failed")
	ErrDelegateCreateObjectOnChain        = gfsperrors.Register(module.SignModularName, http.StatusBadRequest, 120020, "send DelegateCreateObject failed")
)

Functions

func DefaultSignerOptions

func DefaultSignerOptions(signer *SignModular, cfg *gfspconfig.GfSpConfig) error

Types

type GasInfo

type GasInfo struct {
	GasLimit  uint64
	FeeAmount sdk.Coins
}

type GasInfoType

type GasInfoType string

GasInfoType is the type of gas info

type GreenfieldChainSignClient

type GreenfieldChainSignClient struct {
	// contains filtered or unexported fields
}

GreenfieldChainSignClient the greenfield chain client

func NewGreenfieldChainSignClient

func NewGreenfieldChainSignClient(rpcAddr, chainID string, gasInfo map[GasInfoType]GasInfo, operatorPrivateKey, fundingPrivateKey,
	sealPrivateKey, approvalPrivateKey, gcPrivateKey string, blsPrivKey string) (*GreenfieldChainSignClient, error)

NewGreenfieldChainSignClient return the GreenfieldChainSignClient instance

func (*GreenfieldChainSignClient) CancelSwapIn added in v1.3.0

func (*GreenfieldChainSignClient) CompleteMigrateBucket added in v0.2.3

func (client *GreenfieldChainSignClient) CompleteMigrateBucket(ctx context.Context, scope SignType,
	migrateBucket *storagetypes.MsgCompleteMigrateBucket) (string, error)

func (*GreenfieldChainSignClient) CompleteSPExit added in v0.2.3

func (client *GreenfieldChainSignClient) CompleteSPExit(ctx context.Context, scope SignType,
	completeSPExit *virtualgrouptypes.MsgCompleteStorageProviderExit) (string, error)

func (*GreenfieldChainSignClient) CompleteSwapIn added in v1.3.0

func (*GreenfieldChainSignClient) CompleteSwapOut added in v0.2.3

func (client *GreenfieldChainSignClient) CompleteSwapOut(ctx context.Context, scope SignType,
	completeSwapOut *virtualgrouptypes.MsgCompleteSwapOut) (string, error)

func (*GreenfieldChainSignClient) CreateGlobalVirtualGroup added in v0.2.3

func (client *GreenfieldChainSignClient) CreateGlobalVirtualGroup(ctx context.Context, scope SignType,
	gvg *virtualgrouptypes.MsgCreateGlobalVirtualGroup) (string, error)

func (*GreenfieldChainSignClient) DelegateCreateObject added in v1.6.0

func (client *GreenfieldChainSignClient) DelegateCreateObject(ctx context.Context, scope SignType,
	msg *storagetypes.MsgDelegateCreateObject) (string, error)

func (*GreenfieldChainSignClient) DelegateUpdateObjectContent added in v1.6.0

func (client *GreenfieldChainSignClient) DelegateUpdateObjectContent(ctx context.Context, scope SignType,
	msg *storagetypes.MsgDelegateUpdateObjectContent) (string, error)

func (*GreenfieldChainSignClient) DeleteGlobalVirtualGroup added in v1.2.0

func (client *GreenfieldChainSignClient) DeleteGlobalVirtualGroup(ctx context.Context, scope SignType,
	msg *virtualgrouptypes.MsgDeleteGlobalVirtualGroup) (string, error)

func (*GreenfieldChainSignClient) Deposit added in v1.2.0

func (*GreenfieldChainSignClient) DiscontinueBucket

func (client *GreenfieldChainSignClient) DiscontinueBucket(ctx context.Context, scope SignType, discontinueBucket *storagetypes.MsgDiscontinueBucket) (string, error)

DiscontinueBucket stops serving the bucket on the greenfield chain.

func (*GreenfieldChainSignClient) GetAddr

func (client *GreenfieldChainSignClient) GetAddr(scope SignType) (sdk.AccAddress, error)

GetAddr returns the public address of the private key.

func (*GreenfieldChainSignClient) RejectMigrateBucket added in v1.1.0

func (client *GreenfieldChainSignClient) RejectMigrateBucket(ctx context.Context, scope SignType,
	msg *storagetypes.MsgRejectMigrateBucket) (string, error)

func (*GreenfieldChainSignClient) RejectUnSealObject

func (client *GreenfieldChainSignClient) RejectUnSealObject(ctx context.Context, scope SignType,
	rejectObject *storagetypes.MsgRejectSealObject) (string, error)

RejectUnSealObject reject seal object on the greenfield chain.

func (*GreenfieldChainSignClient) ReserveSwapIn added in v1.3.0

func (*GreenfieldChainSignClient) SPExit added in v0.2.3

func (*GreenfieldChainSignClient) SealObject

func (client *GreenfieldChainSignClient) SealObject(ctx context.Context, scope SignType,
	sealObject *storagetypes.MsgSealObject) (string, error)

SealObject seal the object on the greenfield chain.

func (*GreenfieldChainSignClient) SealObjectV2 added in v1.6.0

func (client *GreenfieldChainSignClient) SealObjectV2(ctx context.Context, scope SignType,
	sealObject *storagetypes.MsgSealObjectV2) (string, error)

SealObjectV2 seal the object on the greenfield chain.

func (*GreenfieldChainSignClient) Sign

func (client *GreenfieldChainSignClient) Sign(scope SignType, msg []byte) ([]byte, error)

Sign returns a msg signature signed by private key.

func (*GreenfieldChainSignClient) SwapOut added in v0.2.3

func (client *GreenfieldChainSignClient) SwapOut(ctx context.Context, scope SignType,
	swapOut *virtualgrouptypes.MsgSwapOut) (string, error)

func (*GreenfieldChainSignClient) UpdateSPPrice added in v0.2.3

func (client *GreenfieldChainSignClient) UpdateSPPrice(ctx context.Context, scope SignType,
	priceInfo *sptypes.MsgUpdateSpStoragePrice) (string, error)

func (*GreenfieldChainSignClient) VerifySignature

func (client *GreenfieldChainSignClient) VerifySignature(scope SignType, msg, sig []byte) bool

VerifySignature verifies the signature.

type SignModular

type SignModular struct {
	// contains filtered or unexported fields
}

func (*SignModular) CancelSwapIn added in v1.3.0

func (s *SignModular) CancelSwapIn(ctx context.Context, cancelSwapIn *virtualgrouptypes.MsgCancelSwapIn) (string, error)

func (*SignModular) CompleteMigrateBucket added in v0.2.3

func (s *SignModular) CompleteMigrateBucket(ctx context.Context, migrateBucket *storagetypes.MsgCompleteMigrateBucket) (string, error)

func (*SignModular) CompleteSPExit added in v0.2.3

func (s *SignModular) CompleteSPExit(ctx context.Context, completeSPExit *virtualgrouptypes.MsgCompleteStorageProviderExit) (string, error)

func (*SignModular) CompleteSwapIn added in v1.3.0

func (s *SignModular) CompleteSwapIn(ctx context.Context, completeSwapIn *virtualgrouptypes.MsgCompleteSwapIn) (string, error)

func (*SignModular) CompleteSwapOut added in v0.2.3

func (s *SignModular) CompleteSwapOut(ctx context.Context, completeSwapOut *virtualgrouptypes.MsgCompleteSwapOut) (string, error)

func (*SignModular) CreateGlobalVirtualGroup added in v0.2.3

func (s *SignModular) CreateGlobalVirtualGroup(ctx context.Context, gvg *virtualgrouptypes.MsgCreateGlobalVirtualGroup) (string, error)

func (*SignModular) DelegateCreateObject added in v1.6.0

func (s *SignModular) DelegateCreateObject(ctx context.Context, msg *storagetypes.MsgDelegateCreateObject) (string, error)

func (*SignModular) DelegateUpdateObjectContent added in v1.6.0

func (s *SignModular) DelegateUpdateObjectContent(ctx context.Context, msg *storagetypes.MsgDelegateUpdateObjectContent) (string, error)

func (*SignModular) DeleteGlobalVirtualGroup added in v1.2.0

func (s *SignModular) DeleteGlobalVirtualGroup(ctx context.Context, deleteGVG *virtualgrouptypes.MsgDeleteGlobalVirtualGroup) (string, error)

func (*SignModular) Deposit added in v1.2.0

func (s *SignModular) Deposit(ctx context.Context, deposit *virtualgrouptypes.MsgDeposit) (string, error)

func (*SignModular) DiscontinueBucket

func (s *SignModular) DiscontinueBucket(ctx context.Context, bucket *storagetypes.MsgDiscontinueBucket) (string, error)

func (*SignModular) Name

func (s *SignModular) Name() string

func (*SignModular) RejectMigrateBucket added in v1.1.0

func (s *SignModular) RejectMigrateBucket(ctx context.Context, rejectMigrateBucket *storagetypes.MsgRejectMigrateBucket) (string, error)

func (*SignModular) RejectUnSealObject

func (s *SignModular) RejectUnSealObject(ctx context.Context, rejectObject *storagetypes.MsgRejectSealObject) (string, error)

func (*SignModular) ReleaseResource

func (s *SignModular) ReleaseResource(ctx context.Context, span rcmgr.ResourceScopeSpan)

func (*SignModular) ReserveResource

func (s *SignModular) ReserveResource(ctx context.Context, state *rcmgr.ScopeStat) (
	rcmgr.ResourceScopeSpan, error)

func (*SignModular) ReserveSwapIn added in v1.3.0

func (s *SignModular) ReserveSwapIn(ctx context.Context, reserveSwapIn *virtualgrouptypes.MsgReserveSwapIn) (string, error)

func (*SignModular) SPExit added in v0.2.3

func (*SignModular) SealObject

func (s *SignModular) SealObject(ctx context.Context, object *storagetypes.MsgSealObject) (string, error)

func (*SignModular) SealObjectV2 added in v1.6.0

func (s *SignModular) SealObjectV2(ctx context.Context, object *storagetypes.MsgSealObjectV2) (string, error)

func (*SignModular) SignBucketMigrationInfo added in v1.1.0

func (s *SignModular) SignBucketMigrationInfo(ctx context.Context, mp *gfsptask.GfSpBucketMigrationInfo) ([]byte, error)

func (*SignModular) SignCreateBucketApproval

func (s *SignModular) SignCreateBucketApproval(ctx context.Context, bucket *storagetypes.MsgCreateBucket) ([]byte, error)

func (*SignModular) SignCreateObjectApproval

func (s *SignModular) SignCreateObjectApproval(ctx context.Context, object *storagetypes.MsgCreateObject) ([]byte, error)

func (*SignModular) SignMigrateBucketApproval added in v0.2.3

func (s *SignModular) SignMigrateBucketApproval(ctx context.Context, migrateBucket *storagetypes.MsgMigrateBucket) ([]byte, error)

func (*SignModular) SignMigrateGVG added in v0.2.6

func (s *SignModular) SignMigrateGVG(ctx context.Context, mp *gfsptask.GfSpMigrateGVGTask) ([]byte, error)

func (*SignModular) SignP2PPingMsg

func (s *SignModular) SignP2PPingMsg(ctx context.Context, ping *gfspp2p.GfSpPing) ([]byte, error)

func (*SignModular) SignP2PPongMsg

func (s *SignModular) SignP2PPongMsg(ctx context.Context, pong *gfspp2p.GfSpPong) ([]byte, error)

func (*SignModular) SignReceivePieceTask

func (s *SignModular) SignReceivePieceTask(ctx context.Context, task task.ReceivePieceTask) ([]byte, error)

func (*SignModular) SignRecoveryPieceTask added in v0.2.3

func (s *SignModular) SignRecoveryPieceTask(ctx context.Context, task task.RecoveryPieceTask) (
	[]byte, error)

func (*SignModular) SignReplicatePieceApproval

func (s *SignModular) SignReplicatePieceApproval(ctx context.Context, task task.ApprovalReplicatePieceTask) ([]byte, error)

func (*SignModular) SignSecondarySPMigrationBucket added in v0.2.3

func (s *SignModular) SignSecondarySPMigrationBucket(ctx context.Context, signDoc *storagetypes.SecondarySpMigrationBucketSignDoc) ([]byte, error)

func (*SignModular) SignSecondarySealBls added in v0.2.3

func (s *SignModular) SignSecondarySealBls(ctx context.Context, objectID uint64, gvgId uint32, checksums [][]byte) ([]byte, error)

func (*SignModular) SignSwapOut added in v0.2.3

func (s *SignModular) SignSwapOut(ctx context.Context, swapOut *virtualgrouptypes.MsgSwapOut) ([]byte, error)

func (*SignModular) Start

func (s *SignModular) Start(ctx context.Context) error

func (*SignModular) Stop

func (s *SignModular) Stop(ctx context.Context) error

func (*SignModular) SwapOut added in v0.2.3

func (s *SignModular) SwapOut(ctx context.Context, swapOut *virtualgrouptypes.MsgSwapOut) (string, error)

func (*SignModular) UpdateSPPrice added in v0.2.3

func (s *SignModular) UpdateSPPrice(ctx context.Context, price *sptypes.MsgUpdateSpStoragePrice) (string, error)

type SignType

type SignType string

SignType is the type of msg signature

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL