Documentation
¶
Index ¶
- Constants
- func ChainNetworkIDFromHex(chainIDHex string) ([32]byte, error)
- func CleanupMCMSTestPool(t *testing.T, ctx context.Context, env *E2ETestEnv, gov *MCMSGovernanceStack, ...)
- func ContractIDToBytes32(contractID string) ([32]byte, error)
- func CurseChain(t *testing.T, env *cldfdeployment.Environment, ...)
- func EncodeTimelockInvokePayload(functionName string, argScVals []xdr.ScVal) ([]byte, error)
- func EthSignedMessageHash32(digest [32]byte) [32]byte
- func FindProjectRoot(t *testing.T) string
- func FindProjectRootErr() (string, error)
- func FundViaFriendbot(friendbotURL, address string) error
- func GenerateMockContractID(t *testing.T, deployerAddress, contractName string) string
- func HashRootMetadata(m mcmsbindings.StellarRootMetadata) ([32]byte, error)
- func HashSetRootInner(root [32]byte, validUntil uint32) [32]byte
- func HashStellarOp(op mcmsbindings.StellarOp) ([32]byte, error)
- func KeypairFromPrivateKeyHex(t *testing.T, privateKeyHex string) *keypair.Full
- func MCMSTimelockScheduleAndExecute(t *testing.T, ctx context.Context, env *E2ETestEnv, gov *MCMSGovernanceStack, ...)
- func MCMSTimelockScheduleAndExecuteErr(ctx context.Context, env *E2ETestEnv, gov *MCMSGovernanceStack, ...) error
- func MCMSValidUntilSeconds(ctx context.Context, rpc *rpcclient.Client) (uint32, error)
- func MerkleProofTwoLeaves(leaves [2][32]byte, leafIndex int) [][32]byte
- func MerkleRootTwoLeaves(l0, l1 [32]byte) [32]byte
- func PaddedEthAddress(pub *ecdsa.PublicKey) [32]byte
- func ResolveEVMTestToken(ds datastore.DataStore, evmChainSelector uint64) (protocol.UnknownAddress, error)
- func SetupTestEnv(ctx context.Context, t *testing.T) (string, *keypair.Full, *stellardeployment.Deployer, *rpcclient.Client, string)
- func SignaturesForSetRoot(pk *ecdsa.PrivateKey, root [32]byte, validUntil uint32) (mcmsbindings.SignatureVec, error)
- func SorobanExecuteBatch(caller string, calls timelockbindings.Calls, predecessor, salt [32]byte) ([]byte, error)
- func SorobanScheduleBatch(caller string, calls timelockbindings.Calls, predecessor, salt [32]byte, ...) ([]byte, error)
- func UncurseChain(t *testing.T, env *cldfdeployment.Environment, ...)
- func WaitForFriendbot(ctx context.Context, friendbotBaseURL string, timeout time.Duration) error
- func WaitTimelockOperationReady(ctx context.Context, t *testing.T, tlClient *timelockbindings.TimelockClient, ...)
- type E2ETestEnv
- type MCMSGovernanceStack
- type SharedTestEnv
Constants ¶
const Anvil0SKHex = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
Anvil0SKHex is Anvil account #0 secret (must match contracts/mcms/src/test.rs ANVIL_SK_0).
const DefaultMCMSTimelockMinDelaySec uint64 = 3
const STELLAR_LOCALNET_PASSPHRASE = "Standalone Network ; February 2017"
Sha256 hash of the network passphrase
Variables ¶
This section is empty.
Functions ¶
func ChainNetworkIDFromHex ¶
ChainNetworkIDFromHex parses a 32-byte Stellar chain network id from hex (e.g. chain-selectors ChainID).
func CleanupMCMSTestPool ¶
func CleanupMCMSTestPool( t *testing.T, ctx context.Context, env *E2ETestEnv, gov *MCMSGovernanceStack, poolContractID string, poolRaw [32]byte, remoteSelector uint64, deployerAddr string, predecessor, saltTransfer [32]byte, )
CleanupMCMSTestPool restores the shared devenv lock-release pool after MCMS e2e tests. Assumes the timelock owns the pool and outbound rate limits are enabled: transfers ownership back to the deployer via MCMS, deployer accept_ownership, then disables rate limits directly. Errors are logged but do not fail the test (runs from t.Cleanup).
func ContractIDToBytes32 ¶
ContractIDToBytes32 decodes a Soroban contract strkey into a 32-byte contract id.
func CurseChain ¶
func CurseChain(t *testing.T, env *cldfdeployment.Environment, chainSelector, subjectChainSelector uint64)
CurseChain curses a subject chain from the perspective of the given chain using fastcurse changeset. This replaces the deprecated Chain.Curse() method.
func EncodeTimelockInvokePayload ¶
EncodeTimelockInvokePayload builds timelock Call.data for a Soroban contract function invocation.
func EthSignedMessageHash32 ¶
EthSignedMessageHash32 returns keccak256(EIP-191 prefix || digest) for a 32-byte payload (contracts/mcms EIP-191 path).
func FindProjectRoot ¶
FindProjectRoot finds the root of the chainlink-stellar project.
func FindProjectRootErr ¶
FindProjectRootErr finds the root of the chainlink-stellar project, returning an error on failure.
func FundViaFriendbot ¶
func GenerateMockContractID ¶
generateMockContractID generates a deterministic mock contract ID for testing.
func HashRootMetadata ¶
func HashRootMetadata(m mcmsbindings.StellarRootMetadata) ([32]byte, error)
HashRootMetadata returns keccak256(abi.encode(D_META, StellarRootMetadata)) per contracts/mcms/src/abi_encoding.rs.
func HashSetRootInner ¶
HashSetRootInner returns keccak256(abi.encode(bytes32 root, uint32 validUntil)).
func HashStellarOp ¶
func HashStellarOp(op mcmsbindings.StellarOp) ([32]byte, error)
HashStellarOp returns keccak256(abi.encode(D_OP, StellarOp)) per contracts/mcms/src/abi_encoding.rs.
func MCMSTimelockScheduleAndExecute ¶
func MCMSTimelockScheduleAndExecute( t *testing.T, ctx context.Context, env *E2ETestEnv, gov *MCMSGovernanceStack, calls timelockbindings.Calls, predecessor, salt [32]byte, )
MCMSTimelockScheduleAndExecute drives schedule_batch → wait → execute_batch through MCMS SetRoot + Execute (two-leaf Merkle tree, EIP-191 signing). Uses the current MCMS op count as the schedule nonce; execute uses nonce+1.
func MCMSTimelockScheduleAndExecuteErr ¶
func MCMSTimelockScheduleAndExecuteErr( ctx context.Context, env *E2ETestEnv, gov *MCMSGovernanceStack, calls timelockbindings.Calls, predecessor, salt [32]byte, ) error
MCMSTimelockScheduleAndExecuteErr is the error-returning variant used by test cleanup hooks.
func MCMSValidUntilSeconds ¶
MCMSValidUntilSeconds returns a deadline for MCMS set_root: must be >= host ledger timestamp and ≤ now + 90d (contracts/mcms MAX_ROOT_VALIDITY_SECS).
func MerkleProofTwoLeaves ¶
MerkleProofTwoLeaves returns the sibling path for a two-leaf tree (compute_proof_for_leaf in mcms tests).
func MerkleRootTwoLeaves ¶
MerkleRootTwoLeaves builds the root from exactly two leaf digests (matches mcms merkle_root_native for n=2).
func PaddedEthAddress ¶
PaddedEthAddress returns the 32-byte left-padded address form used in MCMS signer config (match Rust padded_eth_address).
func ResolveEVMTestToken ¶
func ResolveEVMTestToken(ds datastore.DataStore, evmChainSelector uint64) (protocol.UnknownAddress, error)
ResolveEVMTestToken finds the BurnMint test token configured for EVM-to-Stellar transfers on the given EVM chain. It returns the raw token address as a protocol.UnknownAddress suitable for SendMessage.TokenAmount.TokenAddress and GetTokenBalance.
func SetupTestEnv ¶
func SignaturesForSetRoot ¶
func SignaturesForSetRoot(pk *ecdsa.PrivateKey, root [32]byte, validUntil uint32) (mcmsbindings.SignatureVec, error)
SignaturesForSetRoot signs the EIP-191 digest over hash_set_root_inner with the Anvil #0 test key (1-of-1).
func SorobanExecuteBatch ¶
func SorobanExecuteBatch( caller string, calls timelockbindings.Calls, predecessor, salt [32]byte, ) ([]byte, error)
SorobanExecuteBatch encodes timelock execute_batch Call.data for MCMS StellarOp payloads.
func SorobanScheduleBatch ¶
func SorobanScheduleBatch( caller string, calls timelockbindings.Calls, predecessor, salt [32]byte, delay uint64, ) ([]byte, error)
SorobanScheduleBatch encodes timelock schedule_batch Call.data for MCMS StellarOp payloads.
func UncurseChain ¶
func UncurseChain(t *testing.T, env *cldfdeployment.Environment, chainSelector, subjectChainSelector uint64)
UncurseChain uncurses a subject chain from the perspective of the given chain using fastcurse changeset. This replaces the deprecated Chain.Uncurse() method.
func WaitForFriendbot ¶
waitForFriendbot waits for the friendbot service to be ready. The Stellar quickstart container starts multiple services and friendbot initializes after the main RPC endpoint is ready.
func WaitTimelockOperationReady ¶
func WaitTimelockOperationReady( ctx context.Context, t *testing.T, tlClient *timelockbindings.TimelockClient, calls timelockbindings.Calls, predecessor, salt [32]byte, )
WaitTimelockOperationReady polls until the scheduled timelock batch is executable.
Types ¶
type E2ETestEnv ¶
type E2ETestEnv struct {
DeployerKP *keypair.Full
Deployer *stellardeployment.Deployer
RPCClient *rpcclient.Client
NetworkPassphrase string
StellarRoot string
DataStore datastore.DataStore
SourceChain cciptestinterfaces.CCIP17
DestChain cciptestinterfaces.CCIP17
SourceChainDetails *chain_selectors.ChainDetails
DestChainDetails *chain_selectors.ChainDetails
Chains map[uint64]cciptestinterfaces.CCIP17
AggregatorClients map[string]*ccv.AggregatorClient
IndexerMonitor *ccv.IndexerMonitor
FriendbotURL string
CLDFEnv *cldfdeployment.Environment
}
type MCMSGovernanceStack ¶
type MCMSGovernanceStack struct {
MCMSID string
TimelockID string
MCMSClient *mcmsbindings.McmsClient
TimelockClient *timelockbindings.TimelockClient
MCMSRaw [32]byte
TimelockRaw [32]byte
ChainNetID [32]byte
SignerPK *ecdsa.PrivateKey
MinDelaySec uint64
}
MCMSGovernanceStack holds deployed MCMS + timelock contracts wired for MCMS-mediated governance.
func DeployMCMSAndTimelock ¶
func DeployMCMSAndTimelock( t *testing.T, ctx context.Context, env *E2ETestEnv, chainSelector uint64, qualifier string, ) *MCMSGovernanceStack
DeployMCMSAndTimelock deploys and initializes MCMS + RBAC timelock via CLDF operations (mcmsops/timelockops Deploy, Initialize, SetConfig), using mcmsutil WASM paths and deploy salts.
MCMS is configured as both proposer and executor on the timelock so MCMS.execute can drive schedule_batch and execute_batch (same wiring as integration TestMcmsMerkleTimelockScheduleAndExecute).
type SharedTestEnv ¶
type SharedTestEnv struct {
}
SharedTestEnv holds the result of SetupTestEnvShared for use across multiple integration tests.
func SetupTestEnvShared ¶
func SetupTestEnvShared(ctx context.Context, containerName string) (*SharedTestEnv, error)
SetupTestEnvShared performs the same setup as SetupTestEnv but without *testing.T. It returns the blockchain Output for teardown. Use containerName for a stable container name when sharing across tests (e.g. "blockchain-stellar-integration-shared").