Skip to content

Commit

Permalink
Remove feature flag for ABI-only version of EVM contract
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Mar 27, 2024
1 parent 51a3fb6 commit f4e4fc7
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 283 deletions.
5 changes: 1 addition & 4 deletions cmd/util/ledger/migrations/change_contract_code_migration.go
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

// 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

0 comments on commit f4e4fc7

Please sign in to comment.