manager

package
v0.0.0-...-2838e17 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package manager implements the Manager Service for the guardian node. The Manager Service subscribes to incoming VAAs and processes them according to manager requirements.

Index

Constants

This section is empty.

Variables

View Source
var DelegatedManagerSetContracts = map[common.Environment]string{

	common.TestNet: "0x086a699900262d829512299abe07648870000dd1",
}

DelegatedManagerSetContracts maps environments to their DelegatedManagerSet contract addresses. The contract stores manager set configurations that are fetched dynamically at runtime.

Functions

This section is empty.

Types

type ManagerService

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

ManagerService manages manager-related processing of VAAs.

func NewManagerService

func NewManagerService(
	ctx context.Context,
	logger *zap.Logger,
	vaaC <-chan *vaa.VAA,
	env common.Environment,
	signers map[vaa.ChainID]guardiansigner.GuardianSigner,
	managerTxSendC chan<- *gossipv1.ManagerTransaction,
	managerTxRecvC <-chan *gossipv1.ManagerTransaction,
	database *db.Database,
	delegatedManagerSetRPC string,
) (*ManagerService, error)

NewManagerService creates a new ManagerService instance. The delegatedManagerSetRPC parameter is the Ethereum RPC URL (ethRPC) for fetching manager sets from the DelegatedManagerSet contract. It can be empty for DevNet.

func (*ManagerService) GetFeatureString

func (c *ManagerService) GetFeatureString() string

GetFeatureString returns the feature flag string for heartbeat messages. Format: "manager:CHAIN_ID/COMPRESSED_PUBKEY_HEX" for single chain or "manager:CHAIN_ID1/PUBKEY1|CHAIN_ID2/PUBKEY2" for multiple chains.

func (*ManagerService) GetPendingTransactionByHash

func (c *ManagerService) GetPendingTransactionByHash(hashHex string) *db.AggregatedTransaction

GetPendingTransactionByHash returns the aggregated transaction for a given VAA hash. Returns nil if no transaction exists for the hash.

func (*ManagerService) GetPendingTransactionByID

func (c *ManagerService) GetPendingTransactionByID(vaaID string) *db.AggregatedTransaction

GetPendingTransactionByID retrieves an aggregated transaction by VAA ID. Returns nil if no transaction exists with the given ID. This uses an index for O(1) lookup.

func (*ManagerService) Run

func (c *ManagerService) Run(ctx context.Context) error

Run starts the manager service and begins processing incoming VAAs.

type ManagerSetConfig

type ManagerSetConfig struct {
	// Index is the manager set index (for governance tracking)
	Index uint32
	// M is the number of signatures required (threshold)
	M uint8
	// N is the total number of signers
	N uint8
	// PublicKeys are the compressed secp256k1 public keys of the manager signers
	PublicKeys [][]byte
	// IsSigner indicates whether this node is part of the manager set
	IsSigner bool
	// SignerIndex is this node's index within the manager set (0-based)
	// Only valid if IsSigner is true
	SignerIndex uint8
}

ManagerSetConfig holds the manager set configuration for a specific chain. This includes the M-of-N multisig parameters and the public keys of all signers.

type ManagerSetReader

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

ManagerSetReader reads manager sets from the DelegatedManagerSet contract on Ethereum. It provides thread-safe caching of manager sets to minimize RPC calls.

func NewManagerSetReader

func NewManagerSetReader(
	logger *zap.Logger,
	env common.Environment,
	rpcURL string,
) (*ManagerSetReader, error)

NewManagerSetReader creates a new reader using the provided RPC URL. The RPC URL should be from the Ethereum watcher config.

func (*ManagerSetReader) GetManagerSet

func (r *ManagerSetReader) GetManagerSet(
	ctx context.Context,
	chainID vaa.ChainID,
	index uint32,
	signer guardiansigner.GuardianSigner,
) (*ManagerSetConfig, error)

GetManagerSet retrieves a manager set by chain ID and index. It first checks the cache; on cache miss, it fetches from the contract and caches the result. The signer parameter is used to determine if this node is part of the manager set.

type ManagerSignature

type ManagerSignature struct {
	// VAAHash is the hash of the VAA that triggered this signing.
	VAAHash []byte
	// VAAID is the VAA ID in format "{chain}/{emitter}/{sequence}".
	VAAID string
	// DestinationChain is the target chain (e.g., Dogecoin).
	DestinationChain vaa.ChainID
	// ManagerSetIndex is the delegated manager set index from the payload.
	ManagerSetIndex uint32
	// SignerIndex is this signer's index within the manager set.
	SignerIndex uint8
	// InputSignatures contains one signature per input UTXO, in order.
	// Each signature is in the format expected by the destination chain (DER-encoded for Dogecoin).
	InputSignatures [][]byte
}

ManagerSignature represents signatures produced by a single manager signer for a VAA. Multiple ManagerSignatures from different signers are aggregated to form a complete multisig transaction.

Directories

Path Synopsis
Package dogecoin implements Dogecoin transaction building and signing for the manager service.
Package dogecoin implements Dogecoin transaction building and signing for the manager service.

Jump to

Keyboard shortcuts

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