Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization of the CRDT Collections #881

Open
chefsale opened this issue Oct 28, 2024 · 1 comment
Open

Optimization of the CRDT Collections #881

chefsale opened this issue Oct 28, 2024 · 1 comment
Assignees

Comments

@chefsale
Copy link
Member

chefsale commented Oct 28, 2024

Currently our CRDT Collections are doing too many storage requests to write and read data and we should make this better.

Running the runtime demo with KV store, we get this:

$ ./apps/kv-store/build.sh
$ cargo run -p calimero-runtime --example demo --features host-traces -- apps/kv-store/res/kv_store.wasm

fn:set key="name" & value="Jane" leads to 29 storage_reads and 12 storage_writes

----------------------------------------
method: set
params: {"key":"name","value":"Jane"}
fn input(register_id: u64 = 4294967294)
 ⇲ input(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(29)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114120, len: u64 = 29)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042043, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(151)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 151)
 ⇲ read_register(..) -> u32 = Ok(1)
fn log_utf8(ptr: u64 = 1114192, len: u64 = 36)
 ⇲ log_utf8(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1042395, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(197)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 197)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041819, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(90)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 90)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041819, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(90)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 90)
 ⇲ read_register(..) -> u32 = Ok(1)
fn emit(kind_ptr: u64 = 1114304, kind_len: u64 = 8, data_ptr: u64 = 1115272, data_len: u64 = 29)
 ⇲ emit(..) -> () = Ok(())
fn time_now(ptr: u64 = 1044824, len: u64 = 8)
 ⇲ time_now(..) -> () = Ok(())
fn random_bytes(ptr: u64 = 1044832, len: u64 = 16)
 ⇲ random_bytes(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1044251, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(197)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 197)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1044251, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(0)
fn storage_write(key_ptr: u64 = 1044711, key_len: u64 = 17, value_ptr: u64 = 1114872, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(0)
fn storage_read(key_ptr: u64 = 1043131, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043515, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044711, key_len: u64 = 17, value_ptr: u64 = 1114872, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044711, key_len: u64 = 17, value_ptr: u64 = 1114872, value_len: u64 = 245, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043131, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114872, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043515, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114872, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042859, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114872, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044711, key_len: u64 = 17, value_ptr: u64 = 1114872, value_len: u64 = 245, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043195, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114872, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043611, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044071, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042491, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042875, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044071, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043915, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043019, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(0)
fn storage_read(key_ptr: u64 = 1043611, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044071, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042491, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042875, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044071, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1044823, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 92, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(0)
fn storage_read(key_ptr: u64 = 1043595, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043547, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1115472, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1043595, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1115472, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn send_action(action_ptr: u64 = 1115472, action_len: u64 = 166)
 ⇲ send_action(..) -> () = Ok(())
fn value_return(tag: u64 = 0, value_ptr: u64 = 1114160, value_len: u64 = 4)
 ⇲ value_return(..) -> () = Ok(())
fn time_now(ptr: u64 = 1044840, len: u64 = 8)
 ⇲ time_now(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1040459, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(151)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114440, len: u64 = 151)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1040459, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(151)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114440, len: u64 = 151)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042027, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(86)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 86)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1042487, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 86, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1040907, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(86)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 86)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041291, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(86)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 86)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1042487, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 86, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1043239, key_len: u64 = 17, value_ptr: u64 = 1114440, value_len: u64 = 151, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn commit_root(ptr: u64 = 1044680, len: u64 = 32)
 ⇲ commit_root(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1042011, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(86)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 86)
 ⇲ read_register(..) -> u32 = Ok(1)
fn send_action(action_ptr: u64 = 1115472, action_len: u64 = 177)
 ⇲ send_action(..) -> () = Ok(())
New Root Hash: Some([122, 246, 141, 197, 225, 16, 66, 142, 198, 128, 84, 47, 146, 70, 52, 218, 78, 43, 242, 82, 68, 85, 140, 127, 134, 255, 191, 75, 221, 112, 130, 160])
Actions: 2
Logs:
  | Setting key: "name" to value: "Jane"
Events:
  kind: Inserted
  data: {"key":"name","value":"Jane"}
Returns:
  null

fn:get key="name" leads to 5 storage_reads

----------------------------------------
method: get
params: {"key":"name"}
fn input(register_id: u64 = 4294967294)
 ⇲ input(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(14)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114120, len: u64 = 14)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042971, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(151)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114144, len: u64 = 151)
 ⇲ read_register(..) -> u32 = Ok(1)
fn log_utf8(ptr: u64 = 1114144, len: u64 = 19)
 ⇲ log_utf8(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1043195, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114392, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042619, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(90)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114144, len: u64 = 90)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042619, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(90)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114144, len: u64 = 90)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042619, key_len: u64 = 17, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(92)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114144, len: u64 = 92)
 ⇲ read_register(..) -> u32 = Ok(1)
fn value_return(tag: u64 = 0, value_ptr: u64 = 1114144, value_len: u64 = 6)
 ⇲ value_return(..) -> () = Ok(())
New Root Hash: None
Actions: 0
Logs:
  | Getting key: "name"
Events:
  <empty>
Returns:
  "Jane"
@chefsale
Copy link
Member Author

chefsale commented Nov 1, 2024

28 storage_reads and 12 storage_writes

method: set
params: {"key":"name","value":"Jane"}
fn input(register_id: u64 = 4294967294)
 ⇲ input(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(29)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114120, len: u64 = 29)
 ⇲ read_register(..) -> u32 = Ok(1)
