onflow / flow-go

A fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them.
GNU Affero General Public License v3.0
531 stars 170 forks source link

[Access] Investigate options for running multiple FVM/cadence versions on single AN #6023

Open peterargue opened 1 month ago

peterargue commented 1 month ago

From time to time, the version of cadence or FVM need to be upgraded to address security issues, or add new functionality. When this happens, all nodes interacting with execution state (Execution, verification and access nodes) perform what's call a "Height Coordinated Upgrade" to synchronize updating to the new version at the same block height. This ensures that transactions and scripts produce the same result on all nodes.

Currently, Access nodes can run a single version of cadence/FVM for use by script execution. This is fine for executing against the latest block, but poses problems for archival nodes that want to serve queries for previous blocks that cross HCU boundaries. The only way to address this today is to run a separate node for each range of blocks between HCUs, that's running the correct software versions, but this creates operational challenges.

Identify options available to address this issue, and create a proof of concept solution that could be used to solve it.

bluesign commented 1 month ago

This is something I researched previously (unrelated issue actually, it was webassembly emulator when CGO issues came up) , what I ended up with this was to use webassembly and get rid of FVM part (by providing a thin runtime interface to cadence).

I think for script execution it would work very good.