github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/fvm/blueprints/system.go (about) 1 package blueprints 2 3 import ( 4 _ "embed" 5 6 "github.com/onflow/flow-core-contracts/lib/go/templates" 7 8 "github.com/onflow/flow-go/fvm/systemcontracts" 9 "github.com/onflow/flow-go/model/flow" 10 ) 11 12 const SystemChunkTransactionGasLimit = 100_000_000 13 14 // systemChunkTransactionTemplate looks for the epoch and version beacon heartbeat resources 15 // and calls them. 16 // 17 //go:embed scripts/systemChunkTransactionTemplate.cdc 18 var systemChunkTransactionTemplate string 19 20 // SystemChunkTransaction creates and returns the transaction corresponding to the 21 // system chunk for the given chain. 22 func SystemChunkTransaction(chain flow.Chain) (*flow.TransactionBody, error) { 23 contracts := systemcontracts.SystemContractsForChain(chain.ChainID()) 24 25 tx := flow.NewTransactionBody(). 26 SetScript( 27 []byte(templates.ReplaceAddresses( 28 systemChunkTransactionTemplate, 29 contracts.AsTemplateEnv(), 30 )), 31 ). 32 // The heartbeat resources needed by the system tx have are on the service account, 33 // therefore, the service account is the only authorizer needed. 34 AddAuthorizer(chain.ServiceAddress()). 35 SetComputeLimit(SystemChunkTransactionGasLimit) 36 37 return tx, nil 38 }