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

Technical design: Assembling Wasm bytecode #732

Open
raulk opened this issue Jun 13, 2022 · 0 comments
Open

Technical design: Assembling Wasm bytecode #732

raulk opened this issue Jun 13, 2022 · 0 comments

Comments

@raulk
Copy link
Member

raulk commented Jun 13, 2022

The Filecoin network has several limits at different layers that hinder the installation of typical statically-linked Wasm code in a single message:

  • Mpool limit: 64KiB per message
  • Gossipsub limit: 1MiB per message
  • Bitswap limit: 2MiB per message
  • libp2p limit: 4MiB per message
  • Params limit for internal and chain messages: (?, if any)

Possible solutions:

  • ⛔ Hard limit of (less than) 64KiB of code. No-go because this would severely cripple the utility of FVM.
  • ⛔ Extend limits generally. No-go because it creates new attack vectors.
  • ⛔ Conditional limits. No-go: impractical and leaky.
  • ✅ 2 phase installation (preferred solution)
    • Deploy/Bootstrap/Bootloader actors that accumulate/append segments of bytecode in state.
    • Once complete, they call the InitActor#InstallCode method with the final bytecode and self-destruct.
    • They are user-land so that logic is customizable (e.g. compression, patching, etc.) This allows users to find their own ways to reduce their on-chain footprint.
    • All logic happens in actor code, thus it pays for gas, thus disarming any potential bombs.
    • Need to introduce an InitActor#GetCode(cid) method (or equivalent syscall) to fetch existing code to enable advanced use cases. Equivalent to Ethereum’s EXTCODECOPY.
    • Supports permissioned installation and upgrades, similar to [Solana Buffers](https://docs.solana.com/cli/deploy-a-program#using-an-intermediary-buffer-account).
@raulk raulk changed the title Technical design: Assembling actor code Technical design: Assembling Wasm bytecode Jun 28, 2022
@raulk raulk added the MIGRATED label Aug 18, 2022
@raulk raulk transferred this issue from filecoin-project/fvm-specs Aug 18, 2022
@raulk raulk added this to the M2.2 milestone Sep 2, 2022
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

1 participant