Skip to content

Commit

Permalink
update bootstrapping to use ExecutionParameters smart contract and up…
Browse files Browse the repository at this point in the history
…graded service account
  • Loading branch information
joshuahannan committed Feb 5, 2025
1 parent 914f353 commit cbded5d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 15 additions & 2 deletions fvm/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ func (b *bootstrapExecutor) Execute() error {
b.mintInitialTokens(service, fungibleToken, flowToken, b.initialTokenSupply)
}

b.deployExecutionParameters(fungibleToken, &env)
b.setupExecutionWeights(fungibleToken)
b.deployServiceAccount(service, &env)

b.setupParameters(
Expand All @@ -416,8 +418,6 @@ func (b *bootstrapExecutor) Execute() error {

b.setContractDeploymentRestrictions(service, b.restrictedContractDeployment)

b.setupExecutionWeights(service)

b.setupStorageForServiceAccounts(service, fungibleToken, flowToken, feeContract)

b.createMinter(service, flowToken)
Expand Down Expand Up @@ -723,6 +723,19 @@ func (b *bootstrapExecutor) deployEpoch(deployTo flow.Address, env *templates.En
panicOnMetaInvokeErrf("failed to deploy Epoch contract: %s", txError, err)
}

func (b *bootstrapExecutor) deployExecutionParameters(deployTo flow.Address, env *templates.Environment) {
contract := contracts.FlowExecutionParameters(*env)
txError, err := b.invokeMetaTransaction(
b.ctx,
Transaction(
blueprints.DeployContractTransaction(deployTo, contract, "FlowExecutionParameters"),
0,
),
)
env.FlowExecutionParametersAddress = deployTo.String()
panicOnMetaInvokeErrf("failed to deploy FlowExecutionParameters contract: %s", txError, err)
}

func (b *bootstrapExecutor) deployServiceAccount(deployTo flow.Address, env *templates.Environment) {
contract := contracts.FlowServiceAccount(
*env,
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ require (
github.com/onflow/cadence v1.3.1
github.com/onflow/crypto v0.25.2
github.com/onflow/flow v0.3.4
github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.0
github.com/onflow/flow-core-contracts/lib/go/templates v1.4.0
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.0
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.0
github.com/onflow/flow-go-sdk v1.3.1
github.com/onflow/flow/protobuf/go/flow v0.4.7
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,14 @@ github.com/onflow/flow v0.3.4 h1:FXUWVdYB90f/rjNcY0Owo30gL790tiYff9Pb/sycXYE=
github.com/onflow/flow v0.3.4/go.mod h1:lzyAYmbu1HfkZ9cfnL5/sjrrsnJiUU8fRL26CqLP7+c=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.0 h1:R86HaOuk6vpuECZnriEUE7bw9inC2AtdSn8lL/iwQLQ=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.0/go.mod h1:9asTBnB6Tw2UlVVtQKyS/egYv3xr4zVlJnJ75z1dfac=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.0 h1:uyW2VRp8RTeCJRIOcaW/HbzbVF3VsnCmf0lzfN1Lw9Y=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.5.0/go.mod h1:0/Fd2+5yjAp6Vo9cJxHMxNBxElhtX35H1RvTI6Gpbps=
github.com/onflow/flow-core-contracts/lib/go/templates v1.4.0 h1:u2DAG8pk0xFH7TwS70t1gSZ/FtIIZWMSNyiu4SeXBYg=
github.com/onflow/flow-core-contracts/lib/go/templates v1.4.0/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20250121150329-3add9787ef8b h1:MkopKmomIfTd6HxlXygcF0SDEen/RxTfR9ihjiGsak4=
github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20250121150329-3add9787ef8b/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.0 h1:foKXHHzPxiwLg/2S+FYsmIHRDe0TbkJF+Zb5NSYg/lE=
github.com/onflow/flow-core-contracts/lib/go/templates v1.5.0/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64=
github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24=
github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM=
Expand Down

0 comments on commit cbded5d

Please sign in to comment.