Skip to content

Commit

Permalink
solana: various fixes to tbtc and gateway programs
Browse files Browse the repository at this point in the history
Co-authored-by: gator-boi <gator-boi@users.noreply.github.com>
  • Loading branch information
a5-pickle and gator-boi committed Aug 7, 2023
1 parent a81fd81 commit 426d097
Show file tree
Hide file tree
Showing 38 changed files with 1,051 additions and 223 deletions.
1 change: 1 addition & 0 deletions cross-chain/solana/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

.anchor
.prettierrc.json
.DS_Store
target
**/*.rs.bk
Expand Down
8 changes: 4 additions & 4 deletions cross-chain/solana/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ members = [

[programs.localnet]
tbtc = "HksEtDgsXJV1BqcuhzbLRTmXp5gHgHJktieJCtQd3pG"
wormhole-gateway = "8H9F5JGbEMyERycwaGuzLS5MQnV7dn2wm2h6egJ3Leiu"
wormhole_gateway = "8H9F5JGbEMyERycwaGuzLS5MQnV7dn2wm2h6egJ3Leiu"

[registry]
url = "https://api.apr.dev"
Expand Down Expand Up @@ -61,10 +61,10 @@ filename = "tests/accounts/ethereum_token_bridge.json"
address = "DapiQYH3BGonhN8cngWcXQ6SrqSm3cwysoznoHr6Sbsx"
filename = "tests/accounts/token_bridge_config.json"

### Core Bridge -- Bridge
[[test.validator.clone]]
### Core Bridge -- Bridge Data
[[test.validator.account]]
address = "2yVjuQwpsvdsrywzsJJVs9Ueh4zayyo5DYJbBNc3DDpn"
filename = "tests/accounts/core_bridge.json"
filename = "tests/accounts/core_bridge_data.json"

### Core Bridge -- Emitter Sequence (Token Bridge's)
[[test.validator.account]]
Expand Down
169 changes: 153 additions & 16 deletions cross-chain/solana/Cargo.lock

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

9 changes: 7 additions & 2 deletions cross-chain/solana/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

out_solana-devnet=artifacts-testnet
out_mainnet=artifacts-mainnet

.PHONY: all clean build test
.PHONY: all clean build test lint

all: test

Expand All @@ -24,3 +23,9 @@ endif

test: node_modules
anchor test --arch sbf

lint:
cargo fmt --check
cargo check --features "mainnet" --no-default-features
cargo check --features "solana-devnet" --no-default-features
cargo clippy --no-deps --all-targets -- -D warnings
9 changes: 6 additions & 3 deletions cross-chain/solana/programs/tbtc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ no-log-ix-name = []
cpi = ["no-entrypoint"]

[dependencies]
anchor-lang = { version = "=0.28.0", features = ["derive", "init-if-needed"] }
anchor-spl = "=0.28.0"
solana-program = "=1.14.20"
anchor-lang = { version = "0.28.0", features = ["derive", "init-if-needed"] }
anchor-spl = { version = "0.28.0", features = ["metadata"] }

solana-program = "=1.14"

mpl-token-metadata = "1.13.1"
37 changes: 32 additions & 5 deletions cross-chain/solana/programs/tbtc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,36 @@ use anchor_lang::prelude::error_code;

#[error_code]
pub enum TbtcError {
IsPaused,
IsNotPaused,
IsNotAuthority,
IsNotPendingAuthority,
NoPendingAuthorityChange,
#[msg("Not valid authority to perform this action")]
IsNotAuthority = 0x20,

#[msg("Not valid pending authority to take authority")]
IsNotPendingAuthority = 0x22,

#[msg("No pending authority")]
NoPendingAuthorityChange = 0x24,

#[msg("This address is already a guardian")]
GuardianAlreadyExists = 0x30,

#[msg("This address is not a guardian")]
GuardianNonexistent = 0x32,

#[msg("Caller is not a guardian")]
SignerNotGuardian = 0x34,

#[msg("This address is already a minter")]
MinterAlreadyExists = 0x40,

#[msg("This address is not a minter")]
MinterNonexistent = 0x42,

#[msg("Caller is not a minter")]
SignerNotMinter = 0x44,

#[msg("Program is paused")]
IsPaused = 0x50,

#[msg("Program is not paused")]
IsNotPaused = 0x52,
}
2 changes: 1 addition & 1 deletion cross-chain/solana/programs/tbtc/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ pub struct GuardianAdded {
#[event]
pub struct GuardianRemoved {
pub guardian: Pubkey,
}
}
Loading

0 comments on commit 426d097

Please sign in to comment.