nahmii-community / bridge

The Nahmii gateway, for bridging assets between L1 <-> L2.
1 stars 2 forks source link

Clearing localstorage when in claim period loses ability to withdraw. #51

Closed hill399 closed 2 years ago

hill399 commented 2 years ago

Describe the bug When a user initiates a withdrawal on the bridge, a record of this is stored in localstorage. Now IF the user is to clear their browser storage (or use a different PC/mobile) then they will lose this record and be unable to withdraw using this method - as it appears it rely solely on this localstorage entry.

To Reproduce Steps to reproduce the behavior:

  1. Initiate withdraw on testnet. Withdraw appears on account page.
  2. Clear browser storage (with localstorage erase).
  3. View account page, records are no longer visible.
  4. See error

Expected behavior Deposits and withdrawal should be visible to the user regardless of prior localstorage records. Should be regenerated upon connecting Ethereum account.

Possible Solution Implement an initial check on load to fetch contract deposits & withdrawals via contract events. This will allow for records to be regenerated and continue to be used as intended.

Desktop (please complete the following information):

HDauven commented 2 years ago

This has been explicitly ignored to prevent large number of calls to either our JSON-RPC clients or block explorer.

An option I considered was to provide this ability as a standalone tool to prevent users from being able to "DDoS" our services or being blacklisted for executing too many actions towards our services.

The following options and changes are in consideration:

hill399 commented 2 years ago

I think point 2 is a nice solution for the interim, it will give users some ability to withdraw with minimum interaction (fetching the tx hash).

I'm not 100% familiar with the stack, but maybe running a private graph node and subgraph for the bridge contracts could reduce the load on the RPC interface. Would take longer to set up than traditional RPC calls, but will lay the foundations if nahmii wants to integrate into their hosted service.

https://github.com/graphprotocol/graph-node