Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c6d1085
e2e setup added
AryaLanjewar3005 Feb 19, 2026
2de7fd0
added a replace-addresses command to e2e-setup which replaces neccess…
AryaLanjewar3005 Feb 19, 2026
fdc56f8
fix: registered static precompiles in local-native setup e2e
AryaLanjewar3005 Feb 20, 2026
1abe216
refactor: e2e-setup now uses local-multi-validator setup instead of l…
AryaLanjewar3005 Feb 20, 2026
472db33
sdk-setup added
AryaLanjewar3005 Feb 24, 2026
c1f442f
changed core-contracts branch in .env.example
AryaLanjewar3005 Feb 24, 2026
c326607
Merge branch 'main' into feat/e2e-setup
0xNilesh Feb 25, 2026
15be6a6
fix: deploy-addresses.json related issues
AryaLanjewar3005 Feb 25, 2026
740d045
fix: made token-config deploy_addresses.json driven in e2e-setup
AryaLanjewar3005 Feb 25, 2026
464988e
fix : QoL change script added
AryaLanjewar3005 Feb 25, 2026
8461756
Added replace-addresses command + sdk setup command is updated to wir…
AryaLanjewar3005 Feb 25, 2026
d1b4cc2
fix: sdk-testing command in e2e-tests
AryaLanjewar3005 Feb 25, 2026
28450d9
Merge branch 'main' into feat/e2e-setup
0xNilesh Feb 25, 2026
2b6687c
arb, base, bsc and solana support added for e2e-tests
AryaLanjewar3005 Feb 27, 2026
8d7d33f
fix : arbitrum rpc url for monitoring gateway transaction in local-mu…
AryaLanjewar3005 Feb 27, 2026
2afe798
fix : e2e-tests setup : make replace-addresses calculates from the .e…
AryaLanjewar3005 Feb 27, 2026
b9dd0a4
Merge branch 'main' into feat/e2e-setup
0xNilesh Mar 5, 2026
97fec92
refactor
AryaLanjewar3005 Mar 5, 2026
f812853
fix: BNB RPC URL, env account funding, replace-addresses script
AryaLanjewar3005 Mar 5, 2026
b94a598
fix: e2e-tests token path fix
AryaLanjewar3005 Mar 5, 2026
3ac1885
feat: sdk automatically changes TESTNET to LOCALNET in account.ts
AryaLanjewar3005 Mar 5, 2026
fd59e6e
refactor: important addresses which were changed for e2e testing
AryaLanjewar3005 Mar 5, 2026
782bf3b
refactor: minor clean ups
AryaLanjewar3005 Mar 5, 2026
e2f4f6c
fix: Push localnet allocation in sdk
AryaLanjewar3005 Mar 5, 2026
ae14e68
refactor: minor cleaning
AryaLanjewar3005 Mar 5, 2026
132b5f9
fix: some more address adjustments
AryaLanjewar3005 Mar 5, 2026
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ universalClient/coverage.out
# TSS data directory
tss-data/
local-native/data/
e2e-tests/.pchain/
e2e-tests/genesis_accounts.json
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ draw-deps:
clean:
rm -rf snapcraft-local.yaml build/

.PHONY: replace-addresses
replace-addresses:
bash scripts/replace_addresses.sh

distclean: clean
rm -rf vendor/

