0xMiden / 0xMiden/protocol

Send only the required data in (P)SWAPs based on payback visibility (public/private)

未关闭
#2,950 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
standards
主要语言
Rust
星标
132
派生
167
平均合并
1 天 23 小时
30 天内合并 PR
110

描述

Alternative Title: Avoid leakage of (P)SWAP creator/target account id on private paybacks

On both Swap and PSwap in the case of public paybacks the consumer needs to be able to create the public `P2ID` note that (currently) goes to the Swap creator, for that purpose he needs the pre-image of the recipient, information that wouldn't have been necessary if the payback was private because with simply the hash it would've been enough.

The way in which we solve it is that the creator of the swap embeds the `creator_account_id` in the storage of the swap script so that when the consumer executes it they can use that data to compute the recipient. But for the case of private payback this data is not only unnecessary but also reveals information about the target of the swap. In current scenarios that information is revealed anyway because the target of the swap is always the creator but in the future it could be possible that a swap creator may want to receive funds in another account, so in that scenario a private payback would make it impossible for anyone else to know what the target account is. The proposed fix is to put in the storage of the (P)SWAP script the `target_account_id` (currently `creator_account_id` in PSwap) only in case of a public payback, and in a private payback we don't reveal that information.

Given that this change applies for both Swap and PSwap we should also consider unifying the behavior of both, but this is more cumbersome than the current issue and it may require its own separate issue, it's worth considering though as both scripts have behavior in common and there could potentially be only one of them.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。