Skip to content
Open
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
54 changes: 2 additions & 52 deletions fvm/fvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"github.com/onflow/cadence/test_utils/runtime_utils"
"github.com/onflow/crypto"
"github.com/onflow/flow-core-contracts/lib/go/contracts"
bridge "github.com/onflow/flow-evm-bridge"

Check failure on line 30 in fvm/fvm_test.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

"github.com/onflow/flow-evm-bridge" imported as bridge and not used

Check failure on line 30 in fvm/fvm_test.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

"github.com/onflow/flow-evm-bridge" imported as bridge and not used

Check failure on line 30 in fvm/fvm_test.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

"github.com/onflow/flow-evm-bridge" imported as bridge and not used

Check failure on line 30 in fvm/fvm_test.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

"github.com/onflow/flow-evm-bridge" imported as bridge and not used

Check failure on line 30 in fvm/fvm_test.go

View workflow job for this annotation

GitHub Actions / Unit Tests (fvm)

"github.com/onflow/flow-evm-bridge" imported as bridge and not used

Check failure on line 30 in fvm/fvm_test.go

View workflow job for this annotation

GitHub Actions / Lint (./)

"github.com/onflow/flow-evm-bridge" imported as bridge and not used (typecheck)
flowsdk "github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/test"

Expand Down Expand Up @@ -3365,32 +3365,7 @@

env := sc.AsTemplateEnv()

bridgeEnv := bridge.Environment{
CrossVMNFTAddress: env.ServiceAccountAddress,
CrossVMTokenAddress: env.ServiceAccountAddress,
FlowEVMBridgeHandlerInterfacesAddress: env.ServiceAccountAddress,
IBridgePermissionsAddress: env.ServiceAccountAddress,
ICrossVMAddress: env.ServiceAccountAddress,
ICrossVMAssetAddress: env.ServiceAccountAddress,
IEVMBridgeNFTMinterAddress: env.ServiceAccountAddress,
IEVMBridgeTokenMinterAddress: env.ServiceAccountAddress,
IFlowEVMNFTBridgeAddress: env.ServiceAccountAddress,
IFlowEVMTokenBridgeAddress: env.ServiceAccountAddress,
FlowEVMBridgeAddress: env.ServiceAccountAddress,
FlowEVMBridgeAccessorAddress: env.ServiceAccountAddress,
FlowEVMBridgeConfigAddress: env.ServiceAccountAddress,
FlowEVMBridgeHandlersAddress: env.ServiceAccountAddress,
FlowEVMBridgeNFTEscrowAddress: env.ServiceAccountAddress,
FlowEVMBridgeResolverAddress: env.ServiceAccountAddress,
FlowEVMBridgeTemplatesAddress: env.ServiceAccountAddress,
FlowEVMBridgeTokenEscrowAddress: env.ServiceAccountAddress,
FlowEVMBridgeUtilsAddress: env.ServiceAccountAddress,
ArrayUtilsAddress: env.ServiceAccountAddress,
ScopedFTProvidersAddress: env.ServiceAccountAddress,
SerializeAddress: env.ServiceAccountAddress,
SerializeMetadataAddress: env.ServiceAccountAddress,
StringUtilsAddress: env.ServiceAccountAddress,
}
bridgeEnv := sc.AsBridgeEnv()

// Create an account private key.
privateKey, err := testutil.GenerateAccountPrivateKey()
Expand Down Expand Up @@ -3607,32 +3582,7 @@

env := sc.AsTemplateEnv()

