Closed ccyanxyz closed 2 years ago
Code updated @Myse1f
What's the encoding format of the message? How to parse Vec<u8>
to struct message
.
Proof format: https://github.com/nomad-xyz/rust/blob/main/accumulator/src/proof.rs#L8
Message format: https://github.com/nomad-xyz/rust/blob/main/nomad-core/src/types/messages.rs#L8
No need to be Vec
Seems Merkle root can be calculated by proof
only by proof.merkle_root_from_branch
?
Message
only determines whether it needs verification? Or we can only pass need_verify
to process_message
?
merkle root can be calculated from proof(merkel path) + message hash(leaf node value)
need_verify is changed to wait_optimistic, indicates whether or not to wait for the optimistic verification challenge window.
I think message hash is the field leaf
of proof
?
Or need to assert proof.leaf
== message.hash
?
Or assign proof.leaf
= message.hash
?
No need to assign, proxy canister verification logic:
if msg.wait_optimistic == false:
root = calc_root(proof, msg.hash)
if root in chain_roots:
true
else:
false
else:
root = calc_root(proof, msg.hash)
if root in chain_roots and root_confirm_time < time.now():
true
else:
false
https://github.com/rocklabs-io/omnic/blob/refactor/core/ic/refactor/proxy.rs
Proxy canister is responsible for:
@Myse1f