polygon

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRootChainTxConfirmations  uint64        = 6
	DefaultChildChainTxConfirmations uint64        = 10
	DefaultAvgCheckpointLength       uint64        = 256
	DefaultMaxCheckpointLength       uint64        = 1024
	DefaultChildBlockInterval        uint64        = 10000
	DefaultCheckpointBufferTime      time.Duration = 1000 * time.Second
)
View Source
const HeimdallGrpcAddressDefault = "localhost:8540"
View Source
const LegacyMaxStateSyncSize = 100000

Maximum allowed event record data size

View Source
const MaxStateSyncSize = 30000

New max state sync size after hardfork

Variables

View Source
var BridgeEvents = struct {
	StakingEvent  BridgeEvent
	TopupEvent    BridgeEvent
	ClerkEvent    BridgeEvent
	SlashingEvent BridgeEvent
}{
	StakingEvent:  "staking",
	TopupEvent:    "topup",
	ClerkEvent:    "clerk",
	SlashingEvent: "slashing",
}
View Source
var ErrTokenIndexOutOfRange = errors.New("Index is grater than the number of tokens in transaction")

Functions

func UnpackLog

func UnpackLog(abiObject *abi.ABI, out interface{}, event string, log *types.Log) error

UnpackLog unpacks log

Types

type BridgeEvent

type BridgeEvent string

type CheckpointAck

type CheckpointAck struct {
	From       libcommon.Address `json:"from"`
	Number     uint64            `json:"number"`
	Proposer   libcommon.Address `json:"proposer"`
	StartBlock uint64            `json:"start_block"`
	EndBlock   uint64            `json:"end_block"`
	RootHash   libcommon.Hash    `json:"root_hash"`
	TxHash     libcommon.Hash    `json:"tx_hash"`
	LogIndex   uint64            `json:"log_index"`
}

type CheckpointBlock

type CheckpointBlock struct {
	Proposer        libcommon.Address `json:"proposer"`
	StartBlock      uint64            `json:"start_block"`
	EndBlock        uint64            `json:"end_block"`
	RootHash        libcommon.Hash    `json:"root_hash"`
	AccountRootHash libcommon.Hash    `json:"account_root_hash"`
	BorChainID      string            `json:"bor_chain_id"`
}

func (CheckpointBlock) GetSideSignBytes

func (c CheckpointBlock) GetSideSignBytes() []byte

func (CheckpointBlock) GetSignBytes

func (c CheckpointBlock) GetSignBytes() ([]byte, error)

func (CheckpointBlock) GetSigners

func (c CheckpointBlock) GetSigners() []byte

func (CheckpointBlock) ValidateBasic

func (c CheckpointBlock) ValidateBasic() error

type CheckpointConfig

type CheckpointConfig struct {
	RootChainTxConfirmations  uint64
	ChildChainTxConfirmations uint64
	ChildBlockInterval        uint64
	AvgCheckpointLength       uint64
	MaxCheckpointLength       uint64
	CheckpointBufferTime      time.Duration
	CheckpointAccount         *accounts.Account
}

type ContractCheckpoint

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

type EventRecordWithBlock

type EventRecordWithBlock struct {
	clerk.EventRecordWithTime
	BlockNumber uint64
}

type HeaderBlock

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

type Heimdall

type Heimdall struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewHeimdall

func NewHeimdall(
	chainConfig *chain.Config,
	grpcAddr string,
	checkpointConfig *CheckpointConfig,
	logger log.Logger,
) *Heimdall

func (*Heimdall) AwaitCheckpoint

func (h *Heimdall) AwaitCheckpoint(ctx context.Context, blockNumber *big.Int) error

func (*Heimdall) Close

func (h *Heimdall) Close()

func (*Heimdall) FetchCheckpoint

func (h *Heimdall) FetchCheckpoint(ctx context.Context, number int64) (*checkpoint.Checkpoint, error)

func (*Heimdall) FetchCheckpointCount

func (h *Heimdall) FetchCheckpointCount(ctx context.Context) (int64, error)

func (*Heimdall) FetchLastNoAckMilestone

func (h *Heimdall) FetchLastNoAckMilestone(ctx context.Context) (string, error)

func (*Heimdall) FetchMilestone

func (h *Heimdall) FetchMilestone(ctx context.Context) (*milestone.Milestone, error)

func (*Heimdall) FetchMilestoneCount

func (h *Heimdall) FetchMilestoneCount(ctx context.Context) (int64, error)

func (*Heimdall) FetchMilestoneID

func (h *Heimdall) FetchMilestoneID(ctx context.Context, milestoneID string) error

func (*Heimdall) FetchNoAckMilestone

func (h *Heimdall) FetchNoAckMilestone(ctx context.Context, milestoneID string) error

func (*Heimdall) NodeCreated

func (h *Heimdall) NodeCreated(ctx context.Context, node devnet.Node)

func (*Heimdall) NodeStarted

func (h *Heimdall) NodeStarted(ctx context.Context, node devnet.Node)

func (*Heimdall) RootChainAddress

func (h *Heimdall) RootChainAddress() libcommon.Address

func (*Heimdall) Span

func (h *Heimdall) Span(ctx context.Context, spanID uint64) (*span.HeimdallSpan, error)

func (*Heimdall) Start

func (h *Heimdall) Start(ctx context.Context) error

func (*Heimdall) StateSenderAddress

func (h *Heimdall) StateSenderAddress() libcommon.Address

func (*Heimdall) StateSenderContract

func (f *Heimdall) StateSenderContract() *contracts.TestStateSender

func (*Heimdall) StateSyncEvents

func (h *Heimdall) StateSyncEvents(ctx context.Context, fromID uint64, to int64, limit int) (uint64, []*clerk.EventRecordWithTime, error)

func (*Heimdall) Stop

func (h *Heimdall) Stop()

type ProofGenerator

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

func NewProofGenerator

func NewProofGenerator() *ProofGenerator

func (*ProofGenerator) GenerateExitPayload

func (pg *ProofGenerator) GenerateExitPayload(ctx context.Context, burnTxHash libcommon.Hash, eventSignature libcommon.Hash, tokenIndex int) ([]byte, error)

func (*ProofGenerator) NodeCreated

func (pg *ProofGenerator) NodeCreated(ctx context.Context, node devnet.Node)

func (*ProofGenerator) NodeStarted

func (pg *ProofGenerator) NodeStarted(ctx context.Context, node devnet.Node)

func (*ProofGenerator) Start

func (pg *ProofGenerator) Start(ctx context.Context) error

func (*ProofGenerator) Stop

func (pg *ProofGenerator) Stop()

Jump to

Keyboard shortcuts

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