Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Copy the Transaction to the Wasm Instance Memory #462

Open
YaronWittenstein opened this issue Dec 20, 2021 · 0 comments
Open

Copy the Transaction to the Wasm Instance Memory #462

YaronWittenstein opened this issue Dec 20, 2021 · 0 comments
Assignees

Comments

@YaronWittenstein
Copy link
Contributor

YaronWittenstein commented Dec 20, 2021

Depends on: #456 #457 #460 #461

As things stand now, the Runtime takes the relevant calldata piece of the transaction and it copies only it to the Wasm Instance Memory before running it.

maybe better to rename: ctor_data to ctordata

This issue wants to achieve two things:

  • Have the binary Transaction copied to the Instance Memory
  • Avoid copying the calldata separately since this data is already parts of the Transaction (it's just that the field holding that data is contextual to the running code).

Implementation Proposal

Update the Call struct (see also #458)

Since this issue depends on #456 we should have now the binary transaction accessible within the FuncEnv.

The run method in the Runtime is a lower-level abstraction that will execute code.
Each execution will end up calling this function for running:

fn run<Args, Rets>(

It seems that if we'll update the Call struct (might have a different name by now - see #458)
https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/runtime/src/runtime/call.rs

to be like:

// `Call` might have been renamed by now
#[derive(Debug, Clone, PartialEq)]
pub struct Call {
  // It's enough to just specify what the `calldata` means,
  // we don't need the `func_input` anymore.
  pub kind: TxPart, 
}

Since the calldata is held in the binary Transaction we can manage by just specifying that the Call is for executing a verify/ctor/call tx function. If we decide to have also authorize then it'd be easy to adapt.

Adapt how the calldata offsets are extracted

TBD

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

No branches or pull requests

2 participants