sidetxs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthVoteExt        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowVoteExt          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupVoteExt = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Vote_name = map[int32]string{
	0: "UNSPECIFIED",
	1: "VOTE_YES",
	2: "VOTE_NO",
}
View Source
var Vote_value = map[string]int32{
	"UNSPECIFIED": 0,
	"VOTE_YES":    1,
	"VOTE_NO":     2,
}

Functions

func CommonRegisterSideMsgServer

func CommonRegisterSideMsgServer(
	sideCfg SideTxConfigurator,
	srv SideMsgServer,
	serviceDesc grpc.ServiceDesc,
)

func CountSideHandlers

func CountSideHandlers(sideTxCfg SideTxConfigurator, tx sdk.Tx) int

CountSideHandlers returns the number of side handlers for the transaction to make sure we only propose and process one side msg per tx. This enforces only one message per sideTx. Otherwise, a single comet tx would contain more than one side msg, allowing for more than one vote for the same tx hash.

Types

type HasSideMsgServices

type HasSideMsgServices interface {
	// RegisterSideMsgServices allows a module to register side msg services.
	RegisterSideMsgServices(SideTxConfigurator)
}

HasSideMsgServices is the interface for modules to register sideTx services.

type PostTxHandler

type PostTxHandler func(ctx sdk.Context, msg sdk.Msg, sideTxResult Vote) error

PostTxHandler defines the core of the app state transition function after side-tx execution

type SideMsgServer

type SideMsgServer interface {
	// SideTxHandler to register specific sideHandler based on methodName
	SideTxHandler(methodName string) SideTxHandler

	// PostTxHandler to register the specific postHandler based on methodName
	PostTxHandler(methodName string) PostTxHandler
}

SideMsgServer defines the interface to implement the side txs and post-handlers.

type SideTxConfigurator

type SideTxConfigurator interface {
	RegisterSideHandler(msgURL string, handler SideTxHandler) error

	RegisterPostHandler(msgURL string, handler PostTxHandler) error

	GetSideHandler(msg sdk.Msg) SideTxHandler

	GetPostHandler(msg sdk.Msg) PostTxHandler
}

SideTxConfigurator provides the hooks to allow modules to configure and register their sideMsg services in the RegisterSideHandler and RegisterPostHandler method.

func NewSideTxConfigurator

func NewSideTxConfigurator() SideTxConfigurator

NewSideTxConfigurator returns a new Configurator instance

type SideTxDecorator

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

func NewSideTxDecorator

func NewSideTxDecorator(sideTxCfg SideTxConfigurator) SideTxDecorator

func (SideTxDecorator) AnteHandle

