proto

package
v0.1.114 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

README

internal/heimdall/proto — hand-rolled Cosmos SDK tx wire encoding

This package implements the subset of the Cosmos SDK / Heimdall tx protobuf wire format that polycli's heimdall tx builder (internal/heimdall/tx/) needs to build, sign, and broadcast transactions against a Heimdall v2 node.

Why hand-rolled?

The obvious choice is buf generate against heimdall-v2's .proto files. We did not take it because heimdall-v2's dependency closure (cosmos-sdk, cometbft, go-ethereum) requires three Polygon-fork replace directives in go.mod:

  • github.com/ethereum/go-ethereumgithub.com/0xPolygon/bor
  • github.com/cosmos/cosmos-sdkgithub.com/0xPolygon/cosmos-sdk
  • github.com/cometbft/cometbftgithub.com/0xPolygon/cometbft

Adopting any of those in polycli's root go.mod would risk breaking every existing command that already pulls upstream go-ethereum (loadtest, monitor, fund, wallet, rpcfuzz, abi, ...). The W2 brief is explicit: do not add replace directives.

Proto wire format is a small, well-specified byte-level protocol (https://protobuf.dev/programming-guides/encoding). The tx builder only needs a handful of messages:

  • cosmos.tx.v1beta1.{TxBody, AuthInfo, SignerInfo, ModeInfo, ModeInfo.Single, Fee, TxRaw, SignDoc}
  • cosmos.base.v1beta1.Coin
  • cosmos.crypto.secp256k1.PubKey
  • google.protobuf.Any
  • heimdallv2.topup.MsgWithdrawFeeTx (starter Msg; others added in W3/W4)

Each is encoded by appending tag + length-prefixed bytes using google.golang.org/protobuf/encoding/protowire, which is part of the standard protobuf distribution and already a direct dep. Decoding is the mirror operation. Total hand-rolled code is ~300 lines and can be audited in one sitting.

If the tx-builder surface grows large enough that hand-rolling stops being tractable, the escape hatch is buf generate with a local buf.gen.yaml pointing at heimdall-v2's proto tree, outputting to this package. That path stays open.

Signing specifics

Heimdall v2 uses PubKeySecp256k1eth: standard secp256k1 curve, but signing digests are keccak256(signBytes) rather than sha256, and the 65-byte signature (r||s||v) is truncated to 64 bytes (r||s) before storing in TxRaw.signatures. See internal/heimdall/tx/sign.go for the implementation.

Documentation

Overview

Package proto implements the narrow subset of the Cosmos SDK and Heimdall v2 protobuf wire format that polycli's heimdall tx builder needs. See README.md for the rationale — we encode/decode by hand rather than pull in cosmos-sdk's fork-pinned go module.

Index

Constants

View Source
const (
	SignModeDirect    int32 = 1
	SignModeAminoJSON int32 = 127
	SignModeUnspecif  int32 = 0
)

SignModeDirect and SignModeAminoJSON are the two values of cosmos.tx.signing.v1beta1.SignMode that polycli supports.

View Source
const (
	MsgValidatorJoinTypeURL = "/heimdallv2.stake.MsgValidatorJoin"
	MsgStakeUpdateTypeURL   = "/heimdallv2.stake.MsgStakeUpdate"
	MsgSignerUpdateTypeURL  = "/heimdallv2.stake.MsgSignerUpdate"
	MsgValidatorExitTypeURL = "/heimdallv2.stake.MsgValidatorExit"
)

Stake module Msg type URLs.

View Source
const MsgBackfillSpansTypeURL = "/heimdallv2.bor.MsgBackfillSpans"

MsgBackfillSpansTypeURL is the Any type URL for MsgBackfillSpans.

View Source
const MsgCheckpointTypeURL = "/heimdallv2.checkpoint.MsgCheckpoint"

MsgCheckpointTypeURL is the Any type URL for MsgCheckpoint (heimdallv2/proto/heimdallv2/checkpoint/tx.proto).

View Source
const MsgCpAckTypeURL = "/heimdallv2.checkpoint.MsgCpAck"

MsgCpAckTypeURL is the Any type URL for MsgCpAck.

View Source
const MsgCpNoAckTypeURL = "/heimdallv2.checkpoint.MsgCpNoAck"

MsgCpNoAckTypeURL is the Any type URL for MsgCpNoAck.

View Source
const MsgEventRecordTypeURL = "/heimdallv2.clerk.MsgEventRecord"

MsgEventRecordTypeURL is the Any type URL for MsgEventRecord (heimdallv2/proto/heimdallv2/clerk/tx.proto).

View Source
const MsgProposeSpanTypeURL = "/heimdallv2.bor.MsgProposeSpan"

MsgProposeSpanTypeURL is the Any type URL for MsgProposeSpan (heimdallv2/proto/heimdallv2/bor/tx.proto).

View Source
const MsgSetProducerDowntimeTypeURL = "/heimdallv2.bor.MsgSetProducerDowntime"

MsgSetProducerDowntimeTypeURL is the Any type URL for MsgSetProducerDowntime.

View Source
const MsgTopupTxTypeURL = "/heimdallv2.topup.MsgTopupTx"

MsgTopupTxTypeURL is the Any type URL for MsgTopupTx (heimdallv2/proto/heimdallv2/topup/tx.proto).

View Source
const MsgVoteProducersTypeURL = "/heimdallv2.bor.MsgVoteProducers"

MsgVoteProducersTypeURL is the Any type URL for MsgVoteProducers.

View Source
const MsgWithdrawFeeTxTypeURL = "/heimdallv2.topup.MsgWithdrawFeeTx"

MsgWithdrawFeeTxTypeURL is the Any type URL for the withdraw fee message as registered in heimdall-v2.

View Source
const PubKeyTypeURL = "/cosmos.crypto.secp256k1.PubKey"

PubKeyTypeURL is the Any type URL for a Heimdall / Cosmos SDK secp256k1 public key. heimdall-v2 registers this concrete type with the Ethereum-style 65-byte uncompressed key; the proto shape is identical to the upstream cosmos-sdk type.

View Source
const VoteExtensionTypeURL = "/heimdallv2.sidetxs.VoteExtension"

VoteExtensionTypeURL is informational; VoteExtension is not wrapped in Any on the wire (it arrives as plain bytes on CometBFT's ExtendVote interface). Retained so the decode family can surface a consistent label.

Variables

This section is empty.

Functions

func ConsumeField

func ConsumeField(b []byte) (protowire.Number, protowire.Type, []byte, int, error)

ConsumeField exposes consumeField for sibling packages (e.g. the heimdall decode command) so they don't carry their own copy of the wire-format record parser.

func Decode

func Decode(typeURL string, value []byte) (any, error)

Decode resolves typeURL in the registry and invokes its decoder. If typeURL is unknown, Decode returns an error including the type URL so callers can forward it to the user verbatim.

func KnownTypeURLs

func KnownTypeURLs() []string

KnownTypeURLs returns a sorted list of every registered type URL. Useful for diagnostics and for `decode msg` help text.

func Register

func Register(typeURL string, decoder Decoder)

Register associates typeURL with a decoder. Panics on a duplicate registration so the error is caught at init time. Empty typeURL or nil decoder also panic.

func Varint

func Varint(b []byte) (uint64, error)

Varint exposes varint for sibling packages; it reads a varint from a value slice returned by ConsumeField.

Types

type Any

type Any struct {
	TypeURL string
	Value   []byte
}

Any mirrors google.protobuf.Any — a polymorphic envelope carrying a type_url and a proto-encoded value. We use this for both tx messages and pubkeys.

func PubKeyAny

func PubKeyAny(keyBytes []byte) *Any

PubKeyAny returns an Any wrapping a cosmos.crypto.secp256k1.PubKey whose single `bytes key = 1` field is keyBytes. keyBytes should be the 65-byte uncompressed secp256k1 pubkey (0x04 || X || Y) for PubKeySecp256k1eth.

func UnmarshalAny

func UnmarshalAny(b []byte) (*Any, error)

UnmarshalAny parses a length-prefixed Any from b and returns it. Unknown fields are skipped.

func (*Any) Marshal

func (a *Any) Marshal() []byte

Marshal encodes the Any to proto3 wire format. Type URLs and values are both required for a non-empty Any; zero-Any marshals to an empty byte slice.

type AuthInfo

type AuthInfo struct {
	SignerInfos []*SignerInfo
	Fee         *Fee
}

AuthInfo mirrors cosmos.tx.v1beta1.AuthInfo.

func (*AuthInfo) Marshal

func (a *AuthInfo) Marshal() []byte

Marshal encodes AuthInfo.

type BlockIDFlag

type BlockIDFlag int32

BlockIDFlag mirrors tendermint.types.BlockIDFlag.

const (
	BlockIDFlagUnknown BlockIDFlag = 0
	BlockIDFlagAbsent  BlockIDFlag = 1
	BlockIDFlagCommit  BlockIDFlag = 2
	BlockIDFlagNil     BlockIDFlag = 3
)

BlockIDFlag values. UNKNOWN is encoded as 0 and omitted when unset.

func (BlockIDFlag) String

func (f BlockIDFlag) String() string

String returns the short enum name (without the BLOCK_ID_FLAG_ prefix used in the .proto source) for compact table rendering.

type BlockRange

type BlockRange struct {
	StartBlock uint64
	EndBlock   uint64
}

BlockRange mirrors heimdallv2.bor.BlockRange.

func (BlockRange) Marshal

func (r BlockRange) Marshal() []byte

Marshal encodes BlockRange.

type Coin

type Coin struct {
	Denom  string
	Amount string
}

Coin mirrors cosmos.base.v1beta1.Coin.

func (Coin) Marshal

func (c Coin) Marshal() []byte

Marshal encodes the Coin.

type Decoder

type Decoder func([]byte) (any, error)

Decoder takes an Any.value byte slice and returns a decoded Go value (typically a typed *Msg or a map[string]any) along with an error.

The registry is populated by package init() functions in this file. Additional Msg types added in the future should register their decoder alongside their Marshal/Unmarshal helpers.

func Lookup

func Lookup(typeURL string) (Decoder, bool)

Lookup returns the decoder registered for typeURL, or (nil, false) if none is registered.

type ExtValidator

type ExtValidator struct {
	Address []byte // 20-byte CometBFT address == heimdall signer address
	Power   int64
}

ExtValidator mirrors tendermint.abci.Validator. Field 2 is reserved in the .proto source (it once held a pub_key).

func (ExtValidator) Marshal

func (v ExtValidator) Marshal() []byte

Marshal encodes ExtValidator.

type ExtendedCommitInfo

type ExtendedCommitInfo struct {
	Round int32
	Votes []ExtendedVoteInfo
}

ExtendedCommitInfo mirrors tendermint.abci.ExtendedCommitInfo. On heimdall-v2 chains the proposer injects the previous height's extended commit (all validators' vote extensions) as the special transaction at index 0 of every block; decoding block.data.txs[0] with this function recovers each validator's vote extension bytes. Unknown fields are skipped for forward compatibility with fork drift.

func UnmarshalExtendedCommitInfo

func UnmarshalExtendedCommitInfo(b []byte) (*ExtendedCommitInfo, error)

UnmarshalExtendedCommitInfo parses the marshaled ExtendedCommitInfo bytes found at block.data.txs[0].

func (*ExtendedCommitInfo) Marshal

func (e *ExtendedCommitInfo) Marshal() []byte

Marshal encodes ExtendedCommitInfo.

type ExtendedVoteInfo

type ExtendedVoteInfo struct {
	Validator               ExtValidator
	VoteExtension           []byte
	ExtensionSignature      []byte
	BlockIDFlag             BlockIDFlag
	NonRpVoteExtension      []byte
	NonRpExtensionSignature []byte
}

ExtendedVoteInfo mirrors tendermint.abci.ExtendedVoteInfo as defined by the 0xPolygon cometbft fork (v0.3.6-polygon), which adds the non-RP extension fields 6 and 7 on top of the upstream message. Field 2 is reserved in the .proto source.

func (ExtendedVoteInfo) Marshal

func (v ExtendedVoteInfo) Marshal() []byte

Marshal encodes ExtendedVoteInfo.

type Fee

type Fee struct {
	Amount   []Coin
	GasLimit uint64
	Payer    string
	Granter  string
}

Fee mirrors cosmos.tx.v1beta1.Fee.

func (*Fee) Marshal

func (f *Fee) Marshal() []byte

Marshal encodes Fee.

type MilestoneProposition

type MilestoneProposition struct {
	BlockHashes      [][]byte
	StartBlockNumber uint64
	ParentHash       []byte
	BlockTDs         []uint64
}

MilestoneProposition mirrors heimdallv2.milestone.MilestoneProposition. Repeated uint64 fields are decoded tolerantly: both packed and unpacked wire forms are accepted.

func UnmarshalMilestoneProposition

func UnmarshalMilestoneProposition(b []byte) (*MilestoneProposition, error)

UnmarshalMilestoneProposition parses the message bytes.

The block_tds field is a repeated uint64. Proto3 defaults repeated scalars to the packed wire format; heimdalld's gogoproto descriptors use packed encoding. We accept both: consumeField normalizes the value to a raw byte-slice regardless of the tag wire type.

func (*MilestoneProposition) Marshal

func (m *MilestoneProposition) Marshal() []byte

Marshal encodes MilestoneProposition (block_tds as packed varints).

type ModeInfo

type ModeInfo struct {
	Single *ModeInfoSingle
}

ModeInfo represents the ModeInfo oneof; only Single is supported.

func (*ModeInfo) Marshal

func (m *ModeInfo) Marshal() []byte

Marshal encodes ModeInfo.

type ModeInfoSingle

type ModeInfoSingle struct {
	Mode int32
}

ModeInfoSingle is the ModeInfo.Single sub-message.

func (ModeInfoSingle) Marshal

func (m ModeInfoSingle) Marshal() []byte

Marshal encodes ModeInfo.Single.

type MsgBackfillSpans

type MsgBackfillSpans struct {
	Proposer        string
	ChainID         string
	LatestSpanID    uint64
	LatestBorSpanID uint64
}

MsgBackfillSpans mirrors heimdallv2.bor.MsgBackfillSpans.

func UnmarshalMsgBackfillSpans

func UnmarshalMsgBackfillSpans(b []byte) (*MsgBackfillSpans, error)

UnmarshalMsgBackfillSpans parses the message bytes.

func (*MsgBackfillSpans) AsAny

func (m *MsgBackfillSpans) AsAny() *Any

AsAny wraps the message.

func (*MsgBackfillSpans) Marshal

func (m *MsgBackfillSpans) Marshal() []byte

Marshal encodes MsgBackfillSpans.

type MsgCheckpoint

type MsgCheckpoint struct {
	Proposer        string
	StartBlock      uint64
	EndBlock        uint64
	RootHash        []byte
	AccountRootHash []byte
	BorChainID      string
}

MsgCheckpoint mirrors heimdallv2.checkpoint.MsgCheckpoint. Fields are ordered to match the .proto source; the Marshal emits them in field number order regardless.

func UnmarshalMsgCheckpoint

func UnmarshalMsgCheckpoint(b []byte) (*MsgCheckpoint, error)

UnmarshalMsgCheckpoint parses a MsgCheckpoint from its proto bytes.

func (*MsgCheckpoint) AsAny

func (m *MsgCheckpoint) AsAny() *Any

AsAny wraps the message as a google.protobuf.Any.

func (*MsgCheckpoint) Marshal

func (m *MsgCheckpoint) Marshal() []byte

Marshal encodes MsgCheckpoint.

type MsgCpAck

type MsgCpAck struct {
	From       string
	Number     uint64
	Proposer   string
	StartBlock uint64
	EndBlock   uint64
	RootHash   []byte
}

MsgCpAck mirrors heimdallv2.checkpoint.MsgCpAck.

func UnmarshalMsgCpAck

func UnmarshalMsgCpAck(b []byte) (*MsgCpAck, error)

UnmarshalMsgCpAck parses MsgCpAck bytes.

func (*MsgCpAck) AsAny

func (m *MsgCpAck) AsAny() *Any

AsAny wraps the message.

func (*MsgCpAck) Marshal

func (m *MsgCpAck) Marshal() []byte

Marshal encodes MsgCpAck.

type MsgCpNoAck

type MsgCpNoAck struct {
	From string
}

MsgCpNoAck mirrors heimdallv2.checkpoint.MsgCpNoAck (single field).

func UnmarshalMsgCpNoAck

func UnmarshalMsgCpNoAck(b []byte) (*MsgCpNoAck, error)

UnmarshalMsgCpNoAck parses MsgCpNoAck bytes.

func (*MsgCpNoAck) AsAny

func (m *MsgCpNoAck) AsAny() *Any

AsAny wraps the message.

func (*MsgCpNoAck) Marshal

func (m *MsgCpNoAck) Marshal() []byte

Marshal encodes MsgCpNoAck.

type MsgEventRecord

type MsgEventRecord struct {
	From            string
	TxHash          string
	LogIndex        uint64
	BlockNumber     uint64
	ContractAddress string
	Data            []byte
	ID              uint64
	ChainID         string
}

MsgEventRecord mirrors heimdallv2.clerk.MsgEventRecord.

func UnmarshalMsgEventRecord

func UnmarshalMsgEventRecord(b []byte) (*MsgEventRecord, error)

UnmarshalMsgEventRecord parses the message bytes.

func (*MsgEventRecord) AsAny

func (m *MsgEventRecord) AsAny() *Any

AsAny wraps the message.

func (*MsgEventRecord) Marshal

func (m *MsgEventRecord) Marshal() []byte

Marshal encodes MsgEventRecord.

type MsgProposeSpan

type MsgProposeSpan struct {
	SpanID     uint64
	Proposer   string
	StartBlock uint64
	EndBlock   uint64
	ChainID    string
	Seed       []byte
	SeedAuthor string
}

MsgProposeSpan mirrors heimdallv2.bor.MsgProposeSpan.

func UnmarshalMsgProposeSpan

func UnmarshalMsgProposeSpan(b []byte) (*MsgProposeSpan, error)

UnmarshalMsgProposeSpan parses the message bytes.

func (*MsgProposeSpan) AsAny

func (m *MsgProposeSpan) AsAny() *Any

AsAny wraps the message.

func (*MsgProposeSpan) Marshal

func (m *MsgProposeSpan) Marshal() []byte

Marshal encodes MsgProposeSpan.

type MsgSetProducerDowntime

type MsgSetProducerDowntime struct {
	Producer      string
	DowntimeRange BlockRange
}

MsgSetProducerDowntime mirrors heimdallv2.bor.MsgSetProducerDowntime.

func UnmarshalMsgSetProducerDowntime

func UnmarshalMsgSetProducerDowntime(b []byte) (*MsgSetProducerDowntime, error)

UnmarshalMsgSetProducerDowntime parses the message bytes.

func (*MsgSetProducerDowntime) AsAny

func (m *MsgSetProducerDowntime) AsAny() *Any

AsAny wraps the message.

func (*MsgSetProducerDowntime) Marshal

func (m *MsgSetProducerDowntime) Marshal() []byte

Marshal encodes MsgSetProducerDowntime.

type MsgSignerUpdate

type MsgSignerUpdate struct {
	From            string
	ValID           uint64
	NewSignerPubKey []byte
	TxHash          []byte
	LogIndex        uint64
	BlockNumber     uint64
	Nonce           uint64
}

MsgSignerUpdate mirrors heimdallv2.stake.MsgSignerUpdate.

func UnmarshalMsgSignerUpdate

func UnmarshalMsgSignerUpdate(b []byte) (*MsgSignerUpdate, error)

UnmarshalMsgSignerUpdate parses the message bytes.

func (*MsgSignerUpdate) AsAny

func (m *MsgSignerUpdate) AsAny() *Any

AsAny wraps the message.

func (*MsgSignerUpdate) Marshal

func (m *MsgSignerUpdate) Marshal() []byte

Marshal encodes MsgSignerUpdate.

type MsgStakeUpdate

type MsgStakeUpdate struct {
	From        string
	ValID       uint64
	NewAmount   string
	TxHash      []byte
	LogIndex    uint64
	BlockNumber uint64
	Nonce       uint64
}

MsgStakeUpdate mirrors heimdallv2.stake.MsgStakeUpdate.

func UnmarshalMsgStakeUpdate

func UnmarshalMsgStakeUpdate(b []byte) (*MsgStakeUpdate, error)

UnmarshalMsgStakeUpdate parses the message bytes.

func (*MsgStakeUpdate) AsAny

func (m *MsgStakeUpdate) AsAny() *Any

AsAny wraps the message.

func (*MsgStakeUpdate) Marshal

func (m *MsgStakeUpdate) Marshal() []byte

Marshal encodes MsgStakeUpdate.

type MsgTopupTx

type MsgTopupTx struct {
	Proposer    string
	User        string
	Fee         string
	TxHash      []byte
	LogIndex    uint64
	BlockNumber uint64
}

MsgTopupTx mirrors heimdallv2.topup.MsgTopupTx. Fee is carried as a decimal string (math.Int) identical to MsgWithdrawFeeTx.

func UnmarshalMsgTopupTx

func UnmarshalMsgTopupTx(b []byte) (*MsgTopupTx, error)

UnmarshalMsgTopupTx parses the message bytes.

func (*MsgTopupTx) AsAny

func (m *MsgTopupTx) AsAny() *Any

AsAny wraps the message.

func (*MsgTopupTx) Marshal

func (m *MsgTopupTx) Marshal() []byte

Marshal encodes MsgTopupTx.

type MsgValidatorExit

type MsgValidatorExit struct {
	From              string
	ValID             uint64
	DeactivationEpoch uint64
	TxHash            []byte
	LogIndex          uint64
	BlockNumber       uint64
	Nonce             uint64
}

MsgValidatorExit mirrors heimdallv2.stake.MsgValidatorExit.

func UnmarshalMsgValidatorExit

func UnmarshalMsgValidatorExit(b []byte) (*MsgValidatorExit, error)

UnmarshalMsgValidatorExit parses the message bytes.

func (*MsgValidatorExit) AsAny

func (m *MsgValidatorExit) AsAny() *Any

AsAny wraps the message.

func (*MsgValidatorExit) Marshal

func (m *MsgValidatorExit) Marshal() []byte

Marshal encodes MsgValidatorExit.

type MsgValidatorJoin

type MsgValidatorJoin struct {
	From            string
	ValID           uint64
	ActivationEpoch uint64
	Amount          string
	SignerPubKey    []byte
	TxHash          []byte
	LogIndex        uint64
	BlockNumber     uint64
	Nonce           uint64
}

MsgValidatorJoin mirrors heimdallv2.stake.MsgValidatorJoin.

func UnmarshalMsgValidatorJoin

func UnmarshalMsgValidatorJoin(b []byte) (*MsgValidatorJoin, error)

UnmarshalMsgValidatorJoin parses the message bytes.

func (*MsgValidatorJoin) AsAny

func (m *MsgValidatorJoin) AsAny() *Any

AsAny wraps the message.

func (*MsgValidatorJoin) Marshal

func (m *MsgValidatorJoin) Marshal() []byte

Marshal encodes MsgValidatorJoin.

type MsgVoteProducers

type MsgVoteProducers struct {
	Voter   string
	VoterID uint64
	Votes   ProducerVotes
}

MsgVoteProducers mirrors heimdallv2.bor.MsgVoteProducers.

func UnmarshalMsgVoteProducers

func UnmarshalMsgVoteProducers(b []byte) (*MsgVoteProducers, error)

UnmarshalMsgVoteProducers parses the message bytes. Votes may arrive either packed or unpacked per proto3 rules.

func (*MsgVoteProducers) AsAny

func (m *MsgVoteProducers) AsAny() *Any

AsAny wraps the message.

func (*MsgVoteProducers) Marshal

func (m *MsgVoteProducers) Marshal() []byte

Marshal encodes MsgVoteProducers.

type MsgWithdrawFeeTx

type MsgWithdrawFeeTx struct {
	Proposer string
	// Amount is carried as a string because cosmossdk.io/math.Int is
	// encoded as its decimal string representation on the wire.
	Amount string
}

MsgWithdrawFeeTx is the starter Msg we exercise end-to-end in W2. Matches heimdall-v2/proto/heimdallv2/topup/tx.proto. Additional message types are added in W3/W4 with the same pattern.

func UnmarshalMsgWithdrawFeeTx

func UnmarshalMsgWithdrawFeeTx(b []byte) (*MsgWithdrawFeeTx, error)

UnmarshalMsgWithdrawFeeTx parses a MsgWithdrawFeeTx from bytes.

func (*MsgWithdrawFeeTx) AsAny

func (m *MsgWithdrawFeeTx) AsAny() *Any

AsAny wraps the withdraw-fee message as a google.protobuf.Any for inclusion in TxBody.messages.

func (*MsgWithdrawFeeTx) Marshal

func (m *MsgWithdrawFeeTx) Marshal() []byte

Marshal encodes MsgWithdrawFeeTx.

type ProducerVotes

type ProducerVotes struct {
	Votes []uint64
}

ProducerVotes mirrors heimdallv2.bor.ProducerVotes (repeated uint64 field `votes`, encoded packed or repeated per proto3).

func (ProducerVotes) Marshal

func (p ProducerVotes) Marshal() []byte

Marshal encodes ProducerVotes with packed varints (the proto3 default for repeated scalar fields). Accepts either packed or unpacked on the wire when unmarshalling.

type SideTxResponse

type SideTxResponse struct {
	TxHash []byte
	Result Vote
}

SideTxResponse mirrors heimdallv2.sidetxs.SideTxResponse.

func UnmarshalSideTxResponse

func UnmarshalSideTxResponse(b []byte) (SideTxResponse, error)

UnmarshalSideTxResponse parses the message bytes.

func (SideTxResponse) Marshal

func (s SideTxResponse) Marshal() []byte

Marshal encodes SideTxResponse.

type SignDoc

type SignDoc struct {
	BodyBytes     []byte
	AuthInfoBytes []byte
	ChainID       string
	AccountNumber uint64
}

SignDoc mirrors cosmos.tx.v1beta1.SignDoc — the pre-image signed in SIGN_MODE_DIRECT.

func (*SignDoc) Marshal

func (s *SignDoc) Marshal() []byte

Marshal encodes SignDoc.

type SignerInfo

type SignerInfo struct {
	PublicKey *Any
	ModeInfo  *ModeInfo
	Sequence  uint64
}

SignerInfo mirrors cosmos.tx.v1beta1.SignerInfo.

func (*SignerInfo) Marshal

func (s *SignerInfo) Marshal() []byte

Marshal encodes SignerInfo.

type TxBody

type TxBody struct {
	Messages                    []*Any
	Memo                        string
	TimeoutHeight               uint64
	ExtensionOptions            []*Any
	NonCriticalExtensionOptions []*Any
}

TxBody mirrors cosmos.tx.v1beta1.TxBody.

func (*TxBody) Marshal

func (t *TxBody) Marshal() []byte

Marshal encodes TxBody.

type TxRaw

type TxRaw struct {
	BodyBytes     []byte
	AuthInfoBytes []byte
	Signatures    [][]byte
}

TxRaw mirrors cosmos.tx.v1beta1.TxRaw — the canonical signed tx.

func UnmarshalTxRaw

func UnmarshalTxRaw(b []byte) (*TxRaw, error)

UnmarshalTxRaw parses a TxRaw from bytes.

func (*TxRaw) Marshal

func (t *TxRaw) Marshal() []byte

Marshal encodes TxRaw.

type Vote

type Vote int32

Vote mirrors heimdallv2.sidetxs.Vote.

const (
	VoteUnspecified Vote = 0
	VoteYes         Vote = 1
	VoteNo          Vote = 2
)

Vote values. UNSPECIFIED is encoded as 0 and omitted when unset.

func (Vote) String

func (v Vote) String() string

String returns the enum name, matching the .proto source.

type VoteExtension

type VoteExtension struct {
	BlockHash            []byte
	Height               int64
	SideTxResponses      []SideTxResponse
	MilestoneProposition *MilestoneProposition
}

VoteExtension mirrors heimdallv2.sidetxs.VoteExtension.

func UnmarshalVoteExtension

func UnmarshalVoteExtension(b []byte) (*VoteExtension, error)

UnmarshalVoteExtension parses raw vote-extension bytes as emitted by heimdall-v2's ExtendVote handler.

func (*VoteExtension) Marshal

func (v *VoteExtension) Marshal() []byte

Marshal encodes VoteExtension.

Jump to

Keyboard shortcuts

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