project-origin / wallet

OpenSource project to host wallets that contain Granular Certificates in the registries.
https://project-origin.github.io/docs/wallet
Apache License 2.0
4 stars 2 forks source link

Cleanup of Wallet Deposit Endpoints #59

Open duizer opened 1 year ago

duizer commented 1 year ago

Wallet Deposit Endpoints are easily created, which means that there is a case where they are never used. At the time of writing, there is no cleanup of unused Wallet Deposit Endpoint. This could lead to a potential performance issue.

Things to consider here is what is "unused" and do we need some lifetime period.

MartinSchmidt commented 1 year ago

This is indeed a good question, but if you gave the WalletDepositEndpoint to someone, and deleted you own reference to it, then they would be able to transfer to it on the registry level, but the WalletSystem would reject it, this leaves the Slice in limbo where no one can regain control of it.

We could make transfers similar to how allocate/claim works, so that a receiver has to receive on the registries as well before the transfer is complete, if not done, then the sender can revoke the transfer, only if the receiver has not completet it ofcouse.

sequenceDiagram
    SenderWallet->>Registry: TransferSlice
    SenderWallet->>ReceiverWallet: Send receiverSlice

    alt receiveSlice Success
        ReceiverWallet->>Registry: CompleteTransfer
    else fails
        SenderWallet->>Registry: RevokeTransfer
    end