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

feat: solana integration/tilt tests #233

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
f32c669
feat: update hub deploy script to incliude agg proposer, decoder, and…
marcomariscal Oct 8, 2024
0184f11
fix: handle stack too deep
marcomariscal Oct 8, 2024
4d7ab80
feat: update spoke deploy script to use create2
marcomariscal Oct 8, 2024
e8d5a05
fix: salts
marcomariscal Oct 8, 2024
8ca31a4
chore: runs
marcomariscal Oct 9, 2024
809f50f
chore: latest run
marcomariscal Oct 9, 2024
b1d841a
feat: holesky as hub deploy script
marcomariscal Oct 11, 2024
9745fc1
feat: add etherscan
marcomariscal Oct 11, 2024
41d1e66
WIP
alexkeating Oct 15, 2024
2fbf69a
WIP: changes
alexkeating Oct 15, 2024
f839d48
Remove old deployments
alexkeating Oct 15, 2024
0321eb0
Add formatting
alexkeating Oct 15, 2024
2b7d6e2
Actual deployments
alexkeating Oct 17, 2024
a7057a1
Remove dry runs
alexkeating Oct 17, 2024
393a149
feat: deploy scripts for devnet
marcomariscal Oct 18, 2024
b1a6e12
feat: script to output abis
marcomariscal Oct 21, 2024
3af5f43
feat: runs
marcomariscal Oct 28, 2024
4237514
feat: handle mock token deploy for devnet
marcomariscal Oct 28, 2024
bc23d19
feat: integration test structure wip
marcomariscal Oct 28, 2024
df9c989
feat: handle auto addresses from deploys
marcomariscal Oct 28, 2024
d9bdd14
feat: flesh out proposal helpers
marcomariscal Oct 29, 2024
2fcccdb
fix: trying to make proposals unique
marcomariscal Oct 29, 2024
5219270
fix: queue proposal
marcomariscal Oct 29, 2024
5a3e56d
fix: wait for tx
marcomariscal Oct 29, 2024
6a6d610
chore: check
marcomariscal Oct 29, 2024
61abaf1
feat: get proposal data
marcomariscal Oct 29, 2024
63856ad
chore: cleaning/organizing
marcomariscal Oct 29, 2024
820d0e0
fix: move handleNoAccount to a more appropriate place
marcomariscal Oct 29, 2024
5baf3af
fix: naming clarity
marcomariscal Oct 29, 2024
fb68b2e
chore: check
marcomariscal Oct 29, 2024
8462461
feat: biome at root to fix format on save issues
marcomariscal Oct 30, 2024
b0e11dc
feat: handle bridging votes to hub
marcomariscal Oct 30, 2024
98f88d5
fix: await tx's
marcomariscal Oct 30, 2024
01feab4
fix: helpers for registering on hub vote pool
marcomariscal Oct 30, 2024
62e7279
chore: runs
marcomariscal Oct 30, 2024
c1fca6d
fix: handle conflicting env vars
marcomariscal Oct 30, 2024
d7dbbe9
chore: remove logs
marcomariscal Oct 30, 2024
319e76a
fix: transfer ownership of hub vote pool to timelock
marcomariscal Nov 4, 2024
07b812a
feat: executeCrossChain
marcomariscal Nov 5, 2024
4c55476
feat: deploy from within integrations test folder
marcomariscal Nov 7, 2024
a7518e9
fix: remove etherscan
marcomariscal Oct 31, 2024
f7e6ac6
fix: evm gitignore to relevant folder
marcomariscal Oct 31, 2024
af0d33b
fix: setup
marcomariscal Nov 7, 2024
3de9027
fix: better logging, wormhole format the hub message dispatcher in co…
marcomariscal Nov 8, 2024
5c3d3e5
fix: scripts
marcomariscal Nov 8, 2024
58435fe
chore: check
marcomariscal Nov 8, 2024
ff8b2a2
fix: setup
marcomariscal Nov 8, 2024
15aec2e
fix: setup
marcomariscal Nov 8, 2024
e6e5769
fix: setup
marcomariscal Nov 8, 2024
da4dfa7
feat: deployment cache and setup check locally
marcomariscal Nov 8, 2024
6a27628
fix: improve setup handling
marcomariscal Nov 8, 2024
911e25b
fix: testing structure to one file since tests are dependent on each …
marcomariscal Nov 8, 2024
ecabded
fix: setup
marcomariscal Nov 8, 2024
685b4db
chore: check
marcomariscal Nov 8, 2024
e83fdca
chore: remove broadcast
marcomariscal Nov 8, 2024
f14b94e
revert: dont need fs permish now
marcomariscal Nov 8, 2024
844b393
fix: revert to original deploy wallet logic
marcomariscal Nov 8, 2024
873c928
chore: remove unused
marcomariscal Nov 8, 2024
dabad9a
chore: remove unused
marcomariscal Nov 8, 2024
adc25b6
fix: revert deploy wallet logic
marcomariscal Nov 8, 2024
3badc08
fix: revert
marcomariscal Nov 8, 2024
624bb4c
fix: revert
marcomariscal Nov 8, 2024
b8090d1
fix: build
marcomariscal Nov 8, 2024
019cd33
chore: remove unused
marcomariscal Nov 8, 2024
6abd805
chore: remove unused file
marcomariscal Nov 8, 2024
0ddcdfd
fix: deployment cache handling
marcomariscal Nov 11, 2024
e84e796
fix: init ci workflow for integration tests
marcomariscal Nov 11, 2024
6ade069
chore: check
marcomariscal Nov 11, 2024
485321c
fix: remove redundant wrapping call to create proposal via agg proposer
marcomariscal Nov 11, 2024
26386af
fix: remove unused
marcomariscal Nov 11, 2024
840a4a8
fix: use token mint for proposal execution data
marcomariscal Nov 11, 2024
f40834a
chore: check
marcomariscal Nov 11, 2024
170de57
chore: format
marcomariscal Nov 11, 2024
8bfb946
fix: restore broadcast files
marcomariscal Nov 12, 2024
ce6cd41
Solana tests draft run
Nov 15, 2024
71e9300
Add constants
Nov 18, 2024
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
108 changes: 108 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Integration Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
integration-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

# Install system dependencies
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl make gcc g++

# Install Go
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.9"

# Install Foundry
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

# Install Bun
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

# Install Tilt
- name: Install Tilt
run: |
curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash

# Clone Wormhole repo
- name: Clone Wormhole
run: |
git clone https://github.com/wormhole-foundation/wormhole.git
cd wormhole
git submodule update --init

# Cache dependencies
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
node_modules
~/.foundry
~/.bun/install/cache
key: ${{ runner.os }}-deps-${{ hashFiles('**/go.sum', '**/package.json', '**/foundry.toml') }}

# Start Tilt environment
- name: Start Tilt environment
run: |
cd wormhole/testing
tilt up --stream --file Tiltfile -- --evm2=true --query_server=true &
# Wait for environment to be ready
timeout 300 bash -c 'until curl -s http://localhost:8545 > /dev/null; do sleep 5; done'

# Install project dependencies
- name: Install dependencies
run: |
cd integration-tests
bun install

# Generate artifacts
- name: Generate artifacts
run: |
cd integration-tests
bun run generate:artifacts

# Run integration tests (always with fresh deployment in CI)
- name: Run integration tests
run: |
cd integration-tests
CI=true bun test # CI flag will force fresh deployment
env:
WORMHOLE_API_KEY: "my_secret_key_3"
ETHDEVNET_MNEMONIC: "myth like bonus scare over problem client lizard pioneer submit female collect"

