You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the VM there are these three central methods runBlock(), runTx() and buildBlock() which have separate files on their own (like runBlock.ts and are already build for taking in the VM as an object (export async function runBlock(this: VM, opts: RunBlockOpts): Promise<RunBlockResult>). These functions are then bound in the vm.ts file to the VM object with code like this:
This basically does nothing useful except effectively chop off tree shaking and we can easily improve the situation by removing those bindings and switch calling into these like this without loosing any comfort:
vm.runBlock(opts: RunBlockOpts)// oldrunBlock(vm,opts)// new
(I would have a tendency to keep the simple names)
In fact these methods are very much functional/procedural by nature (so just: wrapping some flow around some objects (EVM, StateManager, Blockchain) and not so much about "doing manipulations on the VM object" (what is a "VM" anyway?), so this might generally even be the more fitting design. But that just as a side note.
Bundle for this part looks like this:
With the decoupling the respectively not-used parts (so if one is e.g. only calling into runTx() this will be: runTx(), buildBlock() and even the requests stuff (used in runBlock() and buildBlock()) will go away.
The text was updated successfully, but these errors were encountered:
Note: we can generally further think about where we are with VM (was e.g. wondering in between if we still need/want a VM class at all?), but I would suggest to first round start with this work, since it's pretty simple and already brings us along for some significant part of the way.
Part of #3446
In the VM there are these three central methods
runBlock()
,runTx()
andbuildBlock()
which have separate files on their own (like runBlock.ts and are already build for taking in theVM
as an object (export async function runBlock(this: VM, opts: RunBlockOpts): Promise<RunBlockResult>
). These functions are then bound in the vm.ts file to the VM object with code like this:This basically does nothing useful except effectively chop off tree shaking and we can easily improve the situation by removing those bindings and switch calling into these like this without loosing any comfort:
(I would have a tendency to keep the simple names)
In fact these methods are very much functional/procedural by nature (so just: wrapping some flow around some objects (EVM, StateManager, Blockchain) and not so much about "doing manipulations on the VM object" (what is a "VM" anyway?), so this might generally even be the more fitting design. But that just as a side note.
Bundle for this part looks like this:
With the decoupling the respectively not-used parts (so if one is e.g. only calling into
runTx()
this will be:runTx()
,buildBlock()
and even therequests
stuff (used inrunBlock()
andbuildBlock()
) will go away.The text was updated successfully, but these errors were encountered: