Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove feature flag for ABI-only version of EVM contract #5587

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,7 @@ func SystemContractChanges(chainID flow.ChainID) []SystemContractChange {
// EVM related contracts
NewSystemContractChange(
systemContracts.EVMContract,
evm.ContractCode(
systemContracts.FlowToken.Address,
true,
),
evm.ContractCode(systemContracts.FlowToken.Address),
),
}
}
Expand Down
17 changes: 2 additions & 15 deletions fvm/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,7 @@ type BootstrapParams struct {
minimumStorageReservation cadence.UFix64
storagePerFlow cadence.UFix64
restrictedAccountCreationEnabled cadence.Bool

// `setupEVMEnabled` == true && `evmAbiOnly` == true will enable the ABI-only EVM
// `setupEVMEnabled` == true && `evmAbiOnly` == false will enable the full EVM functionality
// `setupEVMEnabled` == false will disable EVM
// This will allow to quickly disable the ABI-only EVM, in case there's a bug or something.
setupEVMEnabled cadence.Bool
evmAbiOnly cadence.Bool
setupEVMEnabled cadence.Bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can be removed too, but that can be done in a different PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That actually needs a more changes to work, as I think the new account for storage does not have keys. I'll leave this for another PR 🙏


// versionFreezePeriod is the number of blocks in the future where the version
// changes are frozen. The Node version beacon manages the freeze period,
Expand Down Expand Up @@ -225,13 +219,6 @@ func WithSetupEVMEnabled(enabled cadence.Bool) BootstrapProcedureOption {
}
}

func WithEVMABIOnly(evmAbiOnly cadence.Bool) BootstrapProcedureOption {
return func(bp *BootstrapProcedure) *BootstrapProcedure {
bp.evmAbiOnly = evmAbiOnly
return bp
}
}

func WithRestrictedContractDeployment(restricted *bool) BootstrapProcedureOption {
return func(bp *BootstrapProcedure) *BootstrapProcedure {
bp.restrictedContractDeployment = restricted
Expand Down Expand Up @@ -830,7 +817,7 @@ func (b *bootstrapExecutor) setupEVM(serviceAddress, fungibleTokenAddress, flowT
// deploy the EVM contract to the service account
tx := blueprints.DeployContractTransaction(
serviceAddress,
stdlib.ContractCode(flowTokenAddress, bool(b.evmAbiOnly)),
stdlib.ContractCode(flowTokenAddress),
stdlib.ContractName,
)
// WithEVMEnabled should only be used after we create an account for storage
Expand Down
60 changes: 0 additions & 60 deletions fvm/evm/stdlib/abiOnlyContract.cdc

This file was deleted.

9 changes: 1 addition & 8 deletions fvm/evm/stdlib/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@ import (
//go:embed contract.cdc
var contractCode string

//go:embed abiOnlyContract.cdc
var abiOnlyContractCode string

var flowTokenImportPattern = regexp.MustCompile(`(?m)^import "FlowToken"\n`)

func ContractCode(flowTokenAddress flow.Address, evmAbiOnly bool) []byte {
if evmAbiOnly {
return []byte(abiOnlyContractCode)
}

func ContractCode(flowTokenAddress flow.Address) []byte {
return []byte(flowTokenImportPattern.ReplaceAllString(
contractCode,
fmt.Sprintf("import FlowToken from %s", flowTokenAddress.HexWithPrefix()),
Expand Down
Loading
Loading