dwallet-labs / dwallet-network

dWallet Network, a composable modular signature network that is the home of dWallets. A dWallet is a noncollusive and massively decentralized signing mechanism, used as a building block by builders on other networks to add native multi-chain interoperability to any smart contract.
https://docs.dwallet.io
Other
40 stars 35 forks source link

`ethereum-light-client`: update state only when necessary #272

Closed yuvalelmo closed 1 month ago

yuvalelmo commented 2 months ago

Updating the state now only happens if the message cannot be verified using the current state. If the current state includes the message then it won't be updated.

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **dwallet-network-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/dwallet-labs-team/dwallet-network-docs/2LQY5dbDP9xjUGgQh6QpXfoUPqrP)) | [Visit Preview](https://dwallet-network-docs-git-226-try-appro-8fd2f8-dwallet-labs-team.vercel.app) | | Oct 7, 2024 0:06am |
yuvalelmo commented 2 months ago

Are you sure this code is working? AFAIK, the code will fail to generate the proof if it tries to create it with an outdated checkpoint. From here, it seems that when it fails to do so, you simply return the error instead of updating the state and trying again. Am I missing something?

Yes, I am pretty sure this code works. :) The code does not generate any proof. It makes an RPC call to the ethereum execution rpc and gets the proof. If it fails - then something is wrong with either the rpc or the response form - not with the checkpoint.

If you call the proof endpoint with an outdated state it would not fail. you would still get a response with a proof, it would just have some of the fields empty.

ItayLevyOfficial commented 1 month ago

Are you sure this code is working? AFAIK, the code will fail to generate the proof if it tries to create it with an outdated checkpoint. From here, it seems that when it fails to do so, you simply return the error instead of updating the state and trying again. Am I missing something?

Yes, I am pretty sure this code works. :) The code does not generate any proof. It makes an RPC call to the ethereum execution rpc and gets the proof. If it fails - then something is wrong with either the rpc or the response form - not with the checkpoint.

If you call the proof endpoint with an outdated state it would not fail. you would still get a response with a proof, it would just have some of the fields empty.

gotcha cool - maybe add a comment with this explanation? Was not intuitive for me.