bridgeEnv := bridge.Environment{
CrossVMNFTAddress: env.ServiceAccountAddress,
CrossVMTokenAddress: env.ServiceAccountAddress,
FlowEVMBridgeHandlerInterfacesAddress: env.ServiceAccountAddress,
IBridgePermissionsAddress: env.ServiceAccountAddress,
ICrossVMAddress: env.ServiceAccountAddress,
ICrossVMAssetAddress: env.ServiceAccountAddress,
IEVMBridgeNFTMinterAddress: env.ServiceAccountAddress,
IEVMBridgeTokenMinterAddress: env.ServiceAccountAddress,
IFlowEVMNFTBridgeAddress: env.ServiceAccountAddress,
IFlowEVMTokenBridgeAddress: env.ServiceAccountAddress,
FlowEVMBridgeAddress: env.ServiceAccountAddress,
FlowEVMBridgeAccessorAddress: env.ServiceAccountAddress,
FlowEVMBridgeConfigAddress: env.ServiceAccountAddress,
FlowEVMBridgeHandlersAddress: env.ServiceAccountAddress,
FlowEVMBridgeNFTEscrowAddress: env.ServiceAccountAddress,
FlowEVMBridgeResolverAddress: env.ServiceAccountAddress,
FlowEVMBridgeTemplatesAddress: env.ServiceAccountAddress,
FlowEVMBridgeTokenEscrowAddress: env.ServiceAccountAddress,
FlowEVMBridgeUtilsAddress: env.ServiceAccountAddress,
ArrayUtilsAddress: env.ServiceAccountAddress,
ScopedFTProvidersAddress: env.ServiceAccountAddress,
SerializeAddress: env.ServiceAccountAddress,
SerializeMetadataAddress: env.ServiceAccountAddress,
StringUtilsAddress: env.ServiceAccountAddress,
}
bridgeEnv := sc.AsBridgeEnv()

// Create an account private key.
privateKey, err := testutil.GenerateAccountPrivateKey()
Expand Down
200 changes: 178 additions & 22 deletions fvm/systemcontracts/system_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,60 @@ import (

"github.com/onflow/cadence/common"
"github.com/onflow/flow-core-contracts/lib/go/templates"
bridge "github.com/onflow/flow-evm-bridge"

"github.com/onflow/flow-go/model/flow"
)

