-
Notifications
You must be signed in to change notification settings - Fork 719
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
Specify deposit IDs #314
Specify deposit IDs #314
Conversation
updated deposit ID compute process
Not sure exactly what we want to make up the deposit ID. Technically the Also, please advise where else this would need to be specified. I see #103 added to the tx_format part of the protocol to specify withdrawal outputs, but I'm not sure what the parallel would be for deposits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can leave specifying a deposit state element (similar to a UTXO) to a future PR, and only specify the actual identifier for a deposit in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Lots of stuff in the FuelVM works best at word alignment (i.e. 8 bytes). I would instead use 32 bytes for addresses, and left-pad with zeroes (which is what FuelLabs/sway#1452) does. This would also be forwards-compatible with the proposed address extension: https://ethereum-magicians.org/t/thoughts-on-address-space-extension-ase/6779
Also, is there a need for 32 byte nonces? Would prefer 8 bytes (i.e. uint64
) since it'll just be easier to deal with in the FuelVM.
Co-authored-by: John Adler <[email protected]>
Changed address to be 32 bytes left-padded with zeroes and deposit nonce reduced to 64bits (still plenty) |
Looping in @simonr0204 and @rakita for reviews from the perspective of the contract and the relayer, respectively. |
How are we defining Do we want to be stuck with this definition for non-evm deployments ? Also - is the address the depositor (on L1) , or the Fuel address receiving the deposit? |
Good questions. The precision here should be against units, e.g. wei for Ethereum. So a precision of As for address, it should be the receiving address on Fuel, which is 32 bytes so no padding necessary. The sending address is irrelevant for the Fuel chain. |
Makes sense. I'll update the contracts to reflect. For the address, |
Maybe we refer to |
Recipient ain't bad |
Relayer does not care what is inside of hash, we just need some kind of id, only having nonce would be sufficient enough for our side. Regarding deposits, in fuel ecosystem we don't have I am not exactly getting how precision is going to work inside FuelVm, what is the idea behind it is this some data that is going to be used by VM or something like additional info that is tied to coin? |
The FuelVM won't actually use the precision. Token contracts can be provided the preimage to the ID to extract the precision, then use that to mint an appropriate number of Fuel-tokens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, just remembered we need a notion of asset ID for deposits. This should be independent of the user, the amount, and the nonce. Should be computed as token address + token precision.
Then you can use this asset ID in the deposit ID computation instead of duplicating usage of the token address and precision
Co-authored-by: John Adler <[email protected]>
Updated deposit ID compute process