func (std SideTxDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

type SideTxHandler

type SideTxHandler func(ctx sdk.Context, msg sdk.Msg) Vote

SideTxHandler defines the core of the app side-tx execution

type SideTxResponse

type SideTxResponse struct {
	// Hash of the side transaction being voted on.
	TxHash []byte `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
	// The validator's vote (yes or no).
	Result Vote `protobuf:"varint,2,opt,name=result,proto3,enum=heimdallv2.sidetxs.Vote" json:"result,omitempty"`
}

SideTxResponse contains a validator's vote on a side transaction.

func (*SideTxResponse) Descriptor

func (*SideTxResponse) Descriptor() ([]byte, []int)

func (*SideTxResponse) GetResult

func (m *SideTxResponse) GetResult() Vote

func (*SideTxResponse) GetTxHash

func (m *SideTxResponse) GetTxHash() []byte

func (*SideTxResponse) Marshal

func (m *SideTxResponse) Marshal() (dAtA []byte, err error)

func (*SideTxResponse) MarshalTo

func (m *SideTxResponse) MarshalTo(dAtA []byte) (int, error)

func (*SideTxResponse) MarshalToSizedBuffer

func (m *SideTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SideTxResponse) ProtoMessage

func (*SideTxResponse) ProtoMessage()

func (*SideTxResponse) Reset

func (m *SideTxResponse) Reset()

func (*SideTxResponse) Size

func (m *SideTxResponse) Size() (n int)

func (*SideTxResponse) String

func (m *SideTxResponse) String() string

func (*SideTxResponse) Unmarshal

func (m *SideTxResponse) Unmarshal(dAtA []byte) error

func (*SideTxResponse) XXX_DiscardUnknown

func (m *SideTxResponse) XXX_DiscardUnknown()

func (*SideTxResponse) XXX_Marshal

func (m *SideTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SideTxResponse) XXX_Merge

func (m *SideTxResponse) XXX_Merge(src proto.Message)

func (*SideTxResponse) XXX_Size

func (m *SideTxResponse) XXX_Size() int

func (*SideTxResponse) XXX_Unmarshal

func (m *SideTxResponse) XXX_Unmarshal(b []byte) error

type Vote

type Vote int32

Vote represents a validator's decision on a side transaction.

const (
	Vote_UNSPECIFIED Vote = 0
	Vote_VOTE_YES    Vote = 1
	Vote_VOTE_NO     Vote = 2
)

func (Vote) EnumDescriptor

func (Vote) EnumDescriptor() ([]byte, []int)

func (Vote) String

func (x Vote) String() string

type VoteExtension added in v0.1.5

type VoteExtension struct {
	// Hash of the block this vote extension is for.
	BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
	// Height of the block this vote extension is for.
	Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	// Results of side transaction validation by this validator.
	SideTxResponses []SideTxResponse `protobuf:"bytes,3,rep,name=side_tx_responses,json=sideTxResponses,proto3" json:"side_tx_responses"`
	// Milestone proposition submitted by this validator.
	MilestoneProposition *types.MilestoneProposition `protobuf:"bytes,4,opt,name=milestone_proposition,json=milestoneProposition,proto3" json:"milestone_proposition,omitempty"`
}

VoteExtension contains additional data included by validators in their votes. Introduced in ABCI++, vote extensions allow validators to include supplementary information like milestone propositions and side transaction results.

func (*VoteExtension) Descriptor added in v0.1.5

func (*VoteExtension) Descriptor() ([]byte, []int)

func (*VoteExtension) GetBlockHash added in v0.1.5

func (m *VoteExtension) GetBlockHash() []byte

func (*VoteExtension) GetHeight added in v0.1.5

func (m *VoteExtension) GetHeight() int64

func (*VoteExtension) GetMilestoneProposition added in v0.1.5

func (m *VoteExtension) GetMilestoneProposition() *types.MilestoneProposition

func (*VoteExtension) GetSideTxResponses added in v0.1.5

func (m *VoteExtension) GetSideTxResponses() []SideTxResponse

func (*VoteExtension) Marshal added in v0.1.5

func (m *VoteExtension) Marshal() (dAtA []byte, err error)

func (*VoteExtension) MarshalTo added in v0.1.5

func (m *VoteExtension) MarshalTo(dAtA []byte) (int, error)

func (*VoteExtension) MarshalToSizedBuffer added in v0.1.5

func (m *VoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*VoteExtension) ProtoMessage added in v0.1.5

func (*VoteExtension) ProtoMessage()

func (*VoteExtension) Reset added in v0.1.5

func (m *VoteExtension) Reset()

func (*VoteExtension) Size added in v0.1.5

func (m *VoteExtension) Size() (n int)

func (*VoteExtension) String added in v0.1.5

func (m *VoteExtension) String() string

func (*VoteExtension) Unmarshal added in v0.1.5

func (m *VoteExtension) Unmarshal(dAtA []byte) error

func (*VoteExtension) XXX_DiscardUnknown added in v0.1.5

func (m *VoteExtension) XXX_DiscardUnknown()

func (*VoteExtension) XXX_Marshal added in v0.1.5

func (m *VoteExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*VoteExtension) XXX_Merge added in v0.1.5

func (m *VoteExtension) XXX_Merge(src proto.Message)

func (*VoteExtension) XXX_Size added in v0.1.5

func (m *VoteExtension) XXX_Size() int

func (*VoteExtension) XXX_Unmarshal added in v0.1.5

func (m *VoteExtension) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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