const (
// Unqualified names of system smart contracts (not including address prefix)

ContractNameEpoch = "FlowEpoch"
ContractNameIDTableStaking = "FlowIDTableStaking"
ContractNameClusterQC = "FlowClusterQC"
ContractNameDKG = "FlowDKG"
ContractNameServiceAccount = "FlowServiceAccount"
ContractNameFlowFees = "FlowFees"
ContractNameStorageFees = "FlowStorageFees"
ContractNameFlowCallbackScheduler = "FlowTransactionScheduler"
ContractNameNodeVersionBeacon = "NodeVersionBeacon"
ContractNameRandomBeaconHistory = "RandomBeaconHistory"
ContractNameFungibleToken = "FungibleToken"
ContractNameFlowToken = "FlowToken"
ContractNameFungibleTokenSwitchboard = "FungibleTokenSwitchboard"
ContractNameFungibleTokenMetadataViews = "FungibleTokenMetadataViews"
ContractNameNonFungibleToken = "NonFungibleToken"
ContractNameMetadataViews = "MetadataViews"
ContractNameViewResolver = "ViewResolver"
ContractNameCrossVMMetadataViews = "CrossVMMetadataViews"
ContractNameEVM = "EVM"
ContractNameBurner = "Burner"
ContractNameCrypto = "Crypto"
ContractNameMigration = "Migration"
ContractNameEpoch = "FlowEpoch"
ContractNameIDTableStaking = "FlowIDTableStaking"
ContractNameClusterQC = "FlowClusterQC"
ContractNameDKG = "FlowDKG"
ContractNameServiceAccount = "FlowServiceAccount"
ContractNameFlowFees = "FlowFees"
ContractNameStorageFees = "FlowStorageFees"
ContractNameFlowCallbackScheduler = "FlowTransactionScheduler"
ContractNameNodeVersionBeacon = "NodeVersionBeacon"
ContractNameRandomBeaconHistory = "RandomBeaconHistory"
ContractNameFungibleToken = "FungibleToken"
ContractNameFlowToken = "FlowToken"
ContractNameFungibleTokenSwitchboard = "FungibleTokenSwitchboard"
ContractNameFungibleTokenMetadataViews = "FungibleTokenMetadataViews"
ContractNameNonFungibleToken = "NonFungibleToken"
ContractNameMetadataViews = "MetadataViews"
ContractNameViewResolver = "ViewResolver"
ContractNameCrossVMMetadataViews = "CrossVMMetadataViews"
ContractNameEVM = "EVM"
ContractNameBurner = "Burner"
ContractNameCrypto = "Crypto"
ContractNameMigration = "Migration"
ContractNameCrossVMNFT = "CrossVMNFT"
ContractNameCrossVMToken = "CrossVMToken"
ContractNameFlowEVMBridgeHandlerInterfaces = "FlowEVMBridgeHandlerInterfaces"
ContractNameIBridgePermissions = "IBridgePermissions"
ContractNameICrossVM = "ICrossVM"
ContractNameICrossVMAsset = "ICrossVMAsset"
ContractNameIEVMBridgeNFTMinter = "IEVMBridgeNFTMinter"
ContractNameIEVMBridgeTokenMinter = "IEVMBridgeTokenMinter"
ContractNameIFlowEVMNFTBridge = "IFlowEVMNFTBridge"
ContractNameIFlowEVMTokenBridge = "IFlowEVMTokenBridge"
ContractNameFlowEVMBridge = "FlowEVMBridge"
ContractNameFlowEVMBridgeAccessor = "FlowEVMBridgeAccessor"
ContractNameFlowEVMBridgeConfig = "FlowEVMBridgeConfig"
ContractNameFlowEVMBridgeHandlers = "FlowEVMBridgeHandlers"
ContractNameFlowEVMBridgeNFTEscrow = "FlowEVMBridgeNFTEscrow"
ContractNameFlowEVMBridgeResolver = "FlowEVMBridgeResolver"
ContractNameFlowEVMBridgeTemplates = "FlowEVMBridgeTemplates"
ContractNameFlowEVMBridgeTokenEscrow = "FlowEVMBridgeTokenEscrow"
ContractNameFlowEVMBridgeUtils = "FlowEVMBridgeUtils"
ContractNameArrayUtils = "ArrayUtils"
ContractNameScopedFTProviders = "ScopedFTProviders"
ContractNameSerialize = "Serialize"
ContractNameSerializeMetadata = "SerializeMetadata"
ContractNameStringUtils = "StringUtils"

// AccountNameEVMStorage is not a contract, but a special account that is used to store EVM state
AccountNameEVMStorage = "EVMStorageAccount"
Expand Down Expand Up @@ -206,6 +231,32 @@ type SystemContracts struct {

// Migration contracts
Migration SystemContract

// EVM Bridge related contracts
CrossVMNFT SystemContract
CrossVMToken SystemContract
FlowEVMBridgeHandlerInterfaces SystemContract
IBridgePermissions SystemContract
ICrossVM SystemContract
ICrossVMAsset SystemContract
IEVMBridgeNFTMinter SystemContract
IEVMBridgeTokenMinter SystemContract
IFlowEVMNFTBridge SystemContract
IFlowEVMTokenBridge SystemContract
FlowEVMBridge SystemContract
FlowEVMBridgeAccessor SystemContract
FlowEVMBridgeConfig SystemContract
FlowEVMBridgeHandlers SystemContract
FlowEVMBridgeNFTEscrow SystemContract
FlowEVMBridgeResolver SystemContract
FlowEVMBridgeTemplates SystemContract
FlowEVMBridgeTokenEscrow SystemContract
FlowEVMBridgeUtils SystemContract
ArrayUtils SystemContract
ScopedFTProviders SystemContract
Serialize SystemContract
SerializeMetadata SystemContract
StringUtils SystemContract
}

// AsTemplateEnv returns a template environment with all system contracts filled in.
Expand Down Expand Up @@ -240,6 +291,36 @@ func (c SystemContracts) AsTemplateEnv() templates.Environment {
}
}

func (c SystemContracts) AsBridgeEnv() bridge.Environment {
serviceAccountAddress := c.FlowServiceAccount.Address.Hex()
return bridge.Environment{
CrossVMNFTAddress: serviceAccountAddress,
CrossVMTokenAddress: serviceAccountAddress,
FlowEVMBridgeHandlerInterfacesAddress: serviceAccountAddress,
IBridgePermissionsAddress: serviceAccountAddress,
ICrossVMAddress: serviceAccountAddress,
ICrossVMAssetAddress: serviceAccountAddress,
IEVMBridgeNFTMinterAddress: serviceAccountAddress,
IEVMBridgeTokenMinterAddress: serviceAccountAddress,
IFlowEVMNFTBridgeAddress: serviceAccountAddress,
IFlowEVMTokenBridgeAddress: serviceAccountAddress,
FlowEVMBridgeAddress: serviceAccountAddress,
FlowEVMBridgeAccessorAddress: serviceAccountAddress,
FlowEVMBridgeConfigAddress: serviceAccountAddress,
FlowEVMBridgeHandlersAddress: serviceAccountAddress,
FlowEVMBridgeNFTEscrowAddress: serviceAccountAddress,
FlowEVMBridgeResolverAddress: serviceAccountAddress,
FlowEVMBridgeTemplatesAddress: serviceAccountAddress,
FlowEVMBridgeTokenEscrowAddress: serviceAccountAddress,
FlowEVMBridgeUtilsAddress: serviceAccountAddress,
ArrayUtilsAddress: serviceAccountAddress,
ScopedFTProvidersAddress: serviceAccountAddress,
SerializeAddress: serviceAccountAddress,
SerializeMetadataAddress: serviceAccountAddress,
StringUtilsAddress: serviceAccountAddress,
}
}

