Skip to content

Commit d946f1e

Browse files
committed
re-deploy devnet prod solana programs
1 parent 8e5d6cc commit d946f1e

12 files changed

Lines changed: 317 additions & 21 deletions

File tree

base/script/HelperConfig.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ contract HelperConfig is Script {
8787

8888
return NetworkConfig({
8989
initialOwner: bridgeAdmin,
90-
remoteBridge: Pubkey.wrap(0xf4bab13776fe25bfeccf8c99a3aae4cf9ca25d7991d54cccb7dfc614b3ceb5b5), // HUKbDBb1j5M5UV66eKptMGjgvqesD5LFtfUktiVpEmrt
90+
remoteBridge: Pubkey.wrap(0x68b29bb2aca46156b4dd9e1f1aa704ba4477f2bad04297098659b15ce3e9ca04), // 83hN2esneZUbKgLfUvo7uzas4g7kyiodeNKAqZgx5MbH
9191
erc1967Factory: ERC1967FactoryConstants.ADDRESS,
9292
baseValidators: baseValidators,
9393
baseSignatureThreshold: 2,

solana/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ A cross-chain bridge program that enables seamless message passing between Solan
44

55
## Program IDs
66

7-
- **Devnet Bridge**: `HUKbDBb1j5M5UV66eKptMGjgvqesD5LFtfUktiVpEmrt`
8-
- **Devnet Base Relayer**: `2pXcpctLdWasZ7RRjMyiAVCcT9bLuiSn7mrBr3vF7EUk`
7+
- **Devnet Bridge**: `83hN2esneZUbKgLfUvo7uzas4g7kyiodeNKAqZgx5MbH`
8+
- **Devnet Base Relayer**: `J29jxzRsQmkpxkJptuaxYXgyNqjFZErxXtDWQ4ma3k51`
99

1010
## Overview
1111

solana/clients/ts/generated/base_relayer/errors/baseRelayer.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,16 @@ import {
1414
} from '@solana/kit';
1515
import { BASE_RELAYER_PROGRAM_ADDRESS } from '../programs';
1616

17-
/** GasLimitTooLow: Gas limit too low */
18-
export const BASE_RELAYER_ERROR__GAS_LIMIT_TOO_LOW = 0x1770; // 6000
19-
/** GasLimitExceeded: Gas limit exceeded */
20-
export const BASE_RELAYER_ERROR__GAS_LIMIT_EXCEEDED = 0x1771; // 6001
17+
/** UnauthorizedConfigUpdate: Unauthorized to update configuration */
18+
export const BASE_RELAYER_ERROR__UNAUTHORIZED_CONFIG_UPDATE = 0x2ee0; // 12000
2119

2220
export type BaseRelayerError =
23-
| typeof BASE_RELAYER_ERROR__GAS_LIMIT_EXCEEDED
24-
| typeof BASE_RELAYER_ERROR__GAS_LIMIT_TOO_LOW;
21+
typeof BASE_RELAYER_ERROR__UNAUTHORIZED_CONFIG_UPDATE;
2522

2623
let baseRelayerErrorMessages: Record<BaseRelayerError, string> | undefined;
2724
if (process.env.NODE_ENV !== 'production') {
2825
baseRelayerErrorMessages = {
29-
[BASE_RELAYER_ERROR__GAS_LIMIT_EXCEEDED]: `Gas limit exceeded`,
30-
[BASE_RELAYER_ERROR__GAS_LIMIT_TOO_LOW]: `Gas limit too low`,
26+
[BASE_RELAYER_ERROR__UNAUTHORIZED_CONFIG_UPDATE]: `Unauthorized to update configuration`,
3127
};
3228
}
3329

solana/clients/ts/generated/bridge/instructions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export * from './setGasTarget';
3131
export * from './setMaxCallBufferSize';
3232
export * from './setMinimumBaseFee';
3333
export * from './setOracleSigners';
34+
export * from './setPartnerOracleConfig';
3435
export * from './setPauseStatus';
3536
export * from './setWindowDuration';
3637
export * from './transferGuardian';
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/**
2+
* This code was AUTOGENERATED using the codama library.
3+
* Please DO NOT EDIT THIS FILE, instead use visitors
4+
* to add features, then rerun codama to update it.
5+
*
6+
* @see https://github.com/codama-idl/codama
7+
*/
8+
9+
import {
10+
combineCodec,
11+
fixDecoderSize,
12+
fixEncoderSize,
13+
getBytesDecoder,
14+
getBytesEncoder,
15+
getStructDecoder,
16+
getStructEncoder,
17+
transformEncoder,
18+
type Address,
19+
type Codec,
20+
type Decoder,
21+
type Encoder,
22+
type IAccountMeta,
23+
type IAccountSignerMeta,
24+
type IInstruction,
25+
type IInstructionWithAccounts,
26+
type IInstructionWithData,
27+
type ReadonlySignerAccount,
28+
type ReadonlyUint8Array,
29+
type TransactionSigner,
30+
type WritableAccount,
31+
} from '@solana/kit';
32+
import { BRIDGE_PROGRAM_ADDRESS } from '../programs';
33+
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';
34+
import {
35+
getPartnerOracleConfigDecoder,
36+
getPartnerOracleConfigEncoder,
37+
type PartnerOracleConfig,
38+
type PartnerOracleConfigArgs,
39+
} from '../types';
40+
41+
export const SET_PARTNER_ORACLE_CONFIG_DISCRIMINATOR = new Uint8Array([
42+
34, 48, 231, 135, 42, 113, 217, 157,
43+
]);
44+
45+
export function getSetPartnerOracleConfigDiscriminatorBytes() {
46+
return fixEncoderSize(getBytesEncoder(), 8).encode(
47+
SET_PARTNER_ORACLE_CONFIG_DISCRIMINATOR
48+
);
49+
}
50+
51+
export type SetPartnerOracleConfigInstruction<
52+
TProgram extends string = typeof BRIDGE_PROGRAM_ADDRESS,
53+
TAccountBridge extends string | IAccountMeta<string> = string,
54+
TAccountGuardian extends string | IAccountMeta<string> = string,
55+
TRemainingAccounts extends readonly IAccountMeta<string>[] = [],
56+
> = IInstruction<TProgram> &
57+
IInstructionWithData<Uint8Array> &
58+
IInstructionWithAccounts<
59+
[
60+
TAccountBridge extends string
61+
? WritableAccount<TAccountBridge>
62+
: TAccountBridge,
63+
TAccountGuardian extends string
64+
? ReadonlySignerAccount<TAccountGuardian> &
65+
IAccountSignerMeta<TAccountGuardian>
66+
: TAccountGuardian,
67+
...TRemainingAccounts,
68+
]
69+
>;
70+
71+
export type SetPartnerOracleConfigInstructionData = {
72+
discriminator: ReadonlyUint8Array;
73+
newConfig: PartnerOracleConfig;
74+
};
75+
76+
export type SetPartnerOracleConfigInstructionDataArgs = {
77+
newConfig: PartnerOracleConfigArgs;
78+
};
79+
80+
export function getSetPartnerOracleConfigInstructionDataEncoder(): Encoder<SetPartnerOracleConfigInstructionDataArgs> {
81+
return transformEncoder(
82+
getStructEncoder([
83+
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
84+
['newConfig', getPartnerOracleConfigEncoder()],
85+
]),
86+
(value) => ({
87+
...value,
88+
discriminator: SET_PARTNER_ORACLE_CONFIG_DISCRIMINATOR,
89+
})
90+
);
91+
}
92+
93+
export function getSetPartnerOracleConfigInstructionDataDecoder(): Decoder<SetPartnerOracleConfigInstructionData> {
94+
return getStructDecoder([
95+
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
96+
['newConfig', getPartnerOracleConfigDecoder()],
97+
]);
98+
}
99+
100+
export function getSetPartnerOracleConfigInstructionDataCodec(): Codec<
101+
SetPartnerOracleConfigInstructionDataArgs,
102+
SetPartnerOracleConfigInstructionData
103+
> {
104+
return combineCodec(
105+
getSetPartnerOracleConfigInstructionDataEncoder(),
106+
getSetPartnerOracleConfigInstructionDataDecoder()
107+
);
108+
}
109+
110+
export type SetPartnerOracleConfigInput<
111+
TAccountBridge extends string = string,
112+
TAccountGuardian extends string = string,
113+
> = {
114+
/** The bridge account containing configuration */
115+
bridge: Address<TAccountBridge>;
116+
/** The guardian account authorized to update configuration */
117+
guardian: TransactionSigner<TAccountGuardian>;
118+
newConfig: SetPartnerOracleConfigInstructionDataArgs['newConfig'];
119+
};
120+
121+
export function getSetPartnerOracleConfigInstruction<
122+
TAccountBridge extends string,
123+
TAccountGuardian extends string,
124+
TProgramAddress extends Address = typeof BRIDGE_PROGRAM_ADDRESS,
125+
>(
126+
input: SetPartnerOracleConfigInput<TAccountBridge, TAccountGuardian>,
127+
config?: { programAddress?: TProgramAddress }
128+
): SetPartnerOracleConfigInstruction<
129+
TProgramAddress,
130+
TAccountBridge,
131+
TAccountGuardian
132+
> {
133+
// Program address.
134+
const programAddress = config?.programAddress ?? BRIDGE_PROGRAM_ADDRESS;
135+
136+
// Original accounts.
137+
const originalAccounts = {
138+
bridge: { value: input.bridge ?? null, isWritable: true },
139+
guardian: { value: input.guardian ?? null, isWritable: false },
140+
};
141+
const accounts = originalAccounts as Record<
142+
keyof typeof originalAccounts,
143+
ResolvedAccount
144+
>;
145+
146+
// Original args.
147+
const args = { ...input };
148+
149+
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
150+
const instruction = {
151+
accounts: [
152+
getAccountMeta(accounts.bridge),
153+
getAccountMeta(accounts.guardian),
154+
],
155+
programAddress,
156+
data: getSetPartnerOracleConfigInstructionDataEncoder().encode(
157+
args as SetPartnerOracleConfigInstructionDataArgs
158+
),
159+
} as SetPartnerOracleConfigInstruction<
160+
TProgramAddress,
161+
TAccountBridge,
162+
TAccountGuardian
163+
>;
164+
165+
return instruction;
166+
}
167+
168+
export type ParsedSetPartnerOracleConfigInstruction<
169+
TProgram extends string = typeof BRIDGE_PROGRAM_ADDRESS,
170+
TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[],
171+
> = {
172+
programAddress: Address<TProgram>;
173+
accounts: {
174+
/** The bridge account containing configuration */
175+
bridge: TAccountMetas[0];
176+
/** The guardian account authorized to update configuration */
177+
guardian: TAccountMetas[1];
178+
};
179+
data: SetPartnerOracleConfigInstructionData;
180+
};
181+
182+
export function parseSetPartnerOracleConfigInstruction<
183+
TProgram extends string,
184+
TAccountMetas extends readonly IAccountMeta[],
185+
>(
186+
instruction: IInstruction<TProgram> &
187+
IInstructionWithAccounts<TAccountMetas> &
188+
IInstructionWithData<Uint8Array>
189+
): ParsedSetPartnerOracleConfigInstruction<TProgram, TAccountMetas> {
190+
if (instruction.accounts.length < 2) {
191+
// TODO: Coded error.
192+
throw new Error('Not enough accounts');
193+
}
194+
let accountIndex = 0;
195+
const getNextAccount = () => {
196+
const accountMeta = instruction.accounts![accountIndex]!;
197+
accountIndex += 1;
198+
return accountMeta;
199+
};
200+
return {
201+
programAddress: instruction.programAddress,
202+
accounts: {
203+
bridge: getNextAccount(),
204+
guardian: getNextAccount(),
205+
},
206+
data: getSetPartnerOracleConfigInstructionDataDecoder().decode(
207+
instruction.data
208+
),
209+
};
210+
}

solana/clients/ts/generated/bridge/programs/bridge.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
type ParsedSetMaxCallBufferSizeInstruction,
4040
type ParsedSetMinimumBaseFeeInstruction,
4141
type ParsedSetOracleSignersInstruction,
42+
type ParsedSetPartnerOracleConfigInstruction,
4243
type ParsedSetPauseStatusInstruction,
4344
type ParsedSetWindowDurationInstruction,
4445
type ParsedTransferGuardianInstruction,
@@ -145,6 +146,7 @@ export enum BridgeInstruction {
145146
SetMaxCallBufferSize,
146147
SetMinimumBaseFee,
147148
SetOracleSigners,
149+
SetPartnerOracleConfig,
148150
SetPauseStatus,
149151
SetWindowDuration,
150152
TransferGuardian,
@@ -430,6 +432,17 @@ export function identifyBridgeInstruction(
430432
) {
431433
return BridgeInstruction.SetOracleSigners;
432434
}
435+
if (
436+
containsBytes(
437+
data,
438+
fixEncoderSize(getBytesEncoder(), 8).encode(
439+
new Uint8Array([34, 48, 231, 135, 42, 113, 217, 157])
440+
),
441+
0
442+
)
443+
) {
444+
return BridgeInstruction.SetPartnerOracleConfig;
445+
}
433446
if (
434447
containsBytes(
435448
data,
@@ -555,6 +568,9 @@ export type ParsedBridgeInstruction<TProgram extends string = 'undefined'> =
555568
| ({
556569
instructionType: BridgeInstruction.SetOracleSigners;
557570
} & ParsedSetOracleSignersInstruction<TProgram>)
571+
| ({
572+
instructionType: BridgeInstruction.SetPartnerOracleConfig;
573+
} & ParsedSetPartnerOracleConfigInstruction<TProgram>)
558574
| ({
559575
instructionType: BridgeInstruction.SetPauseStatus;
560576
} & ParsedSetPauseStatusInstruction<TProgram>)

solana/idl.base_relayer.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,9 @@ export const IDL = {
344344
],
345345
"errors": [
346346
{
347-
"code": 6000,
348-
"name": "GasLimitTooLow",
349-
"msg": "Gas limit too low"
350-
},
351-
{
352-
"code": 6001,
353-
"name": "GasLimitExceeded",
354-
"msg": "Gas limit exceeded"
347+
"code": 12000,
348+
"name": "UnauthorizedConfigUpdate",
349+
"msg": "Unauthorized to update configuration"
355350
}
356351
],
357352
"types": [

solana/idl.bridge.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,52 @@ export const IDL = {
19351935
}
19361936
]
19371937
},
1938+
{
1939+
"name": "set_partner_oracle_config",
1940+
"docs": [
1941+
"Update the partner oracle configuration containing the required signature threshold",
1942+
"",
1943+
"# Arguments",
1944+
"* `ctx` - The context containing the bridge account and guardian",
1945+
"* `new_config` - The new partner oracle config"
1946+
],
1947+
"discriminator": [
1948+
34,
1949+
48,
1950+
231,
1951+
135,
1952+
42,
1953+
113,
1954+
217,
1955+
157
1956+
],
1957+
"accounts": [
1958+
{
1959+
"name": "bridge",
1960+
"docs": [
1961+
"The bridge account containing configuration"
1962+
],
1963+
"writable": true
1964+
},
1965+
{
1966+
"name": "guardian",
1967+
"docs": [
1968+
"The guardian account authorized to update configuration"
1969+
],
1970+
"signer": true
1971+
}
1972+
],
1973+
"args": [
1974+
{
1975+
"name": "new_config",
1976+
"type": {
1977+
"defined": {
1978+
"name": "PartnerOracleConfig"
1979+
}
1980+
}
1981+
}
1982+
]
1983+
},
19381984
{
19391985
"name": "set_pause_status",
19401986
"docs": [

solana/programs/bridge/src/common/instructions/config/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ pub use pause::*;
2020
pub mod base_oracle_signers;
2121
pub use base_oracle_signers::*;
2222

23+
pub mod partner_config;
24+
pub use partner_config::*;
25+
2326
/// Accounts struct for bridge configuration setter instructions
2427
/// Only the guardian can update these parameters
2528
#[derive(Accounts)]

0 commit comments

Comments
 (0)