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

Consider giving JavaScript host hooks to respond to rollbacks #8

Open
kettle11 opened this issue Feb 18, 2023 · 0 comments
Open

Consider giving JavaScript host hooks to respond to rollbacks #8

kettle11 opened this issue Feb 18, 2023 · 0 comments

Comments

@kettle11
Copy link
Owner

Tangle only syncs WebAssembly but to do anything useful it has to integrate with the host environment.

Tangle could expose some way for the host environment to respond to rollbacks.

A pontential solution could look something like this:

let imports = {
  createBuffer: () => {
    return context.createBuffer(); 
  }
};

let rollbacks = {
  createBuffer: (args, returnValue) => {
    context.deleteBuffer(returnValue);
  }
};

const result = await Tangle.instantiateStreaming(fetch("my_wasm.wasm"), imports, { rollbacks });

Then Tangle would have to track internally which import calls have rollbacks and when Tangle rolls back and resimulates it will call the appropriate rollback callbacks.


A bigger-picture solution might be some sort of meta-Tangle layer that connects individual Tangle nodes and standardizes how rollback events are passed between them. The JavaScript host could be seen as a 'node' that must be manually networked but it still abides by the same interface. Probably something like that is too big-picture to do soon but it's worth keeping in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant