-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View function to check used proofs in ethereum without changing contract #40
Comments
Good idea! But this is relevant for Near->Eth transfer, not the other way. For the Eth->Near transfer to check if the proof exists or not we can have the following solution:
|
Done: #37 |
@paouvrard is this working for eNEAR unlock txs too? (https://github.com/aurora-is-near/near-erc20-connector) |
@mfornet yes |
This is implemented using eth_getStorageAt, but hadn't realized that On a related topic, what would be useful is to be able to determine the transfer finalization tx hash (which recorded the proof in usedProofs_) given the transfer initialization tx hash. The token connector doesn't provide such event, but it should still be possible to determine the correct finalization tx hash with reasonable accuracy by searching for the Transfer event. If more than 1 transfer with same amount and recipient is made inside the search range, we can choose to keep only the 1st one assuming the search range starts when the light client to Ethereum has synced and the transfers were finalized in the same order that they were initiated. For Eth -> NEAR transfers it looks doable for example by querying the |
Just to be clear, by this you mean: given a tx hash that initiated the event in Blockchain 1 find the tx hash that finalise it in Blockchain 2? Out of curiosity, why do you need this. Other than to determine if a transfer was finalised (but this can be done without finding finalisation tx). For NEAR -> Eth, you can binary search for the block where a proof was included (notice that the function eth_getStorageAt let you view the state at any height), then find the target tx in this block. Tbh, we should instead improve the interface and emit a log, but upgrading this contract is a complex operation. We should implement this anyway, for now, and ship it in the next upgrade (which is not planned at the moment).
This should work, since you already know the proof you can filter by success call to |
When the event relayer finalizes Eth -> NEAR transfers for users, it will be nice to show them the transaction which delivered the tokens on NEAR so that there is no confusion. Also when recovering a transfer, we can have a full view of it and display links to blockchain transactions.
Oh yea that works, cool idea ! Users wouldn't be able to make the same lock tx twice in the same block, so once we find the block, the tx hash can be found from the Transfer event. |
In order to check if a proof was already used we need to check in a dictionary inside an ethereum contract if the proof exists already.
Implement this as a function so it can be reused for several tools, in particular for frontend while restoring tx. Relevant comments: aurora-is-near/rainbow-bridge-frontend#235 (comment)
I'm thinking in the following interface:
The text was updated successfully, but these errors were encountered: