Skip to content

Commit 7488349

Browse files
authored
Merge branch 'main' into solana-examples/conditional-ata-value
2 parents e0fd888 + 7dbac78 commit 7488349

112 files changed

Lines changed: 7014 additions & 1435 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/long-panthers-sit.md

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@layerzerolabs/oft-solana-example": patch
3+
---
4+
5+
update nodejs version

.github/workflows/reusable-test.yaml

Lines changed: 113 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ jobs:
122122
FOUNDRY_PROFILE: "ci"
123123
RPC_URL_HYPERLIQUID: "http://127.0.0.1:8546"
124124
RPC_URL_HYPERLIQUID_UPSTREAM: ${{ secrets.RPC_URL_HYPERLIQUID_UPSTREAM || 'https://rpc.hyperliquid.xyz/evm' }}
125+
# Exclude e2e tests from regular CI
126+
JEST_TEST_PATH_IGNORE_PATTERNS: '["<rootDir>/**/test/e2e/**"]'
125127

126128
# We'll collect the docker compose logs from all containers on failure
127129
- name: Collect docker logs on failure
@@ -137,23 +139,122 @@ jobs:
137139
with:
138140
path: ./logs
139141

140-
test-user:
141-
name: User test
142-
runs-on: ${{ matrix.runner }}
142+
test-e2e:
143+
name: Test E2E (Non-blocking)
144+
runs-on: ubuntu-latest-16xlarge
145+
if: github.ref != 'refs/heads/main'
143146

144147
permissions:
145148
contents: read
146149
packages: read
150+
issues: write
151+
pull-requests: write
147152

148-
strategy:
149-
matrix:
150-
include:
151-
- platform: linux/amd64
152-
runner: ubuntu-latest-16xlarge
153-
arch: amd64
154-
- platform: linux/arm64
155-
runner: ubuntu-latest-16xlarge-arm
156-
arch: arm64
153+
steps:
154+
- name: Checkout repo
155+
uses: actions/checkout@v4
156+
with:
157+
submodules: "true"
158+
159+
- name: Setup environment
160+
uses: ./.github/workflows/actions/setup-environment
161+
162+
- name: Setup build cache
163+
uses: ./.github/workflows/actions/setup-build-cache
164+
165+
- name: E2E Test Notice
166+
run: |
167+
echo "::notice::🧪 E2E tests are non-blocking and run against live networks"
168+
echo "::notice::These tests validate real blockchain interactions but may fail due to:"
169+
echo "::notice:: - Network connectivity issues"
170+
echo "::notice:: - RPC rate limiting"
171+
echo "::notice:: - External service downtime"
172+
echo "::notice:: - Gas price fluctuations"
173+
echo "::notice::E2E test failures do NOT block the main CI pipeline"
174+
175+
# There is a small bug in docker compose that will cause 401 if we don't pull the base image manually
176+
#
177+
# See more here https://github.com/docker/compose-cli/issues/1545
178+
- name: Authenticate to GHCR
179+
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
180+
181+
- name: Test E2E
182+
id: test-e2e
183+
run: pnpm test:ci:e2e
184+
continue-on-error: true
185+
env:
186+
# Disable parallel execution for now
187+
LZ_ENABLE_EXPERIMENTAL_PARALLEL_EXECUTION: false
188+
JEST_TIMEOUT: 120_000 # Increase timeout for ARM builds (2 minutes)
189+
TEST_TIMEOUT: 1_200_000 # 20 minutes timeout for long-running e2e tests
190+
# We'll use the prebuilt base image
191+
DEVTOOLS_BASE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-base:main
192+
# And the prebuilt hardhat EVM node image
193+
DEVTOOLS_EVM_NODE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-node-evm-hardhat:main
194+
# And the prebuilt TON node image
195+
DEVTOOLS_TON_NODE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-node-ton-my-local-ton:main
196+
# Enable Solana tests for e2e
197+
LZ_DEVTOOLS_ENABLE_SOLANA_TESTS: 1
198+
RPC_URL_SOLANA_MAINNET: ${{ secrets.RPC_URL_SOLANA_MAINNET || 'https://rpc.ankr.com/solana' }}
199+
RPC_URL_SOLANA_TESTNET: ${{ secrets.RPC_URL_SOLANA_TESTNET || 'https://api.devnet.solana.com' }}
200+
FOUNDRY_PROFILE: "ci"
201+
RPC_URL_HYPERLIQUID: "http://127.0.0.1:8546"
202+
RPC_URL_HYPERLIQUID_UPSTREAM: ${{ secrets.RPC_URL_HYPERLIQUID_UPSTREAM || 'https://rpc.hyperliquid.xyz/evm' }}
203+
# Run only e2e tests
204+
JEST_TEST_PATH_PATTERN: 'test/e2e'
205+
206+
# We'll collect the docker compose logs from all containers on failure
207+
- name: Collect docker logs on failure
208+
if: steps.test-e2e.outcome == 'failure'
209+
uses: jwalton/gh-docker-logs@v2
210+
with:
211+
dest: "./logs"
212+
213+
# We'll collect the docker compose logs from all containers on failure
214+
- name: Store docker logs
215+
if: steps.test-e2e.outcome == 'failure'
216+
uses: actions/upload-artifact@v4
217+
with:
218+
path: ./logs
219+
220+
# Post comment on E2E test failure
221+
- name: Comment on E2E failure
222+
if: steps.test-e2e.outcome == 'failure'
223+
uses: actions/github-script@v7
224+
with:
225+
script: |
226+
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
227+
const prNumber = context.payload.pull_request?.number;
228+
229+
if (prNumber) {
230+
const comment = "## 🚨 E2E Tests Failed\n\n" +
231+
"The E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:\n" +
232+
"- Network connectivity issues\n" +
233+
"- RPC rate limiting\n" +
234+
"- External service downtime\n" +
235+
"**Action Run:** " + runUrl + "\n\n" +
236+
"This is **non-blocking** and does not prevent merging. Check the action logs above for detailed failure information.";
237+
238+
try {
239+
await github.rest.issues.createComment({
240+
issue_number: prNumber,
241+
owner: context.repo.owner,
242+
repo: context.repo.repo,
243+
body: comment
244+
});
245+
} catch (error) {
246+
// Silently fail if we don't have permission to comment (e.g., on forks)
247+
console.log('Could not post comment to PR:', error.message);
248+
}
249+
}
250+
251+
test-user:
252+
name: User test (Parallel)
253+
runs-on: ubuntu-latest-16xlarge
254+
255+
permissions:
256+
contents: read
257+
packages: read
157258
steps:
158259
- name: Checkout repo
159260
uses: actions/checkout@v4

