Skip to content
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

Race Condition Between Deposits and Fee Changes #93

Open
freddyli7 opened this issue Apr 12, 2023 · 2 comments
Open

Race Condition Between Deposits and Fee Changes #93

freddyli7 opened this issue Apr 12, 2023 · 2 comments

Comments

@freddyli7
Copy link
Contributor

A deposit could be charged with an unexpected fee if a fee change occurs shortly before the deposit is processed.

Location
Chainsafe_Sygma_Substrate_Pallets/bridge/src/lib.rs#L458

Remediation
only change bridge fees with long lead times, and after giving ample warnings to users.

Security audit team recommend passing the expected fee as a separate argument to the deposit function call, and also recommend refraining from processing the deposit if the actual fee differs from the expectation.

@freddyli7
Copy link
Contributor Author

split deposit fee as a separate argument of deposit func is considered as a huge breaking change, and I think such issue is avoidable if we take precaution by sending notifications to users and also pause bridge when modifying the fee. Nothing to be fixed or changed in this issue unless we decide to separate the fee, which would be a huge amount of work considering testing

@pesco
Copy link

pesco commented Apr 24, 2023

Since I have no insight into your testing process/requirements, I won't argue with that, but codewise this change would be very simple. I can imagine an extra argument for the expected fee and one additional check right before the one that establishes that the incoming amount actually covers the fees. Another thought: Would it be easier to add a new API call ("deposit2" or whatever) that includes the extra check/argument?

@MakMuftic MakMuftic added this to the Mainnet launch milestone May 4, 2023
@MakMuftic MakMuftic removed this from the Mainnet launch milestone May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants