Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token Bridge CPI + Wormhole Gateway testing scaffold #679

Merged
merged 4 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cross-chain/solana/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ target
**/*.rs.bk
node_modules
test-ledger
.yarn
artifacts-mainnet
artifacts-testnet
1 change: 0 additions & 1 deletion cross-chain/solana/.yarnrc.yml

This file was deleted.

70 changes: 68 additions & 2 deletions cross-chain/solana/Anchor.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[features]
seeds = false
skip-lint = false

[workspace]
members = [
"programs/tbtc",
"programs/wormhole-gateway",
]


[programs.localnet]
tbtc = "HksEtDgsXJV1BqcuhzbLRTmXp5gHgHJktieJCtQd3pG"
wormhole-gateway = "8H9F5JGbEMyERycwaGuzLS5MQnV7dn2wm2h6egJ3Leiu"
Expand All @@ -10,7 +18,65 @@ url = "https://api.apr.dev"

[provider]
cluster = "Localnet"
wallet = "/home/eth/.config/solana/id.json"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "npx ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"

[test]
startup_wait = 10000

[test.validator]
url = "https://api.mainnet-beta.solana.com"

### MPL Token Metadata
[[test.validator.clone]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"

### Wormhole Core Bridge
[[test.validator.clone]]
address = "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth"

### Wormhole Token Bridge
[[test.validator.clone]]
address = "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb"

### Token Bridge -- Wrapped tBTC Mint
[[test.validator.account]]
address = "25rXTx9zDZcHyTav5sRqM6YBvTGu9pPH9yv83uAEqbgG"
filename = "tests/accounts/wrapped_tbtc_mint.json"

### Token Bridge -- Wrapped tBTC Asset
[[test.validator.account]]
address = "5LEUZpBxUQmoxoNGqmYmFEGAPDuhWbAY5CGt519UixLo"
filename = "tests/accounts/wrapped_tbtc_asset.json"

### Token Bridge -- Ethereum Foreign Endpoint
[[test.validator.account]]
address = "DujfLgMKW71CT2W8pxknf42FT86VbcK5PjQ6LsutjWKC"
filename = "tests/accounts/ethereum_token_bridge.json"

### Token Bridge -- Config
[[test.validator.account]]
address = "DapiQYH3BGonhN8cngWcXQ6SrqSm3cwysoznoHr6Sbsx"
filename = "tests/accounts/token_bridge_config.json"

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

### Core Bridge -- Emitter Sequence (Token Bridge's)
[[test.validator.account]]
address = "GF2ghkjwsR9CHkGk1RvuZrApPZGBZynxMm817VNi51Nf"
filename = "tests/accounts/core_emitter_sequence.json"

### Core Bridge -- Fee Collector
[[test.validator.account]]
address = "9bFNrXNb2WTx8fMHXCheaZqkLZ3YCCaiqTftHxeintHy"
filename = "tests/accounts/core_fee_collector.json"

### Core Bridge -- Guardian Set (index == 3)
[[test.validator.account]]
address = "6d3w8mGjJauf6gCAg7WfLezbaPmUHYGuoNutnfYF1RYM"
filename = "tests/accounts/core_guardian_set.json"
26 changes: 26 additions & 0 deletions cross-chain/solana/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

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

.PHONY: all clean build test

all: test

clean:
anchor clean
rm -rf node_modules artifacts-mainnet artifacts-testnet

node_modules:
npm ci

build: $(out_$(NETWORK))

$(out_$(NETWORK)):
ifdef out_$(NETWORK)
anchor build --arch sbf -- --features "$(NETWORK)" -- --no-default-features
mkdir -p $(out_$(NETWORK))
cp target/deploy/*.so $(out_$(NETWORK))/
endif

test: node_modules
anchor test --arch sbf
Loading