.github/workflows/verify-lockfiles.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010
jobs:
1111
verify-example-lockfiles:
1212
name: Verify example lockfiles
13-
if: github.actor != 'layerzero-bot'
13+
if: github.event.pull_request.user.login != 'layerzero-bot'
1414
runs-on: ubuntu-latest
1515

1616
steps:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ ENV CARGO_BUILD_JOBS=$CARGO_BUILD_JOBS
422422
ENV PATH="/root/.foundry/bin:$PATH"
423423
RUN curl -L https://foundry.paradigm.xyz | bash && \
424424
foundryup -i ${FOUNDRY_VERSION} && \
425-
foundryup -u ${FOUNDRY_VERSION}
425+
foundryup -u v${FOUNDRY_VERSION}
426426

427427
# Install SVM and Solidity compiler in single layer
428428
RUN cargo +${RUST_TOOLCHAIN_VERSION_ANCHOR} install svm-rs@${SVM_RS_VERSION} && \

docker-compose.yaml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,41 @@ services:
117117
- RPC_URL_SOLANA_TESTNET=${RPC_URL_SOLANA_TESTNET}
118118
- LZ_DEVTOOLS_ENABLE_SOLANA_TESTS=${LZ_DEVTOOLS_ENABLE_SOLANA_TESTS}
119119
- FOUNDRY_PROFILE=${FOUNDRY_PROFILE}
120-
- RPC_URL_HYPERLIQUID=${RPC_URL_HYPERLIQUID}
120+
121+
#
122+
# .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
123+
# E2E Tests (Live RPC Tests)
124+
# .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
125+
#
126+
tests-e2e:
127+
extends:
128+
file: docker-compose.templates.yaml
129+
service: project
130+
depends_on:
131+
network-vengaboys:
132+
condition: service_healthy
133+
network-britney:
134+
condition: service_healthy
135+
network-tango:
136+
condition: service_healthy
137+
network-ton:
138+
condition: service_healthy
139+
network-hyperliquid:
140+
condition: service_healthy
141+
logging:
142+
driver: none
143+
# E2E tests run against live networks, no local network URLs needed
144+
environment:
145+
- DOCKER_COMPOSE_RUN_TESTS_TURBO_ARGS=$DOCKER_COMPOSE_RUN_TESTS_TURBO_ARGS
146+
# E2E tests use live RPC URLs
147+
- RPC_URL_SOLANA_MAINNET=${RPC_URL_SOLANA_MAINNET}
148+
- RPC_URL_SOLANA_TESTNET=${RPC_URL_SOLANA_TESTNET}
149+
- LZ_DEVTOOLS_ENABLE_SOLANA_TESTS=${LZ_DEVTOOLS_ENABLE_SOLANA_TESTS}
150+
- FOUNDRY_PROFILE=${FOUNDRY_PROFILE}
151+
# E2E specific environment variables
152+
- PRIVATE_KEY=${PRIVATE_KEY}
153+
- NETWORK_URL_TON=http://network-ton:8081/jsonRPC
154+
- NETWORK_URL_HYPERLIQUID=http://network-hyperliquid:8546
121155
volumes:
122156
- ./node_modules/.cache/turbo:/app/node_modules/.cache/turbo
123157
# Hardhat has an issue with caching compilers inside a docker container,
@@ -132,5 +166,5 @@ services:
132166
# This would normally be fine, but if we have more than 1 solana examples anchor tries building them in parallel.
133167
# Anchor does not respect file locks on the rustup directory, so the builds fail as it can't overwrite the other example's rustup.
134168
# Running rustup default before pnpm test ensures that the rustup directory is present and up to date.
135-
command: "pnpm test"
169+
command: "pnpm turbo test:e2e"
136170

