Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Give native support to host function imports

Aperta
#344 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
wasm
Ambito
compilers

Direzione di ricerca

Inizia esaminando l’approccio dei moduli host nella pull request indicata e la definizione di embedding di KEwasm. Poi traccia il modo in cui gli import e le istruzioni di chiamata a funzione sono rappresentati nella semantica di Wasm. Il lavoro sarà completato quando i moduli host e le chiamate host saranno rappresentati nativamente e gli embedding potranno dichiarare i propri moduli host e le proprie regole senza moduli wrapper.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The current approach to host functions is to introduce a Wasm module to simulate it, and adding special function call instructions to it. See this file:
https://github.com/runtimeverification/polkadot-verification/pull/103/files/9a535a2332aa82ae15cef0c54bec7c32ed743f6a#diff-0ca3b001e51794c799c189d2e70e6aa0

I believe we can improve on that method a bit. As it stands, we either need to write a Wasm host module the way the script above does (which is frail), or write a K definition of the module as in KEwasm.

Instead of declaring a new instruction for all host functions and wrapping the host functions in a module, we could extend the Wasm semantics, by having each embedder specify which modules should be considered host modules (in this case "env", in the Ewasm case "ethereum"), and adding rules for them:

syntax Set ::= "#HostModules" [function]
syntax Instr ::= #hostCall(WasmSting, WasmString, TypeDecl)

rule (import MODNAME FUNCNAME (func OID:OptionalId T:TypeDecl)) => (func OID T (#hostCall(MODNAME, FUNCNAME, T))
  requires MODNAME in #HostModules

Not saying this is something we should do now, necessarily, but it's something we should open an issue about,because it would make defining new embeddings easier. The concept of a host call would be native to the Wasm semantics, and each embedding would really only need to define the #HostModules set and each #hostCall it cares about. We could also assume any import from an undeclared module is a host function.

Lingua principale
WebAssembly
Stelle
107
Fork
26
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di runtimeverification/wasm-semantics

Tutte le issue di runtimeverification/wasm-semantics

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.