// All returns all system contracts as a slice.
func (c SystemContracts) All() []SystemContract {
return []SystemContract{
Expand Down Expand Up @@ -272,6 +353,31 @@ func (c SystemContracts) All() []SystemContract {
c.Crypto,

c.Migration,

c.CrossVMNFT,
c.CrossVMToken,
c.FlowEVMBridgeHandlerInterfaces,
c.IBridgePermissions,
c.ICrossVM,
c.ICrossVMAsset,
c.IEVMBridgeNFTMinter,
c.IEVMBridgeTokenMinter,
c.IFlowEVMNFTBridge,
c.IFlowEVMTokenBridge,
c.FlowEVMBridge,
c.FlowEVMBridgeAccessor,
c.FlowEVMBridgeConfig,
c.FlowEVMBridgeHandlers,
c.FlowEVMBridgeNFTEscrow,
c.FlowEVMBridgeResolver,
c.FlowEVMBridgeTemplates,
c.FlowEVMBridgeTokenEscrow,
c.FlowEVMBridgeUtils,
c.ArrayUtils,
c.ScopedFTProviders,
c.Serialize,
c.SerializeMetadata,
c.StringUtils,
Comment on lines 355 to +380
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the system_contracts.go file to see the context
cd fvm/systemcontracts && wc -l system_contracts.go && head -50 system_contracts.go

Repository: onflow/flow-go

Length of output: 2458


🏁 Script executed:

# Find the All() function definition and usage
rg -n "func.*All\(\)|\.All\(\)" --type=go fvm/systemcontracts/

Repository: onflow/flow-go

Length of output: 312


🏁 Script executed:

# Search for bootstrap and deployment code
rg -n "bootstrap|deploy" --type=go -i fvm/systemcontracts/

Repository: onflow/flow-go

Length of output: 710


🏁 Script executed:

# Check for where these new bridge contracts are defined
rg -n "CrossVMNFT|FlowEVMBridge" --type=go fvm/ | head -30

Repository: onflow/flow-go

Length of output: 3155


🏁 Script executed:

# Read the All() function implementation
sed -n '325,380p' fvm/systemcontracts/system_contracts.go

Repository: onflow/flow-go

Length of output: 1226


🏁 Script executed:

# Check how All() is tested
cat -n fvm/systemcontracts/system_contracts_test.go | head -80

Repository: onflow/flow-go

Length of output: 3060


🏁 Script executed:

# Search for where system contracts are deployed/bootstrapped
rg -n "NewSystemContracts|bootstrap" --type=go fvm/ | grep -v test | head -20

Repository: onflow/flow-go

Length of output: 1621


🏁 Script executed:

# Look for init or setup functions that deploy contracts
rg -n "func init|SetupSystemContracts|DeploySystemContracts" --type=go -i | head -20

Repository: onflow/flow-go

Length of output: 1436


🏁 Script executed:

# Look at the bootstrap.go file to see how contracts are deployed
sed -n '224,300p' fvm/bootstrap.go

Repository: onflow/flow-go

Length of output: 2473


🏁 Script executed:

# Check if there's specific code for deploying bridge contracts
rg -n "WithFlowEVMBridge|DeployBridge" --type=go | head -20

Repository: onflow/flow-go

Length of output: 40


🏁 Script executed:

# Look for where SystemContracts are actually deployed in bootstrapping
rg -n "setupSystemContracts|deployContracts" --type=go -i | head -20

Repository: onflow/flow-go

Length of output: 1166


🏁 Script executed:

# Search for how chain-specific system contracts are configured
rg -n "SystemContractsForChain|mainnet|testnet" --type=go fvm/systemcontracts/ | head -30

Repository: onflow/flow-go

Length of output: 987


🏁 Script executed:

# Look at the SystemContractsForChain function implementation
sed -n '404,500p' fvm/systemcontracts/system_contracts.go

Repository: onflow/flow-go

Length of output: 3016


🏁 Script executed:

# Check for chain-specific contract configurations
rg -n "Mainnet|Testnet|Canarynet|Previewnet" --type=go fvm/systemcontracts/system_contracts.go | head -30

Repository: onflow/flow-go

Length of output: 2165


🏁 Script executed:

# Look for where bridge contracts are conditionally included or excluded
rg -n "CrossVMNFT|FlowEVMBridge" --type=go fvm/systemcontracts/system_contracts.go -B 2 -A 2 | head -60

Repository: onflow/flow-go

Length of output: 3390


🏁 Script executed:

# Check if there's any migration or rollout status for these contracts
rg -n "Migration|rollout|enabled|disabled" --type=go fvm/systemcontracts/system_contracts.go -i | head -20

Repository: onflow/flow-go

Length of output: 304


🏁 Script executed:

# Look at the full init() function to see which contracts are registered
sed -n '428,700p' fvm/systemcontracts/system_contracts.go

Repository: onflow/flow-go

Length of output: 11580


🏁 Script executed:

# Search for where contractAddressFunc is populated for the bridge contracts
rg -n "contractAddressFunc\[" --type=go fvm/systemcontracts/system_contracts.go | tail -50

Repository: onflow/flow-go

Length of output: 221


🏁 Script executed:

# Check the complete list of what's registered in contractAddressFunc
rg -n "registerContractAddress|contractAddressFunc\[ContractName" --type=go fvm/systemcontracts/system_contracts.go | wc -l

Repository: onflow/flow-go

Length of output: 59


🏁 Script executed:

# Count how many contracts are in All()
sed -n '325,390p' fvm/systemcontracts/system_contracts.go | grep "c\." | wc -l

Repository: onflow/flow-go

Length of output: 60


🏁 Script executed:

# Look for the registerContractAddress or similar registration pattern
rg -n "registerContractAddress" --type=go fvm/systemcontracts/system_contracts.go -A 3 | head -30

Repository: onflow/flow-go

Length of output: 40


🏁 Script executed:

# Search for bootstrap code that actually deploys contracts
rg -n "setupVM|DeployContracts|BridgeContract" --type=go fvm/ | grep -i bootstrap | head -20

Repository: onflow/flow-go

Length of output: 547


🏁 Script executed:

# Look for Cadence contract deployment in bootstrap
rg -n "setupVMBridge|bridge" --type=go fvm/bootstrap.go -i -A 3 | head -40

Repository: onflow/flow-go

Length of output: 1584


🏁 Script executed:

# Check if there's a deployment manifest or list
rg -n "manifest|deployment.*list|contract.*list" --type=go fvm/ -i | head -20

Repository: onflow/flow-go

Length of output: 1119


🏁 Script executed:

# Look at what happens in transient network setup vs mainnet/testnet
rg -n "transient|mainnet|testnet" --type=go fvm/systemcontracts/system_contracts.go -B 1 -A 1 | head -40

Repository: onflow/flow-go

Length of output: 383


🏁 Script executed:

# Look at the test that was mentioned - transient network contract existence checks
cat -n fvm/systemcontracts/system_contracts_test.go | head -100

Repository: onflow/flow-go

Length of output: 4043


🏁 Script executed:

# Search for tests that check contract existence
rg -n "All\(\)" --type=go fvm/systemcontracts/ -A 5 -B 5

Repository: onflow/flow-go

Length of output: 2394


🏁 Script executed:

# Check if there's documentation about deployment on mainnet/testnet
rg -n "mainnet|testnet" --type=go fvm/bootstrap.go -B 2 -A 2 | grep -i "bridge\|deploy"

Repository: onflow/flow-go

Length of output: 258


🏁 Script executed:

# Look for where bridge contracts are actually deployed on mainnet/testnet
rg -n "CrossVMNFT|FlowEVMBridge" --type=go --type=go -l | xargs grep -l "mainnet\|testnet" | head -10

Repository: onflow/flow-go

Length of output: 114


🏁 Script executed:

# Check the blueprints to see what contracts are deployed
rg -n "BridgeContracts" --type=go fvm/blueprints/ -A 10 -B 5

Repository: onflow/flow-go

Length of output: 1321


🏁 Script executed:

# Check all chain types
rg -n "type ChainID|func AllChainIDs" --type=go model/flow/

Repository: onflow/flow-go

Length of output: 206


🏁 Script executed:

# See what AllChainIDs returns
rg -n "func AllChainIDs" --type=go -A 10 model/flow/

Repository: onflow/flow-go

Length of output: 485


🏁 Script executed:

# Check if there's chain-specific logic for bridge deployment on mainnet/testnet
sed -n '1042,1200p' fvm/bootstrap.go

Repository: onflow/flow-go

Length of output: 7193


🏁 Script executed:

# Look for where bridge contracts might be deployed on mainnet/testnet separately
rg -n "migration|deploy.*bridge|bridge.*deploy" --type=go -i fvm/ | grep -v test | head -20

Repository: onflow/flow-go

Length of output: 1827


🏁 Script executed:

# Double-check: does SystemContractsForChain return different contracts for different chains?
# Look for any filtering or chain-specific logic in the SystemContracts construction
sed -n '575,700p' fvm/systemcontracts/system_contracts.go | grep -A 100 "getSystemContractsForChain"

Repository: onflow/flow-go

Length of output: 5179


🏁 Script executed:

# Check if Mainnet and Testnet are transient
rg -n "func.*Transient|func.*IsTransient" --type=go model/flow/chain.go -A 5

Repository: onflow/flow-go

Length of output: 349


🏁 Script executed:

# Look for any documented notes about bridge contract availability on mainnet/testnet
rg -n "bridge.*mainnet|bridge.*testnet|bridge.*availability" --type=go -i | head -20

Repository: onflow/flow-go

Length of output: 378


🏁 Script executed:

# Final confirmation: check if there's any migration plan or deployment roadmap for bridge contracts on mainnet/testnet
rg -n "bridge.*migration|rollout.*bridge|deploy.*bridge" --type=go -i | grep -v "test" | head -15

Repository: onflow/flow-go

Length of output: 2084


🏁 Script executed:

# Check if the test actually validates this concern
rg -n "TestSystemContracts|checkSystemContracts" --type=go -A 20 fvm/systemcontracts/system_contracts_test.go | head -50

Repository: onflow/flow-go

Length of output: 1955


Bridge contracts are only deployed on transient networks, but All() returns them for all chains including Mainnet and Testnet.

The bridge contracts (CrossVMNFT, CrossVMToken, FlowEVMBridge*, BridgeUtils, etc.) are only deployed during bootstrap on transient networks (Emulator, Previewnet, etc.) via the setupVMBridge() function which returns early for non-transient chains. However, All() includes these contracts for all chains (Mainnet, Testnet, Sandboxnet, etc.), which means tests checking contract existence will report valid addresses but the contracts won't actually be deployed on long-lived networks. Verify whether this is intentional (e.g., planned for future rollout) or if All() and the system contracts registry should only include contracts that are actually deployed on each target chain.

🤖 Prompt for AI Agents
In `@fvm/systemcontracts/system_contracts.go` around lines 355 - 380, All()
currently lists bridge contracts (CrossVMNFT, CrossVMToken, FlowEVMBridge*,
FlowEVMBridgeUtils, etc.) even though setupVMBridge() only deploys them on
transient networks; update the registry so All() only includes those
bridge-related contracts for transient chains (or when setupVMBridge() indicates
they were deployed) — locate the All() function in system_contracts.go and
either filter out the bridge symbols for non-transient chains (e.g., check the
chain type or call the same transient check used by setupVMBridge()) or move the
bridge entries into the transient-only registration path so that contract
existence checks reflect actual deployments.

}
}

Expand Down Expand Up @@ -439,6 +545,31 @@ func init() {
ContractNameCrypto: serviceAddressFunc,

ContractNameMigration: serviceAddressFunc,

ContractNameCrossVMNFT: serviceAddressFunc,
ContractNameCrossVMToken: serviceAddressFunc,
ContractNameFlowEVMBridgeHandlerInterfaces: serviceAddressFunc,
ContractNameIBridgePermissions: serviceAddressFunc,
ContractNameICrossVM: serviceAddressFunc,
ContractNameICrossVMAsset: serviceAddressFunc,
ContractNameIEVMBridgeNFTMinter: serviceAddressFunc,
ContractNameIEVMBridgeTokenMinter: serviceAddressFunc,
ContractNameIFlowEVMNFTBridge: serviceAddressFunc,
ContractNameIFlowEVMTokenBridge: serviceAddressFunc,
ContractNameFlowEVMBridge: serviceAddressFunc,
ContractNameFlowEVMBridgeAccessor: serviceAddressFunc,
ContractNameFlowEVMBridgeConfig: serviceAddressFunc,
ContractNameFlowEVMBridgeHandlers: serviceAddressFunc,
ContractNameFlowEVMBridgeNFTEscrow: serviceAddressFunc,
ContractNameFlowEVMBridgeResolver: serviceAddressFunc,
ContractNameFlowEVMBridgeTemplates: serviceAddressFunc,
ContractNameFlowEVMBridgeTokenEscrow: serviceAddressFunc,
ContractNameFlowEVMBridgeUtils: serviceAddressFunc,
ContractNameArrayUtils: serviceAddressFunc,
ContractNameScopedFTProviders: serviceAddressFunc,
ContractNameSerialize: serviceAddressFunc,
ContractNameSerializeMetadata: serviceAddressFunc,
ContractNameStringUtils: serviceAddressFunc,
}

getSystemContractsForChain := func(chainID flow.ChainID) *SystemContracts {
Expand Down Expand Up @@ -502,6 +633,31 @@ func init() {
Crypto: addressOfContract(ContractNameCrypto),

Migration: addressOfContract(ContractNameMigration),

CrossVMNFT: addressOfContract(ContractNameCrossVMNFT),
CrossVMToken: addressOfContract(ContractNameCrossVMToken),
FlowEVMBridgeHandlerInterfaces: addressOfContract(ContractNameFlowEVMBridgeHandlerInterfaces),
IBridgePermissions: addressOfContract(ContractNameIBridgePermissions),
ICrossVM: addressOfContract(ContractNameICrossVM),
ICrossVMAsset: addressOfContract(ContractNameICrossVMAsset),
IEVMBridgeNFTMinter: addressOfContract(ContractNameIEVMBridgeNFTMinter),
IEVMBridgeTokenMinter: addressOfContract(ContractNameIEVMBridgeTokenMinter),
IFlowEVMNFTBridge: addressOfContract(ContractNameIFlowEVMNFTBridge),
IFlowEVMTokenBridge: addressOfContract(ContractNameIFlowEVMTokenBridge),
FlowEVMBridge: addressOfContract(ContractNameFlowEVMBridge),
FlowEVMBridgeAccessor: addressOfContract(ContractNameFlowEVMBridgeAccessor),
FlowEVMBridgeConfig: addressOfContract(ContractNameFlowEVMBridgeConfig),
FlowEVMBridgeHandlers: addressOfContract(ContractNameFlowEVMBridgeHandlers),
FlowEVMBridgeNFTEscrow: addressOfContract(ContractNameFlowEVMBridgeNFTEscrow),
FlowEVMBridgeResolver: addressOfContract(ContractNameFlowEVMBridgeResolver),
FlowEVMBridgeTemplates: addressOfContract(ContractNameFlowEVMBridgeTemplates),
FlowEVMBridgeTokenEscrow: addressOfContract(ContractNameFlowEVMBridgeTokenEscrow),
FlowEVMBridgeUtils: addressOfContract(ContractNameFlowEVMBridgeUtils),
ArrayUtils: addressOfContract(ContractNameArrayUtils),
ScopedFTProviders: addressOfContract(ContractNameScopedFTProviders),
Serialize: addressOfContract(ContractNameSerialize),
SerializeMetadata: addressOfContract(ContractNameSerializeMetadata),
StringUtils: addressOfContract(ContractNameStringUtils),
}

return contracts
Expand Down
Loading