Skip to content

fix(svm): L-01 create new vault on deposit if needed #957

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

Open
wants to merge 4 commits into
base: solana-march-audit-2
Choose a base branch
from

Conversation

Reinis-FRP
Copy link
Contributor

@Reinis-FRP Reinis-FRP commented Apr 16, 2025

OZ identified following issue:

Pull request #939 removes route-enabling functionality in the SVM Spoke, allowing depositors to provide any input token for any destination chain, not only those with the route enabled. Previously, when a route was enabled, the Associated Token Account (ATA) of the vault for user deposits would be created. The DisabledRoute error would also be generated if a user tried to deposit to a disabled route. Since, by this point, all routes would be enabled, a user may try to submit a deposit where the vault ATA has not been initialized. This will cause the deposit transaction to fail without a descriptive error message.

Thus, if the vault has not been created, the depositor would have to initialize the PDA themselves, for example, using the createVault.ts script. However, this is not a simple process for the majority of users and it may be unclear why the deposit failed. This could cause users to abandon their deposit attempt and consider alternative bridging solutions. A more straightforward solution would be to initialize the vault during deposit using the init_if_needed flag as was previously done when the admin enabled a route.

Consider adding the init_if_needed flag or clearly documenting the desired vault creation process within the docstring for the deposit function.

This PR addresses the issue by adding the init_if_needed flag to the vault account in the deposit method.

Copy link

linear bot commented Apr 16, 2025

Reinis-FRP and others added 3 commits April 16, 2025 10:33
…-vault-initialization-process

Signed-off-by: Reinis Martinsons <[email protected]>
Signed-off-by: Reinis Martinsons <[email protected]>
* fix(svm): pin rust toolchain for solana

Signed-off-by: Reinis Martinsons <[email protected]>

* fix: add local toolchain

Signed-off-by: Reinis Martinsons <[email protected]>

* fix: add rustfmt to nightly

Signed-off-by: Reinis Martinsons <[email protected]>

* fix: pin nightly in lint scripts

Signed-off-by: Reinis Martinsons <[email protected]>

---------

Signed-off-by: Reinis Martinsons <[email protected]>
@Reinis-FRP Reinis-FRP marked this pull request as ready for review April 17, 2025 12:53
Copy link
Contributor

@md0x md0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants