The Flow network has been upgraded!
This release brings a major enhancement to on-chain state storage with Account Storage Format v2, improving both the scalability and resiliency of the network.
✅ What is Included in This Upgrade?
- Optimized Account Storage Format v2 for improved efficiency and scalability
- Zero-Downtime State Migration - an innovative new method to seamlessly roll out the new account storage format on the live network without requiring any downtime.
🔹 What’s New in Account Storage Format v2?
The Account Storage Format v2 enhances how the on-chain state is stored and processed, resulting in significantly reduced memory usage on the Execution nodes.
The Execution State is a Merkle tree, which holds the user data (account token balances, NFTs, smart contracts deployed etc.) as payloads in its leaves. This update optimizes the storage format for the payloads resulting in fewer, more compactly serialized payloads. Fewer payloads in turn reduce the size of the MTrie, making Flow more efficient in handling state.
With this update,
- The number of payloads will be reduced by 25-30%, reducing the on-disk storage footprint of the execution data. This will improve RAM, Disk and CPU efficiency, not only for execution nodes but also for all databases, indexers, and caches that store and serve execution data such as the access node.
- The number of vertices in the MTrie will also be reduced by 25-30% reducing the in-memory storage footprint of the data for execution nodes, which hold the execution state in memory. With this size reduction, execution nodes will see more than an 11% reduction in memory usage (RAM) improving their stability and capacity to accommodate memory spikes during peak usage.
This improvement will also help slow down future memory growth rate as new accounts are created, further ensuring that Flow scales efficiently.
Read more about this change here 👉 GitHub Issue #3584
🔹How Will Account Storage v2 Be Rolled Out? Zero-Downtime Migration!
To deploy the new Account Storage Format without any network downtime, an innovative approach called Zero-Downtime Migration has been introduced.
Zero-Downtime Migration uses system transactions to migrate small batches of accounts, running in the background without affecting network operations. The ambient process takes several days to complete.
With this approach, the new Account Storage Format will be deployed gradually and seamlessly without requiring any action from developers or users, ensuring zero disruption to the network.
🔜 Upcoming improvements
This upgrade also lays the foundation for several upcoming improvements that will be rolled out as part of the next set of updates. These include:
Websocket Streaming API endpoints aimed at improving the user experience of dApps.
The ability to deploy protocol upgrades including downwards-incompatible changes for all node types to the live Mainnet - without requiring any network downtime!
Easy recovery from epoch transition failures, again requiring no downtime.
This upgrade marks another significant step in Flow’s journey toward scaling to petabytes of on-chain data. 🚀
❗Breaking change
There is a breaking change to streaming Access API in this upgrade.
Several AccessAPI and ExecutionDataAPI streaming endpoints include a message_index
field in the response which indicates the order of messages sent by the server so the client can detect if they missed processing any. Previously, some endpoints used 1 as the first index in a stream while others used 0. After the HCU, all endpoints will be consistent regarding message_index and start from index 0.
APIs that will affected (Protobuf definition) -
- SubscribeEvents - field message_index
- SendAndSubscribeTransactionStatuses - field message_index
- SubscribeAccountStatuses - field message_index
These streaming APIs are fairly recent, therefore most apps will not be impacted.
⚠️ Deprecation
- The
protocol_version
field of the NodeVersionInfo endpoint of the Access API is deprecated and will be removed in a future release.
Commit list
Account Storage Format v2 Migration
- Cadence Account Storage Map Migration by @turbolent in #6761
- Enable storage format v2 for all but mainnet by @janezpodhostnik in #6864
- Enable storage format v2 on mainnet by @janezpodhostnik in #6988
NOTE: Account Storage Format v2 is implemented in PRs in repo onflow/cadence.
Zero downtime (Recovering from failed epoch switchover)
- Add test cases documenting CBOR's behaviour with omitted and extra fields by @jordanschalm in #6880
Data Availability
- Reduce logging from version control by @peterargue in #6342
- Reduce logging on some access endpoints by @peterargue in #6340
- Update event parsing validator to support ResourceDestroyed events by @peterargue in #6356
- Updated go-ds-pebble version by @UlyanaAndrukhiv in #6411
- Add compatible range to Node Version Info endpoint by @UlyanaAndrukhiv in #6294
- Added metrics for transaction validator by @Guitarheroua in #6239
- Stop Control feature for AN by @Guitarheroua in #6202
- Implemented options to fail or warn when payer is not able to pay by @Guitarheroua in #6297
- Use Indexed height when checking payer balance by @AndriiDiachuk in #6292
- Enforce prune threshold by @Guitarheroua in #6345
- Improve error messages when querying old blocks by @UlyanaAndrukhiv in #6554
- Store Transaction Result error messages in db by @UlyanaAndrukhiv in #6468
- Refactor executionNodesForBlockID by encapsulating its parameters into a struct by @UlyanaAndrukhiv in #6499
- Improve bounds checking in rest converters by @AndriiDiachuk in #6567
- Make REST message size limit configurable by @AndriiDiachuk in #6596
- Change SendAndSubscribe endpoint's MessageIndex to start at 0 by @AndriiDiachuk in #6598
- Add util command to backfill tx error messages db by @UlyanaAndrukhiv in #6525
- Refactor REST Routes Package by @UlyanaAndrukhiv in #6616
- Add support for ignoring version beacon events for compatible versions by @peterargue in #6535
- Add new websocket handler and skeleton for its deps by @illia-malachyn in #6630
- Add implementation BlockProvider by @UlyanaAndrukhiv in #6636
- Implement keepalive routine with ping-ponging to ws connection in ws controller by @UlyanaAndrukhiv in #6757
- Add unit test for websocket controller by @illia-malachyn in #6762
- Fix mocking in connection unittests by @peterargue in #6822
- Add implementation for events data providers and account statuses data providers by @AndriiDiachuk in #6766
- ws controller error handling by @illia-malachyn in #6798
- Implement inactivity tracker by @UlyanaAndrukhiv in #6817
- Add implementation for transaction statuses data providers by @AndriiDiachuk in #6818
- Response limit tracker by @Guitarheroua in #6814
- Make WebSocket responses from data providers consistent with Access REST API responses by @UlyanaAndrukhiv in #6802
- Fix access connection tests for latest version of testing library by @peterargue in #6917
- Unify subscription id with client message id by @illia-malachyn in #6847
- Heartbeat interval not reset correctly in streaming endpoints. by @AndriiDiachuk in #6848
- Make response for data providers consistent. by @AndriiDiachuk in #6846
- Add deprecate message to legacy ws handler and controller by @illia-malachyn in #6918
- Add arguments getter for data providers by @UlyanaAndrukhiv in #6873
- Backport version control overrides from v0.37 by @peterargue in #6944
- Fix flakiness in ExecutionStateSync integration test by @peterargue in #6994
- Transaction Validator recovers from script parse panic by @jordanschalm in #6435
- Add a Time To Seal metric to access node to track time it takes to seal a transaction by @AndriiDiachuk in #6512
- Fixed issues where time-to-seal was NaN by @AndriiDiachuk in #6624
- TestMessageIndexTransactionStatusesProviderResponse_HappyPath test being flaky. by @AndriiDiachuk in #6862
Collection
- Reduce log level in provider by @peterargue in #6930
- replace engine.Unit with ComponentManager in Pusher Engine by @tim-barry in #6747
- Refactor Pusher Engine with updated interface by @tim-barry in #6780
- Removes unused first height field from LN builder by @jordanschalm in #6828
Consensus
- Proposal is signed by
SafetyRules
by @durkmurder in #6463 - Temp fix to remove systematic observation bias for small committee sizes by @AlexHentschel in #6392
model.Proposal
refactoring by @durkmurder in #6526- cruisectl delay implementation bias (fix for deployment branch
v0.37
) by @AlexHentschel in #6379 - minor revision of log, to clarify the root causes of likely benign error log by @AlexHentschel in #6419
- Improve DKG engine package documentation by @jordanschalm in #6758
- Refactor Consensus Matching Engine:
engine.Unit
->ComponentManager
by @tim-barry in #6916 - Validate consistency of chunk Start and End states by @tim-barry in #6871
Verification
- Adding block id and height in verified approvals by @zhangchiqing in #6402
- Remove engine.Unit from Assigner engine and Fetcher engine by @tim-barry in #6808
- Make chunk assignment immutable by @tim-barry in #6850
Execution
- Remove deprecated ingestion engine by @zhangchiqing in #6510
- Pruning - add a test case to verify compaction can reclaim disk space by @zhangchiqing in #6603
- Refactor Chunk data packs modules to use generic storage interface by @zhangchiqing in #6892
- Replace HighestExecutedBlock with LastExecutedBlock by @zhangchiqing in #6909
- Add chunk data pack pruner by @zhangchiqing in #6919
- Add Block Iterator by @zhangchiqing in #6858
- Refactor Approvals by @zhangchiqing in #6868
- Refactor ConsumerProgress by @zhangchiqing in #6872
- Add Iterator Creator by @zhangchiqing in #6890
- Lower retry interval in EN requester engine by @jordanschalm in #6444
- Refactor AsyncUploader to replace Engine.Unit with ComponentManager by @tim-barry in #6809
- Print log when checks the executed block matches the sealed result by @zhangchiqing in #6559
- Fix verify execution result by @zhangchiqing in #6804
- Add grpc endpoint to EN for transaction execution metrics by @janezpodhostnik in #6172
- Update to Cadence v1.2.1, Move Cadence
Crypto
contract on-chain by @turbolent in #6571
Flow (Cadence) VM
- Enable program recovery by @turbolent in #6336
- Update fee related constants by @janezpodhostnik in #6349
- Let the system transaction report metrics by @ramtinms in #6362
- Recover NFT contract by @turbolent in #6388
- Recover NFT Collections by @turbolent in #6394
- Fix metering invalidation by @janezpodhostnik in #6377
- Move execution parameter to separate account by @janezpodhostnik in #6903
- Add meter method which returns remaining computation for given computation kind by @turbolent in #6215
- Expose minimum required version to cadence interface by @janezpodhostnik in #6560
- Copy slice when setting block hash list by @janezpodhostnik in #6734
- Add offchain block context creation method by @janezpodhostnik in #6751
- Get execution version from snapshot instead of state by @janezpodhostnik in #6867
- Add default fvm context to the epoch counter script by @janezpodhostnik in #6971
- Migration to add keys to service accounts for testing by @janezpodhostnik in #6969
Flow EVM
- skip debug trace uploading step if bucket name is empty by @ramtinms in #6335
- Expose logger to the EVM environment by @ramtinms in #6343
- Set prevrandao value on block level by @ramtinms in #6378
- Use a fixed coinbase address for Run and BatchRun and transfer gas fees afterward by @ramtinms in #6380
- adding state update checksum to transaction execution events by @ramtinms in #6456
- Add boundary checks for ABI encoding values of type
UInt
&Int
by @m-Peter in #6486 - Run tracing hooks
OnTxStart
,OnTxEnd
forDryRunTransaction
by @m-Peter in #6491 - adding a new encoding type for captured precompiled calls by @ramtinms in #6488
- Add support for
ABI
encoding/decoding of Soliditybyte
types by @m-Peter in #6553 - Move tracing reset to
OnTxEnd
hook by @m-Peter in #6627 - Move trace ID generation outside the concurrent path by @m-Peter in #6626
- Trigger
OnLog
tracer hooks upon successful call & tx results by @m-Peter in #6860 - update height in comment by @zhangchiqing in #6743
- Skip EVM storage account in
check-storage
command by @fxamacker in #6399 - Port PR #6401 (Skip EVM storage account for value comparison in diff-states cmd) to v0.37 branch by @fxamacker in #6416
- Include human-friendly error messages on EVM transaction events by @m-Peter in #6836
- Remove trace generation and GCP uploading functionality by @m-Peter in #6841
- Use
ErrorMessageWithRevertReason
when validating replay of EVM tx by @m-Peter in #6952 - Remove buffer gas added in the gas used from
EVM.dryRun
by @m-Peter in #6844 - Handle
UInt
,Int
Cadence types for EVM ABI encoding/decoding by @m-Peter in #6480 - Legacy migrations removed by @sideninja in #6369
- Split contract implementation into separate package by @turbolent in #6396
- Improve EVM addresses in tests by @turbolent in #6400
- Decode legacy block event by @devbugging in #6398
- adding commitment over state updates by @ramtinms in #6451
- patch evm debug tracer by @ramtinms in #6467
- Offchain package - part 1 by @ramtinms in #6544
- Adding account/slot/code iterators to the base storage by @ramtinms in #6555
- Make chain config concurrency safe by @ramtinms in #6578
- Offchain package - part 2 by @ramtinms in #6545
- Offchain package - part 3 by @ramtinms in #6546
- Fix COA ownership proof by @janezpodhostnik in #6550
- adding event collection and verification utilities by @ramtinms in #6582
- add utility command to export EVM state by @ramtinms in #6561
- Add verification tool for evm offchain replay by @zhangchiqing in #6755
- Refactor Export EVM State and Compare State Diff by @zhangchiqing in #6760
- Add testcase for offchain evm backward compatibilities by @zhangchiqing in #6749
- Fix testnet EVM replay by @janezpodhostnik in #6759
- Fix coinbase address change for old testnet by @zhangchiqing in #6763
Database
- Add universal database operations by @zhangchiqing in #6465
- Combine the caches for last finalized and last sealed block by @zhangchiqing in #6915
- Extract uncurried functions from storage writes by @zhangchiqing in #6803
Benchnet
- Align default label names by @peterargue in #6447
- Allow configuring view times faster than 1s by @peterargue in #6446
- Add epoch configs as env variables to Benchnet2 Makefile by @jordanschalm in #6855
Cadence
- Export type requirement extraction by @turbolent in #6395
- Add EVM storage account creation migration by @turbolent in #6422
- Update to Cadence v1.0.0-preview.52 by @turbolent in #6427
Networking Layer
- upgrade libp2p and libp2p-pubsub libraries by @peterargue in #6963
- Make ProtocolPeerCache configurable by @peterargue in #6997
- Add Libp2p Gossipsub Peer Gater by @kc1116 in #6479
Observer
- Ambiguous references by @UlyanaAndrukhiv in #6547
- Changed log level not to spam messages by @AndriiDiachuk in #6621
Utils
- Add a command to print all system addresses by @turbolent in #6339
- Add command to debug transaction by @turbolent in #6385
- Add command to debug a script by @turbolent in #6425
- Check checkpoint file exists when running state extraction by @zhangchiqing in #6459
- Fix duplication detection in root block finalization by @zhangchiqing in #6484
- Add verify execution result cmd by @zhangchiqing in #6746
- add nWorker to verify execution result by @zhangchiqing in #6830
- Add query last executed sealed block by @zhangchiqing in #6857
- Add flag to backward compatibilities testing tool to continue verify when mismatching is found by @zhangchiqing in #6954
- Backport: Fix cluster assignment >2/3 internal check by @jordanschalm in #6433
- Disable adx in util build by @tarakby in #6580
- Add support for private registry builds by @sjonpaulbrown in #6742
- Add support for
cap_tag
domain incheck-storage
command ofutil
program by @fxamacker in #6406 - Skip EVM storage account for value comparison in
util
program'sdiff-states
command by @fxamacker in #6401 - Port PR #6406 (Add support for
cap_tag
domain in check-storage cmd) to v0.37 branch by @fxamacker in #6417 - Port PR #6407 (Add support for
cap_tag
domain indiff-states
cmd) to v0.37 branch by @fxamacker in #6418 - Add support for
cap_tag
domain indiff-states
by @fxamacker in #6407 - Improve pull for transit/bootstrap by @jhawk28 in #6353
- Remove internal partners from root block creation by @zhangchiqing in #6472
- Add stats about account format versions to util's
checkpoint-collect-stats
command by @fxamacker in #6882 - Add support for account format v2 in util
check-storage
by @fxamacker in #6977 - Add
--exclude-randombeaconhistory
todiff-states
cmd inutil
program by @fxamacker in #6993 - Add check-storage command to util program to check storage health of execution state by @fxamacker in #6364
- Move and export some migration funcs to util package for reuse by @fxamacker in #6363
- Add support for checking EVM registers in
check-storage
command by @fxamacker in #6430 - Update
checkpoint-collect-stats
command to support payloads file and state commitment by @fxamacker in #6478 - Collect and report more stats in
checkpoint-collect-stats
command by @fxamacker in #6482 - Refactor the remote debugger and add support for using the execution data API by @turbolent in #6929
- Allow using interface-converted type-requirement in fields by @SupunS in #6341
- Add test for storage capability migration determinism by @SupunS in #6375
CI/CD
- print and include the sha256 checksum of the boot tools and util by @zhangchiqing in #6404
- Split access cohort3 tests into 2 groups by @peterargue in #6839
- Update action runners to latest versions by @peterargue in #6967
- Update code owners by @ramtinms in #6601 and by @franklywatson in #6851 and by @franklywatson in #6859
- Update to Cadence v1.2.2 by @turbolent in #6608
- Upgrade golangci linter to 1.63 by @jordanschalm in #6888
- Upgrade to go 1.23 by @peterargue in #6922
- Update Makefile to support private util builds by @sjonpaulbrown in #6790
- Add support for building private dependencies in CI by @sjonpaulbrown in #6727
- Use Production Docker Registry environment for pushing to docker by @Kay-Zee in #6562
- Update Makefile to handle key injection by @sjonpaulbrown in #6924
- adding a new target in the Makefile to generate a binary for the access node by @vishalchangrani in #6359
Maintenance and Lifecycle Updates
- Upgrade onflow/crypto by @tarakby in #6333
- Remove duplicated debug logs by @zhangchiqing in #6514
- Refactor: Replace some uses of engine.Unit with ComponentManager by @tim-barry in #6833
- Update to Cadence v1.0.0-preview.50 by @turbolent in #6390
- Update to cadence v1.0.0-preview.49 by @SupunS in #6383
- Update to Go SDK v1.0.0-preview.51 by @turbolent in #6386
- Update v0.37 with master by @turbolent in #6403
- Update to Cadence v1.0.0-preview.51 by @turbolent in #6423
- Update to Cadence v1.0.0-preview.52 by @turbolent in #6426
- Update to Cadence v1.0.0 by @turbolent in #6509
- Update to cadence v1.0.1 by @SupunS in #6556
- Remove Cadence 1.0 / Crescendo migrations by @turbolent in #6572
- Update to Cadence v1.1.0 by @turbolent in #6581
- Update to Cadence v1.3.0 by @turbolent in #6779
- Update to Cadence v1.3.1 by @turbolent in #6956
- Update to Atree v0.9.0 by @turbolent in #6956
- Remove last remnants of Cadence 1.0 and authorization fixes migrations by @turbolent in #6987
Misc
- Backport v0.37 pull improvements by @zhangchiqing in #6414
- Change TPS dataset by @janezpodhostnik in #6429
- Verbose sample size logs by @kc1116 in #6441
- Port internal 6971 by @turbolent in #6503
- Fix
systemcontracts
Burner address for Testnet/Mainnet by @jribbink in #6505 - Adds
getIDs()
to NFT program recovery by @joshuahannan in #6513 - Updates core contracts deps to 1.3.2 by @joshuahannan in #6570
- fix: fix slice init length by @rusttech in #6569
- Minimal emulator implementation inside integration by @bluesign in #6594
- Metrics server as component by @janezpodhostnik in #6801
- Expose node component management by @janezpodhostnik in #6769
- Backport log verify execution result master by @zhangchiqing in #6878
- Adds
NFTStorefrontV2
andUSDCFlow
to bootstrapping by @joshuahannan in #6611
New Contributors
- @jhawk28 made their first contribution in #6353
- @rusttech made their first contribution in #6569
- @franklywatson made their first contribution in #6851
Full Changelog: v0.37.26...v0.38.1