# Upload test results (but not deployment cache)
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: integration-tests/test-results/**

# Cleanup
- name: Cleanup
if: always()
run: |
cd wormhole/testing
tilt down
9 changes: 0 additions & 9 deletions .gitignore

This file was deleted.

1 change: 1 addition & 0 deletions .wormhole
Submodule .wormhole added at 6d15f0
5 changes: 4 additions & 1 deletion evm/script/DeployHubContractsBaseImpl.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ abstract contract DeployHubContractsBaseImpl is Script {
HubProposalExtender extender = new HubProposalExtender(
config.voteExtenderAdmin, config.voteTimeExtension, address(timelock), wallet.addr, config.minimumExtensionTime
);
}

// Deploy `HubVotePool` which will revceive cross-chain votes.
HubVotePool hubVotePool = new HubVotePool(config.wormholeCore, address(0), wallet.addr);
Expand Down Expand Up @@ -129,7 +130,9 @@ abstract contract DeployHubContractsBaseImpl is Script {
timelock.grantRole(timelock.DEFAULT_ADMIN_ROLE(), address(timelock));
timelock.renounceRole(timelock.DEFAULT_ADMIN_ROLE(), wallet.addr);

vm.stopBroadcast();
// Deploy HubEvmSpokeAggregateProposer
HubEvmSpokeAggregateProposer hubEvmSpokeAggregateProposer =
new HubEvmSpokeAggregateProposer(config.wormholeCore, address(gov), config.initialMaxQueryTimestampOffset);

return DeployedContracts({
timelock: timelock,
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
"typescript": "^5.0.0"
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.1",
"@wormhole-foundation/sdk": "^0.15.0",
"@wormhole-foundation/wormhole-query-sdk": "^0.0.13",
"axios": "^1.7.7",
"dotenv": "^16.4.5",
"viem": "^2.21.42"
}
Expand Down
103 changes: 103 additions & 0 deletions integration-tests/test/createProposalOnSolana/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { createArbitraryProposalData, createProposalViaAggregateProposer, createProposalViaHubGovernor, getProposal, getVoteStart } from 'test/helpers';
import { createProposalOnSpoke, getProposalOnSpoke } from '../createProposalOnSpoke/helpers';
import { Wallet, AnchorProvider, Program } from "@coral-xyz/anchor";
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
import { DEPLOYER_AUTHORITY_KEYPAIR, HUB_ADDRESS, SOL_RPC_NODE, SOLANA_SPOKE_ADDRESS } from "../proposeFromSpoke/constants.ts";
import idl from "../../../solana/target/idl/staking.json"
import type {Staking} from "../../../solana/target/types/staking.ts"
import { StakeConnection } from "../../../solana/app/StakeConnection.ts";
import { createClients } from "test/config/clients.ts";
import { queryHubProposalMetadata } from "test/createProposalOnSpoke/helpers.ts";
import { getWormholeBridgeData } from "../../../solana/app/helpers/wormholeBridgeConfig.ts";


export const createProposalOnSolana = async () => {
console.log("Starting create proposal on Solana....")

const proposalData = await createArbitraryProposalData();

console.log("Before create proposal...")
const proposalId = await createProposalViaHubGovernor(proposalData);
console.log("After create proposal...")

//const proposalId = 64486728149589802134402046581700694611161572255902220899113581080654785109148n;

console.log("Created Proposal ID:", proposalId.toString(16));

const { ethClient, eth2Client, ethWallet, account } = createClients();

const currentBlock = await ethClient.getBlock();
const queryResponse = await queryHubProposalMetadata({
proposalId,
proposalCreatedBlock: currentBlock.number,
});

console.log("Obtain CCQ data for proposal")

const client = new Connection(SOL_RPC_NODE);
const wallet = new Wallet(DEPLOYER_AUTHORITY_KEYPAIR)

// Prepare signatures for calling PostSig
var ccqData = queryResponse.queryResponseBytes.substring(2);
var sigs = queryResponse.queryResponseSignatures;
var byteSigs: string[] = [];
for( const sig of sigs) {
var hex_data = sig.r.substring(2);
hex_data = hex_data + sig.s.substring(2)

if(sig.v == 27){
hex_data = hex_data + "00"
}
else{ // 28
hex_data = hex_data + "01"
}

hex_data = hex_data + "00" //sig.guardianIndex.toString(16);
byteSigs.push(hex_data)
}

const stakeConnection = await StakeConnection.createStakeConnection(
client,
wallet,
new PublicKey(
idl.address,
),
);

const CORE_BRIDGE_ADDRESS = new PublicKey(
"Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o",
);
const info = await getWormholeBridgeData(client, CORE_BRIDGE_ADDRESS);

// Add signatures for the call
const signaturesKeypair = Keypair.generate();
await stakeConnection.postSignatures(
byteSigs,
signaturesKeypair,
);
console.log("Posted signatures to Solana for CCQ")

await sleep(5000);

// Query to ensure that the sigs were posted
const bufferProposalId = Buffer.from(proposalId.toString(16), "hex");
await stakeConnection.addProposal(
bufferProposalId,
Uint8Array.from(Buffer.from(ccqData, "hex")),
signaturesKeypair.publicKey,
info.guardianSetIndex,
false,
CORE_BRIDGE_ADDRESS
);
console.log("Added proposal to Solana")

// Sleep to allow this proposal to be added. Otherwise, we run into a race condition.
await sleep(30000);
const proposalDataSolana = await stakeConnection.fetchProposalAccountData(bufferProposalId);

console.log("Getting proposal")

return [proposalId, proposalDataSolana];
}

export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
2 changes: 1 addition & 1 deletion integration-tests/test/createProposalOnSpoke/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const createProposalOnSpoke = async (proposalId: bigint) => {
return proposalId;
};

const queryHubProposalMetadata = async ({
export const queryHubProposalMetadata = async ({
proposalId,
proposalCreatedBlock,
}: {
Expand Down
Loading
Loading