predecessors

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyHighestOpCountsToProposal

func ApplyHighestOpCountsToProposal(
	lggr logger.Logger,
	proposalPath string,
	newOpCounts map[mcmstypes.ChainSelector]uint64,
) error

ApplyHighestOpCountsToProposal updates the proposal file with the new starting op counts.

func ComputeHighestOpCountsFromPredecessors

func ComputeHighestOpCountsFromPredecessors(
	lggr logger.Logger,
	newProposalData ProposalsOpData,
	predecessors []PRView,
) map[mcmstypes.ChainSelector]uint64

ComputeHighestOpCountsFromPredecessors looks at the given predecessors, and for each chain present in 'newProposalData', computes the new starting op count as: current StartingOpCount (from the new proposal) + SUM of the number of ops across ALL predecessors that share the same chain selector AND the same MCM address. We assume that the predecessors are sorted from oldest to newest, so we can log them in that order. Returns:

  • newStartPerChain: map[chain] = baseline + sum(ops)

Types

type CLDContext

type CLDContext struct {
	Owner       string
	Name        string
	Domain      string
	Environment string
	QueueID     string
}

CLDContext holds the context for the GitHub repository where the PRs are managed.

type McmOpData

type McmOpData struct {
	MCMAddress      string
	StartingOpCount uint64
	OpsCount        uint64
}

func (McmOpData) EndingOpCount

func (d McmOpData) EndingOpCount() uint64

EndingOpCount returns the exclusive end opcount: StartingOpCount + OpsCount. Treat it as the end of a half-open interval [StartingOpCount, EndingOpCount()).

type PRHead

type PRHead struct {
	Owner string
	Repo  string
	SHA   string
	Ref   string
}

PRHead holds the repo/owner/SHA for the PR head.

type PRNum

type PRNum int64

type PRView

type PRView struct {
	Number           PRNum
	CreatedAt        time.Time
	Body             string
	Head             PRHead
	Proposal         *mcms.TimelockProposal
	ProposalData     ProposalsOpData
	ProposalFilename string
	ProposalContent  string
}

type ProposalsOpData

type ProposalsOpData map[mcmstypes.ChainSelector]McmOpData

func ParseProposalOpsData

func ParseProposalOpsData(ctx context.Context, filePath string) (ProposalsOpData, error)

ParseProposalOpsData uses mcms for a local file path (current proposal) to get op counts.

type ProposalsPRGraph

type ProposalsPRGraph struct {
	Nodes map[PRNum]*prNode // node lookup by PR number
	Topo  []PRNum           // topologically sorted PR numbers (older -> newer respecting deps)
}

ProposalsPRGraph is a dependency graph of proposals where an edge u -> v means: "u must precede v" (they share at least one MCM on some chain and u is older).

func BuildPRDependencyGraph

func BuildPRDependencyGraph(views []PRView) (*ProposalsPRGraph, error)

BuildPRDependencyGraph creates a DAG with edges ONLY from older -> newer, and only when relatedByMCMOnAnyChain(...) is true. Ties on CreatedAt are broken by PR number (smaller = older).

Jump to

Keyboard shortcuts

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