GithubHelp home page GithubHelp logo

modular-svm's Introduction

The Case for a Modular SVM

An effort is underway at Anza to extract most of the transaction processing pipeline out of the validator and into what will be known as the Solana Virtual Machine (SVM).

solana-labs/solana#34196

anza-xyz/agave#389

Although the official specification of this standalone SVM is still in development, it's important that we get this right.

An isolated SVM would be a transaction processing pipeline that can operate independent of any validator. Validators would then run some implementation of an SVM, and brand-new services could be built on top of custom SVM-compatible engines.

Why is a Modular SVM Important?

Having a decoupled SVM with its own well-defined interface unlocks the ability for teams to build custom SVM implementations, including:

  • SVM rollups
  • SVM sidechains
  • SVM-based off-chain services

Solutions like these can make Solana more performant and more reliable, as well as expand the landscape of possible products and services that can be built within its ecosystem.

๐Ÿ‘‰ But let's push the envelope. Imagine if we engineered this new isolated SVM to be an assembly of entirely independent modules. Any SVM implementation could simply drive these modules through well-defined interfaces.

This further disintegrates the barriers to SVM-compatible projects by requiring significantly less overhead to architect custom solutions. Teams could simply implement the modules they care about while using already established implementations for the others (such as those from Agave or Firedancer).

How Do We Get There?

We must take this opportunity to break away from library patterns that have plagued both core and protocol developers for a long time. Some of these issues include:

  • High-level libraries depending on low-level libraries for simple things such as types.
  • Tightly-coupled libraries using each other's objects instead of interfaces and adapters.
  • Metrics-capturing strands wired from the highest-level packages all the way to the lowest-level.

The modularity goals outlined in the previous section can be obtained by remedying these issues. Some suggested solutions are as follows:

  • Leverage lean, low-level type packages.
  • Differentiate between interfaces and implementations.
  • Connect implementations using interface adapters.
  • Bake metrics into the specification.

About This Repository

This repository seeks to demonstrate the concepts above by offering two groups of crates:

  • solana: The specification-based crates for types and interfaces, to be used by implementations.
  • agave: Anza's Agave client implementations of the solana specifications.

The solana-runtime specification (grossly over-simplified here) details a runtime that makes use of an SVM. However, notice that this is all done with interfaces.

https://github.com/buffalojoec/modular-svm/blob/ab1396d067987f52dca325028dbd49a94b50b317/solana/runtime/src/specification.rs#L10-L33

Meanwhile, the Agave runtime is now an implementation (agave-runtime), and it simply implements the solana-runtime interface, but without specifying a specific SVM implementation.

https://github.com/buffalojoec/modular-svm/blob/ab1396d067987f52dca325028dbd49a94b50b317/agave/runtime/src/lib.rs#L11-L45

The beautiful thing here is that any SVM could easily be plugged into Agave's runtime implementation. Anyone could configure an Agave node, then write an adapter for some other SVM implementation and plug it in right here.

https://github.com/buffalojoec/modular-svm/blob/ab1396d067987f52dca325028dbd49a94b50b317/agave/validator/src/lib.rs#L11-L21

๐Ÿ”‘ ๐Ÿ”‘ A huge advantage with this arrangement is the fact that consensus-breaking changes would reside in the specification-level, guarded by SIMDs, while developers could more freely adjust implementation-level code and ship new versions without worrying about partitioning the network.

Other important notes:

  • This demo uses lightweight "leaf node" crates for types (ie. solana-compute-budget).
  • Some leaf node crates are specification-wide (ie. solana-compute-budget) while others are implementation-specific (ie. agave-program-cache).
  • Although metrics are not demonstrated here (yet), the idea is that they would reside in one's implementation, and be vended back up to the callers.

modular-svm's People

Contributors

buffalojoec avatar

Stargazers

Siraaj Khandkar avatar

Watchers

Siraaj Khandkar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.