Skip to content

Commit 389724d

Browse files
authored
fix(svm): upgrade post-audit to pristine program ids (#1054)
This merges new svm program ids PR #1011 and oz-review-june-25 so that we can upgrade the pristine production deployments to the latest post-audit version. Signed-off-by: Reinis Martinsons <[email protected]>
1 parent a49832e commit 389724d

33 files changed

+216
-124
lines changed

Anchor.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ resolution = true
55
skip-lint = false
66

77
[programs.localnet]
8-
multicall_handler = "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h"
9-
svm_spoke = "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq"
8+
multicall_handler = "HaQe51FWtnmaEcuYEfPA7MRCXKrtqptat4oJdJ8zV5Be"
9+
svm_spoke = "DLv3NggMiSaef97YCkew5xKUHDh13tVGZ7tydt3ZeAru"
1010
test = "8tsEfDSiE4WUMf97oyyyasLAvWwjeRZb2GByh4w7HckA"
1111

1212
[programs.devnet]
1313
multicall_handler = "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h"
1414
svm_spoke = "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq"
1515

1616
[programs.mainnet]
17-
multicall_handler = "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h"
18-
svm_spoke = "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq"
17+
multicall_handler = "HaQe51FWtnmaEcuYEfPA7MRCXKrtqptat4oJdJ8zV5Be"
18+
svm_spoke = "DLv3NggMiSaef97YCkew5xKUHDh13tVGZ7tydt3ZeAru"
1919

2020
[registry]
2121
url = "https://api.apr.dev"

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export KEYPAIR=~/.config/solana/dev-wallet.json
8686
export PROGRAM=svm_spoke # Also repeat the deployment process for multicall_handler
8787
export PROGRAM_ID=$(cat target/idl/$PROGRAM.json | jq -r ".address")
8888
export MULTISIG= # Export the Squads vault, not the multisig address!
89+
export SOLANA_VERSION=$(grep -A 2 'name = "solana-program"' Cargo.lock | grep 'version' | head -n 1 | cut -d'"' -f2)
8990
```
9091

9192
For the initial deployment also need these:
@@ -95,6 +96,7 @@ export SVM_CHAIN_ID=$(cast to-dec $(cast shr $(cast shl $(cast keccak solana-dev
9596
export HUB_POOL=0x14224e63716afAcE30C9a417E0542281869f7d9e # This is for sepolia, update for mainnet
9697
export DEPOSIT_QUOTE_TIME_BUFFER=3600
9798
export FILL_DEADLINE_BUFFER=21600
99+
export MAX_LEN=$(( 2 * $(stat -c %s target/deploy/$PROGRAM.so) )) # Reserve twice the size of the program for future upgrades
98100
```
99101

100102
#### Initial deployment
@@ -103,11 +105,14 @@ Deploy the program and set the upgrade authority to the multisig:
103105

104106
```shell
105107
solana program deploy \
106-
--url $RPC_URL target/deploy/$PROGRAM.so \
108+
--url $RPC_URL \
107109
--keypair $KEYPAIR \
108110
--program-id target/deploy/$PROGRAM-keypair.json \
111+
--max-len $MAX_LEN \
109112
--with-compute-unit-price 50000 \
110-
--max-sign-attempts 100
113+
--max-sign-attempts 100 \
114+
--use-rpc \
115+
target/deploy/$PROGRAM.so
111116
solana program set-upgrade-authority \
112117
--url $RPC_URL \
113118
--keypair $KEYPAIR \
@@ -215,6 +220,7 @@ solana-verify verify-from-repo \
215220
--url $RPC_URL \
216221
--program-id $PROGRAM_ID \
217222
--library-name $PROGRAM \
223+
--base-image "solanafoundation/solana-verifiable-build:$SOLANA_VERSION" \
218224
https://github.com/across-protocol/contracts
219225
```
220226

@@ -225,6 +231,7 @@ solana-verify export-pda-tx \
225231
--url $RPC_URL \
226232
--program-id $PROGRAM_ID \
227233
--library-name $PROGRAM \
234+
--base-image "solanafoundation/solana-verifiable-build:$SOLANA_VERSION" \
228235
--uploader $MULTISIG \
229236
https://github.com/across-protocol/contracts
230237
```

deployments/deployments.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"Cher_Adapter": { "address": "0x0c9d064523177dBB55CFE52b9D0c485FBFc35FD2", "blockNumber": 21597341 },
3636
"Lens_Adapter": { "address": "0x63AC22131eD457aeCbD63e6c4C7eeC7BBC74fF1F", "blockNumber": 22167069 },
3737
"DoctorWho_Adapter": { "address": "0xFADcC43096756e1527306FD92982FEbBe3c629Fa", "blockNumber": 21773451 },
38-
"Solana_Adapter": { "address": "0x1E22A3146439C68A2d247448372AcAEe9E201AB1", "blockNumber": 22566473 }
38+
"Solana_Adapter": { "address": "0x9F788694934fD2Ed34D5340B9a76EB34f2bFD7B3", "blockNumber": 22595936 }
3939
},
4040
"10": {
4141
"SpokePool": { "address": "0x6f26Bf09B1C792e3228e5467807a900A503c0281", "blockNumber": 93903076 },
@@ -226,12 +226,12 @@
226226
},
227227
"34268394551451": {
228228
"SvmSpoke": {
229-
"address": "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq",
230-
"blockNumber": 317101505
229+
"address": "DLv3NggMiSaef97YCkew5xKUHDh13tVGZ7tydt3ZeAru",
230+
"blockNumber": 349354195
231231
},
232232
"MulticallHandler": {
233-
"address": "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h",
234-
"blockNumber": 317112562
233+
"address": "HaQe51FWtnmaEcuYEfPA7MRCXKrtqptat4oJdJ8zV5Be",
234+
"blockNumber": 349358090
235235
},
236236
"MessageTransmitter": {
237237
"address": "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd",

deployments/mainnet/Solana_Adapter.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"address": "0x1E22A3146439C68A2d247448372AcAEe9E201AB1",
2+
"address": "0x9F788694934fD2Ed34D5340B9a76EB34f2bFD7B3",
33
"abi": [
44
{
55
"inputs": [
@@ -328,29 +328,29 @@
328328
"type": "function"
329329
}
330330
],
331-
"transactionHash": "0x940c1e4bf26e94e657bc1e1344d3c2aea44e80a051837b75812283668a23c3a7",
331+
"transactionHash": "0x5256d567a2ce4cbc96f04cb3b0885fad53fd48d163b67a79d9dfeaaba21f6fc3",
332332
"receipt": {
333333
"to": null,
334334
"from": "0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D",
335-
"contractAddress": "0x1E22A3146439C68A2d247448372AcAEe9E201AB1",
336-
"transactionIndex": 72,
335+
"contractAddress": "0x9F788694934fD2Ed34D5340B9a76EB34f2bFD7B3",
336+
"transactionIndex": 22,
337337
"gasUsed": "1034334",
338338
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
339-
"blockHash": "0x66dae79469e26570eb7960c9b1daa884ca592e1085f00879f1012d1e5e309022",
340-
"transactionHash": "0x940c1e4bf26e94e657bc1e1344d3c2aea44e80a051837b75812283668a23c3a7",
339+
"blockHash": "0x60c1b45973d5aba6a92d540aa1c8b879817b8a1a3cafcb9b20ce4ba474c44dd1",
340+
"transactionHash": "0x5256d567a2ce4cbc96f04cb3b0885fad53fd48d163b67a79d9dfeaaba21f6fc3",
341341
"logs": [],
342-
"blockNumber": 22566473,
343-
"cumulativeGasUsed": "5278156",
342+
"blockNumber": 22595936,
343+
"cumulativeGasUsed": "4109786",
344344
"status": 1,
345345
"byzantium": true
346346
},
347347
"args": [
348348
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
349349
"0xBd3fa81B58Ba92a82136038B25aDec7066af3155",
350350
"0x0a992d191deec32afe36203ad87d7d289a738f81",
351-
"0xff09aa2d3eb1bc9da19e82264930e13d3993e1160f3039ef21afd1565376efca",
351+
"0xb7664086de37ee70821c10445b162f2c7ec8795bd0800c1462949e2328d1dd5a",
352352
"0xc6fa7af3bedbad3a3d65f36aabc97431b1bbe4c2d2f6e0e47ca60203452f5d61",
353-
"0xe11ef405ee6e9a6497fb8209d04040216281c57264730415648de979f6cec7fa"
353+
"0xf5d9ddc2b5d994277e15ea380117a3f8ef04ce1e37e2c678c3be4d11b2a5d034"
354354
],
355355
"numDeployments": 1,
356356
"solcInputHash": "335735b51fb84a31677c4bf77e2b5d68",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@across-protocol/contracts",
3-
"version": "4.0.13",
3+
"version": "4.1.0",
44
"author": "UMA Team",
55
"license": "AGPL-3.0-only",
66
"repository": {

programs/multicall-handler/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ security_txt! {
2222

2323
// If changing the program ID, make sure to check that the resulting handler_signer PDA has the highest bump of 255 so
2424
// to minimize the compute cost when finding the PDA.
25-
declare_id!("Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h");
25+
declare_id!("HaQe51FWtnmaEcuYEfPA7MRCXKrtqptat4oJdJ8zV5Be");
2626

2727
#[program]
2828
pub mod multicall_handler {

programs/svm-spoke/src/common/relay_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct RelayData {
77
pub exclusive_relayer: Pubkey,
88
pub input_token: Pubkey,
99
pub output_token: Pubkey,
10-
pub input_amount: u64,
10+
pub input_amount: [u8; 32],
1111
pub output_amount: u64,
1212
pub origin_chain_id: u64,
1313
pub deposit_id: [u8; 32],

programs/svm-spoke/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ pub enum CommonError {
3333
InsufficientSpokePoolBalanceToExecuteLeaf,
3434
#[msg("Invalid exclusive relayer!")]
3535
InvalidExclusiveRelayer,
36+
#[msg("Invalid output token!")]
37+
InvalidOutputToken,
3638
}
3739

3840
// SVM specific errors.

programs/svm-spoke/src/event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct FundsDeposited {
3939
pub input_token: Pubkey,
4040
pub output_token: Pubkey,
4141
pub input_amount: u64,
42-
pub output_amount: u64,
42+
pub output_amount: [u8; 32],
4343
pub destination_chain_id: u64,
4444
pub deposit_id: [u8; 32],
4545
pub quote_timestamp: u32,
@@ -71,7 +71,7 @@ pub struct RelayExecutionEventInfo {
7171
pub struct FilledRelay {
7272
pub input_token: Pubkey,
7373
pub output_token: Pubkey,
74-
pub input_amount: u64,
74+
pub input_amount: [u8; 32],
7575
pub output_amount: u64,
7676
pub repayment_chain_id: u64,
7777
pub origin_chain_id: u64,
@@ -91,7 +91,7 @@ pub struct FilledRelay {
9191
pub struct RequestedSlowFill {
9292
pub input_token: Pubkey,
9393
pub output_token: Pubkey,
94-
pub input_amount: u64,
94+
pub input_amount: [u8; 32],
9595
pub output_amount: u64,
9696
pub origin_chain_id: u64,
9797
pub deposit_id: [u8; 32],

programs/svm-spoke/src/instructions/deposit.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@ use crate::{
2121

2222
#[event_cpi]
2323
#[derive(Accounts)]
24-
#[instruction(
25-
depositor: Pubkey,
26-
recipient: Pubkey,
27-
input_token: Pubkey,
28-
output_token: Pubkey,
29-
input_amount: u64,
30-
output_amount: u64,
31-
destination_chain_id: u64
32-
)]
24+
#[instruction(depositor: Pubkey, recipient: Pubkey, input_token: Pubkey)]
3325
pub struct Deposit<'info> {
3426
#[account(mut)]
3527
pub signer: Signer<'info>,
@@ -82,7 +74,7 @@ pub fn _deposit(
8274
input_token: Pubkey,
8375
output_token: Pubkey,
8476
input_amount: u64,
85-
output_amount: u64,
77+
output_amount: [u8; 32],
8678
destination_chain_id: u64,
8779
exclusive_relayer: Pubkey,
8880
deposit_id: [u8; 32],
@@ -95,6 +87,10 @@ pub fn _deposit(
9587
let state = &mut ctx.accounts.state;
9688
let current_time = get_current_time(state)?;
9789

90+
if output_token == Pubkey::default() {
91+
return err!(CommonError::InvalidOutputToken);
92+
}
93+
9894
if current_time.checked_sub(quote_timestamp).unwrap_or(u32::MAX) > state.deposit_quote_time_buffer {
9995
return err!(CommonError::InvalidQuoteTimestamp);
10096
}
@@ -156,7 +152,7 @@ pub fn deposit(
156152
input_token: Pubkey,
157153
output_token: Pubkey,
158154
input_amount: u64,
159-
output_amount: u64,
155+
output_amount: [u8; 32],
160156
destination_chain_id: u64,
161157
exclusive_relayer: Pubkey,
162158
quote_timestamp: u32,
@@ -208,7 +204,7 @@ pub fn deposit_now(
208204
input_token: Pubkey,
209205
output_token: Pubkey,
210206
input_amount: u64,
211-
output_amount: u64,
207+
output_amount: [u8; 32],
212208
destination_chain_id: u64,
213209
exclusive_relayer: Pubkey,
214210
fill_deadline_offset: u32,
@@ -260,7 +256,7 @@ pub fn unsafe_deposit(
260256
input_token: Pubkey,
261257
output_token: Pubkey,
262258
input_amount: u64,
263-
output_amount: u64,
259+
output_amount: [u8; 32],
264260
destination_chain_id: u64,
265261
exclusive_relayer: Pubkey,
266262
deposit_nonce: u64,

0 commit comments

Comments
 (0)