examples/lzapp-migration/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# @layerzerolabs/lzapp-migration-example
22

3+
## 0.3.8
4+
5+
### Patch Changes
6+
7+
- d720011: oft-solana: require user to confirm max total token supply given a local decimals value
8+
- d720011: print max supply given solana local decimals
9+
- Updated dependencies [d720011]
10+
- @layerzerolabs/devtools-solana@3.0.4
11+
- @layerzerolabs/devtools@2.0.3
12+
13+
## 0.3.7
14+
15+
### Patch Changes
16+
17+
- ccc14e0: fix default ALTs not used
18+
- Updated dependencies [06dc63b]
19+
- @layerzerolabs/devtools-solana@3.0.3
20+
- @layerzerolabs/devtools@2.0.2
21+
322
## 0.3.6
423

524
### Patch Changes

examples/lzapp-migration/hardhat.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ if (accounts == null) {
3939
const config: HardhatUserConfig = {
4040
paths: {
4141
cache: 'cache/hardhat',
42+
tests: 'test/hardhat', // prevents test/scripts from being run
4243
},
4344
solidity: {
4445
compilers: [
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
reporters: [['github-actions', { silent: false }], 'default'],
4+
testEnvironment: 'node',
5+
testTimeout: 15000,
6+
moduleNameMapper: {
7+
'^@/(.*)$': '<rootDir>/src/$1',
8+
},
9+
transform: {
10+
'^.+\\.(t|j)sx?$': '@swc/jest',
11+
},
12+
}

examples/lzapp-migration/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@layerzerolabs/lzapp-migration-example",
3-
"version": "0.3.6",
3+
"version": "0.3.8",
44
"private": true,
55
"license": "MIT",
66
"scripts": {
@@ -16,16 +16,17 @@
1616
"test": "$npm_execpath run test:hardhat",
1717
"test:anchor": "anchor test",
1818
"test:forge": "forge test",
19-
"test:hardhat": "hardhat test"
19+
"test:hardhat": "hardhat test",
20+
"test:scripts": "jest --config jest.config.ts --runInBand --testMatch \"**/*.script.test.ts\""
2021
},
2122
"resolutions": {
2223
"ethers": "^5.7.2",
2324
"hardhat-deploy": "^0.12.1"
2425
},
2526
"dependencies": {
26-
"@layerzerolabs/devtools": "^2.0.0",
27+
"@layerzerolabs/devtools": "^2.0.3",
2728
"@layerzerolabs/devtools-evm-hardhat": "^4.0.0",
28-
"@layerzerolabs/devtools-solana": "^3.0.0",
29+
"@layerzerolabs/devtools-solana": "^3.0.4",
2930
"@layerzerolabs/export-deployments": "^0.0.16",
3031
"@layerzerolabs/io-devtools": "^0.3.0",
3132
"@layerzerolabs/lz-evm-sdk-v1": "^3.0.49",
@@ -45,13 +46,13 @@
4546
"@metaplex-foundation/umi-web3js-adapters": "^0.9.2",
4647
"@solana-developers/helpers": "^2.7.0",
4748
"@solana/spl-token": "^0.4.12",
48-
"@solana/web3.js": "~1.95.8"
49+
"@solana/web3.js": "~1.95.8",
50+
"jest": "^29.7.0"
4951
},
5052
"devDependencies": {
5153
"@babel/core": "^7.23.9",
5254
"@coral-xyz/anchor": "^0.31.1",
5355
"@layerzerolabs/eslint-config-next": "~2.3.39",
54-
"@layerzerolabs/io-devtools": "~0.3.0",
5556
"@layerzerolabs/lz-definitions": "^3.0.75",
5657
"@layerzerolabs/lz-evm-messagelib-v2": "^3.0.75",
5758
"@layerzerolabs/lz-evm-protocol-v2": "^3.0.75",

0 commit comments

Comments
 (0)