From 538aa67858029a9b34b5e1c17c1517c95cffd764 Mon Sep 17 00:00:00 2001 From: Terry Tata Date: Wed, 7 May 2025 19:08:52 -0400 Subject: [PATCH] overallocate --- deployment/solana_chain.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deployment/solana_chain.go b/deployment/solana_chain.go index 5ee06de..759b39d 100644 --- a/deployment/solana_chain.go +++ b/deployment/solana_chain.go @@ -91,7 +91,9 @@ func GetSolanaProgramBytes() map[string]int { } } -func (c SolChain) DeployProgram(logger logger.Logger, programName string, isUpgrade bool) (string, error) { +// Overallocate should be set when deploying any program that may eventually be owned by timelock +// Overallocate is mutually exclusive with isUpgrade +func (c SolChain) DeployProgram(logger logger.Logger, programName string, isUpgrade bool, overallocate bool) (string, error) { programFile := filepath.Join(c.ProgramsPath, programName+".so") if _, err := os.Stat(programFile); err != nil { return "", fmt.Errorf("program file not found: %w", err) @@ -124,7 +126,7 @@ func (c SolChain) DeployProgram(logger logger.Logger, programName string, isUpgr "programKeyPair", programKeyPair) baseArgs = append(baseArgs, "--program-id", programKeyPair) totalBytes := GetSolanaProgramBytes()[programName] - if totalBytes > 0 { + if overallocate && totalBytes > 0 { baseArgs = append(baseArgs, "--max-len", strconv.Itoa(totalBytes)) } cmd = exec.Command("solana", baseArgs...) // #nosec G204