freenet-core icon indicating copy to clipboard operation
freenet-core copied to clipboard

Contract versioning

Open sanity opened this issue 3 years ago • 0 comments

The contract API will evolve over time, and we should support a contract versioning mechanism to allow these changes in a backward compatible way.

Here is a suggested approach for representing the versions.

enum ContractContainer {
  Wasm(WasmAPIVersion),
  // Non-Wasm contracts supported here
}

enum WasmAPIVersion {
  V0_0_1 { wasm_code : Wasm, parameters : [u8] },
  V0_0_2 { wasm_code : Wasm, parameters : [u8] },
}

For serializing these enums I suggest using a variable length integer library such as varuint, for maximum flexibility.

sanity avatar Sep 13 '22 16:09 sanity