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

[Flow EVM] Optimize block formation #6958

Open
bluesign opened this issue Jan 30, 2025 · 0 comments
Open

[Flow EVM] Optimize block formation #6958

bluesign opened this issue Jan 30, 2025 · 0 comments

Comments

@bluesign
Copy link
Contributor

bluesign commented Jan 30, 2025

Problem Definition

Currently block formation is accessing storage for each EVM transaction, each read and write is metered.

Which has huge implications for gas usage:

example with 100 EVM transactions ( individual vs batchrun )

https://testnet.flowscan.io/tx/2096a30d58d311416fd5e0fccf8ef8aa4439884fe0cdc10e1737033a2ff487a2
https://testnet.flowscan.io/tx/73ee4d199c071e3f913723fbb6c0795daa7d2c74cdfb79b224d6ae1649ea6a95
(credit @m-Peter)

cadence tx 1
├─ EVM tx 1
├── read block proposal & blockhashlist
├── execute transaction
├── write block proposal & blockhashlist
├─ EVM tx 2
├── read block proposal & blockhashlist
├── execute transaction
├── write block proposal & blockhashlist
cadence tx 2
... (same as above ) 
evm heartbeat
├── read block proposal & blockhashlist
├── create block

I think it should be optimized as: (only one cadence transaction below )

cadence tx 1
├─ read block proposal & blockhashlist
├─ EVM tx 1
├── execute transaction
├── update block proposal & blockhashlist in memory
├─ EVM tx 2
├── execute transaction
├── update block proposal & blockhashlist in memory
├─ write block proposal & blockhashlist

Proposed Solution

With minimal change, we can use PersistantSlabStorage and add a commit phase after TX is executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants