dusk-network / rusk-vm

The Dusk Rust WASM VM implementation
Mozilla Public License 2.0
54 stars 12 forks source link

Port VM1 contract code behind link to VM2 and add state behind link in VM2 contract #333

Closed miloszm closed 2 years ago

miloszm commented 2 years ago

Describe what you want implemented Contract code was put behind link in VM1, this needs to be ported to VM2. Also, it is beneficial to put contract state behind link as well.

Describe "Why" this is needed When state changes, contract code does not need to be rewritten when re-serialising the state. State behind link allows contracts to share same state, e.g., in a hamt node.

Describe alternatives you've considered We could keep contract code and state without links, but this is less efficient as every change in state causes code to be rewritten.

Additional context Not having a link also causes a storage size bloat. That's why it was introduced in VM1.