Skip to content

[Protocol3] Generic Extension for Request Validation (GERV) #318

@Brechtpd

Description

@Brechtpd

This is interesting:

This allows withdrawals before a block is proven.

I think we can do something similar like this with minimal changes:

  • The user does a withdrawal (on-chain/off-chain) like usual
  • The withdrawal is included in a block and the approved withdrawal data is stored on-chain (but the block is not yet proven)
  • The user wants to do a fast withdrawal so requests the withdrawn tokens through the cookie jar contract, the contract checks the approved withdrawal data for the user (accountID, tokenID, amountWithdrawn), if the cookie jar has enough funds to do this transfer:
    • The cookie jar immediately sends the tokens to the user using the funds stored in the cookie jar contract.
    • The accountID in the approved withdrawal data is changed to the account of the cookie jar contract so once the block is proven the cookie jar contract receives the tokens it 'borrowed to the user

The cookie jar contract is operated by the exchange so of course the exchange trusts itself to submit a valid proof for the block. If not, the exchange loses the funds (and the user is happy because he can withdraw the funds again! User funds remain safe.).

The user probably needs to approve this somehow because this could be a security risk for users if the cookie jar contract is malicious. The approved withdrawal data could maybe include a single bit if the user allows these fast withdrawals. Or the cookie jar contract cannot be changed easily for an exchange/needs to be approved by the Loopring contract/...
EDIT: the token transfer from the cookie jar contract to the user can be done in the exchange contract which makes it secure for users even without having to trust the cookie jar contract, no approval from users needed. The only change for users is that they get their tokens earlier than they would otherwise, which is only a benefit.

Could be useful, though the number of withdrawals we can do in a single block is very limited by the approved withdrawal data because we need to store that onchain (which is expensive), currently max ~1800 withdrawals/block so the time to prove a block like this will be quite low to begin with.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions