Skip to content

Commit

Permalink
Fix deployment of EVMBridgeRouter on service account
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Mar 28, 2024
1 parent 83beef6 commit fa4e505
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
14 changes: 14 additions & 0 deletions cadence/scripts/test/is_bridge_router_configured.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import "EVMBridgeRouter"

access(all)
fun main(): Bool {
let serviceAccount = getAuthAccount<auth(Storage) &Account>(0x0000000000000001)
let router = serviceAccount.storage.borrow<&EVMBridgeRouter.Router>(
from: /storage/evmBridgeRouter
) ?? panic("Could not borrow Router")

assert(router.bridgeAddress == 0x0000000000000007)
assert(router.bridgeContractName == "FlowEVMBridge")

return true
}
20 changes: 5 additions & 15 deletions cadence/tests/flow_evm_bridge_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,12 @@ fun setup() {
)
Test.expect(err, Test.beNil())

// Deploy EVMBridgeRouter manually to service account for COA -> bridge integration
let deployResult = executeTransaction(
"../transactions/test/add_contract.cdc",
["EVMBridgeRouter", getEVMBridgeRouterCode(), bridgeAccount.address, "FlowEVMBridge"],
serviceAccount
err = Test.deployContract(
name: "EVMBridgeRouter",
path: "../contracts/bridge/EVMBridgeRouter.cdc",
arguments: [bridgeAccount.address, "FlowEVMBridge"]
)
Test.expect(updateResult, Test.beSucceeded())
// TODO: Remove once issue is address - added here for validation
Test.assertEqual(true, getAccount(serviceAccount.address).contracts.names.contains("EVMBridgeRouter"))
// This also fails with I.Test.Test.Error(message: "could not find an account with address: 0000000000000001")
// err = Test.deployContract(
// name: "EVMBridgeRouter",
// path: "../contracts/bridge/EVMBridgeRouter.cdc",
// arguments: []
// )
// Test.expect(err, Test.beNil())
Test.expect(err, Test.beNil())

// Transfer ERC721 deployer some $FLOW
let fundERC721AccountResult = executeTransaction(
Expand Down

0 comments on commit fa4e505

Please sign in to comment.