cspr-rad / kairos

Apache License 2.0
2 stars 0 forks source link

Add get-nonce endpoint #146

Closed marijanp closed 1 month ago

marijanp commented 1 month ago

See comment in the e2e why we cannot reliably test this yet

koxu1996 commented 1 month ago

I am not sure about that edge case. nonce is used to count number of interactions between user and L2, and deposit is not using it, since it is initiated on L1. Should not first transfer just use nonce=0?

marijanp commented 1 month ago

@koxu1996 after successful batch verification of a deposit the account trie will be updated by inserting an account. And that accounts nonce defaults to 0. Is that what you are referring to?

Avi-D-coder commented 1 month ago

I think synchronization here is just running get nonce in a loop. The account is added to the trie as soon as the l1 even hits the l2 server. It does not wait until batch verification. The proof of the next batch contains the output of a matching deposit and then the pending deposit is complete.

koxu1996 commented 1 month ago

after successful batch verification of a deposit the account trie will be updated by inserting an account. And that accounts nonce defaults to 0. Is that what you are referring to?

Not really. Every public key you could imagine like 0000..0000 is valid account, and nonce is just number of interactions with L2. Therefore I think that nonce returned for account that does not exist in trie should be 0.

marijanp commented 1 month ago

Don't merge yet

marijanp commented 1 month ago

ready to merge