Run E2E tests with EVM VM bridge enabled#894
Conversation
WalkthroughEnable VM bridge in tests, move Cadence-owned account storage/capability paths from Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Tester
participant Emulator
participant CadenceStorage as "Cadence /storage (evm_coa)"
participant PublicCap as "Cadence /public/evm"
Note over Tester,Emulator: Start emulator with VM bridge enabled
Tester->>Emulator: Start (SetupVMBridgeEnabled = true)
Emulator-->>Tester: Ready
Note over Tester,CadenceStorage: Ensure CadenceOwnedAccount exists at /storage/evm_coa
Tester->>CadenceStorage: Check `/storage/evm_coa`
alt not present
Tester->>CadenceStorage: Save COA at `/storage/evm_coa`
Tester->>PublicCap: Publish capability from `/storage/evm_coa` -> `/public/evm`
else present
Tester->>CadenceStorage: Borrow COA from `/storage/evm_coa`
end
sequenceDiagram
autonumber
participant Bootstrap
participant AccessNode as "Cadence Access Node"
participant Subscriber as "EVM Event Subscriber"
Bootstrap->>AccessNode: Query latestCadenceHeight
Note right of Bootstrap: compute nextCadenceHeight = latestCadenceHeight + 1\n(handle Emulator init edge case)
Bootstrap->>Subscriber: Create subscriber(startHeight = nextCadenceHeight)
Subscriber->>AccessNode: Subscribe from nextCadenceHeight...
AccessNode-->>Subscriber: Events stream
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-10-06T10:14:49.676ZApplied to files:
🧬 Code graph analysis (1)bootstrap/bootstrap.go (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The dependent changes should be available via onflow/flow-emulator@v1.8.0 |
4501243 to
bc4dfd0
Compare
Awesome 🙌 I have also updated the emulator version to |
| reward: [['0x96'], ['0x96'], ['0x96']], // gas price is 150 during testing | ||
| baseFeePerGas: [1n, 1n, 1n], | ||
| gasUsedRatio: [0, 0.006205458333333334, 0] | ||
| gasUsedRatio: [0.066314225, 0.006205458333333334, 0] |
There was a problem hiding this comment.
Question: why did this change? I'm not sure I follow.
There was a problem hiding this comment.
@janezpodhostnik A very good question 👏
The VM bridge bootstrap, executed a bunch of EVM transactions, on the genesis block. However, the EVM block was never committed with InternalEVM.commitBlockProposal(), because the system chunk transaction was not executed for the genesis block.
This means that all of the 18 EVM transactions that were executed in the genesis block, will actually be attributed to the first committed EVM block. That would be the first committed Flow block by the Emulator, since it will run the system chunk transaction. The difference is gasUsedRatio comes from the fact that before there were no EVM transactions on EVM block height 1, but now we have the 18 EVM transactions from the VM bridge bootstrap.
There was a problem hiding this comment.
Do we need to fix this in fvm bootstrapping? Add The EVM block formation transaction at the end of bootstrapping?
There was a problem hiding this comment.
And to give some numbers:
total gas used = 7957707
block gas limit = 120000000
gasUsedRatio = total gas used / block gas limit = 0.066314225Do we need to fix this in fvm bootstrapping? Add The EVM block formation transaction at the end of bootstrapping?
I think it's not really necessary. At least for unblocking the current issue. I'll give it a shot when I have some more time.
janezpodhostnik
left a comment
There was a problem hiding this comment.
Code looks good.
bc4dfd0 to
22aaa3e
Compare
22aaa3e to
cb843cf
Compare
Depends on: onflow/flow-go#7999
Depends on: onflow/flow-emulator#870
Closes: #893
Description
This will make sure that the EVM Gateway works correctly when the EVM VM bridge is enabled on Flow Emulator.
For contributor use:
masterbranchFiles changedin the Github PR explorerSummary by CodeRabbit