near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.33k stars 629 forks source link

Tech debt: getting rid of `VMMemoryDefinitionOwnership` #11116

Open Ekleog-NEAR opened 7 months ago

Ekleog-NEAR commented 7 months ago

Currently, we store the VMMemoryDefinition in either the Instance or the LinearMemory instance. This separation sounds most likely wrong to me: we should most likely be able to simplify code by literally always having the memory definition owned by the Instance.

Also, we might be able to get rid of HostOwned altogether: AFAICT our contracts all only rely on exported memories, so we should never be touching the VMMemoryDefinitionOwnership::HostOwned code path. But before doing that, we should think about it and make sure that we do not plan on supporting any wasm extension that would require it, like the components one maybe?

Related to #11033

nagisa commented 7 months ago

I don't think we ever want to worry about future use-cases we might want to support before removing wasmer cruft.

The reason is simple -- that cruft, even if it does apply, will not fit quite right (as a rule of thumb). Trying to rationalize keeping it is throwing out our precious now-time (in both rationalization and maintenance) in hopes that we'll be able to expend slightly less future-time in trying to take advantage of what we'll have spent a bunch of effort by that point.