fn context_id(register_id: u64 = 4294967294)
 ⇲ context_id(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(32)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1043872, len: u64 = 32)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1040155, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(391)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114192, len: u64 = 391)
 ⇲ read_register(..) -> u32 = Ok(1)
fn log_utf8(ptr: u64 = 1114192, len: u64 = 36)
 ⇲ log_utf8(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1041707, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(0)
fn emit(kind_ptr: u64 = 1114304, kind_len: u64 = 8, data_ptr: u64 = 1114432, data_len: u64 = 29)
 ⇲ emit(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1041707, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(0)
fn time_now(ptr: u64 = 1043960, len: u64 = 8)
 ⇲ time_now(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1042971, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(181)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 181)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042971, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(0)
fn storage_write(key_ptr: u64 = 1043831, key_len: u64 = 33, value_ptr: u64 = 1114944, value_len: u64 = 134, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(0)
fn storage_read(key_ptr: u64 = 1041579, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042043, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1043831, key_len: u64 = 33, value_ptr: u64 = 1114944, value_len: u64 = 134, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1043831, key_len: u64 = 33, value_ptr: u64 = 1115208, value_len: u64 = 245, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041579, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1115208, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042043, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1115208, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041227, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1115208, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1043831, key_len: u64 = 33, value_ptr: u64 = 1115208, value_len: u64 = 245, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041611, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1115208, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1042171, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1043031, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 134, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1040779, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041243, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1043031, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 134, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041579, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1040747, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(0)
fn storage_read(key_ptr: u64 = 1041211, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1042071, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 134, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1039819, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1040283, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1042071, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 134, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1042999, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 284, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(0)
fn context_id(register_id: u64 = 4294967294)
 ⇲ context_id(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(32)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1042944, len: u64 = 32)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041227, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(134)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 134)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041195, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114224, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041227, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(245)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1115696, len: u64 = 245)
 ⇲ read_register(..) -> u32 = Ok(1)
fn send_action(action_ptr: u64 = 1115696, action_len: u64 = 390)
 ⇲ send_action(..) -> () = Ok(())
fn value_return(tag: u64 = 0, value_ptr: u64 = 1114160, value_len: u64 = 4)
 ⇲ value_return(..) -> () = Ok(())
fn time_now(ptr: u64 = 1043992, len: u64 = 8)
 ⇲ time_now(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1038443, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(391)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114664, len: u64 = 391)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1038443, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(391)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114664, len: u64 = 391)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1040427, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1041287, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1039035, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1039499, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1041287, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 102, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn storage_write(key_ptr: u64 = 1042215, key_len: u64 = 33, value_ptr: u64 = 1114664, value_len: u64 = 391, register_id: u64 = 4294967294)
 ⇲ storage_write(..) -> u32 = Ok(1)
fn context_id(register_id: u64 = 4294967294)
 ⇲ context_id(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(32)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1042160, len: u64 = 32)
 ⇲ read_register(..) -> u32 = Ok(1)
fn commit_root(ptr: u64 = 1043832, len: u64 = 32)
 ⇲ commit_root(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1040443, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(102)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114296, len: u64 = 102)
 ⇲ read_register(..) -> u32 = Ok(1)
fn send_action(action_ptr: u64 = 1115696, action_len: u64 = 433)
 ⇲ send_action(..) -> () = Ok(())
New Root Hash: Some([242, 164, 241, 47, 220, 111, 198, 119, 149, 54, 13, 165, 37, 59, 115, 212, 53, 60, 129, 38, 104, 253, 156, 113, 145, 10, 188, 225, 51, 5, 156, 1])
Actions: 2
Logs:
  | Setting key: "name" to value: "Jane"
Events:
  kind: Inserted
  data: {"key":"name","value":"Jane"}
Returns:
  null

New implementation 2 storage reads

params: {"key":"name"}
fn input(register_id: u64 = 4294967294)
 ⇲ input(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(14)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114120, len: u64 = 14)
 ⇲ read_register(..) -> u32 = Ok(1)
fn context_id(register_id: u64 = 4294967294)
 ⇲ context_id(..) -> () = Ok(())
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(32)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1045408, len: u64 = 32)
 ⇲ read_register(..) -> u32 = Ok(1)
fn storage_read(key_ptr: u64 = 1041691, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(391)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114144, len: u64 = 391)
 ⇲ read_register(..) -> u32 = Ok(1)
fn log_utf8(ptr: u64 = 1114144, len: u64 = 19)
 ⇲ log_utf8(..) -> () = Ok(())
fn storage_read(key_ptr: u64 = 1042331, key_len: u64 = 33, register_id: u64 = 4294967294)
 ⇲ storage_read(..) -> u32 = Ok(1)
fn register_len(register_id: u64 = 4294967294)
 ⇲ register_len(..) -> u64 = Ok(284)
fn read_register(register_id: u64 = 4294967294, ptr: u64 = 1114144, len: u64 = 284)
 ⇲ read_register(..) -> u32 = Ok(1)
fn value_return(tag: u64 = 0, value_ptr: u64 = 1114144, value_len: u64 = 6)
 ⇲ value_return(..) -> () = Ok(())
New Root Hash: None
Actions: 0
Logs:
  | Getting key: "name"
Events:
  <empty>
Returns:
  "Jane"

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

No branches or pull requests

1 participant