ideas:
previous_amount + value_created - value_destroyed == actual_amount_in_the_bridge. It doesn’t guarantee anything else. So the users must trust the sequencer to organize the ledger correctly and they could use all the founds in PoS for themselves if they want.ledger_aged and ledger_latest that’s not a big change but it’s still important to note it.A proof attesting that given these public values:
class StateTransitionBalance:
previous_root: zkhash # Merkle root of the channel ledger before the update
new_root: zkhash # Merkle root of the channel ledger after the update
value_added: TokenValue
value_removed: TokenValue
The prover knows the following witness:
class StateTransitionBalanceWitness:
previous_notes: list[Note]
new_notes: list[Note]
notes_merkle_path: list[list[zkhash]] # each path is the path against the
# root of the state after the update of all the previous notes
notes_merkle_path_selectors: list[list[bool]]
such that the following constraints hold:
Verify the update of the root and the membership of the previous notes
for (previous_note, new_note, path, selectors) in
zip(previous_notes, notes_merkle_path, notes_merkle_path_selectors):
assert previous_root == path_root(leaf=derive_note_id(0,0,previous_note),
path=path,
selectors=selectors)
previous_root = update_root(leaf=derive_note_id(0,0,new_note),
path=path,
selectors=selectors)
# The new root is the previous root after all the updates
assert new_root == previous_root
The proof ouput the balances
added = 0
removed = 0
for note in previous_notes:
removed += note.value
for note in new_notes:
added += note.value
assert value_added == added
assert value_removed == removed