sherlock-audit / 2024-09-orderly-network-solana-contract-judging

0 stars 0 forks source link

Petite Pecan Starfish - admin cannot update peer address #84

Open sherlock-admin2 opened 4 days ago

sherlock-admin2 commented 4 days ago

Petite Pecan Starfish

Medium

admin cannot update peer address

Summary

admin cannot update peer address

Root Cause

admin can set peer address in application has been deployed in solana network and other application in orderly network and when admin set them as peer its mean they can send and receive message through layer zero, in orderly side admin can update peer address but in solana side admin cannot update that

Code Snippet

https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract/blob/main/solana-vault/packages/solana/contracts/programs/solana-vault/src/instructions/oapp_instr/set_peer.rs#L12

Impact

admin cannot update peer address in solana-valut

Mitigation

@@ -9,7 +9,7 @@ pub struct SetPeer<'info> {
     #[account(mut)]
     pub admin: Signer<'info>,
     #[account(
-        init,
+        init_if_needed,
         payer = admin,
         space = 8 + Peer::INIT_SPACE,
         seeds = [PEER_SEED, &oapp_config.key().to_bytes(), &params.dst_eid.to_be_bytes()],
@@ -27,7 +27,7 @@ pub struct SetPeer<'info> {