Expand Down
2 changes: 1 addition & 1 deletion config/testnet-donut/arb_sepolia/chain.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"chain": "eip155:421614",
"public_rpc_url": "https://endpoints.omniatech.io/v1/arbitrum/sepolia/public",
"public_rpc_url": "https://arbitrum-sepolia.gateway.tenderly.co",
"vm_type": 1,
"gateway_address": "0x2cd870e0166Ba458dEC615168Fd659AacD795f34",
"block_confirmation": {
Expand Down
2 changes: 1 addition & 1 deletion config/testnet-donut/solana_devnet/tokens/sol.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"decimals": 9,
"enabled": true,
"liquidity_cap": "1000000000000000000000000",
"token_type": 4,
"token_type": 4,
"native_representation": {
"denom": "",
"contract_address": "0x5D525Df2bD99a6e7ec58b76aF2fd95F39874EBed"
Expand Down
71 changes: 71 additions & 0 deletions e2e-tests/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copy this file to e2e-tests/.env and adjust values.

# Path to push-chain workspace root.
# Keep this empty to use auto-detection (parent of e2e-tests).
# PUSH_CHAIN_DIR=

# Local Push RPC
PUSH_RPC_URL=http://localhost:8545

# Local chain info
CHAIN_ID=localchain_9000-1
KEYRING_BACKEND=test

# Genesis key recovery/funding
GENESIS_KEY_NAME=genesis-acc-1
GENESIS_KEY_HOME=./e2e-tests/.pchain
# Optional local fallback file. If missing, setup.sh reads accounts from docker core-validator-1 (/tmp/push-accounts/genesis_accounts.json)
GENESIS_ACCOUNTS_JSON=./e2e-tests/genesis_accounts.json

# Optional: set to skip interactive mnemonic prompt
# GENESIS_MNEMONIC="word1 word2 ..."

# Address to fund from genesis account
FUND_TO_ADDRESS=push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60
FUND_AMOUNT=1000000000000000000upc
POOL_CREATION_TOPUP_AMOUNT=50000000000000000000upc
GAS_PRICES=100000000000upc

# EVM private key used by forge/hardhat scripts
PRIVATE_KEY=0xYOURPRIVATEKEY

# External repositories
CORE_CONTRACTS_REPO=https://github.com/pushchain/push-chain-core-contracts.git
CORE_CONTRACTS_BRANCH=node-e2e

SWAP_AMM_REPO=https://github.com/pushchain/push-chain-swap-internal-amm-contracts.git
SWAP_AMM_BRANCH=e2e-push-node

GATEWAY_REPO=https://github.com/pushchain/push-chain-gateway-contracts.git
GATEWAY_BRANCH=e2e-push-node

PUSH_CHAIN_SDK_REPO=https://github.com/pushchain/push-chain-sdk.git
PUSH_CHAIN_SDK_BRANCH=feb-11-2026-alpha-publish

# push-chain-sdk core .env target path (relative to PUSH_CHAIN_SDK_DIR)
PUSH_CHAIN_SDK_CORE_ENV_PATH=packages/core/.env

# Local clone layout (outside push-chain directory)
E2E_PARENT_DIR=../
CORE_CONTRACTS_DIR=../push-chain-core-contracts
SWAP_AMM_DIR=../push-chain-swap-internal-amm-contracts
GATEWAY_DIR=../push-chain-gateway-contracts
PUSH_CHAIN_SDK_DIR=../push-chain-sdk
PUSH_CHAIN_SDK_E2E_DIR=packages/core/__e2e__

# push-chain-sdk required env vars (mirrored into PUSH_CHAIN_SDK_DIR/packages/core/.env by setup-sdk)
# Defaults used by setup-sdk when omitted:
# EVM_PRIVATE_KEY <= PRIVATE_KEY
# EVM_RPC <= PUSH_RPC_URL
# PUSH_PRIVATE_KEY<= PRIVATE_KEY
EVM_PRIVATE_KEY=
EVM_RPC=
SOLANA_RPC_URL=https://api.devnet.solana.com
SOLANA_PRIVATE_KEY=
PUSH_PRIVATE_KEY=

# Tracking files
DEPLOY_ADDRESSES_FILE=./e2e-tests/deploy_addresses.json
TEST_ADDRESSES_PATH=../push-chain-swap-internal-amm-contracts/test-addresses.json
TOKEN_CONFIG_PATH=./config/testnet-donut/eth_sepolia/tokens/eth.json
CHAIN_CONFIG_PATH=./config/testnet-donut/eth_sepolia/chain.json
2 changes: 2 additions & 0 deletions e2e-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
logs/
274 changes: 274 additions & 0 deletions e2e-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
# e2e-tests setup

This folder provides a full, automated local E2E bootstrap for Push Chain.

It covers:

1. local-multi-validator devnet (Docker, validators + universal validators)
2. genesis key recovery + account funding
3. core contracts deployment
4. swap AMM deployment (WPC + V3 core + V3 periphery)
5. pool creation for pETH/WPC
6. core `.env` generation from deployed addresses
7. token config update (`eth_sepolia_eth.json`)
8. gateway contracts deployment
9. push-chain-sdk setup + E2E test runners
10. uregistry chain/token config submission

---

## What gets created

- `e2e-tests/repos/` — cloned external repos
- push-chain-core-contracts
- push-chain-swap-internal-amm-contracts
- push-chain-gateway-contracts
- push-chain-sdk
- `e2e-tests/logs/` — logs for each major deployment step
- `e2e-tests/deploy_addresses.json` — contract/token address source-of-truth

---

## Prerequisites

Required tools:

- `git`
- `jq`
- `node`, `npm`, `npx`
- `forge` (Foundry)
- `make`

Also ensure the Push Chain repo builds/runs locally.

Before running any e2e setup command, run:

```bash
make replace-addresses
```

---

## Configuration

Copy env template:

```bash
cp e2e-tests/.env.example e2e-tests/.env
```

Important variables in `.env`:

- `PUSH_RPC_URL` (default `http://localhost:8545`)
- `PRIVATE_KEY`
- `FUND_TO_ADDRESS`
- `POOL_CREATION_TOPUP_AMOUNT` (funding for deployer before pool creation)
- `CORE_CONTRACTS_BRANCH`
- `SWAP_AMM_BRANCH`
- `GATEWAY_BRANCH` (currently `e2e-push-node`)
- `PUSH_CHAIN_SDK_BRANCH` (default `feb-11-2026-alpha-publish`)

Genesis account source:

- `GENESIS_ACCOUNTS_JSON` can point to a local file, but if missing `setup.sh` automatically
reads `/tmp/push-accounts/genesis_accounts.json` from docker container `core-validator-1`.

Path settings are repository-relative and portable.

---

## One-command full run

```bash
make replace-addresses
./e2e-tests/setup.sh all
```

This runs the full sequence in order:

1. `devnet`
2. `recover-genesis-key`
3. `fund`
4. `setup-core`
5. `setup-swap`
6. `sync-addresses`
7. `create-pool`
8. `check-addresses`
9. `write-core-env`
10. `update-token-config`
11. `setup-gateway`
12. `add-uregistry-configs`

---

## Command reference

```bash
./e2e-tests/setup.sh devnet
./e2e-tests/setup.sh print-genesis
./e2e-tests/setup.sh recover-genesis-key
./e2e-tests/setup.sh fund
./e2e-tests/setup.sh setup-core
./e2e-tests/setup.sh setup-swap
./e2e-tests/setup.sh sync-addresses
./e2e-tests/setup.sh create-pool
./e2e-tests/setup.sh check-addresses
./e2e-tests/setup.sh write-core-env
./e2e-tests/setup.sh update-token-config
./e2e-tests/setup.sh setup-gateway
./e2e-tests/setup.sh setup-sdk
./e2e-tests/setup.sh sdk-test-all
./e2e-tests/setup.sh sdk-test-pctx-last-transaction
./e2e-tests/setup.sh sdk-test-send-to-self
./e2e-tests/setup.sh sdk-test-progress-hook
./e2e-tests/setup.sh sdk-test-bridge-multicall
./e2e-tests/setup.sh sdk-test-pushchain
./e2e-tests/setup.sh add-uregistry-configs
make replace-addresses
./e2e-tests/setup.sh all
```

### push-chain-sdk setup + tests

Clone and install dependencies in one command:

```bash
./e2e-tests/setup.sh setup-sdk
```

This executes:

- `yarn install`
- `npm install`
- `npm i --save-dev @types/bs58`

It also fetches `UEA_PROXY_IMPLEMENTATION` with:

- `cast call 0x00000000000000000000000000000000000000ea "UEA_PROXY_IMPLEMENTATION()(address)"`

Then it updates both:

- `e2e-tests/deploy_addresses.json` as `contracts.UEA_PROXY_IMPLEMENTATION`
- `push-chain-sdk/packages/core/src/lib/constants/chain.ts` at `[PUSH_NETWORK.LOCALNET]`

Run all configured SDK E2E files:

```bash
./e2e-tests/setup.sh sdk-test-all
```

Run single files:

```bash
./e2e-tests/setup.sh sdk-test-pctx-last-transaction
./e2e-tests/setup.sh sdk-test-send-to-self
./e2e-tests/setup.sh sdk-test-progress-hook
./e2e-tests/setup.sh sdk-test-bridge-multicall
./e2e-tests/setup.sh sdk-test-pushchain
```

Before each SDK test run, the script automatically rewrites these values in configured files:

- `PUSH_NETWORK.TESTNET_DONUT` → `PUSH_NETWORK.LOCALNET`
- `PUSH_NETWORK.TESTNET` → `PUSH_NETWORK.LOCALNET`

---

## Address tracking model

`deploy_addresses.json` is the canonical address registry used by later steps.

### Required contracts

- `contracts.WPC`
- `contracts.Factory`
- `contracts.QuoterV2`
- `contracts.SwapRouter`

### Token entries

- `tokens[]` from core deployment logs (`name`, `symbol`, `address`, `source`)

These addresses are used to:

- sync swap repo `test-addresses.json`
- generate core contracts `.env`
- update `config/testnet-donut/tokens/eth_sepolia_eth.json`

Manual helpers:

```bash
./e2e-tests/setup.sh record-contract Factory 0x1234567890123456789012345678901234567890
./e2e-tests/setup.sh record-token "Push ETH" pETH 0x1234567890123456789012345678901234567890
```

---

## Auto-retry and resilience behavior

### Core contracts

- Runs `forge script scripts/localSetup/setup.s.sol ...`
- If receipt fetch fails, auto-retries with `--resume` in a loop until success
- Optional cap via:

```bash
CORE_RESUME_MAX_ATTEMPTS=0 # 0 means unlimited (default)
```

### Gateway contracts

- Runs gateway `forge script ... setup.s.sol`
- If initial execution fails, retries with `--resume`

### uregistry tx submission

- Submits chain config then token config
- Retries automatically on account sequence mismatch
- Validates tx result by checking returned `code`

---

## Generated files of interest

- `e2e-tests/deploy_addresses.json`
- `e2e-tests/repos/push-chain-swap-internal-amm-contracts/test-addresses.json`
- `e2e-tests/repos/push-chain-core-contracts/.env`
- `config/testnet-donut/tokens/eth_sepolia_eth.json` (updated contract address)

---

## Clean re-run

For a fresh run:

```bash
rm -rf e2e-tests/repos
./local-multi-validator/devnet down || true
make replace-addresses
./e2e-tests/setup.sh all
```

---

## Troubleshooting

### 1) Core script keeps stopping with receipt errors

This is expected intermittently on local RPC. The script auto-runs `--resume` until completion.

### 2) Missing branch in a dependency repo

The script attempts to resolve/fallback to available remote branches.

### 3) `account sequence mismatch` in uregistry tx

The script retries automatically for this error.

### 4) WPC deployment artifact not found

`setup-swap` compiles before deployment. If interrupted mid-run, re-run:

```bash
./e2e-tests/setup.sh setup-swap
```
Empty file added e2e-tests/deploy_addresses.json
Empty file.
Loading
Loading