utils

package
v0.0.0-...-005bb9a Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTimelockScheduleDelay = 30 * 24 * time.Hour

MaxTimelockScheduleDelay caps every timelock delay value produced by tooling in this package. It applies in two places:

  1. The per-op scheduling delay carried in a Schedule proposal (TimelockConfig.MinDelay), enforced by TimelockConfig.Validate.
  2. The new_min_delay payload of any mcms::mcms_timelock_update_min_delay batch entry, enforced by assertUpdateMinDelayWithinCap in op_proposal_generate.

The Move source has no upper bound on either value. This cap is the deploy-side belt against the compound F8 finding: values large enough to trip the u64 overflow in `get_timestamp_seconds(clock) + delay` (in timelock_schedule), or to make min_delay > any u64 the schedule cap would allow, permanently brick the timelock.

Variables

View Source
var DefaultTimelockExpirationInHours = 72

Functions

func AssertMinDelayWithinCap

func AssertMinDelayWithinCap(newMinDelaySeconds uint64) error

AssertMinDelayWithinCap rejects any candidate on-chain min_delay value above MaxTimelockScheduleDelay. It is the single source of truth for the numeric bound so both the preventative payload check (in op_proposal_generate.assertUpdateMinDelayWithinCap) and the defensive state-read check (in op_set_config, Interpretation B) share the same definition of "too large". See finding F8 in findings-deduped.md.

func ExtractTransactionCall

func ExtractTransactionCall(output interface{}, operationID string) (sui_ops.TransactionCall, error)

func FindCurserCapInFastRegistry

func FindCurserCapInFastRegistry(
	ctx context.Context,
	suiClient client.SuiPTBClient,
	fastRegistryObjectID string,
	ccipPackageID string,
) (string, error)

FindCurserCapInFastRegistry reads the CurserCap object ID from the fast MCMS Registry bag.

func FindCurserCapObjectIDFromTx

func FindCurserCapObjectIDFromTx(ctx context.Context, suiClient client.SuiPTBClient, txDigest string) (string, error)

FindCurserCapObjectIDFromTx extracts the minted CurserCap object ID from transaction effects.

func GenerateProposal

func GenerateProposal(ctx context.Context, input GenerateProposalInput) (*mcms.TimelockProposal, error)

func ResolveCurserCapObjectID

func ResolveCurserCapObjectID(
	ctx context.Context,
	suiClient client.SuiPTBClient,
	txDigest string,
	fastRegistryObjectID string,
	ccipPackageID string,
) (string, error)

ResolveCurserCapObjectID returns the CurserCap registered in the fast MCMS Registry. mint_and_register_curser_cap stores the cap in the registry bag, so it may not appear as a top-level created object in transaction effects.

func TransactionCallToMCMSTransaction

func TransactionCallToMCMSTransaction(call sui_ops.TransactionCall) (types.Transaction, error)

TransactionCallToMCMSTransaction converts an encoded Sui op call into an MCMS transaction. When call.LatestPackageID is set, it is propagated for upgraded-package PTB routing.

func TransactionLatestPackageID

func TransactionLatestPackageID(tx types.Transaction) (string, error)

TransactionLatestPackageID returns the optional upgraded package ID stored on an MCMS transaction.

Types

type GenerateProposalInput

type GenerateProposalInput struct {
	ChainSelector      uint64
	Client             cslclient.BindingsClient
	MCMSPackageID      string
	MCMSStateObjID     string
	AccountObjID       string
	RegistryObjID      string
	TimelockObjID      string
	DeployerStateObjID string
	Description        string
	BatchOp            types.BatchOperation
	TimelockConfig     TimelockConfig
}

type TimelockConfig

type TimelockConfig struct {
	MCMSAction   types.TimelockAction `json:"mcmsAction"`
	MinDelay     time.Duration        `json:"minDelay"`     // delay for timelock worker to execute the transfers.
	OverrideRoot bool                 `json:"overrideRoot"` // if true, override the previous root with the new one.
}

TimelockConfig is based on chainlink/deployment proposal utils

func (TimelockConfig) Validate

func (c TimelockConfig) Validate() error

Validate rejects configurations that would produce a proposal the Sui MCMS timelock cannot safely execute. Currently enforces the F8 scheduling-delay ceiling; a negative delay is also rejected since time.Duration is signed and would silently underflow when converted to u64 seconds on chain.

Jump to

Keyboard shortcuts

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