Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: XLabs/arbitrary-token-transfers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0886d2928d9d05bcb0f2dac831a879cf8ed13ae1
Choose a base ref
..
head repository: XLabs/arbitrary-token-transfers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1fb1484cea8a10df96d1c2773c2882f5b37c7f3f
Choose a head ref
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/relayer-infra-contracts
50 changes: 7 additions & 43 deletions sdk/solana/tbrv3/idl/token_bridge_relayer.ts
Original file line number Diff line number Diff line change
@@ -761,7 +761,7 @@ export type TokenBridgeRelayer = {
"name": "tbrConfig",
"docs": [
"Owner Config account. This program requires that the `owner` specified",
"in the context equals the pubkey specified in this account. Mutable."
"in the context equals the pubkey specified in this account."
],
"writable": true,
"pda": {
@@ -957,13 +957,6 @@ export type TokenBridgeRelayer = {
"Proof that the signer is authorized."
]
},
{
"name": "tbrConfig",
"docs": [
"Owner Config account. This program requires that the `signer` specified",
"in the context equals an authorized pubkey specified in this account."
]
},
{
"name": "peer",
"writable": true,
@@ -1186,14 +1179,6 @@ export type TokenBridgeRelayer = {
{
"name": "chainConfig",
"writable": true
},
{
"name": "tbrConfig",
"docs": [
"Program Config account. This program requires that the [`signer`] specified",
"in the context equals a pubkey specified in this account. Mutable,",
"because we will update roles depending on the operation."
]
}
],
"args": [
@@ -1635,17 +1620,7 @@ export type TokenBridgeRelayer = {
"docs": [
"Owner of the program as set in the [`TbrConfig`] account."
],
"signer": true,
"relations": [
"tbrConfig"
]
},
{
"name": "tbrConfig",
"docs": [
"Owner Config account. This program requires that the `owner` specified",
"in the context equals the `owner` pubkey specified in this account."
]
"signer": true
},
{
"name": "peer"
@@ -1802,14 +1777,6 @@ export type TokenBridgeRelayer = {
{
"name": "chainConfig",
"writable": true
},
{
"name": "tbrConfig",
"docs": [
"Program Config account. This program requires that the [`signer`] specified",
"in the context equals a pubkey specified in this account. Mutable,",
"because we will update roles depending on the operation."
]
}
],
"args": [
@@ -1857,14 +1824,6 @@ export type TokenBridgeRelayer = {
{
"name": "chainConfig",
"writable": true
},
{
"name": "tbrConfig",
"docs": [
"Program Config account. This program requires that the [`signer`] specified",
"in the context equals a pubkey specified in this account. Mutable,",
"because we will update roles depending on the operation."
]
}
],
"args": [
@@ -2068,6 +2027,11 @@ export type TokenBridgeRelayer = {
"code": 6019,
"name": "missingAssociatedTokenAccount",
"msg": "missingAssociatedTokenAccount"
},
{
"code": 6020,
"name": "overflow",
"msg": "overflow"
}
],
"types": [
9 changes: 3 additions & 6 deletions sdk/solana/tbrv3/token-bridge-relayer.ts
Original file line number Diff line number Diff line change
@@ -467,7 +467,6 @@ export class SolanaTokenBridgeRelayer {
.accountsStrict({
signer,
authBadge: this.account.authBadge(signer).address,
tbrConfig: this.account.config().address,
peer: this.account.peer(chain, peerAddress).address,
chainConfig: this.account.chainConfig(chain).address,
systemProgram: SystemProgram.programId,
@@ -488,7 +487,6 @@ export class SolanaTokenBridgeRelayer {
.updateCanonicalPeer()
.accountsStrict({
owner: config.owner,
tbrConfig: this.account.config().address,
peer: this.account.peer(chain, peerAddress).address,
chainConfig: this.account.chainConfig(chain).address,
systemProgram: SystemProgram.programId,
@@ -512,7 +510,6 @@ export class SolanaTokenBridgeRelayer {
signer,
authBadge: this.account.authBadge(signer).address,
chainConfig: this.account.chainConfig(chain).address,
tbrConfig: this.account.config().address,
})
.instruction();
}
@@ -531,15 +528,16 @@ export class SolanaTokenBridgeRelayer {
signer,
authBadge: this.account.authBadge(signer).address,
chainConfig: this.account.chainConfig(chain).address,
tbrConfig: this.account.config().address,
})
.instruction();
}

/**
* Change the fee asked for relaying a transfer.
*
* Signer: the Owner or an Admin.
*/
async updateRelayerFee(
async updateBaseFee(
signer: PublicKey,
chain: Chain,
relayerFee: number,
@@ -550,7 +548,6 @@ export class SolanaTokenBridgeRelayer {
signer,
authBadge: this.account.authBadge(signer).address,
chainConfig: this.account.chainConfig(chain).address,
tbrConfig: this.account.config().address,
})
.instruction();
}
9 changes: 3 additions & 6 deletions solana/programs/token-bridge-relayer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -25,20 +25,17 @@ testnet = ["solana-price-oracle/testnet", "wormhole-anchor-sdk/solana-devnet"]

[dependencies]
cfg-if = "1"
anchor-lang = { version = "0.30.1", git = "https://github.com/coral-xyz/anchor/", rev = "8d52c1c", features = [
anchor-lang = { version = "0.30.1", git = "https://github.com/coral-xyz/anchor/", rev = "06527e57c3e59683c36eb0a5c69ee669100b42e5", features = [
"init-if-needed",
] }
anchor-spl = { version = "0.30.1", git = "https://github.com/coral-xyz/anchor/", rev = "8d52c1c" }
anchor-spl = { version = "0.30.1", git = "https://github.com/coral-xyz/anchor/", rev = "06527e57c3e59683c36eb0a5c69ee669100b42e5" }

solana-price-oracle = { path = "../../../lib/relayer-infra-contracts/src/solana/programs/price-oracle" }

#wormhole-anchor-sdk = { git = "https://github.com/wormhole-foundation/wormhole-scaffolding.git", rev = "1acd10e3cbeea0df06976b606bd24da2e8e849e1", features = ["token-bridge"] }
wormhole-anchor-sdk = { git = "https://github.com/real-felix/wormhole-scaffolding.git", branch = "bump-anchor", default-features = false, features = [
wormhole-anchor-sdk = { git = "https://github.com/wormhole-foundation/wormhole-scaffolding.git", default-features = false, features = [
"solana-devnet",
"token-bridge",
] }
#wormhole-anchor-sdk = { path = "../../../../wormhole-scaffolding/solana/modules/wormhole-anchor-sdk/", features = ["token-bridge"] }
#wormhole-solana-utils = { version = "0.3.0-alpha.1", features = ["anchor"]}

wormhole-io = "0.1"

4 changes: 4 additions & 0 deletions solana/programs/token-bridge-relayer/src/error.rs
Original file line number Diff line number Diff line change
@@ -90,4 +90,8 @@ pub(crate) enum TokenBridgeRelayerError {
/// unwrap intent is set to `true`.
#[msg("MissingAssociatedTokenAccount")]
MissingAssociatedTokenAccount,

/// Numerical overflow.
#[msg("Overflow")]
Overflow,
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
error::TokenBridgeRelayerError,
state::{AuthBadgeState, ChainConfigState, TbrConfigState},
state::{AuthBadgeState, ChainConfigState},
};
use anchor_lang::prelude::*;

@@ -16,11 +16,6 @@ pub struct UpdateChainConfig<'info> {

#[account(mut)]
pub chain_config: Account<'info, ChainConfigState>,

/// Program Config account. This program requires that the [`signer`] specified
/// in the context equals a pubkey specified in this account. Mutable,
/// because we will update roles depending on the operation.
pub tbr_config: Account<'info, TbrConfigState>,
}

pub fn set_pause_for_outbound_transfers(
11 changes: 6 additions & 5 deletions solana/programs/token-bridge-relayer/src/processor/initialize.rs
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ pub struct Initialize<'info> {
pub deployer: Signer<'info>,

/// The designated owner of the program.
pub owner: UncheckedAccount<'info>,
pub owner: AccountInfo<'info>,

#[account(
init,
@@ -29,7 +29,7 @@ pub struct Initialize<'info> {
pub auth_badge: Account<'info, AuthBadgeState>,

/// Owner Config account. This program requires that the `owner` specified
/// in the context equals the pubkey specified in this account. Mutable.
/// in the context equals the pubkey specified in this account.
#[account(
init,
payer = deployer,
@@ -47,12 +47,14 @@ pub struct Initialize<'info> {
)]
program_data: Account<'info, ProgramData>,

/// CHECK: An account used by the Token Bridge.
#[account(
seeds = [token_bridge::SEED_PREFIX_SENDER],
bump
)]
pub wormhole_sender: UncheckedAccount<'info>,

/// CHECK: An account used by the Token Bridge.
#[account(
seeds = [token_bridge::SEED_PREFIX_REDEEMER],
bump
@@ -115,11 +117,10 @@ pub fn initialize<'a, 'b, 'c, 'info>(
);

for (admin, badge_acc_info) in zip(admins, ctx.remaining_accounts) {
let bump = Pubkey::find_program_address(
let (_pubkey, bump) = Pubkey::find_program_address(
&[AuthBadgeState::SEED_PREFIX, admin.to_bytes().as_ref()],
ctx.program_id,
)
.1;
);
let badge_seeds = [AuthBadgeState::SEED_PREFIX, &admin.to_bytes(), &[bump]];

// Before calling `create_account`, we need to verify that the account
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ pub struct OutboundTransfer<'info> {
/// CHECK: Token Bridge emitter.
pub token_bridge_emitter: UncheckedAccount<'info>,

/// CHECK: Token Bridge sequence.
/// CHECK: Token Bridge sequence. Mutable.
#[account(mut)]
pub token_bridge_sequence: UncheckedAccount<'info>,

Loading