From c6d1085b208fa7f4c7bff3395a1e53e4d3b23233 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 19 Feb 2026 17:44:33 +0530 Subject: [PATCH 01/23] e2e setup added --- e2e-tests/.env.example | 49 + e2e-tests/.gitignore | 3 + e2e-tests/README.md | 205 ++++ e2e-tests/deploy_addresses.json | 26 + e2e-tests/setup.sh | 1111 ++++++++++++++++++++++ local-native/README.md | 3 +- local-native/devnet | 22 +- local-native/scripts/configure-pushuv.sh | 112 +++ local-native/scripts/setup-universal.sh | 8 + 9 files changed, 1536 insertions(+), 3 deletions(-) create mode 100644 e2e-tests/.env.example create mode 100644 e2e-tests/.gitignore create mode 100644 e2e-tests/README.md create mode 100644 e2e-tests/deploy_addresses.json create mode 100755 e2e-tests/setup.sh create mode 100644 local-native/scripts/configure-pushuv.sh diff --git a/e2e-tests/.env.example b/e2e-tests/.env.example new file mode 100644 index 00000000..ebec79f6 --- /dev/null +++ b/e2e-tests/.env.example @@ -0,0 +1,49 @@ +# 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=./local-native/data/validator1/.pchain + +# Optional: set to skip interactive mnemonic prompt +# GENESIS_MNEMONIC="word1 word2 ..." + +# Address to fund from genesis account +FUND_TO_ADDRESS=push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60 +FUND_AMOUNT=1000000000000000000upc +GAS_PRICES=100000000000upc + +# EVM private key used by forge/hardhat scripts +PRIVATE_KEY=0x0dfb3d814afd8d0bf7a6010e8dd2b6ac835cabe4da9e2c1e80c6a14df3994dd4 + +# External repositories +CORE_CONTRACTS_REPO=https://github.com/pushchain/push-chain-core-contracts.git +CORE_CONTRACTS_BRANCH=e2e-push-node + +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 + +# 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 + +# 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/tokens/eth_sepolia_eth.json +CHAIN_CONFIG_PATH=./config/testnet-donut/chains/eth_sepolia_chain_config.json diff --git a/e2e-tests/.gitignore b/e2e-tests/.gitignore new file mode 100644 index 00000000..ef853ca1 --- /dev/null +++ b/e2e-tests/.gitignore @@ -0,0 +1,3 @@ +.env +logs/ +repos/ diff --git a/e2e-tests/README.md b/e2e-tests/README.md new file mode 100644 index 00000000..810d76cf --- /dev/null +++ b/e2e-tests/README.md @@ -0,0 +1,205 @@ +# e2e-tests setup + +This folder provides a full, automated local E2E bootstrap for Push Chain. + +It covers: + +1. local-native devnet (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. 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 +- `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. + +--- + +## 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` +- `CORE_CONTRACTS_BRANCH` +- `SWAP_AMM_BRANCH` +- `GATEWAY_BRANCH` (currently `e2e-push-node`) + +Path settings are repository-relative and portable. + +--- + +## One-command full run + +```bash +./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 add-uregistry-configs +./e2e-tests/setup.sh all +``` + +--- + +## 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-native/devnet down || true +./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 +``` diff --git a/e2e-tests/deploy_addresses.json b/e2e-tests/deploy_addresses.json new file mode 100644 index 00000000..c4fee1c2 --- /dev/null +++ b/e2e-tests/deploy_addresses.json @@ -0,0 +1,26 @@ +{ + "generatedAt": "2026-02-19T11:46:45Z", + "contracts": { + "WPC": "0x4ff2d01380CCd03A53457935B2e9d2eD092e9300", + "Factory": "0x373D3F1B2b26729A308C5641970247bc9d4ddDa4", + "SwapRouter": "0x6a20557430be6412AF423681e35CC96797506F3a", + "QuoterV2": "0xc2055dD3A7Ad875520BdB5c91300F964F7038C73", + "PositionManager": "0xdBdFEB7A79868Cb4A4e9e57D7d28C84AE77AC4BC" + }, + "tokens": [ + { + "name": "pETH.eth", + "symbol": "pETH", + "address": "0x90F4A15601E08570D6fFbaE883C44BDB85bDb7d1", + "source": "core-contracts", + "decimals": 18 + }, + { + "name": "USDT.eth", + "symbol": "USDT.eth", + "address": "0x00cb38A885cf8D0B2dDfd19Bd1c04aAAC44C5a86", + "source": "core-contracts", + "decimals": 6 + } + ] +} diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh new file mode 100755 index 00000000..9dc19041 --- /dev/null +++ b/e2e-tests/setup.sh @@ -0,0 +1,1111 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +SCRIPT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PUSH_CHAIN_DIR_DEFAULT="$(cd -P "$SCRIPT_DIR/.." && pwd)" +ENV_FILE="$SCRIPT_DIR/.env" + +if [[ -f "$ENV_FILE" ]]; then + set -a + source "$ENV_FILE" + set +a +fi + +: "${PUSH_CHAIN_DIR:=$PUSH_CHAIN_DIR_DEFAULT}" +: "${PUSH_RPC_URL:=http://localhost:8545}" +: "${CHAIN_ID:=localchain_9000-1}" +: "${KEYRING_BACKEND:=test}" +: "${GENESIS_KEY_NAME:=genesis-acc-1}" +: "${GENESIS_KEY_HOME:=$PUSH_CHAIN_DIR/local-native/data/validator1/.pchain}" +: "${GENESIS_ACCOUNTS_JSON:=$PUSH_CHAIN_DIR/local-native/data/accounts/genesis_accounts.json}" +: "${FUND_AMOUNT:=1000000000000000000upc}" +: "${GAS_PRICES:=100000000000upc}" + +: "${CORE_CONTRACTS_REPO:=https://github.com/pushchain/push-chain-core-contracts.git}" +: "${CORE_CONTRACTS_BRANCH:=e2e-push-node}" +: "${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}" + +: "${E2E_PARENT_DIR:=../}" +: "${CORE_CONTRACTS_DIR:=$E2E_PARENT_DIR/push-chain-core-contracts}" +: "${SWAP_AMM_DIR:=$E2E_PARENT_DIR/push-chain-swap-internal-amm-contracts}" +: "${GATEWAY_DIR:=$E2E_PARENT_DIR/push-chain-gateway-contracts}" +: "${DEPLOY_ADDRESSES_FILE:=$SCRIPT_DIR/deploy_addresses.json}" +: "${LOG_DIR:=$SCRIPT_DIR/logs}" +: "${TEST_ADDRESSES_PATH:=$SWAP_AMM_DIR/test-addresses.json}" +: "${TOKENS_CONFIG_DIR:=./config/testnet-donut/tokens}" +: "${TOKEN_CONFIG_PATH:=./config/testnet-donut/tokens/eth_sepolia_eth.json}" +: "${CHAIN_CONFIG_PATH:=./config/testnet-donut/chains/eth_sepolia_chain_config.json}" + +abs_from_root() { + local path="$1" + if [[ "$path" = /* ]]; then + printf "%s" "$path" + else + printf "%s/%s" "$PUSH_CHAIN_DIR" "${path#./}" + fi +} + +GENESIS_KEY_HOME="$(abs_from_root "$GENESIS_KEY_HOME")" +GENESIS_ACCOUNTS_JSON="$(abs_from_root "$GENESIS_ACCOUNTS_JSON")" +E2E_PARENT_DIR="$(abs_from_root "$E2E_PARENT_DIR")" +CORE_CONTRACTS_DIR="$(abs_from_root "$CORE_CONTRACTS_DIR")" +SWAP_AMM_DIR="$(abs_from_root "$SWAP_AMM_DIR")" +GATEWAY_DIR="$(abs_from_root "$GATEWAY_DIR")" +DEPLOY_ADDRESSES_FILE="$(abs_from_root "$DEPLOY_ADDRESSES_FILE")" +TEST_ADDRESSES_PATH="$(abs_from_root "$TEST_ADDRESSES_PATH")" +LOG_DIR="$(abs_from_root "$LOG_DIR")" +TOKENS_CONFIG_DIR="$(abs_from_root "$TOKENS_CONFIG_DIR")" +TOKEN_CONFIG_PATH="$(abs_from_root "$TOKEN_CONFIG_PATH")" +CHAIN_CONFIG_PATH="$(abs_from_root "$CHAIN_CONFIG_PATH")" + +mkdir -p "$LOG_DIR" + +green='\033[0;32m' +yellow='\033[0;33m' +red='\033[0;31m' +cyan='\033[0;36m' +nc='\033[0m' + +log_info() { printf "%b\n" "${cyan}==>${nc} $*"; } +log_ok() { printf "%b\n" "${green}✓${nc} $*"; } +log_warn() { printf "%b\n" "${yellow}!${nc} $*"; } +log_err() { printf "%b\n" "${red}x${nc} $*"; } + +require_cmd() { + local c + for c in "$@"; do + command -v "$c" >/dev/null 2>&1 || { + log_err "Missing command: $c" + exit 1 + } + done +} + +list_remote_branches() { + local repo_url="$1" + git ls-remote --heads "$repo_url" | awk '{print $2}' | sed 's#refs/heads/##' +} + +select_best_matching_branch() { + local requested="$1" + shift + local branches=("$@") + local best="" + local best_score=0 + local branch token score + + # Tokenize requested branch by non-alphanumeric delimiters. + local tokens=() + while IFS= read -r token; do + [[ -n "$token" ]] && tokens+=("$token") + done < <(echo "$requested" | tr -cs '[:alnum:]' '\n' | tr '[:upper:]' '[:lower:]') + + for branch in "${branches[@]}"; do + score=0 + local b_lc + b_lc="$(echo "$branch" | tr '[:upper:]' '[:lower:]')" + for token in "${tokens[@]}"; do + if [[ "$b_lc" == *"$token"* ]]; then + score=$((score + 1)) + fi + done + if (( score > best_score )); then + best_score=$score + best="$branch" + fi + done + + if (( best_score >= 2 )); then + printf "%s" "$best" + fi +} + +resolve_branch() { + local repo_url="$1" + local requested="$2" + local branches=() + local b + + while IFS= read -r b; do + [[ -n "$b" ]] && branches+=("$b") + done < <(list_remote_branches "$repo_url") + + local branch + for branch in "${branches[@]}"; do + if [[ "$branch" == "$requested" ]]; then + printf "%s" "$requested" + return + fi + done + + local best + best="$(select_best_matching_branch "$requested" "${branches[@]}")" + if [[ -n "$best" ]]; then + printf "%b\n" "${yellow}!${nc} Branch '$requested' not found. Auto-selected '$best'." >&2 + printf "%s" "$best" + return + fi + + for branch in main master; do + for b in "${branches[@]}"; do + if [[ "$b" == "$branch" ]]; then + printf "%b\n" "${yellow}!${nc} Branch '$requested' not found. Falling back to '$branch'." >&2 + printf "%s" "$branch" + return + fi + done + done + + if [[ ${#branches[@]} -gt 0 ]]; then + printf "%b\n" "${yellow}!${nc} Branch '$requested' not found. Falling back to '${branches[0]}'." >&2 + printf "%s" "${branches[0]}" + return + fi + + log_err "No remote branches found for $repo_url" + exit 1 +} + +ensure_deploy_file() { + if [[ ! -f "$DEPLOY_ADDRESSES_FILE" ]]; then + cat >"$DEPLOY_ADDRESSES_FILE" <<'JSON' +{ + "generatedAt": "", + "contracts": {}, + "tokens": [] +} +JSON + fi +} + +set_generated_at() { + local tmp + tmp="$(mktemp)" + jq --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" '.generatedAt = $now' "$DEPLOY_ADDRESSES_FILE" >"$tmp" + mv "$tmp" "$DEPLOY_ADDRESSES_FILE" +} + +record_contract() { + local key="$1" + local address="$2" + local tmp + tmp="$(mktemp)" + jq --arg key "$key" --arg val "$address" '.contracts[$key] = $val' "$DEPLOY_ADDRESSES_FILE" >"$tmp" + mv "$tmp" "$DEPLOY_ADDRESSES_FILE" + set_generated_at + log_ok "Recorded contract $key=$address" +} + +record_token() { + local name="$1" + local symbol="$2" + local address="$3" + local source="$4" + local tmp + tmp="$(mktemp)" + jq \ + --arg name "$name" \ + --arg symbol "$symbol" \ + --arg address "$address" \ + --arg source "$source" \ + ' + .tokens = ( + ([.tokens[]? | select((.address | ascii_downcase) != ($address | ascii_downcase))]) + + [{name:$name, symbol:$symbol, address:$address, source:$source}] + ) + ' "$DEPLOY_ADDRESSES_FILE" >"$tmp" + mv "$tmp" "$DEPLOY_ADDRESSES_FILE" + set_generated_at + log_ok "Recorded token $symbol=$address ($name)" +} + +validate_eth_address() { + [[ "$1" =~ ^0x[a-fA-F0-9]{40}$ ]] +} + +clone_or_update_repo() { + local repo_url="$1" + local branch="$2" + local dest="$3" + local resolved_branch + + resolved_branch="$(resolve_branch "$repo_url" "$branch")" + + if [[ -d "$dest" && ! -d "$dest/.git" ]]; then + log_warn "Removing non-git directory at $dest" + rm -rf "$dest" + fi + + if [[ -d "$dest/.git" ]]; then + log_info "Updating repo $(basename "$dest")" + git -C "$dest" fetch origin + git -C "$dest" checkout "$resolved_branch" + git -C "$dest" reset --hard "origin/$resolved_branch" + else + log_info "Cloning $(basename "$dest")" + git clone --branch "$resolved_branch" "$repo_url" "$dest" + fi +} + +step_devnet() { + require_cmd bash + log_info "Starting local-native devnet" + ( + cd "$PUSH_CHAIN_DIR/local-native" + ./devnet build + ./devnet start 4 + ./devnet setup-uvalidators + ./devnet start-uv 4 + ) + log_ok "Devnet is up" +} + +step_print_genesis() { + require_cmd jq + if [[ ! -f "$GENESIS_ACCOUNTS_JSON" ]]; then + log_err "Missing genesis accounts file: $GENESIS_ACCOUNTS_JSON" + exit 1 + fi + + jq -r '.[0] | "Account: \(.name)\nAddress: \(.address)\nMnemonic: \(.mnemonic)"' "$GENESIS_ACCOUNTS_JSON" +} + +step_recover_genesis_key() { + require_cmd "$PUSH_CHAIN_DIR/build/pchaind" jq + + local mnemonic="${GENESIS_MNEMONIC:-}" + if [[ -z "$mnemonic" ]]; then + if [[ -f "$GENESIS_ACCOUNTS_JSON" ]]; then + mnemonic="$(jq -r --arg n "$GENESIS_KEY_NAME" ' + (first(.[] | select(.name == $n) | .mnemonic) // first(.[].mnemonic) // "") + ' "$GENESIS_ACCOUNTS_JSON")" + fi + fi + + if [[ -z "$mnemonic" ]]; then + log_err "Could not auto-resolve mnemonic from $GENESIS_ACCOUNTS_JSON" + log_err "Set GENESIS_MNEMONIC in e2e-tests/.env" + exit 1 + fi + + if "$PUSH_CHAIN_DIR/build/pchaind" keys show "$GENESIS_KEY_NAME" \ + --keyring-backend "$KEYRING_BACKEND" \ + --home "$GENESIS_KEY_HOME" >/dev/null 2>&1; then + log_warn "Key ${GENESIS_KEY_NAME} already exists. Deleting before recover." + "$PUSH_CHAIN_DIR/build/pchaind" keys delete "$GENESIS_KEY_NAME" \ + --keyring-backend "$KEYRING_BACKEND" \ + --home "$GENESIS_KEY_HOME" \ + -y >/dev/null + fi + + log_info "Recovering key ${GENESIS_KEY_NAME}" + printf "%s\n" "$mnemonic" | "$PUSH_CHAIN_DIR/build/pchaind" keys add "$GENESIS_KEY_NAME" \ + --recover \ + --keyring-backend "$KEYRING_BACKEND" \ + --algo eth_secp256k1 \ + --home "$GENESIS_KEY_HOME" >/dev/null + + log_ok "Recovered key ${GENESIS_KEY_NAME}" +} + +step_fund_account() { + require_cmd "$PUSH_CHAIN_DIR/build/pchaind" + + local to_addr="${FUND_TO_ADDRESS:-}" + if [[ -z "$to_addr" ]]; then + log_err "Set FUND_TO_ADDRESS in e2e-tests/.env" + exit 1 + fi + if ! validate_eth_address "$to_addr" && [[ ! "$to_addr" =~ ^push1[0-9a-z]+$ ]]; then + log_err "Invalid FUND_TO_ADDRESS: $to_addr" + exit 1 + fi + + log_info "Funding $to_addr with $FUND_AMOUNT" + "$PUSH_CHAIN_DIR/build/pchaind" tx bank send "$GENESIS_KEY_NAME" "$to_addr" "$FUND_AMOUNT" \ + --gas-prices "$GAS_PRICES" \ + --keyring-backend "$KEYRING_BACKEND" \ + --chain-id "$CHAIN_ID" \ + --home "$GENESIS_KEY_HOME" \ + -y + + log_ok "Funding transaction submitted" +} + +parse_core_prc20_logs() { + local log_file="$1" + local current_addr="" + local line + + while IFS= read -r line; do + if [[ "$line" =~ PRC20[[:space:]]deployed[[:space:]]at:[[:space:]](0x[a-fA-F0-9]{40}) ]]; then + current_addr="${BASH_REMATCH[1]}" + continue + fi + + if [[ -n "$current_addr" && "$line" =~ Name:[[:space:]](.+)[[:space:]]Symbol:[[:space:]]([A-Za-z0-9._-]+)$ ]]; then + local token_name="${BASH_REMATCH[1]}" + local token_symbol="${BASH_REMATCH[2]}" + record_token "$token_name" "$token_symbol" "$current_addr" "core-contracts" + current_addr="" + fi + done <"$log_file" +} + +enrich_core_token_decimals() { + require_cmd jq cast + ensure_deploy_file + + local addr decimals tmp + while IFS= read -r addr; do + [[ -n "$addr" ]] || continue + decimals="$(cast call "$addr" "decimals()(uint8)" --rpc-url "$PUSH_RPC_URL" 2>/dev/null || true)" + decimals="$(echo "$decimals" | tr -d '[:space:]')" + + if [[ "$decimals" =~ ^[0-9]+$ ]]; then + tmp="$(mktemp)" + jq --arg addr "$addr" --argjson dec "$decimals" ' + .tokens |= map( + if ((.address | ascii_downcase) == ($addr | ascii_downcase)) + then . + {decimals: $dec} + else . + end + ) + ' "$DEPLOY_ADDRESSES_FILE" >"$tmp" + mv "$tmp" "$DEPLOY_ADDRESSES_FILE" + log_ok "Resolved token decimals: $addr => $decimals" + else + log_warn "Could not resolve decimals() for token $addr" + fi + done < <(jq -r '.tokens[]? | select(.decimals == null) | .address' "$DEPLOY_ADDRESSES_FILE") +} + +step_setup_core_contracts() { + require_cmd git forge jq + [[ -n "${PRIVATE_KEY:-}" ]] || { log_err "Set PRIVATE_KEY in e2e-tests/.env"; exit 1; } + + ensure_deploy_file + clone_or_update_repo "$CORE_CONTRACTS_REPO" "$CORE_CONTRACTS_BRANCH" "$CORE_CONTRACTS_DIR" + + log_info "Running forge build in core contracts" + (cd "$CORE_CONTRACTS_DIR" && forge build) + + local log_file="$LOG_DIR/core_setup_$(date +%Y%m%d_%H%M%S).log" + local failed=0 + local resume_attempt=1 + local resume_max_attempts="${CORE_RESUME_MAX_ATTEMPTS:-0}" # 0 = unlimited + + log_info "Running local core setup script" + ( + cd "$CORE_CONTRACTS_DIR" + forge script scripts/localSetup/setup.s.sol \ + --broadcast \ + --rpc-url "$PUSH_RPC_URL" \ + --private-key "$PRIVATE_KEY" \ + --slow + ) 2>&1 | tee "$log_file" || failed=1 + + if [[ "$failed" -ne 0 ]]; then + log_warn "Initial run failed. Retrying with --resume until success" + while true; do + log_info "Resume attempt: $resume_attempt" + if ( + cd "$CORE_CONTRACTS_DIR" + forge script scripts/localSetup/setup.s.sol \ + --broadcast \ + --rpc-url "$PUSH_RPC_URL" \ + --private-key "$PRIVATE_KEY" \ + --slow \ + --resume + ) 2>&1 | tee -a "$log_file"; then + break + fi + + if [[ "$resume_max_attempts" != "0" && "$resume_attempt" -ge "$resume_max_attempts" ]]; then + log_err "Reached CORE_RESUME_MAX_ATTEMPTS=$resume_max_attempts without success" + exit 1 + fi + + resume_attempt=$((resume_attempt + 1)) + sleep 2 + done + fi + + parse_core_prc20_logs "$log_file" + enrich_core_token_decimals + log_ok "Core contracts setup complete" +} + +find_first_address_with_keywords() { + local log_file="$1" + shift + local pattern + pattern="$(printf '%s|' "$@")" + pattern="${pattern%|}" + grep -Ei "$pattern" "$log_file" | grep -Eo '0x[a-fA-F0-9]{40}' | tail -1 || true +} + +address_from_deploy_contract() { + local key="$1" + jq -r --arg k "$key" '.contracts[$k] // ""' "$DEPLOY_ADDRESSES_FILE" +} + +address_from_deploy_token() { + local sym="$1" + jq -r --arg s "$sym" 'first(.tokens[]? | select((.symbol|ascii_downcase) == ($s|ascii_downcase)) | .address) // ""' "$DEPLOY_ADDRESSES_FILE" +} + +resolve_peth_token_address() { + local addr="" + addr="$(address_from_deploy_token "pETH")" + [[ -n "$addr" ]] || addr="$(address_from_deploy_token "WETH")" + if [[ -z "$addr" ]]; then + addr="$(jq -r 'first(.tokens[]? | select((.name|ascii_downcase) | test("eth")) | .address) // ""' "$DEPLOY_ADDRESSES_FILE")" + fi + printf "%s" "$addr" +} + +assert_required_addresses() { + ensure_deploy_file + local required=("WPC" "Factory" "QuoterV2" "SwapRouter") + local missing=0 + local key val + + for key in "${required[@]}"; do + val="$(address_from_deploy_contract "$key")" + if [[ -z "$val" ]]; then + log_err "Missing required address in deploy file: contracts.$key" + missing=1 + else + log_ok "contracts.$key=$val" + fi + done + + if [[ "$missing" -ne 0 ]]; then + log_err "Required addresses are missing in $DEPLOY_ADDRESSES_FILE" + exit 1 + fi +} + +step_write_core_env() { + require_cmd jq + ensure_deploy_file + assert_required_addresses + + local core_env="$CORE_CONTRACTS_DIR/.env" + local wpc factory quoter router + wpc="$(address_from_deploy_contract "WPC")" + factory="$(address_from_deploy_contract "Factory")" + quoter="$(address_from_deploy_contract "QuoterV2")" + router="$(address_from_deploy_contract "SwapRouter")" + + log_info "Writing core-contracts .env" + { + echo "PUSH_RPC_URL=$PUSH_RPC_URL" + echo "PRIVATE_KEY=$PRIVATE_KEY" + echo "WPC_ADDRESS=$wpc" + echo "FACTORY_ADDRESS=$factory" + echo "QUOTER_V2_ADDRESS=$quoter" + echo "SWAP_ROUTER_ADDRESS=$router" + echo "WPC=$wpc" + echo "UNISWAP_V3_FACTORY=$factory" + echo "UNISWAP_V3_QUOTER=$quoter" + echo "UNISWAP_V3_ROUTER=$router" + echo "" + echo "# Tokens deployed from core setup" + jq -r '.tokens | to_entries[]? | "TOKEN" + ((.key + 1)|tostring) + "=" + .value.address' "$DEPLOY_ADDRESSES_FILE" + } >"$core_env" + + log_ok "Generated $core_env" +} + +step_update_eth_token_config() { + step_update_deployed_token_configs +} + +norm_token_key() { + local s="$1" + s="$(echo "$s" | tr '[:upper:]' '[:lower:]')" + s="$(echo "$s" | sed -E 's/[^a-z0-9]+//g')" + printf "%s" "$s" +} + +norm_token_key_without_leading_p() { + local s + s="$(norm_token_key "$1")" + if [[ "$s" == p* && ${#s} -gt 1 ]]; then + printf "%s" "${s#p}" + else + printf "%s" "$s" + fi +} + +find_matching_token_config_file() { + local deployed_symbol="$1" + local deployed_name="$2" + local best_file="" + local best_score=0 + + local d_sym d_name d_sym_np d_name_np + d_sym="$(norm_token_key "$deployed_symbol")" + d_name="$(norm_token_key "$deployed_name")" + d_sym_np="$(norm_token_key_without_leading_p "$deployed_symbol")" + d_name_np="$(norm_token_key_without_leading_p "$deployed_name")" + + local file f_sym f_name f_base f_sym_np f_name_np score + for file in "$TOKENS_CONFIG_DIR"/*.json; do + [[ -f "$file" ]] || continue + f_sym="$(jq -r '.symbol // ""' "$file")" + f_name="$(jq -r '.name // ""' "$file")" + f_base="$(basename "$file" .json)" + + f_sym="$(norm_token_key "$f_sym")" + f_name="$(norm_token_key "$f_name")" + f_base="$(norm_token_key "$f_base")" + f_sym_np="$(norm_token_key_without_leading_p "$f_sym")" + f_name_np="$(norm_token_key_without_leading_p "$f_name")" + + score=0 + [[ -n "$d_sym" && "$d_sym" == "$f_sym" ]] && score=$((score + 100)) + [[ -n "$d_name" && "$d_name" == "$f_name" ]] && score=$((score + 90)) + [[ -n "$d_sym_np" && "$d_sym_np" == "$f_sym" ]] && score=$((score + 80)) + [[ -n "$d_name_np" && "$d_name_np" == "$f_name" ]] && score=$((score + 70)) + [[ -n "$d_sym" && "$d_sym" == "$f_name" ]] && score=$((score + 60)) + [[ -n "$d_name" && "$d_name" == "$f_sym" ]] && score=$((score + 60)) + [[ -n "$d_sym_np" && "$f_base" == *"$d_sym_np"* ]] && score=$((score + 30)) + [[ -n "$d_name_np" && "$f_base" == *"$d_name_np"* ]] && score=$((score + 20)) + + if (( score > best_score )); then + best_score=$score + best_file="$file" + fi + done + + if (( best_score >= 60 )); then + printf "%s" "$best_file" + fi +} + +step_update_deployed_token_configs() { + require_cmd jq + ensure_deploy_file + + if [[ ! -d "$TOKENS_CONFIG_DIR" ]]; then + log_err "Tokens config directory missing: $TOKENS_CONFIG_DIR" + exit 1 + fi + + local used_files="" + local updated=0 + local token_json token_symbol token_name token_address match_file tmp + + while IFS= read -r token_json; do + token_symbol="$(echo "$token_json" | jq -r '.symbol // ""')" + token_name="$(echo "$token_json" | jq -r '.name // ""')" + token_address="$(echo "$token_json" | jq -r '.address // ""')" + + [[ -n "$token_address" ]] || continue + match_file="$(find_matching_token_config_file "$token_symbol" "$token_name")" + + if [[ -z "$match_file" ]]; then + log_warn "No token config match found for deployed token: $token_symbol ($token_name)" + continue + fi + + if echo "$used_files" | grep -Fxq "$match_file"; then + log_warn "Token config already matched by another token, skipping: $(basename "$match_file")" + continue + fi + + tmp="$(mktemp)" + jq --arg a "$token_address" '.native_representation.contract_address = $a' "$match_file" >"$tmp" + mv "$tmp" "$match_file" + used_files+="$match_file"$'\n' + updated=$((updated + 1)) + log_ok "Updated $(basename "$match_file") contract_address => $token_address" + done < <(jq -c '.tokens[]?' "$DEPLOY_ADDRESSES_FILE") + + if [[ "$updated" -eq 0 ]]; then + log_warn "No token config files were updated from deployed tokens" + else + log_ok "Updated $updated token config file(s) from deployed tokens" + fi +} + +step_setup_swap_amm() { + require_cmd git node npm npx jq + [[ -n "${PRIVATE_KEY:-}" ]] || { log_err "Set PRIVATE_KEY in e2e-tests/.env"; exit 1; } + + ensure_deploy_file + clone_or_update_repo "$SWAP_AMM_REPO" "$SWAP_AMM_BRANCH" "$SWAP_AMM_DIR" + + log_info "Installing swap-amm dependencies" + ( + cd "$SWAP_AMM_DIR" + npm install + (cd v3-core && npm install) + (cd v3-periphery && npm install) + ) + + log_info "Writing swap repo .env from main e2e .env" + cat >"$SWAP_AMM_DIR/.env" <&1 | tee "$wpc_log" + + local wpc_addr + wpc_addr="$(find_first_address_with_keywords "$wpc_log" wpc wpush wrapped)" + if [[ -n "$wpc_addr" ]]; then + record_contract "WPC" "$wpc_addr" + else + log_warn "Could not auto-detect WPC address from logs" + fi + + local core_log="$LOG_DIR/swap_core_$(date +%Y%m%d_%H%M%S).log" + log_info "Deploying v3-core" + ( + cd "$SWAP_AMM_DIR/v3-core" + npx hardhat compile + npx hardhat run scripts/deploy-core.js --network pushchain + ) 2>&1 | tee "$core_log" + + local factory_addr + factory_addr="$(grep -E 'Factory Address|FACTORY_ADDRESS=' "$core_log" | grep -Eo '0x[a-fA-F0-9]{40}' | tail -1 || true)" + if [[ -n "$factory_addr" ]]; then + record_contract "Factory" "$factory_addr" + else + log_warn "Could not auto-detect Factory address from logs" + fi + + local periphery_log="$LOG_DIR/swap_periphery_$(date +%Y%m%d_%H%M%S).log" + log_info "Deploying v3-periphery" + ( + cd "$SWAP_AMM_DIR/v3-periphery" + npx hardhat compile + npx hardhat run scripts/deploy-periphery.js --network pushchain + ) 2>&1 | tee "$periphery_log" + + local swap_router quoter_v2 position_manager + swap_router="$(grep -E 'SwapRouter' "$periphery_log" | grep -Eo '0x[a-fA-F0-9]{40}' | tail -1 || true)" + quoter_v2="$(grep -E 'QuoterV2' "$periphery_log" | grep -Eo '0x[a-fA-F0-9]{40}' | tail -1 || true)" + position_manager="$(grep -E 'PositionManager' "$periphery_log" | grep -Eo '0x[a-fA-F0-9]{40}' | tail -1 || true)" + wpc_addr="$(grep -E '^.*WPC:' "$periphery_log" | grep -Eo '0x[a-fA-F0-9]{40}' | tail -1 || true)" + + [[ -n "$swap_router" ]] && record_contract "SwapRouter" "$swap_router" + [[ -n "$quoter_v2" ]] && record_contract "QuoterV2" "$quoter_v2" + [[ -n "$position_manager" ]] && record_contract "PositionManager" "$position_manager" + [[ -n "$wpc_addr" ]] && record_contract "WPC" "$wpc_addr" + + assert_required_addresses + + log_ok "Swap AMM setup complete" +} + +step_setup_gateway() { + require_cmd git forge + [[ -n "${PRIVATE_KEY:-}" ]] || { log_err "Set PRIVATE_KEY in e2e-tests/.env"; exit 1; } + + clone_or_update_repo "$GATEWAY_REPO" "$GATEWAY_BRANCH" "$GATEWAY_DIR" + + log_info "Preparing gateway repo submodules" + ( + cd "$GATEWAY_DIR" + if [[ -d "contracts/svm-gateway/mock-pyth" ]]; then + git rm --cached contracts/svm-gateway/mock-pyth || true + rm -rf contracts/svm-gateway/mock-pyth + fi + git submodule update --init --recursive + ) + + local gw_dir="$GATEWAY_DIR/contracts/evm-gateway" + local gw_log="$LOG_DIR/gateway_setup_$(date +%Y%m%d_%H%M%S).log" + local failed=0 + local resume_attempt=1 + local resume_max_attempts="${GATEWAY_RESUME_MAX_ATTEMPTS:-0}" # 0 = unlimited + + log_info "Building gateway evm contracts" + (cd "$gw_dir" && forge build) + + log_info "Running gateway local setup script" + ( + cd "$gw_dir" + forge script scripts/localSetup/setup.s.sol \ + --broadcast \ + --rpc-url "$PUSH_RPC_URL" \ + --private-key "$PRIVATE_KEY" \ + --slow + ) 2>&1 | tee "$gw_log" || failed=1 + + if [[ "$failed" -ne 0 ]]; then + log_warn "Gateway script failed. Retrying with --resume until success" + while true; do + log_info "Gateway resume attempt: $resume_attempt" + if ( + cd "$gw_dir" + forge script scripts/localSetup/setup.s.sol \ + --broadcast \ + --rpc-url "$PUSH_RPC_URL" \ + --private-key "$PRIVATE_KEY" \ + --slow \ + --resume + ) 2>&1 | tee -a "$gw_log"; then + break + fi + + if [[ "$resume_max_attempts" != "0" && "$resume_attempt" -ge "$resume_max_attempts" ]]; then + log_err "Reached GATEWAY_RESUME_MAX_ATTEMPTS=$resume_max_attempts without success" + exit 1 + fi + + resume_attempt=$((resume_attempt + 1)) + sleep 2 + done + fi + + log_ok "Gateway setup complete" +} + +step_add_uregistry_configs() { + require_cmd "$PUSH_CHAIN_DIR/build/pchaind" jq + + [[ -f "$CHAIN_CONFIG_PATH" ]] || { log_err "Missing chain config: $CHAIN_CONFIG_PATH"; exit 1; } + [[ -d "$TOKENS_CONFIG_DIR" ]] || { log_err "Missing tokens config directory: $TOKENS_CONFIG_DIR"; exit 1; } + + # Ensure all deployed core tokens have updated contract addresses in token config files. + step_update_deployed_token_configs + + local chain_payload token_payload + chain_payload="$(jq -c . "$CHAIN_CONFIG_PATH")" + + run_registry_tx() { + local kind="$1" + local payload="$2" + local max_attempts=10 + local attempt=1 + local out code raw + + while true; do + if [[ "$kind" == "chain" ]]; then + out="$("$PUSH_CHAIN_DIR/build/pchaind" tx uregistry add-chain-config \ + --chain-config "$payload" \ + --from "$GENESIS_KEY_NAME" \ + --keyring-backend "$KEYRING_BACKEND" \ + --home data/validator1/.pchain \ + --node tcp://127.0.0.1:26657 \ + --gas-prices "$GAS_PRICES" \ + -y)" + else + out="$("$PUSH_CHAIN_DIR/build/pchaind" tx uregistry add-token-config \ + --token-config "$payload" \ + --from "$GENESIS_KEY_NAME" \ + --keyring-backend "$KEYRING_BACKEND" \ + --home data/validator1/.pchain \ + --node tcp://127.0.0.1:26657 \ + --gas-prices "$GAS_PRICES" \ + -y)" + fi + echo "$out" + if [[ "$out" =~ ^\{ ]]; then + code="$(echo "$out" | jq -r '.code // 1')" + raw="$(echo "$out" | jq -r '.raw_log // ""')" + else + code="$(echo "$out" | awk -F': ' '/^code:/ {print $2; exit}')" + raw="$(echo "$out" | awk -F': ' '/^raw_log:/ {sub(/^\x27|\x27$/, "", $2); print $2; exit}')" + [[ -n "$code" ]] || code="1" + fi + + if [[ "$code" == "0" ]]; then + return 0 + fi + + if [[ "$raw" == *"account sequence mismatch"* && "$attempt" -lt "$max_attempts" ]]; then + log_warn "Sequence mismatch on attempt $attempt/$max_attempts. Retrying..." + attempt=$((attempt + 1)) + sleep 2 + continue + fi + + log_err "Registry tx failed: code=$code raw_log=$raw" + return 1 + done + } + + log_info "Adding chain config to uregistry" + ( + cd "$PUSH_CHAIN_DIR/local-native" + run_registry_tx "chain" "$chain_payload" + ) + + local deployed_addrs token_file token_addr matched_count + deployed_addrs="$(jq -r '.tokens[]?.address | ascii_downcase' "$DEPLOY_ADDRESSES_FILE")" + matched_count=0 + + while IFS= read -r token_file; do + [[ -f "$token_file" ]] || continue + token_addr="$(jq -r '.native_representation.contract_address // "" | ascii_downcase' "$token_file")" + [[ -n "$token_addr" ]] || continue + + if echo "$deployed_addrs" | grep -Fxq "$token_addr"; then + token_payload="$(jq -c . "$token_file")" + log_info "Adding token config to uregistry: $(basename "$token_file")" + ( + cd "$PUSH_CHAIN_DIR/local-native" + run_registry_tx "token" "$token_payload" + ) + matched_count=$((matched_count + 1)) + fi + done < <(find "$TOKENS_CONFIG_DIR" -maxdepth 1 -type f -name '*.json' | sort) + + if [[ "$matched_count" -eq 0 ]]; then + log_warn "No deployed tokens matched token config files for uregistry add-token-config" + else + log_ok "Registered $matched_count deployed token config(s) in uregistry" + fi + + log_ok "uregistry chain/token configs added" +} + +step_sync_test_addresses() { + require_cmd jq + ensure_deploy_file + + if [[ ! -f "$TEST_ADDRESSES_PATH" ]]; then + log_err "test-addresses.json not found: $TEST_ADDRESSES_PATH" + exit 1 + fi + + log_info "Syncing deploy addresses into test-addresses.json" + local tmp + tmp="$(mktemp)" + + jq \ + --arg today "$(date +%F)" \ + --arg rpc "$PUSH_RPC_URL" \ + --slurpfile dep "$DEPLOY_ADDRESSES_FILE" \ + ' + ($dep[0]) as $d + | def token_addr($sym): first(($d.tokens[]? | select(.symbol == $sym) | .address), empty); + .lastUpdated = $today + | .network.rpcUrl = $rpc + | if ($d.contracts.Factory // "") != "" then .contracts.factory = $d.contracts.Factory else . end + | if ($d.contracts.WPC // "") != "" then .contracts.WPC = $d.contracts.WPC else . end + | if ($d.contracts.SwapRouter // "") != "" then .contracts.swapRouter = $d.contracts.SwapRouter else . end + | if ($d.contracts.PositionManager // "") != "" then .contracts.positionManager = $d.contracts.PositionManager else . end + | if ($d.contracts.QuoterV2 // "") != "" then .contracts.quoterV2 = $d.contracts.QuoterV2 else . end + | .testTokens |= with_entries( + .value.address = (token_addr(.key) // .value.address) + ) + | .testTokens = ( + .testTokens as $existing + | $existing + + ( + reduce ($d.tokens[]?) as $t ({}; + .[$t.symbol] = { + name: $t.name, + symbol: $t.symbol, + address: $t.address, + decimals: ($t.decimals // ($existing[$t.symbol].decimals // null)), + totalSupply: ($existing[$t.symbol].totalSupply // "") + } + ) + ) + ) + | .pools |= with_entries( + .value.token0 = (token_addr(.value.token0Symbol) // .value.token0) + | .value.token1 = (token_addr(.value.token1Symbol) // .value.token1) + ) + ' "$TEST_ADDRESSES_PATH" >"$tmp" + + mv "$tmp" "$TEST_ADDRESSES_PATH" + log_ok "Updated $TEST_ADDRESSES_PATH" +} + +step_create_all_wpc_pools() { + require_cmd node + ensure_deploy_file + + if [[ ! -f "$TEST_ADDRESSES_PATH" ]]; then + log_err "Missing test-addresses.json at $TEST_ADDRESSES_PATH" + exit 1 + fi + + local wpc_addr token_count token_addr token_symbol + wpc_addr="$(address_from_deploy_contract "WPC")" + if [[ -z "$wpc_addr" ]]; then + log_err "Missing WPC contract address in $DEPLOY_ADDRESSES_FILE" + exit 1 + fi + + token_count="$(jq -r '.tokens | length' "$DEPLOY_ADDRESSES_FILE")" + if [[ "$token_count" == "0" ]]; then + log_warn "No core tokens found in deploy addresses; skipping pool creation" + return 0 + fi + + while IFS=$'\t' read -r token_symbol token_addr; do + [[ -n "$token_addr" ]] || continue + if [[ "$(echo "$token_addr" | tr '[:upper:]' '[:lower:]')" == "$(echo "$wpc_addr" | tr '[:upper:]' '[:lower:]')" ]]; then + continue + fi + + log_info "Creating ${token_symbol}/WPC pool with liquidity" + ( + cd "$SWAP_AMM_DIR" + node scripts/pool-manager.js create-pool "$token_addr" "$wpc_addr" 4 500 true 1 4 + ) + done < <(jq -r '.tokens[]? | [.symbol, .address] | @tsv' "$DEPLOY_ADDRESSES_FILE") + + log_ok "All token/WPC pool creation commands completed" +} + +step_configure_universal_core() { + require_cmd forge + [[ -n "${PRIVATE_KEY:-}" ]] || { log_err "Set PRIVATE_KEY in e2e-tests/.env"; exit 1; } + + # configureUniversalCore depends on values from core .env + step_write_core_env + + local script_path="scripts/localSetup/configureUniversalCore.s.sol" + local log_file="$LOG_DIR/core_configure_$(date +%Y%m%d_%H%M%S).log" + local resume_attempt=1 + local resume_max_attempts="${CORE_CONFIGURE_RESUME_MAX_ATTEMPTS:-0}" # 0 = unlimited + + if [[ ! -f "$CORE_CONTRACTS_DIR/$script_path" ]]; then + log_warn "configureUniversalCore script not found at $CORE_CONTRACTS_DIR/$script_path; skipping" + return 0 + fi + + log_info "Running configureUniversalCore script" + if ( + cd "$CORE_CONTRACTS_DIR" + forge script "$script_path" \ + --broadcast \ + --rpc-url "$PUSH_RPC_URL" \ + --private-key "$PRIVATE_KEY" \ + --slow + ) 2>&1 | tee "$log_file"; then + log_ok "configureUniversalCore completed" + return 0 + fi + + log_warn "configureUniversalCore failed. Retrying with --resume until success" + while true; do + log_info "configureUniversalCore resume attempt: $resume_attempt" + if ( + cd "$CORE_CONTRACTS_DIR" + forge script "$script_path" \ + --broadcast \ + --rpc-url "$PUSH_RPC_URL" \ + --private-key "$PRIVATE_KEY" \ + --slow \ + --resume + ) 2>&1 | tee -a "$log_file"; then + log_ok "configureUniversalCore resumed successfully" + return 0 + fi + + if [[ "$resume_max_attempts" != "0" && "$resume_attempt" -ge "$resume_max_attempts" ]]; then + log_err "Reached CORE_CONFIGURE_RESUME_MAX_ATTEMPTS=$resume_max_attempts without success" + exit 1 + fi + + resume_attempt=$((resume_attempt + 1)) + sleep 2 + done +} + +cmd_all() { + step_devnet + step_recover_genesis_key + step_fund_account + step_setup_core_contracts + step_setup_swap_amm + step_sync_test_addresses + step_create_all_wpc_pools + assert_required_addresses + step_write_core_env + step_configure_universal_core + step_update_eth_token_config + step_setup_gateway + step_add_uregistry_configs +} + +cmd_show_help() { + cat < + +Commands: + devnet Build/start local-native devnet + uvalidators + print-genesis Print first genesis account + mnemonic + recover-genesis-key Recover genesis key into local keyring + fund Fund FUND_TO_ADDRESS from genesis key + setup-core Clone/build/setup core contracts (auto resume on failure) + setup-swap Clone/install/deploy swap AMM contracts + sync-addresses Apply deploy_addresses.json into test-addresses.json + create-pool Create WPC pools for all deployed core tokens + configure-core Run configureUniversalCore.s.sol (auto --resume retries) + check-addresses Verify required deploy addresses exist (WPC/Factory/QuoterV2/SwapRouter) + write-core-env Create core-contracts .env from deploy_addresses.json + update-token-config Update eth_sepolia_eth.json contract_address using deployed token + setup-gateway Clone/setup gateway repo and run forge localSetup (with --resume retry) + add-uregistry-configs Submit chain + token config txs via local-native validator1 + record-contract K A Manually record contract key/address + record-token N S A Manually record token name/symbol/address + all Run full setup pipeline + help Show this help + +Primary files: + Env: $ENV_FILE + Address: $DEPLOY_ADDRESSES_FILE +EOF +} + +main() { + local cmd="${1:-help}" + case "$cmd" in + devnet) step_devnet ;; + print-genesis) step_print_genesis ;; + recover-genesis-key) step_recover_genesis_key ;; + fund) step_fund_account ;; + setup-core) step_setup_core_contracts ;; + setup-swap) step_setup_swap_amm ;; + sync-addresses) step_sync_test_addresses ;; + create-pool) step_create_all_wpc_pools ;; + configure-core) step_configure_universal_core ;; + check-addresses) assert_required_addresses ;; + write-core-env) step_write_core_env ;; + update-token-config) step_update_deployed_token_configs ;; + setup-gateway) step_setup_gateway ;; + add-uregistry-configs) step_add_uregistry_configs ;; + record-contract) + ensure_deploy_file + [[ $# -eq 3 ]] || { log_err "Usage: $0 record-contract
"; exit 1; } + validate_eth_address "$3" || { log_err "Invalid address: $3"; exit 1; } + record_contract "$2" "$3" + ;; + record-token) + ensure_deploy_file + [[ $# -eq 4 ]] || { log_err "Usage: $0 record-token
"; exit 1; } + validate_eth_address "$4" || { log_err "Invalid address: $4"; exit 1; } + record_token "$2" "$3" "$4" "manual" + ;; + all) cmd_all ;; + help|--help|-h) cmd_show_help ;; + *) log_err "Unknown command: $cmd"; cmd_show_help; exit 1 ;; + esac +} + +main "$@" diff --git a/local-native/README.md b/local-native/README.md index 50f3cc4d..b911c8f5 100644 --- a/local-native/README.md +++ b/local-native/README.md @@ -49,7 +49,8 @@ cd local-native |---------|-------------| | `./devnet start [n]` | Start n core validators (default: 1) | | `./devnet setup-uvalidators` | Register UVs on-chain + create AuthZ grants | -| `./devnet start-uv [n]` | Start n universal validators (default: 4) | +| `./devnet start-uv [n]` | Start n universal validators (default: 4) and auto-set Sepolia `event_start_from` | +| `./devnet configure` | Manually refresh Sepolia `event_start_from` in existing UV configs | | `./devnet down` | Stop all validators | | `./devnet status` | Show network status | | `./devnet logs [service]` | View logs | diff --git a/local-native/devnet b/local-native/devnet index 081590fa..40f01540 100755 --- a/local-native/devnet +++ b/local-native/devnet @@ -236,6 +236,7 @@ start_validator() { start_universal() { local id=$1 + local sepolia_start_height=${2:-} local pid_file="$DATA_DIR/universal$id.pid" # Check if already running @@ -251,7 +252,7 @@ start_universal() { mkdir -p "$DATA_DIR/universal$id" print_status "Starting universal validator $id..." - UNIVERSAL_ID=$id "$SCRIPT_DIR/scripts/setup-universal.sh" > "$DATA_DIR/universal$id/universal.log" 2>&1 & + UNIVERSAL_ID=$id SEPOLIA_EVENT_START_FROM="$sepolia_start_height" "$SCRIPT_DIR/scripts/setup-universal.sh" > "$DATA_DIR/universal$id/universal.log" 2>&1 & echo $! > "$pid_file" print_success "Universal validator $id started (PID: $(cat $pid_file))" @@ -297,12 +298,19 @@ cmd_up() { cmd_start_uv() { require_binaries print_header "Starting Universal Validators..." + + local sepolia_start_height="" + if ! sepolia_start_height=$(bash "$SCRIPT_DIR/scripts/configure-pushuv.sh" --get-height); then + print_error "Failed to fetch latest Sepolia height" + exit 1 + fi + print_status "Using Sepolia event_start_from: $sepolia_start_height" local num_uv=${1:-4} for i in $(seq 1 $num_uv); do if [ $i -le 4 ]; then - start_universal $i + start_universal $i "$sepolia_start_height" sleep 3 fi done @@ -313,6 +321,14 @@ cmd_start_uv() { cmd_status } +# ═══════════════════════════════════════════════════════════════════════════════ +# CONFIGURE COMMANDS +# ═══════════════════════════════════════════════════════════════════════════════ +cmd_configure() { + print_header "Configuring local-native universal relayer configs..." + bash "$SCRIPT_DIR/scripts/configure-pushuv.sh" +} + # ═══════════════════════════════════════════════════════════════════════════════ # STOP/DOWN COMMANDS # ═══════════════════════════════════════════════════════════════════════════════ @@ -487,6 +503,7 @@ cmd_help() { echo -e "${BOLD}${CYAN}UNIVERSAL VALIDATORS${NC}" printf " ${BOLD}%-20s${NC}%s\n" "setup-uvalidators" "Register UVs and create AuthZ grants" printf " ${BOLD}%-20s${NC}%s\n" "start-uv [n]" "Start n universal validators (default: 4)" + printf " ${BOLD}%-20s${NC}%s\n" "configure" "Set Sepolia event_start_from to latest block" echo echo -e "${BOLD}${CYAN}TSS COMMANDS${NC}" printf " ${BOLD}%-20s${NC}%s\n" "tss-keygen" "Initiate TSS key generation" @@ -536,6 +553,7 @@ case "${1:-help}" in # Universal validators setup-uvalidators) "$SCRIPT_DIR/scripts/setup-uvalidators.sh" ;; start-uv) shift; cmd_start_uv "$@" ;; + configure) cmd_configure ;; # Maintenance clean) cmd_clean ;; diff --git a/local-native/scripts/configure-pushuv.sh b/local-native/scripts/configure-pushuv.sh new file mode 100644 index 00000000..8eea0098 --- /dev/null +++ b/local-native/scripts/configure-pushuv.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +LOCAL_NATIVE_DIR="$(cd -P "$SCRIPT_DIR/.." && pwd)" +DATA_DIR="$LOCAL_NATIVE_DIR/data" + +require_bin() { + local bin="$1" + if ! command -v "$bin" >/dev/null 2>&1; then + echo "❌ Required binary not found: $bin" + exit 1 + fi +} + +require_bin curl +require_bin jq + +SEPOLIA_CHAIN_ID="eip155:11155111" +DEFAULT_RPC_URL="https://sepolia.drpc.org" + +# Prefer RPC URL from existing config, fallback to default. +detect_rpc_url() { + local cfg="$1" + jq -r --arg chain "$SEPOLIA_CHAIN_ID" '.chain_configs[$chain].rpc_url[0] // empty' "$cfg" 2>/dev/null || true +} + +fetch_sepolia_height() { + local rpc_url="$1" + local response + response=$(curl -sS -X POST "$rpc_url" \ + -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}') + + local hex_height + hex_height=$(echo "$response" | jq -r '.result // empty') + + if [[ -z "$hex_height" || "$hex_height" == "null" || ! "$hex_height" =~ ^0x[0-9a-fA-F]+$ ]]; then + return 1 + fi + + echo "$((16#${hex_height#0x}))" +} + +find_pushuv_configs() { + find "$DATA_DIR" -type f -path '*/.puniversal/config/pushuv_config.json' | sort +} + +print_only_height() { + local rpc_url="$DEFAULT_RPC_URL" + local height="" + + if ! height=$(fetch_sepolia_height "$rpc_url"); then + echo "❌ Failed to fetch Sepolia block height from $rpc_url" >&2 + exit 1 + fi + + echo "$height" +} + +main() { + if [ "${1:-}" = "--get-height" ]; then + print_only_height + return 0 + fi + + local configs=() + while IFS= read -r cfg; do + configs+=("$cfg") + done < <(find_pushuv_configs) + + if [ "${#configs[@]}" -eq 0 ]; then + echo "❌ No pushuv_config.json files found under $DATA_DIR" + echo " Start universal validators first with: ./devnet start-uv 4" + exit 1 + fi + + local rpc_url="" + rpc_url=$(detect_rpc_url "${configs[0]}") + if [ -z "$rpc_url" ]; then + rpc_url="$DEFAULT_RPC_URL" + fi + + local height="" + if ! height=$(fetch_sepolia_height "$rpc_url"); then + echo "⚠️ Failed using configured RPC ($rpc_url), retrying default RPC ($DEFAULT_RPC_URL)..." + if ! height=$(fetch_sepolia_height "$DEFAULT_RPC_URL"); then + echo "❌ Failed to fetch Sepolia block height from both RPC endpoints" + exit 1 + fi + rpc_url="$DEFAULT_RPC_URL" + fi + + echo "ℹ️ Sepolia latest block height: $height" + echo "ℹ️ RPC used: $rpc_url" + + local updated=0 + for cfg in "${configs[@]}"; do + local tmp + tmp=$(mktemp) + jq --arg chain "$SEPOLIA_CHAIN_ID" --argjson height "$height" \ + '.chain_configs[$chain].event_start_from = $height' \ + "$cfg" > "$tmp" + mv "$tmp" "$cfg" + updated=$((updated + 1)) + echo "✅ Updated: $cfg" + done + + echo "🎉 Updated event_start_from for $updated config file(s)." +} + +main "$@" diff --git a/local-native/scripts/setup-universal.sh b/local-native/scripts/setup-universal.sh index e8023cde..e90919a0 100755 --- a/local-native/scripts/setup-universal.sh +++ b/local-native/scripts/setup-universal.sh @@ -86,6 +86,14 @@ jq --argjson port "$QUERY_PORT" '.query_server_port = $port' \ "$HOME_DIR/config/pushuv_config.json" > "$HOME_DIR/config/pushuv_config.json.tmp" && \ mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" +# Optionally override Sepolia event start height (set by ./devnet start-uv) +if [ -n "${SEPOLIA_EVENT_START_FROM:-}" ]; then + jq --argjson height "$SEPOLIA_EVENT_START_FROM" \ + '.chain_configs["eip155:11155111"].event_start_from = $height' \ + "$HOME_DIR/config/pushuv_config.json" > "$HOME_DIR/config/pushuv_config.json.tmp" && \ + mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" +fi + # Enable TSS TSS_PRIVATE_KEY=$(printf '%02x' $UNIVERSAL_ID | head -c 2) TSS_PRIVATE_KEY=$(yes $TSS_PRIVATE_KEY | head -32 | tr -d '\n') From 2de7fd08ea1d723a793a24c76cc2fb1b061aeb8f Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 19 Feb 2026 18:51:25 +0530 Subject: [PATCH 02/23] added a replace-addresses command to e2e-setup which replaces neccessary addresses in node repo --- e2e-tests/README.md | 3 +++ e2e-tests/setup.sh | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/e2e-tests/README.md b/e2e-tests/README.md index 810d76cf..fc8389bc 100644 --- a/e2e-tests/README.md +++ b/e2e-tests/README.md @@ -65,6 +65,7 @@ Path settings are repository-relative and portable. ## One-command full run ```bash +./e2e-tests/setup.sh replace-addresses ./e2e-tests/setup.sh all ``` @@ -101,6 +102,7 @@ This runs the full sequence in order: ./e2e-tests/setup.sh update-token-config ./e2e-tests/setup.sh setup-gateway ./e2e-tests/setup.sh add-uregistry-configs +./e2e-tests/setup.sh replace-addresses ./e2e-tests/setup.sh all ``` @@ -177,6 +179,7 @@ For a fresh run: ```bash rm -rf e2e-tests/repos ./local-native/devnet down || true +./e2e-tests/setup.sh replace-addresses ./e2e-tests/setup.sh all ``` diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 9dc19041..f5e0d4d8 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -41,6 +41,11 @@ fi : "${TOKEN_CONFIG_PATH:=./config/testnet-donut/tokens/eth_sepolia_eth.json}" : "${CHAIN_CONFIG_PATH:=./config/testnet-donut/chains/eth_sepolia_chain_config.json}" +: "${OLD_PUSH_ADDRESS:=push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20}" +: "${NEW_PUSH_ADDRESS:=push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20}" +: "${OLD_EVM_ADDRESS:=0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4}" +: "${NEW_EVM_ADDRESS:=0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4}" + abs_from_root() { local path="$1" if [[ "$path" = /* ]]; then @@ -1027,6 +1032,44 @@ step_configure_universal_core() { done } +step_replace_addresses_everywhere() { + require_cmd grep perl + + local touched=0 + local file + + while IFS= read -r file; do + [[ -n "$file" ]] || continue + perl -0777 -i -pe "s/\Q$OLD_PUSH_ADDRESS\E/$NEW_PUSH_ADDRESS/g; s/\Q$OLD_EVM_ADDRESS\E/$NEW_EVM_ADDRESS/g;" "$file" + touched=$((touched + 1)) + done < <( + grep -RIl \ + --exclude-dir=.git \ + --binary-files=without-match \ + -e "$OLD_PUSH_ADDRESS" \ + -e "$OLD_EVM_ADDRESS" \ + "$PUSH_CHAIN_DIR" || true + ) + + if [[ "$touched" -eq 0 ]]; then + log_warn "No files contained legacy addresses" + else + log_ok "Replaced legacy addresses in $touched file(s)" + fi +} + +run_preflight() { + local cmd="$1" + + case "$cmd" in + help|--help|-h|replace-addresses) + return 0 + ;; + esac + + step_replace_addresses_everywhere +} + cmd_all() { step_devnet step_recover_genesis_key @@ -1057,6 +1100,7 @@ Commands: sync-addresses Apply deploy_addresses.json into test-addresses.json create-pool Create WPC pools for all deployed core tokens configure-core Run configureUniversalCore.s.sol (auto --resume retries) + replace-addresses Replace legacy push/evm addresses across repo check-addresses Verify required deploy addresses exist (WPC/Factory/QuoterV2/SwapRouter) write-core-env Create core-contracts .env from deploy_addresses.json update-token-config Update eth_sepolia_eth.json contract_address using deployed token @@ -1075,6 +1119,7 @@ EOF main() { local cmd="${1:-help}" + run_preflight "$cmd" case "$cmd" in devnet) step_devnet ;; print-genesis) step_print_genesis ;; @@ -1085,6 +1130,7 @@ main() { sync-addresses) step_sync_test_addresses ;; create-pool) step_create_all_wpc_pools ;; configure-core) step_configure_universal_core ;; + replace-addresses) step_replace_addresses_everywhere ;; check-addresses) assert_required_addresses ;; write-core-env) step_write_core_env ;; update-token-config) step_update_deployed_token_configs ;; From fdc56f89c6902a77f67279522a84040ff684e9a5 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Fri, 20 Feb 2026 17:23:05 +0530 Subject: [PATCH 03/23] fix: registered static precompiles in local-native setup e2e --- e2e-tests/setup.sh | 57 ++++------------------ local-native/scripts/setup-genesis-auto.sh | 1 + 2 files changed, 11 insertions(+), 47 deletions(-) diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index f5e0d4d8..78522218 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -41,11 +41,6 @@ fi : "${TOKEN_CONFIG_PATH:=./config/testnet-donut/tokens/eth_sepolia_eth.json}" : "${CHAIN_CONFIG_PATH:=./config/testnet-donut/chains/eth_sepolia_chain_config.json}" -: "${OLD_PUSH_ADDRESS:=push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20}" -: "${NEW_PUSH_ADDRESS:=push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20}" -: "${OLD_EVM_ADDRESS:=0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4}" -: "${NEW_EVM_ADDRESS:=0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4}" - abs_from_root() { local path="$1" if [[ "$path" = /* ]]; then @@ -247,6 +242,15 @@ clone_or_update_repo() { fi if [[ -d "$dest/.git" ]]; then + local current_branch has_changes + current_branch="$(git -C "$dest" rev-parse --abbrev-ref HEAD 2>/dev/null || true)" + has_changes="$(git -C "$dest" status --porcelain 2>/dev/null)" + + if [[ -n "$has_changes" && "$current_branch" == "$resolved_branch" ]]; then + log_warn "Repo $(basename "$dest") has local changes on branch '$current_branch'. Skipping update to preserve local changes." + return 0 + fi + log_info "Updating repo $(basename "$dest")" git -C "$dest" fetch origin git -C "$dest" checkout "$resolved_branch" @@ -1032,44 +1036,6 @@ step_configure_universal_core() { done } -step_replace_addresses_everywhere() { - require_cmd grep perl - - local touched=0 - local file - - while IFS= read -r file; do - [[ -n "$file" ]] || continue - perl -0777 -i -pe "s/\Q$OLD_PUSH_ADDRESS\E/$NEW_PUSH_ADDRESS/g; s/\Q$OLD_EVM_ADDRESS\E/$NEW_EVM_ADDRESS/g;" "$file" - touched=$((touched + 1)) - done < <( - grep -RIl \ - --exclude-dir=.git \ - --binary-files=without-match \ - -e "$OLD_PUSH_ADDRESS" \ - -e "$OLD_EVM_ADDRESS" \ - "$PUSH_CHAIN_DIR" || true - ) - - if [[ "$touched" -eq 0 ]]; then - log_warn "No files contained legacy addresses" - else - log_ok "Replaced legacy addresses in $touched file(s)" - fi -} - -run_preflight() { - local cmd="$1" - - case "$cmd" in - help|--help|-h|replace-addresses) - return 0 - ;; - esac - - step_replace_addresses_everywhere -} - cmd_all() { step_devnet step_recover_genesis_key @@ -1100,7 +1066,6 @@ Commands: sync-addresses Apply deploy_addresses.json into test-addresses.json create-pool Create WPC pools for all deployed core tokens configure-core Run configureUniversalCore.s.sol (auto --resume retries) - replace-addresses Replace legacy push/evm addresses across repo check-addresses Verify required deploy addresses exist (WPC/Factory/QuoterV2/SwapRouter) write-core-env Create core-contracts .env from deploy_addresses.json update-token-config Update eth_sepolia_eth.json contract_address using deployed token @@ -1119,7 +1084,6 @@ EOF main() { local cmd="${1:-help}" - run_preflight "$cmd" case "$cmd" in devnet) step_devnet ;; print-genesis) step_print_genesis ;; @@ -1130,7 +1094,6 @@ main() { sync-addresses) step_sync_test_addresses ;; create-pool) step_create_all_wpc_pools ;; configure-core) step_configure_universal_core ;; - replace-addresses) step_replace_addresses_everywhere ;; check-addresses) assert_required_addresses ;; write-core-env) step_write_core_env ;; update-token-config) step_update_deployed_token_configs ;; @@ -1154,4 +1117,4 @@ main() { esac } -main "$@" +main "$@" \ No newline at end of file diff --git a/local-native/scripts/setup-genesis-auto.sh b/local-native/scripts/setup-genesis-auto.sh index 1ab5e6d6..f4ed4c6d 100755 --- a/local-native/scripts/setup-genesis-auto.sh +++ b/local-native/scripts/setup-genesis-auto.sh @@ -109,6 +109,7 @@ update_genesis '.app_state["gov"]["params"]["max_deposit_period"]="300s"' update_genesis '.app_state["gov"]["params"]["voting_period"]="300s"' update_genesis ".app_state[\"evm\"][\"params\"][\"evm_denom\"]=\"$DENOM\"" update_genesis ".app_state[\"evm\"][\"params\"][\"chain_config\"][\"chain_id\"]=$EVM_CHAIN_ID" +update_genesis '.app_state["evm"]["params"]["active_static_precompiles"]=["0x00000000000000000000000000000000000000CB","0x00000000000000000000000000000000000000ca","0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805"]' update_genesis ".app_state[\"staking\"][\"params\"][\"bond_denom\"]=\"$DENOM\"" update_genesis ".app_state[\"mint\"][\"params\"][\"mint_denom\"]=\"$DENOM\"" update_genesis ".app_state[\"uregistry\"][\"params\"][\"admin\"]=\"$GENESIS_ADDR1\"" From 1abe21634bc890f18bd5d60d570f2debc30c7797 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Fri, 20 Feb 2026 19:48:39 +0530 Subject: [PATCH 04/23] refactor: e2e-setup now uses local-multi-validator setup instead of local-native --- .gitignore | 2 + e2e-tests/.env.example | 5 +- e2e-tests/README.md | 10 +- e2e-tests/deploy_addresses.json | 2 +- e2e-tests/setup.sh | 141 ++++++++++++++---- local-multi-validator/Dockerfile.unified | 2 +- local-multi-validator/README.md | 20 +++ local-multi-validator/devnet | 38 ++++- local-multi-validator/docker-compose.yml | 4 + .../scripts/setup-universal.sh | 9 ++ 10 files changed, 201 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 7cb5df7d..951f3e1c 100755 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ universalClient/coverage.out # TSS data directory tss-data/ local-native/data/ +e2e-tests/.pchain/ +e2e-tests/genesis_accounts.json diff --git a/e2e-tests/.env.example b/e2e-tests/.env.example index ebec79f6..545bdc87 100644 --- a/e2e-tests/.env.example +++ b/e2e-tests/.env.example @@ -13,7 +13,9 @@ KEYRING_BACKEND=test # Genesis key recovery/funding GENESIS_KEY_NAME=genesis-acc-1 -GENESIS_KEY_HOME=./local-native/data/validator1/.pchain +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 ..." @@ -21,6 +23,7 @@ GENESIS_KEY_HOME=./local-native/data/validator1/.pchain # 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 diff --git a/e2e-tests/README.md b/e2e-tests/README.md index fc8389bc..cf5c8bef 100644 --- a/e2e-tests/README.md +++ b/e2e-tests/README.md @@ -4,7 +4,7 @@ This folder provides a full, automated local E2E bootstrap for Push Chain. It covers: -1. local-native devnet (validators + universal validators) +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) @@ -54,10 +54,16 @@ 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`) +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. --- @@ -178,7 +184,7 @@ For a fresh run: ```bash rm -rf e2e-tests/repos -./local-native/devnet down || true +./local-multi-validator/devnet down || true ./e2e-tests/setup.sh replace-addresses ./e2e-tests/setup.sh all ``` diff --git a/e2e-tests/deploy_addresses.json b/e2e-tests/deploy_addresses.json index c4fee1c2..83f7d660 100644 --- a/e2e-tests/deploy_addresses.json +++ b/e2e-tests/deploy_addresses.json @@ -1,5 +1,5 @@ { - "generatedAt": "2026-02-19T11:46:45Z", + "generatedAt": "2026-02-20T13:50:15Z", "contracts": { "WPC": "0x4ff2d01380CCd03A53457935B2e9d2eD092e9300", "Factory": "0x373D3F1B2b26729A308C5641970247bc9d4ddDa4", diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 78522218..be63e66b 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -18,10 +18,13 @@ fi : "${CHAIN_ID:=localchain_9000-1}" : "${KEYRING_BACKEND:=test}" : "${GENESIS_KEY_NAME:=genesis-acc-1}" -: "${GENESIS_KEY_HOME:=$PUSH_CHAIN_DIR/local-native/data/validator1/.pchain}" -: "${GENESIS_ACCOUNTS_JSON:=$PUSH_CHAIN_DIR/local-native/data/accounts/genesis_accounts.json}" +: "${GENESIS_KEY_HOME:=./e2e-tests/.pchain}" +: "${GENESIS_ACCOUNTS_JSON:=./e2e-tests/genesis_accounts.json}" : "${FUND_AMOUNT:=1000000000000000000upc}" +: "${POOL_CREATION_TOPUP_AMOUNT:=50000000000000000000upc}" : "${GAS_PRICES:=100000000000upc}" +: "${LOCAL_DEVNET_DIR:=./local-multi-validator}" +: "${LEGACY_LOCAL_NATIVE_DIR:=./local-native}" : "${CORE_CONTRACTS_REPO:=https://github.com/pushchain/push-chain-core-contracts.git}" : "${CORE_CONTRACTS_BRANCH:=e2e-push-node}" @@ -52,6 +55,8 @@ abs_from_root() { GENESIS_KEY_HOME="$(abs_from_root "$GENESIS_KEY_HOME")" GENESIS_ACCOUNTS_JSON="$(abs_from_root "$GENESIS_ACCOUNTS_JSON")" +LOCAL_DEVNET_DIR="$(abs_from_root "$LOCAL_DEVNET_DIR")" +LEGACY_LOCAL_NATIVE_DIR="$(abs_from_root "$LEGACY_LOCAL_NATIVE_DIR")" E2E_PARENT_DIR="$(abs_from_root "$E2E_PARENT_DIR")" CORE_CONTRACTS_DIR="$(abs_from_root "$CORE_CONTRACTS_DIR")" SWAP_AMM_DIR="$(abs_from_root "$SWAP_AMM_DIR")" @@ -76,6 +81,24 @@ log_ok() { printf "%b\n" "${green}✓${nc} $*"; } log_warn() { printf "%b\n" "${yellow}!${nc} $*"; } log_err() { printf "%b\n" "${red}x${nc} $*"; } +get_genesis_accounts_json() { + if [[ -f "$GENESIS_ACCOUNTS_JSON" ]]; then + cat "$GENESIS_ACCOUNTS_JSON" + return 0 + fi + + if command -v docker >/dev/null 2>&1; then + if docker ps --format '{{.Names}}' | grep -qx 'core-validator-1'; then + if docker exec core-validator-1 test -f /tmp/push-accounts/genesis_accounts.json >/dev/null 2>&1; then + docker exec core-validator-1 cat /tmp/push-accounts/genesis_accounts.json + return 0 + fi + fi + fi + + return 1 +} + require_cmd() { local c for c in "$@"; do @@ -263,25 +286,47 @@ clone_or_update_repo() { step_devnet() { require_cmd bash - log_info "Starting local-native devnet" + log_info "Starting local-multi-validator devnet" ( - cd "$PUSH_CHAIN_DIR/local-native" - ./devnet build - ./devnet start 4 + cd "$LOCAL_DEVNET_DIR" + ./devnet start --build ./devnet setup-uvalidators - ./devnet start-uv 4 ) log_ok "Devnet is up" } +step_stop_running_nodes() { + log_info "Stopping running local nodes/validators" + + if [[ -x "$LOCAL_DEVNET_DIR/devnet" ]]; then + ( + cd "$LOCAL_DEVNET_DIR" + ./devnet down || true + ) + fi + + if [[ -x "$LEGACY_LOCAL_NATIVE_DIR/devnet" ]]; then + ( + cd "$LEGACY_LOCAL_NATIVE_DIR" + ./devnet down || true + ) + fi + + pkill -f "$PUSH_CHAIN_DIR/build/pchaind start" >/dev/null 2>&1 || true + pkill -f "$PUSH_CHAIN_DIR/build/puniversald" >/dev/null 2>&1 || true + + log_ok "Running nodes stopped" +} + step_print_genesis() { require_cmd jq - if [[ ! -f "$GENESIS_ACCOUNTS_JSON" ]]; then - log_err "Missing genesis accounts file: $GENESIS_ACCOUNTS_JSON" + local accounts_json + if ! accounts_json="$(get_genesis_accounts_json)"; then + log_err "Could not resolve genesis accounts from $GENESIS_ACCOUNTS_JSON or docker container core-validator-1" exit 1 fi - jq -r '.[0] | "Account: \(.name)\nAddress: \(.address)\nMnemonic: \(.mnemonic)"' "$GENESIS_ACCOUNTS_JSON" + jq -r '.[0] | "Account: \(.name)\nAddress: \(.address)\nMnemonic: \(.mnemonic)"' <<<"$accounts_json" } step_recover_genesis_key() { @@ -289,15 +334,17 @@ step_recover_genesis_key() { local mnemonic="${GENESIS_MNEMONIC:-}" if [[ -z "$mnemonic" ]]; then - if [[ -f "$GENESIS_ACCOUNTS_JSON" ]]; then + local accounts_json + accounts_json="$(get_genesis_accounts_json || true)" + if [[ -n "$accounts_json" ]]; then mnemonic="$(jq -r --arg n "$GENESIS_KEY_NAME" ' (first(.[] | select(.name == $n) | .mnemonic) // first(.[].mnemonic) // "") - ' "$GENESIS_ACCOUNTS_JSON")" + ' <<<"$accounts_json")" fi fi if [[ -z "$mnemonic" ]]; then - log_err "Could not auto-resolve mnemonic from $GENESIS_ACCOUNTS_JSON" + log_err "Could not auto-resolve mnemonic from $GENESIS_ACCOUNTS_JSON or docker container core-validator-1" log_err "Set GENESIS_MNEMONIC in e2e-tests/.env" exit 1 fi @@ -812,7 +859,7 @@ step_add_uregistry_configs() { --chain-config "$payload" \ --from "$GENESIS_KEY_NAME" \ --keyring-backend "$KEYRING_BACKEND" \ - --home data/validator1/.pchain \ + --home "$GENESIS_KEY_HOME" \ --node tcp://127.0.0.1:26657 \ --gas-prices "$GAS_PRICES" \ -y)" @@ -821,7 +868,7 @@ step_add_uregistry_configs() { --token-config "$payload" \ --from "$GENESIS_KEY_NAME" \ --keyring-backend "$KEYRING_BACKEND" \ - --home data/validator1/.pchain \ + --home "$GENESIS_KEY_HOME" \ --node tcp://127.0.0.1:26657 \ --gas-prices "$GAS_PRICES" \ -y)" @@ -853,10 +900,7 @@ step_add_uregistry_configs() { } log_info "Adding chain config to uregistry" - ( - cd "$PUSH_CHAIN_DIR/local-native" - run_registry_tx "chain" "$chain_payload" - ) + run_registry_tx "chain" "$chain_payload" local deployed_addrs token_file token_addr matched_count deployed_addrs="$(jq -r '.tokens[]?.address | ascii_downcase' "$DEPLOY_ADDRESSES_FILE")" @@ -870,10 +914,7 @@ step_add_uregistry_configs() { if echo "$deployed_addrs" | grep -Fxq "$token_addr"; then token_payload="$(jq -c . "$token_file")" log_info "Adding token config to uregistry: $(basename "$token_file")" - ( - cd "$PUSH_CHAIN_DIR/local-native" - run_registry_tx "token" "$token_payload" - ) + run_registry_tx "token" "$token_payload" matched_count=$((matched_count + 1)) fi done < <(find "$TOKENS_CONFIG_DIR" -maxdepth 1 -type f -name '*.json' | sort) @@ -943,9 +984,11 @@ step_sync_test_addresses() { } step_create_all_wpc_pools() { - require_cmd node + require_cmd node cast "$PUSH_CHAIN_DIR/build/pchaind" ensure_deploy_file + [[ -n "${PRIVATE_KEY:-}" ]] || { log_err "Set PRIVATE_KEY in e2e-tests/.env"; exit 1; } + if [[ ! -f "$TEST_ADDRESSES_PATH" ]]; then log_err "Missing test-addresses.json at $TEST_ADDRESSES_PATH" exit 1 @@ -964,6 +1007,51 @@ step_create_all_wpc_pools() { return 0 fi + local deployer_evm_addr + deployer_evm_addr="$(cast wallet address --private-key "$PRIVATE_KEY" 2>/dev/null || true)" + if ! validate_eth_address "$deployer_evm_addr"; then + log_err "Could not resolve deployer EVM address from PRIVATE_KEY" + exit 1 + fi + + local deployer_hex deployer_push_addr + deployer_hex="$(echo "$deployer_evm_addr" | tr '[:upper:]' '[:lower:]' | sed 's/^0x//')" + deployer_push_addr="$("$PUSH_CHAIN_DIR/build/pchaind" debug addr "$deployer_hex" 2>/dev/null | awk -F': ' '/Bech32 Acc:/ {print $2; exit}')" + if [[ -z "$deployer_push_addr" ]]; then + log_err "Could not derive bech32 deployer address from $deployer_evm_addr" + exit 1 + fi + + log_info "Funding deployer $deployer_push_addr ($deployer_evm_addr) for pool creation ($POOL_CREATION_TOPUP_AMOUNT)" + local fund_attempt=1 + local fund_max_attempts=5 + local fund_out="" + while true; do + fund_out="$("$PUSH_CHAIN_DIR/build/pchaind" tx bank send "$GENESIS_KEY_NAME" "$deployer_push_addr" "$POOL_CREATION_TOPUP_AMOUNT" \ + --gas-prices "$GAS_PRICES" \ + --keyring-backend "$KEYRING_BACKEND" \ + --chain-id "$CHAIN_ID" \ + --home "$GENESIS_KEY_HOME" \ + -y 2>&1 || true)" + + if echo "$fund_out" | grep -q 'txhash:' || echo "$fund_out" | grep -q '"txhash"'; then + log_ok "Deployer funding transaction submitted" + break + fi + + if echo "$fund_out" | grep -qi 'account sequence mismatch' && [[ "$fund_attempt" -lt "$fund_max_attempts" ]]; then + log_warn "Funding sequence mismatch on attempt $fund_attempt/$fund_max_attempts. Retrying..." + fund_attempt=$((fund_attempt + 1)) + sleep 2 + continue + fi + + log_err "Failed to fund deployer for pool creation" + echo "$fund_out" + exit 1 + done + sleep 2 + while IFS=$'\t' read -r token_symbol token_addr; do [[ -n "$token_addr" ]] || continue if [[ "$(echo "$token_addr" | tr '[:upper:]' '[:lower:]')" == "$(echo "$wpc_addr" | tr '[:upper:]' '[:lower:]')" ]]; then @@ -1037,6 +1125,7 @@ step_configure_universal_core() { } cmd_all() { + step_stop_running_nodes step_devnet step_recover_genesis_key step_fund_account @@ -1057,7 +1146,7 @@ cmd_show_help() { Usage: $(basename "$0") Commands: - devnet Build/start local-native devnet + uvalidators + devnet Build/start local-multi-validator devnet + uvalidators print-genesis Print first genesis account + mnemonic recover-genesis-key Recover genesis key into local keyring fund Fund FUND_TO_ADDRESS from genesis key @@ -1070,7 +1159,7 @@ Commands: write-core-env Create core-contracts .env from deploy_addresses.json update-token-config Update eth_sepolia_eth.json contract_address using deployed token setup-gateway Clone/setup gateway repo and run forge localSetup (with --resume retry) - add-uregistry-configs Submit chain + token config txs via local-native validator1 + add-uregistry-configs Submit chain + token config txs via local-multi-validator validator1 record-contract K A Manually record contract key/address record-token N S A Manually record token name/symbol/address all Run full setup pipeline diff --git a/local-multi-validator/Dockerfile.unified b/local-multi-validator/Dockerfile.unified index 070594ad..0ff6edc8 100644 --- a/local-multi-validator/Dockerfile.unified +++ b/local-multi-validator/Dockerfile.unified @@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/go/pkg/mod,id=go-mod \ go mod tidy # Replace admin addresses for local-multi-validator setup -RUN sed -i 's/push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a/push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20/g' \ +RUN sed -i 's/push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20/push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20/g' \ ./x/uregistry/types/params.go \ ./x/utss/types/params.go \ ./x/uvalidator/types/params.go diff --git a/local-multi-validator/README.md b/local-multi-validator/README.md index 818b72f6..f130d579 100644 --- a/local-multi-validator/README.md +++ b/local-multi-validator/README.md @@ -37,6 +37,20 @@ docker compose up --build - Auto-builds base image if missing (~15-20 min first time) - Pulls core/universal from cache or builds locally - Starts all 8 validators +- Auto-sets Sepolia `event_start_from` to latest block for all universal validators + +### Sepolia Event Start Block + +On `./devnet start`, the script fetches latest Sepolia block height from `https://sepolia.drpc.org` +and injects it into each universal validator config: + +- `chain_configs["eip155:11155111"].event_start_from = ` + +You can override this manually at startup: + +```bash +SEPOLIA_EVENT_START_FROM=12345678 ./devnet start +``` ### I Changed Core Validator Code **Files:** `cmd/pchaind/`, `app/`, `x/` modules @@ -133,6 +147,12 @@ docker compose up -d # Start containers directly | `./devnet push-cache` | Push local images to GCR | | `./devnet refresh-cache` | Force rebuild and push to GCR | +The `start` command also supports: + +| Environment Variable | Description | +|----------------------|-------------| +| `SEPOLIA_EVENT_START_FROM` | Force universal validators to start monitoring Sepolia from a specific block | + ## Endpoints | Service | Port | Description | diff --git a/local-multi-validator/devnet b/local-multi-validator/devnet index fd92da91..8fdc2fc5 100755 --- a/local-multi-validator/devnet +++ b/local-multi-validator/devnet @@ -15,6 +15,8 @@ cd "$SCRIPT_DIR" # ═══════════════════════════════════════════════════════════════════════════════ GCR_REGISTRY="${GCR_REGISTRY:-gcr.io/push-chain-testnet}" CACHE_TAG="${CACHE_TAG:-latest}" +SEPOLIA_CHAIN_ID="eip155:11155111" +SEPOLIA_DEFAULT_RPC_URL="${SEPOLIA_DEFAULT_RPC_URL:-https://sepolia.drpc.org}" # ═══════════════════════════════════════════════════════════════════════════════ # COLORS @@ -68,6 +70,23 @@ has_buildx() { docker buildx version >/dev/null 2>&1 } +fetch_sepolia_height() { + local rpc_url="$1" + local response + response=$(curl -sS -X POST "$rpc_url" \ + -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}') + + local hex_height + hex_height=$(echo "$response" | jq -r '.result // empty') + + if [ -z "$hex_height" ] || [ "$hex_height" = "null" ] || [[ ! "$hex_height" =~ ^0x[0-9a-fA-F]+$ ]]; then + return 1 + fi + + echo "$((16#${hex_height#0x}))" +} + # ═══════════════════════════════════════════════════════════════════════════════ # STATUS HELPERS # ═══════════════════════════════════════════════════════════════════════════════ @@ -413,7 +432,24 @@ cmd_up() { fi fi - docker compose up -d + local sepolia_start_height="${SEPOLIA_EVENT_START_FROM:-}" + if [ -z "$sepolia_start_height" ]; then + if sepolia_start_height=$(fetch_sepolia_height "$SEPOLIA_DEFAULT_RPC_URL"); then + print_status "Using Sepolia event_start_from: $sepolia_start_height" + else + print_warning "Could not fetch Sepolia latest block from $SEPOLIA_DEFAULT_RPC_URL" + print_warning "Universal validators will use default event_start_from from pushuv config" + sepolia_start_height="" + fi + else + print_status "Using provided SEPOLIA_EVENT_START_FROM: $sepolia_start_height" + fi + + if [ -n "$sepolia_start_height" ]; then + SEPOLIA_EVENT_START_FROM="$sepolia_start_height" docker compose up -d + else + docker compose up -d + fi # Auto-push to cache if we built locally (populate cache for team) if [ -n "$built_locally" ] && [ -z "$skip_cache" ]; then diff --git a/local-multi-validator/docker-compose.yml b/local-multi-validator/docker-compose.yml index a9374086..1bd2fa29 100644 --- a/local-multi-validator/docker-compose.yml +++ b/local-multi-validator/docker-compose.yml @@ -231,6 +231,7 @@ services: - CORE_VALIDATOR_GRPC=core-validator-1:9090 - QUERY_PORT=8080 - TSS_ENABLED=true + - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-1: @@ -264,6 +265,7 @@ services: - CORE_VALIDATOR_GRPC=core-validator-2:9090 - QUERY_PORT=8080 - TSS_ENABLED=true + - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-2: @@ -297,6 +299,7 @@ services: - CORE_VALIDATOR_GRPC=core-validator-3:9090 - QUERY_PORT=8080 - TSS_ENABLED=true + - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-3: @@ -330,6 +333,7 @@ services: - CORE_VALIDATOR_GRPC=core-validator-4:9090 - QUERY_PORT=8080 - TSS_ENABLED=true + - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-4: diff --git a/local-multi-validator/scripts/setup-universal.sh b/local-multi-validator/scripts/setup-universal.sh index cfb4d3f3..0ac82001 100755 --- a/local-multi-validator/scripts/setup-universal.sh +++ b/local-multi-validator/scripts/setup-universal.sh @@ -136,6 +136,15 @@ if [ "$QUERY_PORT" != "8080" ]; then mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" fi +# Optionally override Sepolia event start height (set by ./devnet start) +if [ -n "${SEPOLIA_EVENT_START_FROM:-}" ]; then + echo "📍 Setting Sepolia event_start_from: $SEPOLIA_EVENT_START_FROM" + jq --argjson height "$SEPOLIA_EVENT_START_FROM" \ + '.chain_configs["eip155:11155111"].event_start_from = $height' \ + "$HOME_DIR/config/pushuv_config.json" > "$HOME_DIR/config/pushuv_config.json.tmp" && \ + mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" +fi + # --------------------------- # === SET CORE VALOPER ADDRESS === # --------------------------- From 472db3377641f4534d4cab80aabd5bb9e76d0aee Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Tue, 24 Feb 2026 13:12:26 +0530 Subject: [PATCH 05/23] sdk-setup added --- e2e-tests/README.md | 56 ++++++++++- e2e-tests/deploy_addresses.json | 26 ----- e2e-tests/setup.sh | 163 ++++++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+), 27 deletions(-) diff --git a/e2e-tests/README.md b/e2e-tests/README.md index cf5c8bef..14b0d54e 100644 --- a/e2e-tests/README.md +++ b/e2e-tests/README.md @@ -12,7 +12,8 @@ It covers: 6. core `.env` generation from deployed addresses 7. token config update (`eth_sepolia_eth.json`) 8. gateway contracts deployment -9. uregistry chain/token config submission +9. push-chain-sdk setup + E2E test runners +10. uregistry chain/token config submission --- @@ -22,6 +23,7 @@ It covers: - 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 @@ -58,6 +60,7 @@ Important variables in `.env`: - `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: @@ -107,11 +110,62 @@ This runs the full sequence in order: ./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 ./e2e-tests/setup.sh 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 diff --git a/e2e-tests/deploy_addresses.json b/e2e-tests/deploy_addresses.json index 83f7d660..e69de29b 100644 --- a/e2e-tests/deploy_addresses.json +++ b/e2e-tests/deploy_addresses.json @@ -1,26 +0,0 @@ -{ - "generatedAt": "2026-02-20T13:50:15Z", - "contracts": { - "WPC": "0x4ff2d01380CCd03A53457935B2e9d2eD092e9300", - "Factory": "0x373D3F1B2b26729A308C5641970247bc9d4ddDa4", - "SwapRouter": "0x6a20557430be6412AF423681e35CC96797506F3a", - "QuoterV2": "0xc2055dD3A7Ad875520BdB5c91300F964F7038C73", - "PositionManager": "0xdBdFEB7A79868Cb4A4e9e57D7d28C84AE77AC4BC" - }, - "tokens": [ - { - "name": "pETH.eth", - "symbol": "pETH", - "address": "0x90F4A15601E08570D6fFbaE883C44BDB85bDb7d1", - "source": "core-contracts", - "decimals": 18 - }, - { - "name": "USDT.eth", - "symbol": "USDT.eth", - "address": "0x00cb38A885cf8D0B2dDfd19Bd1c04aAAC44C5a86", - "source": "core-contracts", - "decimals": 6 - } - ] -} diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index be63e66b..7b99cc63 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -32,11 +32,16 @@ fi : "${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}" : "${E2E_PARENT_DIR:=../}" : "${CORE_CONTRACTS_DIR:=$E2E_PARENT_DIR/push-chain-core-contracts}" : "${SWAP_AMM_DIR:=$E2E_PARENT_DIR/push-chain-swap-internal-amm-contracts}" : "${GATEWAY_DIR:=$E2E_PARENT_DIR/push-chain-gateway-contracts}" +: "${PUSH_CHAIN_SDK_DIR:=$E2E_PARENT_DIR/push-chain-sdk}" +: "${PUSH_CHAIN_SDK_E2E_DIR:=packages/core/__e2e__}" +: "${PUSH_CHAIN_SDK_CHAIN_CONSTANTS_PATH:=packages/core/src/lib/constants/chain.ts}" : "${DEPLOY_ADDRESSES_FILE:=$SCRIPT_DIR/deploy_addresses.json}" : "${LOG_DIR:=$SCRIPT_DIR/logs}" : "${TEST_ADDRESSES_PATH:=$SWAP_AMM_DIR/test-addresses.json}" @@ -61,6 +66,7 @@ E2E_PARENT_DIR="$(abs_from_root "$E2E_PARENT_DIR")" CORE_CONTRACTS_DIR="$(abs_from_root "$CORE_CONTRACTS_DIR")" SWAP_AMM_DIR="$(abs_from_root "$SWAP_AMM_DIR")" GATEWAY_DIR="$(abs_from_root "$GATEWAY_DIR")" +PUSH_CHAIN_SDK_DIR="$(abs_from_root "$PUSH_CHAIN_SDK_DIR")" DEPLOY_ADDRESSES_FILE="$(abs_from_root "$DEPLOY_ADDRESSES_FILE")" TEST_ADDRESSES_PATH="$(abs_from_root "$TEST_ADDRESSES_PATH")" LOG_DIR="$(abs_from_root "$LOG_DIR")" @@ -284,6 +290,149 @@ clone_or_update_repo() { fi } +sdk_test_files() { + local base_dir="$PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_E2E_DIR" + local file alt + local requested_files=( + "pctx-last-transaction.spec.tx" + "send-to-self.spec.ts" + "progress-hook-per-tx.spec.ts" + "bridge-multicall.spec.ts" + "pushchain.spec.ts" + ) + + for file in "${requested_files[@]}"; do + if [[ -f "$base_dir/$file" ]]; then + printf "%s\n" "$base_dir/$file" + continue + fi + + if [[ "$file" == *.tx ]]; then + alt="${file%.tx}.ts" + if [[ -f "$base_dir/$alt" ]]; then + log_warn "Test file '$file' not found. Using '$alt'." + printf "%s\n" "$base_dir/$alt" + continue + fi + fi + + log_err "SDK test file not found: $base_dir/$file" + exit 1 + done +} + +sdk_prepare_test_files_for_localnet() { + require_cmd perl + + if [[ ! -d "$PUSH_CHAIN_SDK_DIR/.git" && ! -d "$PUSH_CHAIN_SDK_DIR" ]]; then + log_err "SDK repo not found at $PUSH_CHAIN_SDK_DIR" + log_err "Run: $0 setup-sdk" + exit 1 + fi + + if [[ ! -d "$PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_E2E_DIR" ]]; then + log_err "SDK E2E directory not found: $PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_E2E_DIR" + exit 1 + fi + + while IFS= read -r test_file; do + [[ -n "$test_file" ]] || continue + perl -0pi -e 's/\bPUSH_NETWORK\.TESTNET_DONUT\b/PUSH_NETWORK.LOCALNET/g; s/\bPUSH_NETWORK\.TESTNET\b/PUSH_NETWORK.LOCALNET/g' "$test_file" + log_ok "Prepared LOCALNET network replacement in $(basename "$test_file")" + done < <(sdk_test_files) +} + +step_setup_push_chain_sdk() { + require_cmd git yarn npm cast jq + + local chain_constants_file="$PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_CHAIN_CONSTANTS_PATH" + local uea_impl_raw uea_impl synced_localnet_uea + + clone_or_update_repo "$PUSH_CHAIN_SDK_REPO" "$PUSH_CHAIN_SDK_BRANCH" "$PUSH_CHAIN_SDK_DIR" + + if [[ ! -f "$chain_constants_file" ]]; then + log_err "SDK chain constants file not found: $chain_constants_file" + exit 1 + fi + + log_info "Fetching UEA_PROXY_IMPLEMENTATION from local chain" + uea_impl_raw="$(cast call 0x00000000000000000000000000000000000000ea 'UEA_PROXY_IMPLEMENTATION()(address)' --rpc-url "$PUSH_RPC_URL" 2>/dev/null || true)" + uea_impl="$(echo "$uea_impl_raw" | grep -Eo '0x[a-fA-F0-9]{40}' | head -1 || true)" + + if ! validate_eth_address "$uea_impl"; then + log_err "Could not resolve valid UEA_PROXY_IMPLEMENTATION address from cast output: $uea_impl_raw" + exit 1 + fi + + ensure_deploy_file + record_contract "UEA_PROXY_IMPLEMENTATION" "$uea_impl" + + UEA_PROXY_IMPL="$uea_impl" perl -0pi -e 's#(\[PUSH_NETWORK\.LOCALNET\]:\s*)'\''[^'\'']*'\''#$1'\''$ENV{UEA_PROXY_IMPL}'\''#g' "$chain_constants_file" + + synced_localnet_uea="$(grep -E '\[PUSH_NETWORK\.LOCALNET\]:' "$chain_constants_file" | head -1 | sed -E "s/.*'([^']+)'.*/\1/")" + if [[ "$synced_localnet_uea" != "$uea_impl" ]]; then + log_err "Failed to update PUSH_NETWORK.LOCALNET UEA proxy in $chain_constants_file" + exit 1 + fi + + log_ok "Synced PUSH_NETWORK.LOCALNET UEA proxy to $uea_impl" + + log_info "Installing push-chain-sdk dependencies" + ( + cd "$PUSH_CHAIN_SDK_DIR" + yarn install + npm install + npm i --save-dev @types/bs58 + ) + + log_ok "push-chain-sdk setup complete" +} + +step_run_sdk_test_file() { + local test_basename="$1" + local test_file="" + + sdk_prepare_test_files_for_localnet + + while IFS= read -r candidate; do + [[ -n "$candidate" ]] || continue + if [[ "$(basename "$candidate")" == "$test_basename" ]]; then + test_file="$candidate" + break + fi + done < <(sdk_test_files) + + if [[ -z "$test_file" ]]; then + log_err "Requested SDK test file not in configured list: $test_basename" + exit 1 + fi + + log_info "Running SDK test: $test_basename" + ( + cd "$PUSH_CHAIN_SDK_DIR" + npx jest "$test_file" + ) + + log_ok "Completed SDK test: $test_basename" +} + +step_run_sdk_tests_all() { + local test_file + + sdk_prepare_test_files_for_localnet + + while IFS= read -r test_file; do + [[ -n "$test_file" ]] || continue + log_info "Running SDK test: $(basename "$test_file")" + ( + cd "$PUSH_CHAIN_SDK_DIR" + npx jest "$test_file" + ) + done < <(sdk_test_files) + + log_ok "Completed all configured SDK E2E tests" +} + step_devnet() { require_cmd bash log_info "Starting local-multi-validator devnet" @@ -1159,6 +1308,13 @@ Commands: write-core-env Create core-contracts .env from deploy_addresses.json update-token-config Update eth_sepolia_eth.json contract_address using deployed token setup-gateway Clone/setup gateway repo and run forge localSetup (with --resume retry) + setup-sdk Clone/setup push-chain-sdk and install dependencies + sdk-test-all Replace PUSH_NETWORK TESTNET variants with LOCALNET and run all configured SDK E2E tests + sdk-test-pctx-last-transaction Run pctx-last-transaction.spec.ts + sdk-test-send-to-self Run send-to-self.spec.ts + sdk-test-progress-hook Run progress-hook-per-tx.spec.ts + sdk-test-bridge-multicall Run bridge-multicall.spec.ts + sdk-test-pushchain Run pushchain.spec.ts add-uregistry-configs Submit chain + token config txs via local-multi-validator validator1 record-contract K A Manually record contract key/address record-token N S A Manually record token name/symbol/address @@ -1187,6 +1343,13 @@ main() { write-core-env) step_write_core_env ;; update-token-config) step_update_deployed_token_configs ;; setup-gateway) step_setup_gateway ;; + setup-sdk) step_setup_push_chain_sdk ;; + sdk-test-all) step_run_sdk_tests_all ;; + sdk-test-pctx-last-transaction) step_run_sdk_test_file "pctx-last-transaction.spec.ts" ;; + sdk-test-send-to-self) step_run_sdk_test_file "send-to-self.spec.ts" ;; + sdk-test-progress-hook) step_run_sdk_test_file "progress-hook-per-tx.spec.ts" ;; + sdk-test-bridge-multicall) step_run_sdk_test_file "bridge-multicall.spec.ts" ;; + sdk-test-pushchain) step_run_sdk_test_file "pushchain.spec.ts" ;; add-uregistry-configs) step_add_uregistry_configs ;; record-contract) ensure_deploy_file From c1f442fe70aaa2b96fbf36fc2f91962dccc28481 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Tue, 24 Feb 2026 13:14:34 +0530 Subject: [PATCH 06/23] changed core-contracts branch in .env.example --- e2e-tests/.env.example | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/e2e-tests/.env.example b/e2e-tests/.env.example index 545bdc87..c5442fa0 100644 --- a/e2e-tests/.env.example +++ b/e2e-tests/.env.example @@ -31,7 +31,7 @@ PRIVATE_KEY=0x0dfb3d814afd8d0bf7a6010e8dd2b6ac835cabe4da9e2c1e80c6a14df3994dd4 # External repositories CORE_CONTRACTS_REPO=https://github.com/pushchain/push-chain-core-contracts.git -CORE_CONTRACTS_BRANCH=e2e-push-node +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 @@ -39,11 +39,16 @@ 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 + # 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__ # Tracking files DEPLOY_ADDRESSES_FILE=./e2e-tests/deploy_addresses.json From 15be6a6a6732d1252e4e7620a8abbde1442106d3 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Wed, 25 Feb 2026 11:43:56 +0530 Subject: [PATCH 07/23] fix: deploy-addresses.json related issues --- e2e-tests/.env.example | 2 +- e2e-tests/setup.sh | 33 ++++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/e2e-tests/.env.example b/e2e-tests/.env.example index c5442fa0..91a15368 100644 --- a/e2e-tests/.env.example +++ b/e2e-tests/.env.example @@ -27,7 +27,7 @@ POOL_CREATION_TOPUP_AMOUNT=50000000000000000000upc GAS_PRICES=100000000000upc # EVM private key used by forge/hardhat scripts -PRIVATE_KEY=0x0dfb3d814afd8d0bf7a6010e8dd2b6ac835cabe4da9e2c1e80c6a14df3994dd4 +PRIVATE_KEY=0xYOURPRIVATEKEY # External repositories CORE_CONTRACTS_REPO=https://github.com/pushchain/push-chain-core-contracts.git diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 7b99cc63..decc33ef 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -201,7 +201,9 @@ resolve_branch() { } ensure_deploy_file() { - if [[ ! -f "$DEPLOY_ADDRESSES_FILE" ]]; then + mkdir -p "$(dirname "$DEPLOY_ADDRESSES_FILE")" + + if [[ ! -s "$DEPLOY_ADDRESSES_FILE" ]]; then cat >"$DEPLOY_ADDRESSES_FILE" <<'JSON' { "generatedAt": "", @@ -209,7 +211,29 @@ ensure_deploy_file() { "tokens": [] } JSON + return fi + + if ! jq -e . "$DEPLOY_ADDRESSES_FILE" >/dev/null 2>&1; then + log_warn "Deploy file is empty/invalid JSON, reinitializing: $DEPLOY_ADDRESSES_FILE" + cat >"$DEPLOY_ADDRESSES_FILE" <<'JSON' +{ + "generatedAt": "", + "contracts": {}, + "tokens": [] +} +JSON + return + fi + + local tmp + tmp="$(mktemp)" + jq ' + .generatedAt = (.generatedAt // "") + | .contracts = (.contracts // {}) + | .tokens = (.tokens // []) + ' "$DEPLOY_ADDRESSES_FILE" >"$tmp" + mv "$tmp" "$DEPLOY_ADDRESSES_FILE" } set_generated_at() { @@ -684,7 +708,7 @@ assert_required_addresses() { for key in "${required[@]}"; do val="$(address_from_deploy_contract "$key")" if [[ -z "$val" ]]; then - log_err "Missing required address in deploy file: contracts.$key" + log_warn "Missing address in deploy file: contracts.$key" missing=1 else log_ok "contracts.$key=$val" @@ -692,8 +716,7 @@ assert_required_addresses() { done if [[ "$missing" -ne 0 ]]; then - log_err "Required addresses are missing in $DEPLOY_ADDRESSES_FILE" - exit 1 + log_warn "Some addresses are missing in $DEPLOY_ADDRESSES_FILE; continuing with available values" fi } @@ -1304,7 +1327,7 @@ Commands: sync-addresses Apply deploy_addresses.json into test-addresses.json create-pool Create WPC pools for all deployed core tokens configure-core Run configureUniversalCore.s.sol (auto --resume retries) - check-addresses Verify required deploy addresses exist (WPC/Factory/QuoterV2/SwapRouter) + check-addresses Check/report deploy addresses (WPC/Factory/QuoterV2/SwapRouter) write-core-env Create core-contracts .env from deploy_addresses.json update-token-config Update eth_sepolia_eth.json contract_address using deployed token setup-gateway Clone/setup gateway repo and run forge localSetup (with --resume retry) From 740d0456fce5d1cd5986b4a33d9f11a4dd94b029 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Wed, 25 Feb 2026 12:30:50 +0530 Subject: [PATCH 08/23] fix: made token-config deploy_addresses.json driven in e2e-setup --- e2e-tests/setup.sh | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index decc33ef..ade9e924 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -1012,9 +1012,6 @@ step_add_uregistry_configs() { [[ -f "$CHAIN_CONFIG_PATH" ]] || { log_err "Missing chain config: $CHAIN_CONFIG_PATH"; exit 1; } [[ -d "$TOKENS_CONFIG_DIR" ]] || { log_err "Missing tokens config directory: $TOKENS_CONFIG_DIR"; exit 1; } - # Ensure all deployed core tokens have updated contract addresses in token config files. - step_update_deployed_token_configs - local chain_payload token_payload chain_payload="$(jq -c . "$CHAIN_CONFIG_PATH")" @@ -1074,27 +1071,44 @@ step_add_uregistry_configs() { log_info "Adding chain config to uregistry" run_registry_tx "chain" "$chain_payload" - local deployed_addrs token_file token_addr matched_count - deployed_addrs="$(jq -r '.tokens[]?.address | ascii_downcase' "$DEPLOY_ADDRESSES_FILE")" + local token_json token_file token_addr token_symbol token_name matched_count submitted_files tmp matched_count=0 + submitted_files="" + + while IFS= read -r token_json; do + token_symbol="$(echo "$token_json" | jq -r '.symbol // ""')" + token_name="$(echo "$token_json" | jq -r '.name // ""')" + token_addr="$(echo "$token_json" | jq -r '.address // ""')" - while IFS= read -r token_file; do - [[ -f "$token_file" ]] || continue - token_addr="$(jq -r '.native_representation.contract_address // "" | ascii_downcase' "$token_file")" [[ -n "$token_addr" ]] || continue - if echo "$deployed_addrs" | grep -Fxq "$token_addr"; then - token_payload="$(jq -c . "$token_file")" - log_info "Adding token config to uregistry: $(basename "$token_file")" - run_registry_tx "token" "$token_payload" - matched_count=$((matched_count + 1)) + token_file="$(find_matching_token_config_file "$token_symbol" "$token_name")" + if [[ -z "$token_file" ]]; then + log_warn "No token config match found for deployed token (uregistry): $token_symbol ($token_name)" + continue fi - done < <(find "$TOKENS_CONFIG_DIR" -maxdepth 1 -type f -name '*.json' | sort) + + if echo "$submitted_files" | grep -Fxq "$token_file"; then + log_warn "Token config already submitted by another deployed token, skipping: $(basename "$token_file")" + continue + fi + + tmp="$(mktemp)" + jq --arg a "$token_addr" '.native_representation.contract_address = $a' "$token_file" >"$tmp" + mv "$tmp" "$token_file" + + token_payload="$(jq -c . "$token_file")" + log_info "Adding token config to uregistry: $(basename "$token_file") (from $token_symbol)" + run_registry_tx "token" "$token_payload" + + submitted_files+="$token_file"$'\n' + matched_count=$((matched_count + 1)) + done < <(jq -c '.tokens[]?' "$DEPLOY_ADDRESSES_FILE") if [[ "$matched_count" -eq 0 ]]; then - log_warn "No deployed tokens matched token config files for uregistry add-token-config" + log_warn "No token configs were registered from deploy_addresses.json tokens" else - log_ok "Registered $matched_count deployed token config(s) in uregistry" + log_ok "Registered $matched_count token config(s) from deploy_addresses.json" fi log_ok "uregistry chain/token configs added" From 464988ec55c1a7dc3f0afce92f5549c90cb97a67 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:04:01 +0530 Subject: [PATCH 09/23] fix : QoL change script added --- scripts/replace_addresses.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 scripts/replace_addresses.sh diff --git a/scripts/replace_addresses.sh b/scripts/replace_addresses.sh new file mode 100644 index 00000000..2cc63713 --- /dev/null +++ b/scripts/replace_addresses.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -euo pipefail + +OLD_BECH32="push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a" +NEW_BECH32="push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20" +OLD_HEX="0xa96CaA79eb2312DbEb0B8E93c1Ce84C98b67bF11" +NEW_HEX="0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" + +ROOT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +if ! command -v git >/dev/null 2>&1; then + echo "git command not found" >&2 + exit 1 +fi + +if ! command -v perl >/dev/null 2>&1; then + echo "perl command not found" >&2 + exit 1 +fi + +git ls-files -z | xargs -0 perl -pi -e "s/\Q$OLD_BECH32\E/$NEW_BECH32/g; s/\Q$OLD_HEX\E/$NEW_HEX/g" + +echo "Address replacement completed in tracked files." From 8461756f6806a09ec212bd78d3034341e31cf351 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Wed, 25 Feb 2026 13:34:37 +0530 Subject: [PATCH 10/23] Added replace-addresses command + sdk setup command is updated to wire .env for sdk testing --- Makefile | 4 ++++ e2e-tests/.env.example | 14 ++++++++++++++ e2e-tests/README.md | 12 +++++++++--- e2e-tests/setup.sh | 42 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a5db6e09..84322ffa 100755 --- a/Makefile +++ b/Makefile @@ -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/ diff --git a/e2e-tests/.env.example b/e2e-tests/.env.example index 91a15368..8ba45535 100644 --- a/e2e-tests/.env.example +++ b/e2e-tests/.env.example @@ -42,6 +42,9 @@ 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 @@ -50,6 +53,17 @@ 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 diff --git a/e2e-tests/README.md b/e2e-tests/README.md index 14b0d54e..80267847 100644 --- a/e2e-tests/README.md +++ b/e2e-tests/README.md @@ -41,6 +41,12 @@ Required tools: Also ensure the Push Chain repo builds/runs locally. +Before running any e2e setup command, run: + +```bash +make replace-addresses +``` + --- ## Configuration @@ -74,7 +80,7 @@ Path settings are repository-relative and portable. ## One-command full run ```bash -./e2e-tests/setup.sh replace-addresses +make replace-addresses ./e2e-tests/setup.sh all ``` @@ -118,7 +124,7 @@ This runs the full sequence in order: ./e2e-tests/setup.sh sdk-test-bridge-multicall ./e2e-tests/setup.sh sdk-test-pushchain ./e2e-tests/setup.sh add-uregistry-configs -./e2e-tests/setup.sh replace-addresses +make replace-addresses ./e2e-tests/setup.sh all ``` @@ -239,7 +245,7 @@ For a fresh run: ```bash rm -rf e2e-tests/repos ./local-multi-validator/devnet down || true -./e2e-tests/setup.sh replace-addresses +make replace-addresses ./e2e-tests/setup.sh all ``` diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index ade9e924..9934a062 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -42,6 +42,7 @@ fi : "${PUSH_CHAIN_SDK_DIR:=$E2E_PARENT_DIR/push-chain-sdk}" : "${PUSH_CHAIN_SDK_E2E_DIR:=packages/core/__e2e__}" : "${PUSH_CHAIN_SDK_CHAIN_CONSTANTS_PATH:=packages/core/src/lib/constants/chain.ts}" +: "${PUSH_CHAIN_SDK_CORE_ENV_PATH:=packages/core/.env}" : "${DEPLOY_ADDRESSES_FILE:=$SCRIPT_DIR/deploy_addresses.json}" : "${LOG_DIR:=$SCRIPT_DIR/logs}" : "${TEST_ADDRESSES_PATH:=$SWAP_AMM_DIR/test-addresses.json}" @@ -305,8 +306,19 @@ clone_or_update_repo() { fi log_info "Updating repo $(basename "$dest")" + local current_origin + current_origin="$(git -C "$dest" remote get-url origin 2>/dev/null || true)" + if [[ -z "$current_origin" || "$current_origin" != "$repo_url" ]]; then + log_warn "Setting origin for $(basename "$dest") to $repo_url" + if git -C "$dest" remote get-url origin >/dev/null 2>&1; then + git -C "$dest" remote set-url origin "$repo_url" + else + git -C "$dest" remote add origin "$repo_url" + fi + fi + git -C "$dest" fetch origin - git -C "$dest" checkout "$resolved_branch" + git -C "$dest" checkout -B "$resolved_branch" "origin/$resolved_branch" git -C "$dest" reset --hard "origin/$resolved_branch" else log_info "Cloning $(basename "$dest")" @@ -374,6 +386,32 @@ step_setup_push_chain_sdk() { clone_or_update_repo "$PUSH_CHAIN_SDK_REPO" "$PUSH_CHAIN_SDK_BRANCH" "$PUSH_CHAIN_SDK_DIR" + local sdk_env_path="$PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_CORE_ENV_PATH" + local sdk_evm_private_key sdk_evm_rpc sdk_solana_rpc sdk_solana_private_key sdk_push_private_key + + sdk_evm_private_key="${EVM_PRIVATE_KEY:-${PRIVATE_KEY:-}}" + sdk_evm_rpc="${EVM_RPC:-${PUSH_RPC_URL:-}}" + sdk_solana_rpc="${SOLANA_RPC_URL:-https://api.devnet.solana.com}" + sdk_solana_private_key="${SOLANA_PRIVATE_KEY:-${SVM_PRIVATE_KEY:-${SOL_PRIVATE_KEY:-}}}" + sdk_push_private_key="${PUSH_PRIVATE_KEY:-${PRIVATE_KEY:-}}" + + mkdir -p "$(dirname "$sdk_env_path")" + { + echo "# Auto-generated by e2e-tests/setup.sh setup-sdk" + echo "# Source: e2e-tests/.env" + echo "EVM_PRIVATE_KEY=$sdk_evm_private_key" + echo "EVM_RPC=$sdk_evm_rpc" + echo "SOLANA_RPC_URL=$sdk_solana_rpc" + echo "SOLANA_PRIVATE_KEY=$sdk_solana_private_key" + echo "PUSH_PRIVATE_KEY=$sdk_push_private_key" + } >"$sdk_env_path" + + [[ -n "$sdk_evm_private_key" ]] || log_warn "SDK env EVM_PRIVATE_KEY is empty (set EVM_PRIVATE_KEY or PRIVATE_KEY in e2e-tests/.env)" + [[ -n "$sdk_evm_rpc" ]] || log_warn "SDK env EVM_RPC is empty (set EVM_RPC or PUSH_RPC_URL in e2e-tests/.env)" + [[ -n "$sdk_solana_private_key" ]] || log_warn "SDK env SOLANA_PRIVATE_KEY is empty (set SOLANA_PRIVATE_KEY in e2e-tests/.env)" + [[ -n "$sdk_push_private_key" ]] || log_warn "SDK env PUSH_PRIVATE_KEY is empty (set PUSH_PRIVATE_KEY or PRIVATE_KEY in e2e-tests/.env)" + log_ok "Generated push-chain-sdk env file: $sdk_env_path" + if [[ ! -f "$chain_constants_file" ]]; then log_err "SDK chain constants file not found: $chain_constants_file" exit 1 @@ -1345,7 +1383,7 @@ Commands: write-core-env Create core-contracts .env from deploy_addresses.json update-token-config Update eth_sepolia_eth.json contract_address using deployed token setup-gateway Clone/setup gateway repo and run forge localSetup (with --resume retry) - setup-sdk Clone/setup push-chain-sdk and install dependencies + setup-sdk Clone/setup push-chain-sdk, generate SDK .env from e2e .env, and install dependencies sdk-test-all Replace PUSH_NETWORK TESTNET variants with LOCALNET and run all configured SDK E2E tests sdk-test-pctx-last-transaction Run pctx-last-transaction.spec.ts sdk-test-send-to-self Run send-to-self.spec.ts From d1b4cc2664bd6862999247cb638b93822dd75cba Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:27:35 +0530 Subject: [PATCH 11/23] fix: sdk-testing command in e2e-tests --- e2e-tests/setup.sh | 6 +++--- scripts/replace_addresses.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 9934a062..665d1ebb 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -346,7 +346,7 @@ sdk_test_files() { if [[ "$file" == *.tx ]]; then alt="${file%.tx}.ts" if [[ -f "$base_dir/$alt" ]]; then - log_warn "Test file '$file' not found. Using '$alt'." + printf "%b\n" "${yellow}!${nc} Test file '$file' not found. Using '$alt'." >&2 printf "%s\n" "$base_dir/$alt" continue fi @@ -472,7 +472,7 @@ step_run_sdk_test_file() { log_info "Running SDK test: $test_basename" ( cd "$PUSH_CHAIN_SDK_DIR" - npx jest "$test_file" + npx nx test core --runInBand --testPathPattern="$(basename "$test_file")" ) log_ok "Completed SDK test: $test_basename" @@ -488,7 +488,7 @@ step_run_sdk_tests_all() { log_info "Running SDK test: $(basename "$test_file")" ( cd "$PUSH_CHAIN_SDK_DIR" - npx jest "$test_file" + npx nx test core --runInBand --testPathPattern="$(basename "$test_file")" ) done < <(sdk_test_files) diff --git a/scripts/replace_addresses.sh b/scripts/replace_addresses.sh index 2cc63713..771f8947 100644 --- a/scripts/replace_addresses.sh +++ b/scripts/replace_addresses.sh @@ -2,9 +2,9 @@ set -euo pipefail -OLD_BECH32="push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a" +OLD_BECH32="push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20" NEW_BECH32="push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20" -OLD_HEX="0xa96CaA79eb2312DbEb0B8E93c1Ce84C98b67bF11" +OLD_HEX="0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" NEW_HEX="0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" ROOT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" From 2b6687cbbde36f2c0cd30ac5ba79030ad2aa19b9 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Fri, 27 Feb 2026 15:39:41 +0530 Subject: [PATCH 12/23] arb, base, bsc and solana support added for e2e-tests --- app/upgrades/supply-slash/rebalance.json | 4 +- .../chains/arb_sepolia_chain_config.json | 2 +- .../testnet-donut/tokens/arb_sepolia_eth.json | 14 + .../tokens/base_sepolia_eth.json | 14 + .../testnet-donut/tokens/eth_sepolia_eth.json | 4 +- .../tokens/eth_sepolia_usdt.json | 4 +- .../tokens/solana_devnet_sol_new.json | 4 +- data/validator1/.pchain/config/app.toml | 341 ++++++++++++ data/validator1/.pchain/config/client.toml | 17 + data/validator1/.pchain/config/config.toml | 498 ++++++++++++++++++ e2e-tests/deploy_addresses.json | 55 ++ e2e-tests/setup.sh | 23 +- local-multi-validator/README.md | 24 +- local-multi-validator/devnet | 92 +++- local-multi-validator/docker-compose.yml | 16 + .../scripts/setup-universal.sh | 24 +- x/uexecutor/types/constants.go | 2 +- x/uregistry/types/constants.go | 2 +- x/uregistry/types/params.go | 2 +- x/utss/types/params.go | 2 +- x/uvalidator/types/params.go | 2 +- 21 files changed, 1110 insertions(+), 36 deletions(-) create mode 100644 config/testnet-donut/tokens/arb_sepolia_eth.json create mode 100644 config/testnet-donut/tokens/base_sepolia_eth.json create mode 100644 data/validator1/.pchain/config/app.toml create mode 100644 data/validator1/.pchain/config/client.toml create mode 100644 data/validator1/.pchain/config/config.toml diff --git a/app/upgrades/supply-slash/rebalance.json b/app/upgrades/supply-slash/rebalance.json index 1ef536de..20be3628 100644 --- a/app/upgrades/supply-slash/rebalance.json +++ b/app/upgrades/supply-slash/rebalance.json @@ -1345,7 +1345,7 @@ }, { "address": "push149k2570tyvfdh6ct36furn5yex9k00c3k3ckkj", - "evm_address": "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11", + "evm_address": "0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4", "amount_upc": 100004.0, "rebalanced_tokens": 1304.0 }, @@ -1374,7 +1374,7 @@ "rebalanced_tokens": 1304.0 }, { - "address": "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", + "address": "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", "evm_address": "0x9e510b6120e3cb2a0981b7a77677137108adf529", "amount_upc": 95600.0, "rebalanced_tokens": 1300.0 diff --git a/config/testnet-donut/chains/arb_sepolia_chain_config.json b/config/testnet-donut/chains/arb_sepolia_chain_config.json index 64051629..9e15528d 100644 --- a/config/testnet-donut/chains/arb_sepolia_chain_config.json +++ b/config/testnet-donut/chains/arb_sepolia_chain_config.json @@ -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": { diff --git a/config/testnet-donut/tokens/arb_sepolia_eth.json b/config/testnet-donut/tokens/arb_sepolia_eth.json new file mode 100644 index 00000000..797c5c06 --- /dev/null +++ b/config/testnet-donut/tokens/arb_sepolia_eth.json @@ -0,0 +1,14 @@ +{ + "chain": "eip155:421614", + "address": "0x0000000000000000000000000000000000000000", + "name": "pETH.arb", + "symbol": "pETH.arb", + "decimals": 18, + "enabled": true, + "liquidity_cap": "1000000000000000000000000", + "token_type": 1, + "native_representation": { + "denom": "", + "contract_address": "0x90bFeD13b1D7db6243Dfb554c336b0254F099596" + } +} diff --git a/config/testnet-donut/tokens/base_sepolia_eth.json b/config/testnet-donut/tokens/base_sepolia_eth.json new file mode 100644 index 00000000..72695522 --- /dev/null +++ b/config/testnet-donut/tokens/base_sepolia_eth.json @@ -0,0 +1,14 @@ +{ + "chain": "eip155:84532", + "address": "0x0000000000000000000000000000000000000000", + "name": "pETH.base", + "symbol": "pETH.base", + "decimals": 18, + "enabled": true, + "liquidity_cap": "1000000000000000000000000", + "token_type": 1, + "native_representation": { + "denom": "", + "contract_address": "0x697164dD5f2727a4d6EfcF977dCc080Ff10c7459" + } +} diff --git a/config/testnet-donut/tokens/eth_sepolia_eth.json b/config/testnet-donut/tokens/eth_sepolia_eth.json index 1ce55267..a9e1a9b8 100644 --- a/config/testnet-donut/tokens/eth_sepolia_eth.json +++ b/config/testnet-donut/tokens/eth_sepolia_eth.json @@ -6,9 +6,9 @@ "decimals": 18, "enabled": true, "liquidity_cap": "1000000000000000000000000", - "token_type": 1, + "token_type": 1, "native_representation": { "denom": "", - "contract_address": "0x2971824Db68229D087931155C2b8bB820B275809" + "contract_address": "0x69c5560bB765a935C345f507D2adD34253FBe41b" } } diff --git a/config/testnet-donut/tokens/eth_sepolia_usdt.json b/config/testnet-donut/tokens/eth_sepolia_usdt.json index 93981bee..45eacd8e 100644 --- a/config/testnet-donut/tokens/eth_sepolia_usdt.json +++ b/config/testnet-donut/tokens/eth_sepolia_usdt.json @@ -6,9 +6,9 @@ "decimals": 6, "enabled": true, "liquidity_cap": "1000000000000000000000000", - "token_type": 1, + "token_type": 1, "native_representation": { "denom": "", - "contract_address": "0xCA0C5E6F002A389E1580F0DB7cd06e4549B5F9d3" + "contract_address": "0xc2055dD3A7Ad875520BdB5c91300F964F7038C73" } } diff --git a/config/testnet-donut/tokens/solana_devnet_sol_new.json b/config/testnet-donut/tokens/solana_devnet_sol_new.json index 2ec25016..68c8acfe 100644 --- a/config/testnet-donut/tokens/solana_devnet_sol_new.json +++ b/config/testnet-donut/tokens/solana_devnet_sol_new.json @@ -6,9 +6,9 @@ "decimals": 9, "enabled": true, "liquidity_cap": "1000000000000000000000000", - "token_type": 4, + "token_type": 4, "native_representation": { "denom": "", - "contract_address": "0x5D525Df2bD99a6e7ec58b76aF2fd95F39874EBed" + "contract_address": "0xB2cf4B3aec93F4A8F92b292d2F605591dB3e3011" } } diff --git a/data/validator1/.pchain/config/app.toml b/data/validator1/.pchain/config/app.toml new file mode 100644 index 00000000..d025d33c --- /dev/null +++ b/data/validator1/.pchain/config/app.toml @@ -0,0 +1,341 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +############################################################################### +### Base Configuration ### +############################################################################### + +# The minimum gas prices a validator is willing to accept for processing a +# transaction. A transaction's fees must meet the minimum of any denomination +# specified in this config (e.g. 0.25token1,0.0001token2). +minimum-gas-prices = "0stake" + +# The maximum gas a query coming over rest/grpc may consume. +# If this is set to zero, the query can consume an unbounded amount of gas. +query-gas-limit = "0" + +# default: the last 362880 states are kept, pruning at 10 block intervals +# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +# everything: 2 latest states will be kept; pruning at 10 block intervals. +# custom: allow pruning options to be manually specified through 'pruning-keep-recent', and 'pruning-interval' +pruning = "default" + +# These are applied if and only if the pruning strategy is custom. +pruning-keep-recent = "0" +pruning-interval = "0" + +# HaltHeight contains a non-zero block height at which a node will gracefully +# halt and shutdown that can be used to assist upgrades and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-height = 0 + +# HaltTime contains a non-zero minimum block time (in Unix seconds) at which +# a node will gracefully halt and shutdown that can be used to assist upgrades +# and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-time = 0 + +# MinRetainBlocks defines the minimum block height offset from the current +# block being committed, such that all blocks past this offset are pruned +# from CometBFT. It is used as part of the process of determining the +# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates +# that no blocks should be pruned. +# +# This configuration value is only responsible for pruning CometBFT blocks. +# It has no bearing on application state pruning which is determined by the +# "pruning-*" configurations. +# +# Note: CometBFT block pruning is dependant on this parameter in conjunction +# with the unbonding (safety threshold) period, state pruning and state sync +# snapshot parameters to determine the correct minimum value of +# ResponseCommit.RetainHeight. +min-retain-blocks = 0 + +# InterBlockCache enables inter-block caching. +inter-block-cache = true + +# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, +# which informs CometBFT what to index. If empty, all events will be indexed. +# +# Example: +# ["message.sender", "message.recipient"] +index-events = [] + +# IavlCacheSize set the size of the iavl tree cache (in number of nodes). +iavl-cache-size = 781250 + +# IAVLDisableFastNode enables or disables the fast node feature of IAVL. +# Default is false. +iavl-disable-fastnode = false + +# AppDBBackend defines the database backend type to use for the application and snapshots DBs. +# An empty string indicates that a fallback will be used. +# The fallback is the db_backend value set in CometBFT's config.toml. +app-db-backend = "" + +############################################################################### +### Telemetry Configuration ### +############################################################################### + +[telemetry] + +# Prefixed with keys to separate services. +service-name = "" + +# Enabled enables the application telemetry functionality. When enabled, +# an in-memory sink is also enabled by default. Operators may also enabled +# other sinks such as Prometheus. +enabled = false + +# Enable prefixing gauge values with hostname. +enable-hostname = false + +# Enable adding hostname to labels. +enable-hostname-label = false + +# Enable adding service to labels. +enable-service-label = false + +# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. +prometheus-retention-time = 0 + +# GlobalLabels defines a global set of name/value label tuples applied to all +# metrics emitted using the wrapper functions defined in telemetry package. +# +# Example: +# [["chain_id", "cosmoshub-1"]] +global-labels = [ +] + +# MetricsSink defines the type of metrics sink to use. +metrics-sink = "" + +# StatsdAddr defines the address of a statsd server to send metrics to. +# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". +statsd-addr = "" + +# DatadogHostname defines the hostname to use when emitting metrics to +# Datadog. Only utilized if MetricsSink is set to "dogstatsd". +datadog-hostname = "" + +############################################################################### +### API Configuration ### +############################################################################### + +[api] + +# Enable defines if the API server should be enabled. +enable = false + +# Swagger defines if swagger documentation should automatically be registered. +swagger = false + +# Address defines the API server to listen on. +address = "tcp://localhost:1317" + +# MaxOpenConnections defines the number of maximum open connections. +max-open-connections = 1000 + +# RPCReadTimeout defines the CometBFT RPC read timeout (in seconds). +rpc-read-timeout = 10 + +# RPCWriteTimeout defines the CometBFT RPC write timeout (in seconds). +rpc-write-timeout = 0 + +# RPCMaxBodyBytes defines the CometBFT maximum request body (in bytes). +rpc-max-body-bytes = 1000000 + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enabled-unsafe-cors = false + +############################################################################### +### gRPC Configuration ### +############################################################################### + +[grpc] + +# Enable defines if the gRPC server should be enabled. +enable = true + +# Address defines the gRPC server address to bind to. +address = "localhost:9090" + +# MaxRecvMsgSize defines the max message size in bytes the server can receive. +# The default value is 10MB. +max-recv-msg-size = "10485760" + +# MaxSendMsgSize defines the max message size in bytes the server can send. +# The default value is math.MaxInt32. +max-send-msg-size = "2147483647" + +############################################################################### +### gRPC Web Configuration ### +############################################################################### + +[grpc-web] + +# GRPCWebEnable defines if the gRPC-web should be enabled. +# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. +# NOTE: gRPC-Web uses the same address as the API server. +enable = true + +############################################################################### +### State Sync Configuration ### +############################################################################### + +# State sync snapshots allow other nodes to rapidly join the network without replaying historical +# blocks, instead downloading and applying a snapshot of the application state at a given height. +[state-sync] + +# snapshot-interval specifies the block interval at which local state sync snapshots are +# taken (0 to disable). +snapshot-interval = 0 + +# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). +snapshot-keep-recent = 2 + +############################################################################### +### State Streaming ### +############################################################################### + +# Streaming allows nodes to stream state to external systems. +[streaming] + +# streaming.abci specifies the configuration for the ABCI Listener streaming service. +[streaming.abci] + +# List of kv store keys to stream out via gRPC. +# The store key names MUST match the module's StoreKey name. +# +# Example: +# ["acc", "bank", "gov", "staking", "mint"[,...]] +# ["*"] to expose all keys. +keys = [] + +# The plugin name used for streaming via gRPC. +# Streaming is only enabled if this is set. +# Supported plugins: abci +plugin = "" + +# stop-node-on-err specifies whether to stop the node on message delivery error. +stop-node-on-err = true + +############################################################################### +### Mempool ### +############################################################################### + +[mempool] +# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool. +# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool (no-op mempool). +# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount. +# +# Note, this configuration only applies to SDK built-in app-side mempool +# implementations. +max-txs = -1 + +[wasm] +# Smart query gas limit is the max gas to be used in a smart query contract call +query_gas_limit = 3000000 + +# in-memory cache for Wasm contracts. Set to 0 to disable. +# The value is in MiB not bytes +memory_cache_size = 100 + +# Simulation gas limit is the max gas to be used in a tx simulation call. +# When not set the consensus max block gas is used instead +# simulation_gas_limit = + +############################################################################### +### EVM Configuration ### +############################################################################### + +[evm] + +# Tracer defines the 'vm.Tracer' type that the EVM will use when the node is run in +# debug mode. To enable tracing use the '--evm.tracer' flag when starting your node. +# Valid types are: json|struct|access_list|markdown +tracer = "" + +# MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. +max-tx-gas-wanted = 0 + +############################################################################### +### JSON RPC Configuration ### +############################################################################### + +[json-rpc] + +# Enable defines if the JSONRPC server should be enabled. +enable = false + +# Address defines the EVM RPC HTTP server address to bind to. +address = "127.0.0.1:8545" + +# Address defines the EVM WebSocket server address to bind to. +ws-address = "127.0.0.1:8546" + +# API defines a list of JSON-RPC namespaces that should be enabled +# Example: "eth,txpool,personal,net,debug,web3" +api = "eth,net,web3" + +# GasCap sets a cap on gas that can be used in eth_call/estimateGas (0=infinite). Default: 25,000,000. +gas-cap = 25000000 + +# Allow insecure account unlocking when account-related RPCs are exposed by http +allow-insecure-unlock = true + +# EVMTimeout is the global timeout for eth_call. Default: 5s. +evm-timeout = "5s" + +# TxFeeCap is the global tx-fee cap for send transaction. Default: 1eth. +txfee-cap = 1 + +# FilterCap sets the global cap for total number of filters that can be created +filter-cap = 200 + +# FeeHistoryCap sets the global cap for total number of blocks that can be fetched +feehistory-cap = 100 + +# LogsCap defines the max number of results can be returned from single 'eth_getLogs' query. +logs-cap = 10000 + +# BlockRangeCap defines the max block range allowed for 'eth_getLogs' query. +block-range-cap = 10000 + +# HTTPTimeout is the read/write timeout of http json-rpc server. +http-timeout = "30s" + +# HTTPIdleTimeout is the idle timeout of http json-rpc server. +http-idle-timeout = "2m0s" + +# AllowUnprotectedTxs restricts unprotected (non EIP155 signed) transactions to be submitted via +# the node's RPC when the global parameter is disabled. +allow-unprotected-txs = false + +# MaxOpenConnections sets the maximum number of simultaneous connections +# for the server listener. +max-open-connections = 0 + +# EnableIndexer enables the custom transaction indexer for the EVM (ethereum transactions). +enable-indexer = false + +# MetricsAddress defines the EVM Metrics server address to bind to. Pass --metrics in CLI to enable +# Prometheus metrics path: /debug/metrics/prometheus +metrics-address = "127.0.0.1:6065" + +# Upgrade height for fix of revert gas refund logic when transaction reverted. +fix-revert-gas-refund-height = 0 + +############################################################################### +### TLS Configuration ### +############################################################################### + +[tls] + +# Certificate path defines the cert.pem file path for the TLS configuration. +certificate-path = "" + +# Key path defines the key.pem file path for the TLS configuration. +key-path = "" diff --git a/data/validator1/.pchain/config/client.toml b/data/validator1/.pchain/config/client.toml new file mode 100644 index 00000000..02581600 --- /dev/null +++ b/data/validator1/.pchain/config/client.toml @@ -0,0 +1,17 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +############################################################################### +### Client Configuration ### +############################################################################### + +# The network chain ID +chain-id = "localchain_9000-1" +# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) +keyring-backend = "os" +# CLI output format (text|json) +output = "text" +# : to CometBFT RPC interface for this chain +node = "tcp://localhost:26657" +# Transaction broadcasting mode (sync|async) +broadcast-mode = "sync" diff --git a/data/validator1/.pchain/config/config.toml b/data/validator1/.pchain/config/config.toml new file mode 100644 index 00000000..e0acc58f --- /dev/null +++ b/data/validator1/.pchain/config/config.toml @@ -0,0 +1,498 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or +# relative to the home directory (e.g. "data"). The home directory is +# "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable +# or --home cmd flag. + +# The version of the CometBFT binary that created or +# last modified the config file. Do not modify this. +version = "0.38.17" + +####################################################################### +### Main Base Config Options ### +####################################################################### + +# TCP or UNIX socket address of the ABCI application, +# or the name of an ABCI application compiled in with the CometBFT binary +proxy_app = "tcp://127.0.0.1:26658" + +# A custom human readable name for this node +moniker = "Aryas-MacBook-Pro.local" + +# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb +# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) +# - pure go +# - stable +# * cleveldb (uses levigo wrapper) +# - fast +# - requires gcc +# - use cleveldb build tag (go build -tags cleveldb) +# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) +# - EXPERIMENTAL +# - may be faster is some use-cases (random reads - indexer) +# - use boltdb build tag (go build -tags boltdb) +# * rocksdb (uses github.com/tecbot/gorocksdb) +# - EXPERIMENTAL +# - requires gcc +# - use rocksdb build tag (go build -tags rocksdb) +# * badgerdb (uses github.com/dgraph-io/badger) +# - EXPERIMENTAL +# - use badgerdb build tag (go build -tags badgerdb) +db_backend = "goleveldb" + +# Database directory +db_dir = "data" + +# Output level for logging, including package level options +log_level = "info" + +# Output format: 'plain' (colored text) or 'json' +log_format = "plain" + +##### additional base config options ##### + +# Path to the JSON file containing the initial validator set and other meta data +genesis_file = "config/genesis.json" + +# Path to the JSON file containing the private key to use as a validator in the consensus protocol +priv_validator_key_file = "config/priv_validator_key.json" + +# Path to the JSON file containing the last sign state of a validator +priv_validator_state_file = "data/priv_validator_state.json" + +# TCP or UNIX socket address for CometBFT to listen on for +# connections from an external PrivValidator process +priv_validator_laddr = "" + +# Path to the JSON file containing the private key to use for node authentication in the p2p protocol +node_key_file = "config/node_key.json" + +# Mechanism to connect to the ABCI application: socket | grpc +abci = "socket" + +# If true, query the ABCI app on connecting to a new peer +# so the app can decide if we should keep the connection or not +filter_peers = false + + +####################################################################### +### Advanced Configuration Options ### +####################################################################### + +####################################################### +### RPC Server Configuration Options ### +####################################################### +[rpc] + +# TCP or UNIX socket address for the RPC server to listen on +laddr = "tcp://127.0.0.1:26657" + +# A list of origins a cross-domain request can be executed from +# Default value '[]' disables cors support +# Use '["*"]' to allow any origin +cors_allowed_origins = [] + +# A list of methods the client is allowed to use with cross-domain requests +cors_allowed_methods = ["HEAD", "GET", "POST", ] + +# A list of non simple headers the client is allowed to use with cross-domain requests +cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ] + +# TCP or UNIX socket address for the gRPC server to listen on +# NOTE: This server only supports /broadcast_tx_commit +grpc_laddr = "" + +# Maximum number of simultaneous connections. +# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +grpc_max_open_connections = 900 + +# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool +unsafe = false + +# Maximum number of simultaneous connections (including WebSocket). +# Does not include gRPC connections. See grpc_max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +max_open_connections = 900 + +# Maximum number of unique clientIDs that can /subscribe +# If you're using /broadcast_tx_commit, set to the estimated maximum number +# of broadcast_tx_commit calls per block. +max_subscription_clients = 100 + +# Maximum number of unique queries a given client can /subscribe to +# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to +# the estimated # maximum number of broadcast_tx_commit calls per block. +max_subscriptions_per_client = 5 + +# Experimental parameter to specify the maximum number of events a node will +# buffer, per subscription, before returning an error and closing the +# subscription. Must be set to at least 100, but higher values will accommodate +# higher event throughput rates (and will use more memory). +experimental_subscription_buffer_size = 200 + +# Experimental parameter to specify the maximum number of RPC responses that +# can be buffered per WebSocket client. If clients cannot read from the +# WebSocket endpoint fast enough, they will be disconnected, so increasing this +# parameter may reduce the chances of them being disconnected (but will cause +# the node to use more memory). +# +# Must be at least the same as "experimental_subscription_buffer_size", +# otherwise connections could be dropped unnecessarily. This value should +# ideally be somewhat higher than "experimental_subscription_buffer_size" to +# accommodate non-subscription-related RPC responses. +experimental_websocket_write_buffer_size = 200 + +# If a WebSocket client cannot read fast enough, at present we may +# silently drop events instead of generating an error or disconnecting the +# client. +# +# Enabling this experimental parameter will cause the WebSocket connection to +# be closed instead if it cannot read fast enough, allowing for greater +# predictability in subscription behavior. +experimental_close_on_slow_client = false + +# How long to wait for a tx to be committed during /broadcast_tx_commit. +# WARNING: Using a value larger than 10s will result in increasing the +# global HTTP write timeout, which applies to all connections and endpoints. +# See https://github.com/tendermint/tendermint/issues/3435 +timeout_broadcast_tx_commit = "10s" + +# Maximum number of requests that can be sent in a batch +# If the value is set to '0' (zero-value), then no maximum batch size will be +# enforced for a JSON-RPC batch request. +max_request_batch_size = 10 + +# Maximum size of request body, in bytes +max_body_bytes = 1000000 + +# Maximum size of request header, in bytes +max_header_bytes = 1048576 + +# The path to a file containing certificate that is used to create the HTTPS server. +# Might be either absolute path or path related to CometBFT's config directory. +# If the certificate is signed by a certificate authority, +# the certFile should be the concatenation of the server's certificate, any intermediates, +# and the CA's certificate. +# NOTE: both tls_cert_file and tls_key_file must be present for CometBFT to create HTTPS server. +# Otherwise, HTTP server is run. +tls_cert_file = "" + +# The path to a file containing matching private key that is used to create the HTTPS server. +# Might be either absolute path or path related to CometBFT's config directory. +# NOTE: both tls-cert-file and tls-key-file must be present for CometBFT to create HTTPS server. +# Otherwise, HTTP server is run. +tls_key_file = "" + +# pprof listen address (https://golang.org/pkg/net/http/pprof) +pprof_laddr = "localhost:6060" + +####################################################### +### P2P Configuration Options ### +####################################################### +[p2p] + +# Address to listen for incoming connections +laddr = "tcp://0.0.0.0:26656" + +# Address to advertise to peers for them to dial. If empty, will use the same +# port as the laddr, and will introspect on the listener to figure out the +# address. IP and port are required. Example: 159.89.10.97:26656 +external_address = "" + +# Comma separated list of seed nodes to connect to +seeds = "" + +# Comma separated list of nodes to keep persistent connections to +persistent_peers = "" + +# Path to address book +addr_book_file = "config/addrbook.json" + +# Set true for strict address routability rules +# Set false for private or local networks +addr_book_strict = true + +# Maximum number of inbound peers +max_num_inbound_peers = 40 + +# Maximum number of outbound peers to connect to, excluding persistent peers +max_num_outbound_peers = 10 + +# List of node IDs, to which a connection will be (re)established ignoring any existing limits +unconditional_peer_ids = "" + +# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) +persistent_peers_max_dial_period = "0s" + +# Time to wait before flushing messages out on the connection +flush_throttle_timeout = "100ms" + +# Maximum size of a message packet payload, in bytes +max_packet_msg_payload_size = 1024 + +# Rate at which packets can be sent, in bytes/second +send_rate = 5120000 + +# Rate at which packets can be received, in bytes/second +recv_rate = 5120000 + +# Set true to enable the peer-exchange reactor +pex = true + +# Seed mode, in which node constantly crawls the network and looks for +# peers. If another node asks it for addresses, it responds and disconnects. +# +# Does not work if the peer-exchange reactor is disabled. +seed_mode = false + +# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) +private_peer_ids = "" + +# Toggle to disable guard against peers connecting from the same ip. +allow_duplicate_ip = false + +# Peer connection configuration. +handshake_timeout = "20s" +dial_timeout = "3s" + +####################################################### +### Mempool Configuration Option ### +####################################################### +[mempool] + +# The type of mempool for this node to use. +# +# Possible types: +# - "flood" : concurrent linked list mempool with flooding gossip protocol +# (default) +# - "nop" : nop-mempool (short for no operation; the ABCI app is responsible +# for storing, disseminating and proposing txs). "create_empty_blocks=false" is +# not supported. +type = "flood" + +# Recheck (default: true) defines whether CometBFT should recheck the +# validity for all remaining transaction in the mempool after a block. +# Since a block affects the application state, some transactions in the +# mempool may become invalid. If this does not apply to your application, +# you can disable rechecking. +recheck = true + +# recheck_timeout is the time the application has during the rechecking process +# to return CheckTx responses, once all requests have been sent. Responses that +# arrive after the timeout expires are discarded. It only applies to +# non-local ABCI clients and when recheck is enabled. +# +# The ideal value will strongly depend on the application. It could roughly be estimated as the +# average size of the mempool multiplied by the average time it takes the application to validate one +# transaction. We consider that the ABCI application runs in the same location as the CometBFT binary +# so that the recheck duration is not affected by network delays when making requests and receiving responses. +recheck_timeout = "1s" + +# Broadcast (default: true) defines whether the mempool should relay +# transactions to other peers. Setting this to false will stop the mempool +# from relaying transactions to other peers until they are included in a +# block. In other words, if Broadcast is disabled, only the peer you send +# the tx to will see it until it is included in a block. +broadcast = true + +# WalPath (default: "") configures the location of the Write Ahead Log +# (WAL) for the mempool. The WAL is disabled by default. To enable, set +# WalPath to where you want the WAL to be written (e.g. +# "data/mempool.wal"). +wal_dir = "" + +# Maximum number of transactions in the mempool +size = 5000 + +# Limit the total size of all txs in the mempool. +# This only accounts for raw transactions (e.g. given 1MB transactions and +# max_txs_bytes=5MB, mempool will only accept 5 transactions). +max_txs_bytes = 1073741824 + +# Size of the cache (used to filter transactions we saw earlier) in transactions +cache_size = 10000 + +# Do not remove invalid transactions from the cache (default: false) +# Set to true if it's not possible for any invalid transaction to become valid +# again in the future. +keep-invalid-txs-in-cache = false + +# Maximum size of a single transaction. +# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. +max_tx_bytes = 1048576 + +# Maximum size of a batch of transactions to send to a peer +# Including space needed by encoding (one varint per transaction). +# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 +max_batch_bytes = 0 + +# Experimental parameters to limit gossiping txs to up to the specified number of peers. +# We use two independent upper values for persistent and non-persistent peers. +# Unconditional peers are not affected by this feature. +# If we are connected to more than the specified number of persistent peers, only send txs to +# ExperimentalMaxGossipConnectionsToPersistentPeers of them. If one of those +# persistent peers disconnects, activate another persistent peer. +# Similarly for non-persistent peers, with an upper limit of +# ExperimentalMaxGossipConnectionsToNonPersistentPeers. +# If set to 0, the feature is disabled for the corresponding group of peers, that is, the +# number of active connections to that group of peers is not bounded. +# For non-persistent peers, if enabled, a value of 10 is recommended based on experimental +# performance results using the default P2P configuration. +experimental_max_gossip_connections_to_persistent_peers = 0 +experimental_max_gossip_connections_to_non_persistent_peers = 0 + +####################################################### +### State Sync Configuration Options ### +####################################################### +[statesync] +# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine +# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in +# the network to take and serve state machine snapshots. State sync is not attempted if the node +# has any local state (LastBlockHeight > 0). The node will have a truncated block history, +# starting from the height of the snapshot. +enable = false + +# RPC servers (comma-separated) for light client verification of the synced state machine and +# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding +# header hash obtained from a trusted source, and a period during which validators can be trusted. +# +# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 +# weeks) during which they can be financially punished (slashed) for misbehavior. +rpc_servers = "" +trust_height = 0 +trust_hash = "" +trust_period = "168h0m0s" + +# Time to spend discovering snapshots before initiating a restore. +discovery_time = "15s" + +# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). +# Will create a new, randomly named directory within, and remove it when done. +temp_dir = "" + +# The timeout duration before re-requesting a chunk, possibly from a different +# peer (default: 1 minute). +chunk_request_timeout = "10s" + +# The number of concurrent chunk fetchers to run (default: 1). +chunk_fetchers = "4" + +####################################################### +### Block Sync Configuration Options ### +####################################################### +[blocksync] + +# Block Sync version to use: +# +# In v0.37, v1 and v2 of the block sync protocols were deprecated. +# Please use v0 instead. +# +# 1) "v0" - the default block sync implementation +version = "v0" + +####################################################### +### Consensus Configuration Options ### +####################################################### +[consensus] + +wal_file = "data/cs.wal/wal" + +# How long we wait for a proposal block before prevoting nil +timeout_propose = "3s" +# How much timeout_propose increases with each round +timeout_propose_delta = "500ms" +# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) +timeout_prevote = "1s" +# How much the timeout_prevote increases with each round +timeout_prevote_delta = "500ms" +# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) +timeout_precommit = "1s" +# How much the timeout_precommit increases with each round +timeout_precommit_delta = "500ms" +# How long we wait after committing a block, before starting on the new +# height (this gives us a chance to receive some more precommits, even +# though we already have +2/3). +timeout_commit = "5s" + +# How many blocks to look back to check existence of the node's consensus votes before joining consensus +# When non-zero, the node will panic upon restart +# if the same consensus key was used to sign {double_sign_check_height} last blocks. +# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. +double_sign_check_height = 0 + +# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) +skip_timeout_commit = false + +# EmptyBlocks mode and possible interval between empty blocks +create_empty_blocks = true +create_empty_blocks_interval = "0s" + +# Reactor sleep duration parameters +peer_gossip_sleep_duration = "100ms" +peer_query_maj23_sleep_duration = "2s" + +####################################################### +### Storage Configuration Options ### +####################################################### +[storage] + +# Set to true to discard ABCI responses from the state store, which can save a +# considerable amount of disk space. Set to false to ensure ABCI responses are +# persisted. ABCI responses are required for /block_results RPC queries, and to +# reindex events in the command-line tool. +discard_abci_responses = false + +####################################################### +### Transaction Indexer Configuration Options ### +####################################################### +[tx_index] + +# What indexer to use for transactions +# +# The application will set which txs to index. In some cases a node operator will be able +# to decide which txs to index based on configuration set in the application. +# +# Options: +# 1) "null" +# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). +# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. +# 3) "psql" - the indexer services backed by PostgreSQL. +# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. +indexer = "kv" + +# The PostgreSQL connection configuration, the connection format: +# postgresql://:@:/? +psql-conn = "" + +####################################################### +### Instrumentation Configuration Options ### +####################################################### +[instrumentation] + +# When true, Prometheus metrics are served under /metrics on +# PrometheusListenAddr. +# Check out the documentation for the list of available metrics. +prometheus = false + +# Address to listen for Prometheus collector(s) connections +prometheus_listen_addr = ":26660" + +# Maximum number of simultaneous connections. +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +max_open_connections = 3 + +# Instrumentation namespace +namespace = "cometbft" diff --git a/e2e-tests/deploy_addresses.json b/e2e-tests/deploy_addresses.json index e69de29b..68be9ddf 100644 --- a/e2e-tests/deploy_addresses.json +++ b/e2e-tests/deploy_addresses.json @@ -0,0 +1,55 @@ +{ + "generatedAt": "2026-02-27T09:29:04Z", + "contracts": { + "WPC": "0x057931Df99f61caB5e5DbDb6224D7003E64F659e", + "Factory": "0xe0b7A8833f77C5728295D489F4B64f9DA236E4C8", + "SwapRouter": "0x7fd62fe2Aba9af8bF4d08a6cce49beA8c8Ca6d97", + "QuoterV2": "0x484aC6ED747090fe8C82c5F10427ccC2F2998930", + "PositionManager": "0x95cE5e63366D3A11E9BCCe71917bB37C23Fd0002", + "UEA_PROXY_IMPLEMENTATION": "0x00cb38A885cf8D0B2dDfd19Bd1c04aAAC44C5a86" + }, + "tokens": [ + { + "name": "pETH.eth", + "symbol": "pETH", + "address": "0x69c5560bB765a935C345f507D2adD34253FBe41b", + "source": "core-contracts", + "decimals": 18 + }, + { + "name": "USDT.eth", + "symbol": "USDT.eth", + "address": "0xc2055dD3A7Ad875520BdB5c91300F964F7038C73", + "source": "core-contracts", + "decimals": 6 + }, + { + "name": "pETH.base", + "symbol": "pETH.base", + "address": "0x697164dD5f2727a4d6EfcF977dCc080Ff10c7459", + "source": "core-contracts", + "decimals": 18 + }, + { + "name": "pETH.arb", + "symbol": "pETH.arb", + "address": "0x90bFeD13b1D7db6243Dfb554c336b0254F099596", + "source": "core-contracts", + "decimals": 18 + }, + { + "name": "pBNB", + "symbol": "pBNB", + "address": "0xD19a6d5ed3BBb15B70843152610705ba25fF6df2", + "source": "core-contracts", + "decimals": 18 + }, + { + "name": "pSOL", + "symbol": "pSOL", + "address": "0xB2cf4B3aec93F4A8F92b292d2F605591dB3e3011", + "source": "core-contracts", + "decimals": 9 + } + ] +} diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 665d1ebb..b2155529 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -1050,8 +1050,7 @@ step_add_uregistry_configs() { [[ -f "$CHAIN_CONFIG_PATH" ]] || { log_err "Missing chain config: $CHAIN_CONFIG_PATH"; exit 1; } [[ -d "$TOKENS_CONFIG_DIR" ]] || { log_err "Missing tokens config directory: $TOKENS_CONFIG_DIR"; exit 1; } - local chain_payload token_payload - chain_payload="$(jq -c . "$CHAIN_CONFIG_PATH")" + local token_payload run_registry_tx() { local kind="$1" @@ -1106,8 +1105,24 @@ step_add_uregistry_configs() { done } - log_info "Adding chain config to uregistry" - run_registry_tx "chain" "$chain_payload" + local chain_config_dir chain_file chain_payload chain_count + chain_config_dir="$(dirname "$CHAIN_CONFIG_PATH")" + chain_count=0 + + while IFS= read -r chain_file; do + [[ -f "$chain_file" ]] || continue + chain_payload="$(jq -c . "$chain_file")" + log_info "Adding chain config to uregistry: $(basename "$chain_file")" + run_registry_tx "chain" "$chain_payload" + chain_count=$((chain_count + 1)) + done < <(find "$chain_config_dir" -maxdepth 1 -type f -name '*_chain_config.json' | sort) + + if [[ "$chain_count" -eq 0 ]]; then + log_err "No chain config files found in: $chain_config_dir" + exit 1 + fi + + log_ok "Registered $chain_count chain config(s) from $chain_config_dir" local token_json token_file token_addr token_symbol token_name matched_count submitted_files tmp matched_count=0 diff --git a/local-multi-validator/README.md b/local-multi-validator/README.md index f130d579..bb8d6be2 100644 --- a/local-multi-validator/README.md +++ b/local-multi-validator/README.md @@ -37,19 +37,27 @@ docker compose up --build - Auto-builds base image if missing (~15-20 min first time) - Pulls core/universal from cache or builds locally - Starts all 8 validators -- Auto-sets Sepolia `event_start_from` to latest block for all universal validators +- Auto-sets `event_start_from` to latest height/slot for Sepolia, Base Sepolia, Arbitrum Sepolia, BSC testnet, and Solana devnet -### Sepolia Event Start Block +### Event Start Heights/Slots -On `./devnet start`, the script fetches latest Sepolia block height from `https://sepolia.drpc.org` -and injects it into each universal validator config: +On `./devnet start`, the script fetches latest chain heights/slots and injects them into each universal validator config: - `chain_configs["eip155:11155111"].event_start_from = ` +- `chain_configs["eip155:84532"].event_start_from = ` +- `chain_configs["eip155:421614"].event_start_from = ` +- `chain_configs["eip155:97"].event_start_from = ` +- `chain_configs["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].event_start_from = ` -You can override this manually at startup: +You can override any of them manually at startup: ```bash -SEPOLIA_EVENT_START_FROM=12345678 ./devnet start +SEPOLIA_EVENT_START_FROM=12345678 \ +BASE_EVENT_START_FROM=23456789 \ +ARBITRUM_EVENT_START_FROM=34567890 \ +BSC_EVENT_START_FROM=45678901 \ +SOLANA_EVENT_START_FROM=56789012 \ +./devnet start ``` ### I Changed Core Validator Code @@ -152,6 +160,10 @@ The `start` command also supports: | Environment Variable | Description | |----------------------|-------------| | `SEPOLIA_EVENT_START_FROM` | Force universal validators to start monitoring Sepolia from a specific block | +| `BASE_EVENT_START_FROM` | Force universal validators to start monitoring Base Sepolia from a specific block | +| `ARBITRUM_EVENT_START_FROM` | Force universal validators to start monitoring Arbitrum Sepolia from a specific block | +| `BSC_EVENT_START_FROM` | Force universal validators to start monitoring BSC testnet from a specific block | +| `SOLANA_EVENT_START_FROM` | Force universal validators to start monitoring Solana devnet from a specific slot | ## Endpoints diff --git a/local-multi-validator/devnet b/local-multi-validator/devnet index 8fdc2fc5..e8ff9e40 100755 --- a/local-multi-validator/devnet +++ b/local-multi-validator/devnet @@ -16,7 +16,16 @@ cd "$SCRIPT_DIR" GCR_REGISTRY="${GCR_REGISTRY:-gcr.io/push-chain-testnet}" CACHE_TAG="${CACHE_TAG:-latest}" SEPOLIA_CHAIN_ID="eip155:11155111" +ARBITRUM_SEPOLIA_CHAIN_ID="eip155:421614" +BASE_SEPOLIA_CHAIN_ID="eip155:84532" +BSC_TESTNET_CHAIN_ID="eip155:97" +SOLANA_DEVNET_CHAIN_ID="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1" + SEPOLIA_DEFAULT_RPC_URL="${SEPOLIA_DEFAULT_RPC_URL:-https://sepolia.drpc.org}" +ARBITRUM_SEPOLIA_DEFAULT_RPC_URL="${ARBITRUM_SEPOLIA_DEFAULT_RPC_URL:-https://arbitrum-sepolia.gateway.tenderly.co}" +BASE_SEPOLIA_DEFAULT_RPC_URL="${BASE_SEPOLIA_DEFAULT_RPC_URL:-https://sepolia.base.org}" +BSC_TESTNET_DEFAULT_RPC_URL="${BSC_TESTNET_DEFAULT_RPC_URL:-https://bsc-testnet-rpc.publicnode.com}" +SOLANA_DEVNET_DEFAULT_RPC_URL="${SOLANA_DEVNET_DEFAULT_RPC_URL:-https://api.devnet.solana.com}" # ═══════════════════════════════════════════════════════════════════════════════ # COLORS @@ -70,7 +79,7 @@ has_buildx() { docker buildx version >/dev/null 2>&1 } -fetch_sepolia_height() { +fetch_evm_height() { local rpc_url="$1" local response response=$(curl -sS -X POST "$rpc_url" \ @@ -87,6 +96,23 @@ fetch_sepolia_height() { echo "$((16#${hex_height#0x}))" } +fetch_solana_slot() { + local rpc_url="$1" + local response + response=$(curl -sS -X POST "$rpc_url" \ + -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","id":1,"method":"getSlot","params":[{"commitment":"processed"}]}') + + local slot + slot=$(echo "$response" | jq -r '.result // empty') + + if [ -z "$slot" ] || [ "$slot" = "null" ] || [[ ! "$slot" =~ ^[0-9]+$ ]]; then + return 1 + fi + + echo "$slot" +} + # ═══════════════════════════════════════════════════════════════════════════════ # STATUS HELPERS # ═══════════════════════════════════════════════════════════════════════════════ @@ -433,24 +459,78 @@ cmd_up() { fi local sepolia_start_height="${SEPOLIA_EVENT_START_FROM:-}" + local base_start_height="${BASE_EVENT_START_FROM:-}" + local arbitrum_start_height="${ARBITRUM_EVENT_START_FROM:-}" + local bsc_start_height="${BSC_EVENT_START_FROM:-}" + local solana_start_height="${SOLANA_EVENT_START_FROM:-}" + if [ -z "$sepolia_start_height" ]; then - if sepolia_start_height=$(fetch_sepolia_height "$SEPOLIA_DEFAULT_RPC_URL"); then + if sepolia_start_height=$(fetch_evm_height "$SEPOLIA_DEFAULT_RPC_URL"); then print_status "Using Sepolia event_start_from: $sepolia_start_height" else print_warning "Could not fetch Sepolia latest block from $SEPOLIA_DEFAULT_RPC_URL" - print_warning "Universal validators will use default event_start_from from pushuv config" + print_warning "Sepolia will use default event_start_from from pushuv config" sepolia_start_height="" fi else print_status "Using provided SEPOLIA_EVENT_START_FROM: $sepolia_start_height" fi - if [ -n "$sepolia_start_height" ]; then - SEPOLIA_EVENT_START_FROM="$sepolia_start_height" docker compose up -d + if [ -z "$base_start_height" ]; then + if base_start_height=$(fetch_evm_height "$BASE_SEPOLIA_DEFAULT_RPC_URL"); then + print_status "Using Base Sepolia event_start_from: $base_start_height" + else + print_warning "Could not fetch Base Sepolia latest block from $BASE_SEPOLIA_DEFAULT_RPC_URL" + print_warning "Base Sepolia will use default event_start_from from pushuv config" + base_start_height="" + fi else - docker compose up -d + print_status "Using provided BASE_EVENT_START_FROM: $base_start_height" fi + if [ -z "$arbitrum_start_height" ]; then + if arbitrum_start_height=$(fetch_evm_height "$ARBITRUM_SEPOLIA_DEFAULT_RPC_URL"); then + print_status "Using Arbitrum Sepolia event_start_from: $arbitrum_start_height" + else + print_warning "Could not fetch Arbitrum Sepolia latest block from $ARBITRUM_SEPOLIA_DEFAULT_RPC_URL" + print_warning "Arbitrum Sepolia will use default event_start_from from pushuv config" + arbitrum_start_height="" + fi + else + print_status "Using provided ARBITRUM_EVENT_START_FROM: $arbitrum_start_height" + fi + + if [ -z "$bsc_start_height" ]; then + if bsc_start_height=$(fetch_evm_height "$BSC_TESTNET_DEFAULT_RPC_URL"); then + print_status "Using BSC testnet event_start_from: $bsc_start_height" + else + print_warning "Could not fetch BSC testnet latest block from $BSC_TESTNET_DEFAULT_RPC_URL" + print_warning "BSC testnet will use default event_start_from from pushuv config" + bsc_start_height="" + fi + else + print_status "Using provided BSC_EVENT_START_FROM: $bsc_start_height" + fi + + if [ -z "$solana_start_height" ]; then + if solana_start_height=$(fetch_solana_slot "$SOLANA_DEVNET_DEFAULT_RPC_URL"); then + print_status "Using Solana devnet event_start_from: $solana_start_height" + else + print_warning "Could not fetch Solana devnet latest slot from $SOLANA_DEVNET_DEFAULT_RPC_URL" + print_warning "Solana devnet will use default event_start_from from pushuv config" + solana_start_height="" + fi + else + print_status "Using provided SOLANA_EVENT_START_FROM: $solana_start_height" + fi + + SEPOLIA_EVENT_START_FROM="$sepolia_start_height" \ + BASE_EVENT_START_FROM="$base_start_height" \ + ARBITRUM_EVENT_START_FROM="$arbitrum_start_height" \ + BSC_EVENT_START_FROM="$bsc_start_height" \ + SOLANA_EVENT_START_FROM="$solana_start_height" \ + docker compose up -d + # Auto-push to cache if we built locally (populate cache for team) if [ -n "$built_locally" ] && [ -z "$skip_cache" ]; then auto_push_to_cache diff --git a/local-multi-validator/docker-compose.yml b/local-multi-validator/docker-compose.yml index 1bd2fa29..2c1c39b5 100644 --- a/local-multi-validator/docker-compose.yml +++ b/local-multi-validator/docker-compose.yml @@ -232,6 +232,10 @@ services: - QUERY_PORT=8080 - TSS_ENABLED=true - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} + - BASE_EVENT_START_FROM=${BASE_EVENT_START_FROM:-} + - ARBITRUM_EVENT_START_FROM=${ARBITRUM_EVENT_START_FROM:-} + - BSC_EVENT_START_FROM=${BSC_EVENT_START_FROM:-} + - SOLANA_EVENT_START_FROM=${SOLANA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-1: @@ -266,6 +270,10 @@ services: - QUERY_PORT=8080 - TSS_ENABLED=true - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} + - BASE_EVENT_START_FROM=${BASE_EVENT_START_FROM:-} + - ARBITRUM_EVENT_START_FROM=${ARBITRUM_EVENT_START_FROM:-} + - BSC_EVENT_START_FROM=${BSC_EVENT_START_FROM:-} + - SOLANA_EVENT_START_FROM=${SOLANA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-2: @@ -300,6 +308,10 @@ services: - QUERY_PORT=8080 - TSS_ENABLED=true - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} + - BASE_EVENT_START_FROM=${BASE_EVENT_START_FROM:-} + - ARBITRUM_EVENT_START_FROM=${ARBITRUM_EVENT_START_FROM:-} + - BSC_EVENT_START_FROM=${BSC_EVENT_START_FROM:-} + - SOLANA_EVENT_START_FROM=${SOLANA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-3: @@ -334,6 +346,10 @@ services: - QUERY_PORT=8080 - TSS_ENABLED=true - SEPOLIA_EVENT_START_FROM=${SEPOLIA_EVENT_START_FROM:-} + - BASE_EVENT_START_FROM=${BASE_EVENT_START_FROM:-} + - ARBITRUM_EVENT_START_FROM=${ARBITRUM_EVENT_START_FROM:-} + - BSC_EVENT_START_FROM=${BSC_EVENT_START_FROM:-} + - SOLANA_EVENT_START_FROM=${SOLANA_EVENT_START_FROM:-} command: ["/opt/scripts/setup-universal.sh"] depends_on: core-validator-4: diff --git a/local-multi-validator/scripts/setup-universal.sh b/local-multi-validator/scripts/setup-universal.sh index 0ac82001..649d4fc4 100755 --- a/local-multi-validator/scripts/setup-universal.sh +++ b/local-multi-validator/scripts/setup-universal.sh @@ -136,14 +136,26 @@ if [ "$QUERY_PORT" != "8080" ]; then mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" fi -# Optionally override Sepolia event start height (set by ./devnet start) -if [ -n "${SEPOLIA_EVENT_START_FROM:-}" ]; then - echo "📍 Setting Sepolia event_start_from: $SEPOLIA_EVENT_START_FROM" - jq --argjson height "$SEPOLIA_EVENT_START_FROM" \ - '.chain_configs["eip155:11155111"].event_start_from = $height' \ +# Optionally override chain event start heights (set by ./devnet start) +set_chain_event_start_from() { + local chain_id="$1" + local chain_label="$2" + local start_height="$3" + + [ -n "$start_height" ] || return 0 + + echo "📍 Setting ${chain_label} event_start_from: $start_height" + jq --arg chain "$chain_id" --argjson height "$start_height" \ + '.chain_configs[$chain].event_start_from = $height' \ "$HOME_DIR/config/pushuv_config.json" > "$HOME_DIR/config/pushuv_config.json.tmp" && \ mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" -fi +} + +set_chain_event_start_from "eip155:11155111" "Sepolia" "${SEPOLIA_EVENT_START_FROM:-}" +set_chain_event_start_from "eip155:84532" "Base Sepolia" "${BASE_EVENT_START_FROM:-}" +set_chain_event_start_from "eip155:421614" "Arbitrum Sepolia" "${ARBITRUM_EVENT_START_FROM:-}" +set_chain_event_start_from "eip155:97" "BSC testnet" "${BSC_EVENT_START_FROM:-}" +set_chain_event_start_from "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1" "Solana devnet" "${SOLANA_EVENT_START_FROM:-}" # --------------------------- # === SET CORE VALOPER ADDRESS === diff --git a/x/uexecutor/types/constants.go b/x/uexecutor/types/constants.go index 35d94535..a39b1a50 100644 --- a/x/uexecutor/types/constants.go +++ b/x/uexecutor/types/constants.go @@ -7,7 +7,7 @@ import ( const ( FACTORY_PROXY_ADDRESS_HEX = "0x00000000000000000000000000000000000000eA" - PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96CaA79eb2312DbEb0B8E93c1Ce84C98b67bF11" + PROXY_ADMIN_OWNER_ADDRESS_HEX = "0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" FACTORY_IMPL_ADDRESS_HEX = "0x00000000000000000000000000000000000000fa" PROXY_ADMIN_ADDRESS_HEX = "0x00000000000000000000000000000000000000AA" ) diff --git a/x/uregistry/types/constants.go b/x/uregistry/types/constants.go index 55f706fe..88e6d1b9 100644 --- a/x/uregistry/types/constants.go +++ b/x/uregistry/types/constants.go @@ -14,7 +14,7 @@ var GATEWAY_METHOD = struct { EVM: struct{ AddFunds string }{AddFunds: "addFunds"}, } -const PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96CaA79eb2312DbEb0B8E93c1Ce84C98b67bF11" +const PROXY_ADMIN_OWNER_ADDRESS_HEX = "0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" var ProxyAdminRuntimeBytecode = common.FromHex("0x608060405260043610610058575f3560e01c80639623609d116100415780639623609d146100aa578063ad3cb1cc146100bd578063f2fde38b14610112575f80fd5b8063715018a61461005c5780638da5cb5b14610072575b5f80fd5b348015610067575f80fd5b50610070610131565b005b34801561007d575f80fd5b505f5460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100706100b8366004610351565b610144565b3480156100c8575f80fd5b506101056040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516100a191906104c6565b34801561011d575f80fd5b5061007061012c3660046104df565b6101d5565b61013961023d565b6101425f61028f565b565b61014c61023d565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef2869034906101a290869086906004016104fa565b5f604051808303818588803b1580156101b9575f80fd5b505af11580156101cb573d5f803e3d5ffd5b5050505050505050565b6101dd61023d565b73ffffffffffffffffffffffffffffffffffffffff8116610231576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b61023a8161028f565b50565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610142576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610228565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff8116811461023a575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f805f60608486031215610363575f80fd5b833561036e81610303565b9250602084013561037e81610303565b9150604084013567ffffffffffffffff811115610399575f80fd5b8401601f810186136103a9575f80fd5b803567ffffffffffffffff8111156103c3576103c3610324565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff8211171561042f5761042f610324565b604052818152828201602001881015610446575f80fd5b816020840160208301375f602083830101528093505050509250925092565b5f81518084525f5b818110156104895760208185018101518683018201520161046d565b505f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f6104d86020830184610465565b9392505050565b5f602082840312156104ef575f80fd5b81356104d881610303565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201525f6105286040830184610465565b94935050505056fea26469706673582212209ce80139bf41b00bc44c4532122ff649c1e8542240b8a5c13f39af0d72f21b2364736f6c634300081a0033") var PROXY_ADMIN_SLOT = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103") diff --git a/x/uregistry/types/params.go b/x/uregistry/types/params.go index 548788eb..dc56afee 100755 --- a/x/uregistry/types/params.go +++ b/x/uregistry/types/params.go @@ -8,7 +8,7 @@ import ( func DefaultParams() Params { // TODO: return Params{ - Admin: "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", + Admin: "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", } } diff --git a/x/utss/types/params.go b/x/utss/types/params.go index b137d735..a269f2af 100755 --- a/x/utss/types/params.go +++ b/x/utss/types/params.go @@ -7,7 +7,7 @@ import ( // DefaultParams returns default module parameters. func DefaultParams() Params { return Params{ - Admin: "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", + Admin: "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", } } diff --git a/x/uvalidator/types/params.go b/x/uvalidator/types/params.go index b137d735..a269f2af 100755 --- a/x/uvalidator/types/params.go +++ b/x/uvalidator/types/params.go @@ -7,7 +7,7 @@ import ( // DefaultParams returns default module parameters. func DefaultParams() Params { return Params{ - Admin: "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", + Admin: "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", } } From 8d7d33f0981c3b5116a0ea08fd4389e961e475d3 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Fri, 27 Feb 2026 19:19:33 +0530 Subject: [PATCH 13/23] fix : arbitrum rpc url for monitoring gateway transaction in local-multi-validator --- e2e-tests/deploy_addresses.json | 2 +- e2e-tests/setup.sh | 5 ++++- local-multi-validator/scripts/setup-universal.sh | 10 ++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/e2e-tests/deploy_addresses.json b/e2e-tests/deploy_addresses.json index 68be9ddf..df19a604 100644 --- a/e2e-tests/deploy_addresses.json +++ b/e2e-tests/deploy_addresses.json @@ -1,5 +1,5 @@ { - "generatedAt": "2026-02-27T09:29:04Z", + "generatedAt": "2026-02-27T11:51:04Z", "contracts": { "WPC": "0x057931Df99f61caB5e5DbDb6224D7003E64F659e", "Factory": "0xe0b7A8833f77C5728295D489F4B64f9DA236E4C8", diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index b2155529..3120a017 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -330,11 +330,12 @@ sdk_test_files() { local base_dir="$PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_E2E_DIR" local file alt local requested_files=( - "pctx-last-transaction.spec.tx" + "pctx-last-transaction.spec.ts" "send-to-self.spec.ts" "progress-hook-per-tx.spec.ts" "bridge-multicall.spec.ts" "pushchain.spec.ts" + "bridge-hooks.spec.ts" ) for file in "${requested_files[@]}"; do @@ -1405,6 +1406,7 @@ Commands: sdk-test-progress-hook Run progress-hook-per-tx.spec.ts sdk-test-bridge-multicall Run bridge-multicall.spec.ts sdk-test-pushchain Run pushchain.spec.ts + sdk-test-bridge-hooks Run bridge-hooks.spec.ts add-uregistry-configs Submit chain + token config txs via local-multi-validator validator1 record-contract K A Manually record contract key/address record-token N S A Manually record token name/symbol/address @@ -1440,6 +1442,7 @@ main() { sdk-test-progress-hook) step_run_sdk_test_file "progress-hook-per-tx.spec.ts" ;; sdk-test-bridge-multicall) step_run_sdk_test_file "bridge-multicall.spec.ts" ;; sdk-test-pushchain) step_run_sdk_test_file "pushchain.spec.ts" ;; + sdk-test-bridge-hooks) step_run_sdk_test_file "bridge-hooks.spec.ts" ;; add-uregistry-configs) step_add_uregistry_configs ;; record-contract) ensure_deploy_file diff --git a/local-multi-validator/scripts/setup-universal.sh b/local-multi-validator/scripts/setup-universal.sh index 649d4fc4..45ede69a 100755 --- a/local-multi-validator/scripts/setup-universal.sh +++ b/local-multi-validator/scripts/setup-universal.sh @@ -136,6 +136,16 @@ if [ "$QUERY_PORT" != "8080" ]; then mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" fi +# After initialization and before event start from overrides +# Force Arbitrum Sepolia RPC URL to tenderly endpoint +ARBITRUM_CHAIN_ID="eip155:421614" +ARBITRUM_TENDERLY_URL="https://arbitrum-sepolia.gateway.tenderly.co" + +jq --arg chain "$ARBITRUM_CHAIN_ID" --arg url "$ARBITRUM_TENDERLY_URL" \ + '.chain_configs[$chain].rpc_urls = [$url]' \ + "$HOME_DIR/config/pushuv_config.json" > "$HOME_DIR/config/pushuv_config.json.tmp" && \ + mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" + # Optionally override chain event start heights (set by ./devnet start) set_chain_event_start_from() { local chain_id="$1" From 2afe7985348265ac146441bebac3ea9d3d39381f Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Fri, 27 Feb 2026 19:51:33 +0530 Subject: [PATCH 14/23] fix : e2e-tests setup : make replace-addresses calculates from the .env PRIVATE_KEY to replace addresses --- e2e-tests/setup.sh | 2 ++ scripts/replace_addresses.sh | 55 ++++++++++++++++++++++++++++-------- x/uregistry/types/params.go | 2 +- x/utss/types/params.go | 2 +- x/uvalidator/types/params.go | 2 +- 5 files changed, 49 insertions(+), 14 deletions(-) diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 3120a017..e5a6718a 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -1365,6 +1365,8 @@ step_configure_universal_core() { } cmd_all() { + (cd "$PUSH_CHAIN_DIR" && make replace-addresses) + (cd "$PUSH_CHAIN_DIR" && make build) step_stop_running_nodes step_devnet step_recover_genesis_key diff --git a/scripts/replace_addresses.sh b/scripts/replace_addresses.sh index 771f8947..4af98e8f 100644 --- a/scripts/replace_addresses.sh +++ b/scripts/replace_addresses.sh @@ -2,24 +2,57 @@ set -euo pipefail -OLD_BECH32="push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20" -NEW_BECH32="push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20" -OLD_HEX="0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" -NEW_HEX="0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" - ROOT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT_DIR" -if ! command -v git >/dev/null 2>&1; then - echo "git command not found" >&2 +ENV_FILE="e2e-tests/.env" +if [[ ! -f "$ENV_FILE" ]]; then + echo "e2e-tests/.env not found" >&2 + exit 1 +fi + +PRIVATE_KEY=$(grep '^PRIVATE_KEY=' "$ENV_FILE" | cut -d= -f2 | tr -d '"' | tr -d "'") +if [[ -z "$PRIVATE_KEY" ]]; then + echo "PRIVATE_KEY not found in $ENV_FILE" >&2 exit 1 fi -if ! command -v perl >/dev/null 2>&1; then - echo "perl command not found" >&2 +# Derive EVM address +if ! command -v cast >/dev/null 2>&1; then + echo "cast command not found (install foundry/cast)" >&2 exit 1 fi +EVM_ADDRESS=$(cast wallet address $PRIVATE_KEY) + +# Derive push (cosmos) address +if ! command -v $PWD/build/pchaind >/dev/null 2>&1; then + echo "pchaind binary not found in build/ (run make build)" >&2 + exit 1 +fi +PUSH_ADDRESS=$($PWD/build/pchaind debug addr $(echo $EVM_ADDRESS | tr '[:upper:]' '[:lower:]' | sed 's/^0x//') | awk -F': ' '/Bech32 Acc:/ {print $2; exit}') +if [[ -z "$PUSH_ADDRESS" ]]; then + echo "Could not derive push address from $EVM_ADDRESS" >&2 + exit 1 +fi + +echo "Replacing with PUSH_ADDRESS: $PUSH_ADDRESS" +echo "Replacing with EVM_ADDRESS: $EVM_ADDRESS" + +# Replace Admin in params.go files +for f in x/utss/types/params.go x/uregistry/types/params.go x/uvalidator/types/params.go; do + if [[ -f "$f" ]]; then + perl -pi -e "s/Admin: \"push1[0-9a-z]+\"/Admin: \"$PUSH_ADDRESS\"/g" "$f" + echo "Updated Admin in $f" + fi +done -git ls-files -z | xargs -0 perl -pi -e "s/\Q$OLD_BECH32\E/$NEW_BECH32/g; s/\Q$OLD_HEX\E/$NEW_HEX/g" +# Replace PROXY_ADMIN_OWNER_ADDRESS in constants.go files +for f in x/uexecutor/types/constants.go x/uregistry/types/constants.go; do + if [[ -f "$f" ]]; then + perl -pi -e "s/PROXY_ADMIN_OWNER_ADDRESS_HEX = \"0x[a-fA-F0-9]{40}\"/PROXY_ADMIN_OWNER_ADDRESS_HEX = \"$EVM_ADDRESS\"/g" "$f" + perl -pi -e "s/PROXY_ADMIN_OWNER_ADDRESS = \"0x[a-fA-F0-9]{40}\"/PROXY_ADMIN_OWNER_ADDRESS = \"$EVM_ADDRESS\"/g" "$f" + echo "Updated PROXY_ADMIN_OWNER_ADDRESS in $f" + fi +done -echo "Address replacement completed in tracked files." +echo "Address replacement completed." diff --git a/x/uregistry/types/params.go b/x/uregistry/types/params.go index dc56afee..5400d4f2 100755 --- a/x/uregistry/types/params.go +++ b/x/uregistry/types/params.go @@ -8,7 +8,7 @@ import ( func DefaultParams() Params { // TODO: return Params{ - Admin: "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", + Admin: "push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60", } } diff --git a/x/utss/types/params.go b/x/utss/types/params.go index a269f2af..b5def128 100755 --- a/x/utss/types/params.go +++ b/x/utss/types/params.go @@ -7,7 +7,7 @@ import ( // DefaultParams returns default module parameters. func DefaultParams() Params { return Params{ - Admin: "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", + Admin: "push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60", } } diff --git a/x/uvalidator/types/params.go b/x/uvalidator/types/params.go index a269f2af..b5def128 100755 --- a/x/uvalidator/types/params.go +++ b/x/uvalidator/types/params.go @@ -7,7 +7,7 @@ import ( // DefaultParams returns default module parameters. func DefaultParams() Params { return Params{ - Admin: "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", + Admin: "push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60", } } From 97fec92ec4f3bfde09a443a2edd25d7d915c0d1d Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 12:44:33 +0530 Subject: [PATCH 15/23] refactor --- .../eth_sepolia/tokens/arb_sepolia_eth.json | 14 ---- .../eth_sepolia/tokens/base_sepolia_eth.json | 14 ---- e2e-tests/.env.bak | 71 +++++++++++++++++++ e2e-tests/deploy_addresses.json | 2 +- 4 files changed, 72 insertions(+), 29 deletions(-) delete mode 100644 config/testnet-donut/eth_sepolia/tokens/arb_sepolia_eth.json delete mode 100644 config/testnet-donut/eth_sepolia/tokens/base_sepolia_eth.json create mode 100644 e2e-tests/.env.bak diff --git a/config/testnet-donut/eth_sepolia/tokens/arb_sepolia_eth.json b/config/testnet-donut/eth_sepolia/tokens/arb_sepolia_eth.json deleted file mode 100644 index 797c5c06..00000000 --- a/config/testnet-donut/eth_sepolia/tokens/arb_sepolia_eth.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "chain": "eip155:421614", - "address": "0x0000000000000000000000000000000000000000", - "name": "pETH.arb", - "symbol": "pETH.arb", - "decimals": 18, - "enabled": true, - "liquidity_cap": "1000000000000000000000000", - "token_type": 1, - "native_representation": { - "denom": "", - "contract_address": "0x90bFeD13b1D7db6243Dfb554c336b0254F099596" - } -} diff --git a/config/testnet-donut/eth_sepolia/tokens/base_sepolia_eth.json b/config/testnet-donut/eth_sepolia/tokens/base_sepolia_eth.json deleted file mode 100644 index 72695522..00000000 --- a/config/testnet-donut/eth_sepolia/tokens/base_sepolia_eth.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "chain": "eip155:84532", - "address": "0x0000000000000000000000000000000000000000", - "name": "pETH.base", - "symbol": "pETH.base", - "decimals": 18, - "enabled": true, - "liquidity_cap": "1000000000000000000000000", - "token_type": 1, - "native_representation": { - "denom": "", - "contract_address": "0x697164dD5f2727a4d6EfcF977dCc080Ff10c7459" - } -} diff --git a/e2e-tests/.env.bak b/e2e-tests/.env.bak new file mode 100644 index 00000000..fec3b693 --- /dev/null +++ b/e2e-tests/.env.bak @@ -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=0x0dfb3d814afd8d0bf7a6010e8dd2b6ac835cabe4da9e2c1e80c6a14df3994dd4 + +# 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=new-sendUniversalTx + +# 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=0xddc31465c891443c6e3e5f30ca7808d66f8036163fd0b99f4ed5e05cd261ac7f +EVM_RPC=https://eth-sepolia.public.blastapi.io +SOLANA_RPC_URL=https://api.devnet.solana.com +SOLANA_PRIVATE_KEY=2NPV9cXdRuC8Zydqa3beEJ8xK9N6qgKqXYVYQ2PtpJhNvWrhuPJAZH67NFTW5Q1JsMjgPEsTY3ph2Sd1nGqqcNFv +PUSH_PRIVATE_KEY=0x0dfb3d814afd8d0bf7a6010e8dd2b6ac835cabe4da9e2c1e80c6a14df3994dd4 + +# 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/tokens/eth_sepolia_eth.json +CHAIN_CONFIG_PATH=./config/testnet-donut/chains/eth_sepolia_chain_config.json diff --git a/e2e-tests/deploy_addresses.json b/e2e-tests/deploy_addresses.json index df19a604..4a38b519 100644 --- a/e2e-tests/deploy_addresses.json +++ b/e2e-tests/deploy_addresses.json @@ -1,5 +1,5 @@ { - "generatedAt": "2026-02-27T11:51:04Z", + "generatedAt": "2026-03-05T07:13:22Z", "contracts": { "WPC": "0x057931Df99f61caB5e5DbDb6224D7003E64F659e", "Factory": "0xe0b7A8833f77C5728295D489F4B64f9DA236E4C8", From f81285311a7d54f54d2878ef592ff49109a1d081 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 12:52:06 +0530 Subject: [PATCH 16/23] fix: BNB RPC URL, env account funding, replace-addresses script --- e2e-tests/setup.sh | 35 +++++++++++++++++++ .../scripts/setup-universal.sh | 7 ++++ scripts/replace_addresses.sh | 6 +--- universalClient/config/default_config.json | 2 +- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index e5a6718a..121e45bf 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -605,6 +605,40 @@ step_fund_account() { log_ok "Funding transaction submitted" } +step_update_env_fund_to_address() { + require_cmd jq + ENV_FILE="$SCRIPT_DIR/.env" + if [[ ! -f "$ENV_FILE" ]]; then + log_err ".env file not found in e2e-tests folder" + exit 1 + fi + PRIVATE_KEY=$(grep '^PRIVATE_KEY=' "$ENV_FILE" | cut -d= -f2 | tr -d '"' | tr -d "'") + if [[ -z "$PRIVATE_KEY" ]]; then + log_err "PRIVATE_KEY not found in .env" + exit 1 + fi + if ! command -v $PUSH_CHAIN_DIR/build/pchaind >/dev/null 2>&1; then + log_err "pchaind binary not found in build/ (run make build)" + exit 1 + fi + EVM_ADDRESS=$(cast wallet address $PRIVATE_KEY) + COSMOS_ADDRESS=$($PUSH_CHAIN_DIR/build/pchaind debug addr $(echo $EVM_ADDRESS | tr '[:upper:]' '[:lower:]' | sed 's/^0x//') | awk -F': ' '/Bech32 Acc:/ {print $2; exit}') + if [[ -z "$COSMOS_ADDRESS" ]]; then + log_err "Could not derive cosmos address from $EVM_ADDRESS" + exit 1 + fi + if grep -q '^FUND_TO_ADDRESS=' "$ENV_FILE"; then + sed -i.bak "s|^FUND_TO_ADDRESS=.*$|FUND_TO_ADDRESS=$COSMOS_ADDRESS|" "$ENV_FILE" + else + echo "FUND_TO_ADDRESS=$COSMOS_ADDRESS" >> "$ENV_FILE" + fi + # Refresh .env after updating FUND_TO_ADDRESS + set -a + source "$SCRIPT_DIR/.env" + set +a + log_ok "Updated FUND_TO_ADDRESS in .env to $COSMOS_ADDRESS" +} + parse_core_prc20_logs() { local log_file="$1" local current_addr="" @@ -1367,6 +1401,7 @@ step_configure_universal_core() { cmd_all() { (cd "$PUSH_CHAIN_DIR" && make replace-addresses) (cd "$PUSH_CHAIN_DIR" && make build) + step_update_env_fund_to_address step_stop_running_nodes step_devnet step_recover_genesis_key diff --git a/local-multi-validator/scripts/setup-universal.sh b/local-multi-validator/scripts/setup-universal.sh index 45ede69a..437d739f 100755 --- a/local-multi-validator/scripts/setup-universal.sh +++ b/local-multi-validator/scripts/setup-universal.sh @@ -140,12 +140,19 @@ fi # Force Arbitrum Sepolia RPC URL to tenderly endpoint ARBITRUM_CHAIN_ID="eip155:421614" ARBITRUM_TENDERLY_URL="https://arbitrum-sepolia.gateway.tenderly.co" +BSC_TESTNET_CHAIN_ID="eip155:97" +BSC_TESTNET_RPC_URL="${BSC_TESTNET_RPC_URL:-https://bsc-testnet-rpc.publicnode.com}" jq --arg chain "$ARBITRUM_CHAIN_ID" --arg url "$ARBITRUM_TENDERLY_URL" \ '.chain_configs[$chain].rpc_urls = [$url]' \ "$HOME_DIR/config/pushuv_config.json" > "$HOME_DIR/config/pushuv_config.json.tmp" && \ mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" +jq --arg chain "$BSC_TESTNET_CHAIN_ID" --arg url "$BSC_TESTNET_RPC_URL" \ + '.chain_configs[$chain].rpc_urls = [$url]' \ + "$HOME_DIR/config/pushuv_config.json" > "$HOME_DIR/config/pushuv_config.json.tmp" && \ + mv "$HOME_DIR/config/pushuv_config.json.tmp" "$HOME_DIR/config/pushuv_config.json" + # Optionally override chain event start heights (set by ./devnet start) set_chain_event_start_from() { local chain_id="$1" diff --git a/scripts/replace_addresses.sh b/scripts/replace_addresses.sh index 4af98e8f..63ecc00e 100644 --- a/scripts/replace_addresses.sh +++ b/scripts/replace_addresses.sh @@ -29,11 +29,7 @@ if ! command -v $PWD/build/pchaind >/dev/null 2>&1; then echo "pchaind binary not found in build/ (run make build)" >&2 exit 1 fi -PUSH_ADDRESS=$($PWD/build/pchaind debug addr $(echo $EVM_ADDRESS | tr '[:upper:]' '[:lower:]' | sed 's/^0x//') | awk -F': ' '/Bech32 Acc:/ {print $2; exit}') -if [[ -z "$PUSH_ADDRESS" ]]; then - echo "Could not derive push address from $EVM_ADDRESS" >&2 - exit 1 -fi +PUSH_ADDRESS=push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20 echo "Replacing with PUSH_ADDRESS: $PUSH_ADDRESS" echo "Replacing with EVM_ADDRESS: $EVM_ADDRESS" diff --git a/universalClient/config/default_config.json b/universalClient/config/default_config.json index 9f4542a3..71924b8b 100644 --- a/universalClient/config/default_config.json +++ b/universalClient/config/default_config.json @@ -49,7 +49,7 @@ }, "eip155:97": { "rpc_urls": [ - "https://binance.llamarpc.com" + "https://bsc-testnet-rpc.publicnode.com" ], "cleanup_interval_seconds": 1800, "retention_period_seconds": 43200, From b94a59831006acff7eb53c1f69b40390126fd955 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 13:10:24 +0530 Subject: [PATCH 17/23] fix: e2e-tests token path fix --- e2e-tests/.env.example | 4 ++-- e2e-tests/setup.sh | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/e2e-tests/.env.example b/e2e-tests/.env.example index 8ba45535..c41836bd 100644 --- a/e2e-tests/.env.example +++ b/e2e-tests/.env.example @@ -67,5 +67,5 @@ 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/tokens/eth_sepolia_eth.json -CHAIN_CONFIG_PATH=./config/testnet-donut/chains/eth_sepolia_chain_config.json +TOKEN_CONFIG_PATH=./config/testnet-donut/eth_sepolia/tokens/eth.json +CHAIN_CONFIG_PATH=./config/testnet-donut/eth_sepolia/chain.json diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 121e45bf..1808e952 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -46,9 +46,9 @@ fi : "${DEPLOY_ADDRESSES_FILE:=$SCRIPT_DIR/deploy_addresses.json}" : "${LOG_DIR:=$SCRIPT_DIR/logs}" : "${TEST_ADDRESSES_PATH:=$SWAP_AMM_DIR/test-addresses.json}" -: "${TOKENS_CONFIG_DIR:=./config/testnet-donut/tokens}" -: "${TOKEN_CONFIG_PATH:=./config/testnet-donut/tokens/eth_sepolia_eth.json}" -: "${CHAIN_CONFIG_PATH:=./config/testnet-donut/chains/eth_sepolia_chain_config.json}" +: "${TOKENS_CONFIG_DIR:=./config/testnet-donut}" +: "${TOKEN_CONFIG_PATH:=./config/testnet-donut/eth_sepolia/tokens/eth.json}" +: "${CHAIN_CONFIG_PATH:=./config/testnet-donut/eth_sepolia/chain.json}" abs_from_root() { local path="$1" @@ -859,7 +859,7 @@ find_matching_token_config_file() { d_name_np="$(norm_token_key_without_leading_p "$deployed_name")" local file f_sym f_name f_base f_sym_np f_name_np score - for file in "$TOKENS_CONFIG_DIR"/*.json; do + while IFS= read -r file; do [[ -f "$file" ]] || continue f_sym="$(jq -r '.symbol // ""' "$file")" f_name="$(jq -r '.name // ""' "$file")" @@ -885,7 +885,7 @@ find_matching_token_config_file() { best_score=$score best_file="$file" fi - done + done < <(find "$TOKENS_CONFIG_DIR" -type f -path '*/tokens/*.json' | sort) if (( best_score >= 60 )); then printf "%s" "$best_file" @@ -901,6 +901,11 @@ step_update_deployed_token_configs() { exit 1 fi + if ! find "$TOKENS_CONFIG_DIR" -type f -path '*/tokens/*.json' | grep -q .; then + log_err "No token config files found under: $TOKENS_CONFIG_DIR" + exit 1 + fi + local used_files="" local updated=0 local token_json token_symbol token_name token_address match_file tmp @@ -1082,7 +1087,6 @@ step_setup_gateway() { step_add_uregistry_configs() { require_cmd "$PUSH_CHAIN_DIR/build/pchaind" jq - [[ -f "$CHAIN_CONFIG_PATH" ]] || { log_err "Missing chain config: $CHAIN_CONFIG_PATH"; exit 1; } [[ -d "$TOKENS_CONFIG_DIR" ]] || { log_err "Missing tokens config directory: $TOKENS_CONFIG_DIR"; exit 1; } local token_payload @@ -1141,7 +1145,7 @@ step_add_uregistry_configs() { } local chain_config_dir chain_file chain_payload chain_count - chain_config_dir="$(dirname "$CHAIN_CONFIG_PATH")" + chain_config_dir="$TOKENS_CONFIG_DIR" chain_count=0 while IFS= read -r chain_file; do @@ -1150,7 +1154,7 @@ step_add_uregistry_configs() { log_info "Adding chain config to uregistry: $(basename "$chain_file")" run_registry_tx "chain" "$chain_payload" chain_count=$((chain_count + 1)) - done < <(find "$chain_config_dir" -maxdepth 1 -type f -name '*_chain_config.json' | sort) + done < <(find "$chain_config_dir" -type f \( -name 'chain.json' -o -name '*_chain_config.json' \) | sort) if [[ "$chain_count" -eq 0 ]]; then log_err "No chain config files found in: $chain_config_dir" From 3ac18858eb4f75142fbc55f27786653780527fac Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 13:58:25 +0530 Subject: [PATCH 18/23] feat: sdk automatically changes TESTNET to LOCALNET in account.ts --- e2e-tests/setup.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index 1808e952..e70c1cb6 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -42,6 +42,7 @@ fi : "${PUSH_CHAIN_SDK_DIR:=$E2E_PARENT_DIR/push-chain-sdk}" : "${PUSH_CHAIN_SDK_E2E_DIR:=packages/core/__e2e__}" : "${PUSH_CHAIN_SDK_CHAIN_CONSTANTS_PATH:=packages/core/src/lib/constants/chain.ts}" +: "${PUSH_CHAIN_SDK_ACCOUNT_TS_PATH:=packages/core/src/lib/universal/account/account.ts}" : "${PUSH_CHAIN_SDK_CORE_ENV_PATH:=packages/core/.env}" : "${DEPLOY_ADDRESSES_FILE:=$SCRIPT_DIR/deploy_addresses.json}" : "${LOG_DIR:=$SCRIPT_DIR/logs}" @@ -374,15 +375,16 @@ sdk_prepare_test_files_for_localnet() { while IFS= read -r test_file; do [[ -n "$test_file" ]] || continue - perl -0pi -e 's/\bPUSH_NETWORK\.TESTNET_DONUT\b/PUSH_NETWORK.LOCALNET/g; s/\bPUSH_NETWORK\.TESTNET\b/PUSH_NETWORK.LOCALNET/g' "$test_file" + perl -0pi -e 's/\bPUSH_NETWORK\.TESTNET_DONUT\b/PUSH_NETWORK.LOCALNET/g; s/\bPUSH_NETWORK\.TESTNET\b/PUSH_NETWORK.LOCALNET/g; s/\bCHAIN\.PUSH_TESTNET_DONUT\b/CHAIN.PUSH_LOCALNET/g' "$test_file" log_ok "Prepared LOCALNET network replacement in $(basename "$test_file")" done < <(sdk_test_files) } step_setup_push_chain_sdk() { - require_cmd git yarn npm cast jq + require_cmd git yarn npm cast jq perl local chain_constants_file="$PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_CHAIN_CONSTANTS_PATH" + local sdk_account_file="$PUSH_CHAIN_SDK_DIR/$PUSH_CHAIN_SDK_ACCOUNT_TS_PATH" local uea_impl_raw uea_impl synced_localnet_uea clone_or_update_repo "$PUSH_CHAIN_SDK_REPO" "$PUSH_CHAIN_SDK_BRANCH" "$PUSH_CHAIN_SDK_DIR" @@ -440,6 +442,14 @@ step_setup_push_chain_sdk() { log_ok "Synced PUSH_NETWORK.LOCALNET UEA proxy to $uea_impl" + if [[ ! -f "$sdk_account_file" ]]; then + log_err "SDK account file not found: $sdk_account_file" + exit 1 + fi + + perl -0pi -e 's/\bCHAIN\.PUSH_TESTNET_DONUT\b/CHAIN.PUSH_LOCALNET/g' "$sdk_account_file" + log_ok "Replaced CHAIN.PUSH_TESTNET_DONUT with CHAIN.PUSH_LOCALNET in $sdk_account_file" + log_info "Installing push-chain-sdk dependencies" ( cd "$PUSH_CHAIN_SDK_DIR" From fd59e6e227821c63ef2a6ebf27e12a8efa31aaa3 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 17:44:03 +0530 Subject: [PATCH 19/23] refactor: important addresses which were changed for e2e testing --- app/upgrades/supply-slash/rebalance.json | 4 +- data/validator1/.pchain/config/app.toml | 341 -------------- data/validator1/.pchain/config/client.toml | 17 - data/validator1/.pchain/config/config.toml | 498 --------------------- e2e-tests/.env.bak | 71 --- local-multi-validator/Dockerfile.unified | 2 +- test/utils/constants.go | 2 +- x/uexecutor/types/constants.go | 2 +- x/uregistry/types/constants.go | 2 +- x/uregistry/types/params.go | 2 +- x/utss/types/params.go | 2 +- x/uvalidator/types/params.go | 2 +- 12 files changed, 9 insertions(+), 936 deletions(-) delete mode 100644 data/validator1/.pchain/config/app.toml delete mode 100644 data/validator1/.pchain/config/client.toml delete mode 100644 data/validator1/.pchain/config/config.toml delete mode 100644 e2e-tests/.env.bak diff --git a/app/upgrades/supply-slash/rebalance.json b/app/upgrades/supply-slash/rebalance.json index 20be3628..1ef536de 100644 --- a/app/upgrades/supply-slash/rebalance.json +++ b/app/upgrades/supply-slash/rebalance.json @@ -1345,7 +1345,7 @@ }, { "address": "push149k2570tyvfdh6ct36furn5yex9k00c3k3ckkj", - "evm_address": "0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4", + "evm_address": "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11", "amount_upc": 100004.0, "rebalanced_tokens": 1304.0 }, @@ -1374,7 +1374,7 @@ "rebalanced_tokens": 1304.0 }, { - "address": "push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20", + "address": "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", "evm_address": "0x9e510b6120e3cb2a0981b7a77677137108adf529", "amount_upc": 95600.0, "rebalanced_tokens": 1300.0 diff --git a/data/validator1/.pchain/config/app.toml b/data/validator1/.pchain/config/app.toml deleted file mode 100644 index d025d33c..00000000 --- a/data/validator1/.pchain/config/app.toml +++ /dev/null @@ -1,341 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Base Configuration ### -############################################################################### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1,0.0001token2). -minimum-gas-prices = "0stake" - -# The maximum gas a query coming over rest/grpc may consume. -# If this is set to zero, the query can consume an unbounded amount of gas. -query-gas-limit = "0" - -# default: the last 362880 states are kept, pruning at 10 block intervals -# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: 2 latest states will be kept; pruning at 10 block intervals. -# custom: allow pruning options to be manually specified through 'pruning-keep-recent', and 'pruning-interval' -pruning = "default" - -# These are applied if and only if the pruning strategy is custom. -pruning-keep-recent = "0" -pruning-interval = "0" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-time = 0 - -# MinRetainBlocks defines the minimum block height offset from the current -# block being committed, such that all blocks past this offset are pruned -# from CometBFT. It is used as part of the process of determining the -# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates -# that no blocks should be pruned. -# -# This configuration value is only responsible for pruning CometBFT blocks. -# It has no bearing on application state pruning which is determined by the -# "pruning-*" configurations. -# -# Note: CometBFT block pruning is dependant on this parameter in conjunction -# with the unbonding (safety threshold) period, state pruning and state sync -# snapshot parameters to determine the correct minimum value of -# ResponseCommit.RetainHeight. -min-retain-blocks = 0 - -# InterBlockCache enables inter-block caching. -inter-block-cache = true - -# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, -# which informs CometBFT what to index. If empty, all events will be indexed. -# -# Example: -# ["message.sender", "message.recipient"] -index-events = [] - -# IavlCacheSize set the size of the iavl tree cache (in number of nodes). -iavl-cache-size = 781250 - -# IAVLDisableFastNode enables or disables the fast node feature of IAVL. -# Default is false. -iavl-disable-fastnode = false - -# AppDBBackend defines the database backend type to use for the application and snapshots DBs. -# An empty string indicates that a fallback will be used. -# The fallback is the db_backend value set in CometBFT's config.toml. -app-db-backend = "" - -############################################################################### -### Telemetry Configuration ### -############################################################################### - -[telemetry] - -# Prefixed with keys to separate services. -service-name = "" - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled = false - -# Enable prefixing gauge values with hostname. -enable-hostname = false - -# Enable adding hostname to labels. -enable-hostname-label = false - -# Enable adding service to labels. -enable-service-label = false - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 0 - -# GlobalLabels defines a global set of name/value label tuples applied to all -# metrics emitted using the wrapper functions defined in telemetry package. -# -# Example: -# [["chain_id", "cosmoshub-1"]] -global-labels = [ -] - -# MetricsSink defines the type of metrics sink to use. -metrics-sink = "" - -# StatsdAddr defines the address of a statsd server to send metrics to. -# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". -statsd-addr = "" - -# DatadogHostname defines the hostname to use when emitting metrics to -# Datadog. Only utilized if MetricsSink is set to "dogstatsd". -datadog-hostname = "" - -############################################################################### -### API Configuration ### -############################################################################### - -[api] - -# Enable defines if the API server should be enabled. -enable = false - -# Swagger defines if swagger documentation should automatically be registered. -swagger = false - -# Address defines the API server to listen on. -address = "tcp://localhost:1317" - -# MaxOpenConnections defines the number of maximum open connections. -max-open-connections = 1000 - -# RPCReadTimeout defines the CometBFT RPC read timeout (in seconds). -rpc-read-timeout = 10 - -# RPCWriteTimeout defines the CometBFT RPC write timeout (in seconds). -rpc-write-timeout = 0 - -# RPCMaxBodyBytes defines the CometBFT maximum request body (in bytes). -rpc-max-body-bytes = 1000000 - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enabled-unsafe-cors = false - -############################################################################### -### gRPC Configuration ### -############################################################################### - -[grpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the gRPC server address to bind to. -address = "localhost:9090" - -# MaxRecvMsgSize defines the max message size in bytes the server can receive. -# The default value is 10MB. -max-recv-msg-size = "10485760" - -# MaxSendMsgSize defines the max message size in bytes the server can send. -# The default value is math.MaxInt32. -max-send-msg-size = "2147483647" - -############################################################################### -### gRPC Web Configuration ### -############################################################################### - -[grpc-web] - -# GRPCWebEnable defines if the gRPC-web should be enabled. -# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. -# NOTE: gRPC-Web uses the same address as the API server. -enable = true - -############################################################################### -### State Sync Configuration ### -############################################################################### - -# State sync snapshots allow other nodes to rapidly join the network without replaying historical -# blocks, instead downloading and applying a snapshot of the application state at a given height. -[state-sync] - -# snapshot-interval specifies the block interval at which local state sync snapshots are -# taken (0 to disable). -snapshot-interval = 0 - -# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). -snapshot-keep-recent = 2 - -############################################################################### -### State Streaming ### -############################################################################### - -# Streaming allows nodes to stream state to external systems. -[streaming] - -# streaming.abci specifies the configuration for the ABCI Listener streaming service. -[streaming.abci] - -# List of kv store keys to stream out via gRPC. -# The store key names MUST match the module's StoreKey name. -# -# Example: -# ["acc", "bank", "gov", "staking", "mint"[,...]] -# ["*"] to expose all keys. -keys = [] - -# The plugin name used for streaming via gRPC. -# Streaming is only enabled if this is set. -# Supported plugins: abci -plugin = "" - -# stop-node-on-err specifies whether to stop the node on message delivery error. -stop-node-on-err = true - -############################################################################### -### Mempool ### -############################################################################### - -[mempool] -# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool. -# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool (no-op mempool). -# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount. -# -# Note, this configuration only applies to SDK built-in app-side mempool -# implementations. -max-txs = -1 - -[wasm] -# Smart query gas limit is the max gas to be used in a smart query contract call -query_gas_limit = 3000000 - -# in-memory cache for Wasm contracts. Set to 0 to disable. -# The value is in MiB not bytes -memory_cache_size = 100 - -# Simulation gas limit is the max gas to be used in a tx simulation call. -# When not set the consensus max block gas is used instead -# simulation_gas_limit = - -############################################################################### -### EVM Configuration ### -############################################################################### - -[evm] - -# Tracer defines the 'vm.Tracer' type that the EVM will use when the node is run in -# debug mode. To enable tracing use the '--evm.tracer' flag when starting your node. -# Valid types are: json|struct|access_list|markdown -tracer = "" - -# MaxTxGasWanted defines the gas wanted for each eth tx returned in ante handler in check tx mode. -max-tx-gas-wanted = 0 - -############################################################################### -### JSON RPC Configuration ### -############################################################################### - -[json-rpc] - -# Enable defines if the JSONRPC server should be enabled. -enable = false - -# Address defines the EVM RPC HTTP server address to bind to. -address = "127.0.0.1:8545" - -# Address defines the EVM WebSocket server address to bind to. -ws-address = "127.0.0.1:8546" - -# API defines a list of JSON-RPC namespaces that should be enabled -# Example: "eth,txpool,personal,net,debug,web3" -api = "eth,net,web3" - -# GasCap sets a cap on gas that can be used in eth_call/estimateGas (0=infinite). Default: 25,000,000. -gas-cap = 25000000 - -# Allow insecure account unlocking when account-related RPCs are exposed by http -allow-insecure-unlock = true - -# EVMTimeout is the global timeout for eth_call. Default: 5s. -evm-timeout = "5s" - -# TxFeeCap is the global tx-fee cap for send transaction. Default: 1eth. -txfee-cap = 1 - -# FilterCap sets the global cap for total number of filters that can be created -filter-cap = 200 - -# FeeHistoryCap sets the global cap for total number of blocks that can be fetched -feehistory-cap = 100 - -# LogsCap defines the max number of results can be returned from single 'eth_getLogs' query. -logs-cap = 10000 - -# BlockRangeCap defines the max block range allowed for 'eth_getLogs' query. -block-range-cap = 10000 - -# HTTPTimeout is the read/write timeout of http json-rpc server. -http-timeout = "30s" - -# HTTPIdleTimeout is the idle timeout of http json-rpc server. -http-idle-timeout = "2m0s" - -# AllowUnprotectedTxs restricts unprotected (non EIP155 signed) transactions to be submitted via -# the node's RPC when the global parameter is disabled. -allow-unprotected-txs = false - -# MaxOpenConnections sets the maximum number of simultaneous connections -# for the server listener. -max-open-connections = 0 - -# EnableIndexer enables the custom transaction indexer for the EVM (ethereum transactions). -enable-indexer = false - -# MetricsAddress defines the EVM Metrics server address to bind to. Pass --metrics in CLI to enable -# Prometheus metrics path: /debug/metrics/prometheus -metrics-address = "127.0.0.1:6065" - -# Upgrade height for fix of revert gas refund logic when transaction reverted. -fix-revert-gas-refund-height = 0 - -############################################################################### -### TLS Configuration ### -############################################################################### - -[tls] - -# Certificate path defines the cert.pem file path for the TLS configuration. -certificate-path = "" - -# Key path defines the key.pem file path for the TLS configuration. -key-path = "" diff --git a/data/validator1/.pchain/config/client.toml b/data/validator1/.pchain/config/client.toml deleted file mode 100644 index 02581600..00000000 --- a/data/validator1/.pchain/config/client.toml +++ /dev/null @@ -1,17 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Client Configuration ### -############################################################################### - -# The network chain ID -chain-id = "localchain_9000-1" -# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) -keyring-backend = "os" -# CLI output format (text|json) -output = "text" -# : to CometBFT RPC interface for this chain -node = "tcp://localhost:26657" -# Transaction broadcasting mode (sync|async) -broadcast-mode = "sync" diff --git a/data/validator1/.pchain/config/config.toml b/data/validator1/.pchain/config/config.toml deleted file mode 100644 index e0acc58f..00000000 --- a/data/validator1/.pchain/config/config.toml +++ /dev/null @@ -1,498 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or -# relative to the home directory (e.g. "data"). The home directory is -# "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable -# or --home cmd flag. - -# The version of the CometBFT binary that created or -# last modified the config file. Do not modify this. -version = "0.38.17" - -####################################################################### -### Main Base Config Options ### -####################################################################### - -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the CometBFT binary -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "Aryas-MacBook-Pro.local" - -# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb -# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) -# - pure go -# - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -# * rocksdb (uses github.com/tecbot/gorocksdb) -# - EXPERIMENTAL -# - requires gcc -# - use rocksdb build tag (go build -tags rocksdb) -# * badgerdb (uses github.com/dgraph-io/badger) -# - EXPERIMENTAL -# - use badgerdb build tag (go build -tags badgerdb) -db_backend = "goleveldb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "info" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_key_file = "config/priv_validator_key.json" - -# Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "data/priv_validator_state.json" - -# TCP or UNIX socket address for CometBFT to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -node_key_file = "config/node_key.json" - -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - -# If true, query the ABCI app on connecting to a new peer -# so the app can decide if we should keep the connection or not -filter_peers = false - - -####################################################################### -### Advanced Configuration Options ### -####################################################################### - -####################################################### -### RPC Server Configuration Options ### -####################################################### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://127.0.0.1:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = [] - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = ["HEAD", "GET", "POST", ] - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ] - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -# Maximum number of unique clientIDs that can /subscribe -# If you're using /broadcast_tx_commit, set to the estimated maximum number -# of broadcast_tx_commit calls per block. -max_subscription_clients = 100 - -# Maximum number of unique queries a given client can /subscribe to -# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to -# the estimated # maximum number of broadcast_tx_commit calls per block. -max_subscriptions_per_client = 5 - -# Experimental parameter to specify the maximum number of events a node will -# buffer, per subscription, before returning an error and closing the -# subscription. Must be set to at least 100, but higher values will accommodate -# higher event throughput rates (and will use more memory). -experimental_subscription_buffer_size = 200 - -# Experimental parameter to specify the maximum number of RPC responses that -# can be buffered per WebSocket client. If clients cannot read from the -# WebSocket endpoint fast enough, they will be disconnected, so increasing this -# parameter may reduce the chances of them being disconnected (but will cause -# the node to use more memory). -# -# Must be at least the same as "experimental_subscription_buffer_size", -# otherwise connections could be dropped unnecessarily. This value should -# ideally be somewhat higher than "experimental_subscription_buffer_size" to -# accommodate non-subscription-related RPC responses. -experimental_websocket_write_buffer_size = 200 - -# If a WebSocket client cannot read fast enough, at present we may -# silently drop events instead of generating an error or disconnecting the -# client. -# -# Enabling this experimental parameter will cause the WebSocket connection to -# be closed instead if it cannot read fast enough, allowing for greater -# predictability in subscription behavior. -experimental_close_on_slow_client = false - -# How long to wait for a tx to be committed during /broadcast_tx_commit. -# WARNING: Using a value larger than 10s will result in increasing the -# global HTTP write timeout, which applies to all connections and endpoints. -# See https://github.com/tendermint/tendermint/issues/3435 -timeout_broadcast_tx_commit = "10s" - -# Maximum number of requests that can be sent in a batch -# If the value is set to '0' (zero-value), then no maximum batch size will be -# enforced for a JSON-RPC batch request. -max_request_batch_size = 10 - -# Maximum size of request body, in bytes -max_body_bytes = 1000000 - -# Maximum size of request header, in bytes -max_header_bytes = 1048576 - -# The path to a file containing certificate that is used to create the HTTPS server. -# Might be either absolute path or path related to CometBFT's config directory. -# If the certificate is signed by a certificate authority, -# the certFile should be the concatenation of the server's certificate, any intermediates, -# and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for CometBFT to create HTTPS server. -# Otherwise, HTTP server is run. -tls_cert_file = "" - -# The path to a file containing matching private key that is used to create the HTTPS server. -# Might be either absolute path or path related to CometBFT's config directory. -# NOTE: both tls-cert-file and tls-key-file must be present for CometBFT to create HTTPS server. -# Otherwise, HTTP server is run. -tls_key_file = "" - -# pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "localhost:6060" - -####################################################### -### P2P Configuration Options ### -####################################################### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial. If empty, will use the same -# port as the laddr, and will introspect on the listener to figure out the -# address. IP and port are required. Example: 159.89.10.97:26656 -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "" - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# List of node IDs, to which a connection will be (re)established ignoring any existing limits -unconditional_peer_ids = "" - -# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) -persistent_peers_max_dial_period = "0s" - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be sent, in bytes/second -send_rate = 5120000 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = false - -# Peer connection configuration. -handshake_timeout = "20s" -dial_timeout = "3s" - -####################################################### -### Mempool Configuration Option ### -####################################################### -[mempool] - -# The type of mempool for this node to use. -# -# Possible types: -# - "flood" : concurrent linked list mempool with flooding gossip protocol -# (default) -# - "nop" : nop-mempool (short for no operation; the ABCI app is responsible -# for storing, disseminating and proposing txs). "create_empty_blocks=false" is -# not supported. -type = "flood" - -# Recheck (default: true) defines whether CometBFT should recheck the -# validity for all remaining transaction in the mempool after a block. -# Since a block affects the application state, some transactions in the -# mempool may become invalid. If this does not apply to your application, -# you can disable rechecking. -recheck = true - -# recheck_timeout is the time the application has during the rechecking process -# to return CheckTx responses, once all requests have been sent. Responses that -# arrive after the timeout expires are discarded. It only applies to -# non-local ABCI clients and when recheck is enabled. -# -# The ideal value will strongly depend on the application. It could roughly be estimated as the -# average size of the mempool multiplied by the average time it takes the application to validate one -# transaction. We consider that the ABCI application runs in the same location as the CometBFT binary -# so that the recheck duration is not affected by network delays when making requests and receiving responses. -recheck_timeout = "1s" - -# Broadcast (default: true) defines whether the mempool should relay -# transactions to other peers. Setting this to false will stop the mempool -# from relaying transactions to other peers until they are included in a -# block. In other words, if Broadcast is disabled, only the peer you send -# the tx to will see it until it is included in a block. -broadcast = true - -# WalPath (default: "") configures the location of the Write Ahead Log -# (WAL) for the mempool. The WAL is disabled by default. To enable, set -# WalPath to where you want the WAL to be written (e.g. -# "data/mempool.wal"). -wal_dir = "" - -# Maximum number of transactions in the mempool -size = 5000 - -# Limit the total size of all txs in the mempool. -# This only accounts for raw transactions (e.g. given 1MB transactions and -# max_txs_bytes=5MB, mempool will only accept 5 transactions). -max_txs_bytes = 1073741824 - -# Size of the cache (used to filter transactions we saw earlier) in transactions -cache_size = 10000 - -# Do not remove invalid transactions from the cache (default: false) -# Set to true if it's not possible for any invalid transaction to become valid -# again in the future. -keep-invalid-txs-in-cache = false - -# Maximum size of a single transaction. -# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. -max_tx_bytes = 1048576 - -# Maximum size of a batch of transactions to send to a peer -# Including space needed by encoding (one varint per transaction). -# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 -max_batch_bytes = 0 - -# Experimental parameters to limit gossiping txs to up to the specified number of peers. -# We use two independent upper values for persistent and non-persistent peers. -# Unconditional peers are not affected by this feature. -# If we are connected to more than the specified number of persistent peers, only send txs to -# ExperimentalMaxGossipConnectionsToPersistentPeers of them. If one of those -# persistent peers disconnects, activate another persistent peer. -# Similarly for non-persistent peers, with an upper limit of -# ExperimentalMaxGossipConnectionsToNonPersistentPeers. -# If set to 0, the feature is disabled for the corresponding group of peers, that is, the -# number of active connections to that group of peers is not bounded. -# For non-persistent peers, if enabled, a value of 10 is recommended based on experimental -# performance results using the default P2P configuration. -experimental_max_gossip_connections_to_persistent_peers = 0 -experimental_max_gossip_connections_to_non_persistent_peers = 0 - -####################################################### -### State Sync Configuration Options ### -####################################################### -[statesync] -# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine -# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in -# the network to take and serve state machine snapshots. State sync is not attempted if the node -# has any local state (LastBlockHeight > 0). The node will have a truncated block history, -# starting from the height of the snapshot. -enable = false - -# RPC servers (comma-separated) for light client verification of the synced state machine and -# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding -# header hash obtained from a trusted source, and a period during which validators can be trusted. -# -# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 -# weeks) during which they can be financially punished (slashed) for misbehavior. -rpc_servers = "" -trust_height = 0 -trust_hash = "" -trust_period = "168h0m0s" - -# Time to spend discovering snapshots before initiating a restore. -discovery_time = "15s" - -# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). -# Will create a new, randomly named directory within, and remove it when done. -temp_dir = "" - -# The timeout duration before re-requesting a chunk, possibly from a different -# peer (default: 1 minute). -chunk_request_timeout = "10s" - -# The number of concurrent chunk fetchers to run (default: 1). -chunk_fetchers = "4" - -####################################################### -### Block Sync Configuration Options ### -####################################################### -[blocksync] - -# Block Sync version to use: -# -# In v0.37, v1 and v2 of the block sync protocols were deprecated. -# Please use v0 instead. -# -# 1) "v0" - the default block sync implementation -version = "v0" - -####################################################### -### Consensus Configuration Options ### -####################################################### -[consensus] - -wal_file = "data/cs.wal/wal" - -# How long we wait for a proposal block before prevoting nil -timeout_propose = "3s" -# How much timeout_propose increases with each round -timeout_propose_delta = "500ms" -# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) -timeout_prevote = "1s" -# How much the timeout_prevote increases with each round -timeout_prevote_delta = "500ms" -# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) -timeout_precommit = "1s" -# How much the timeout_precommit increases with each round -timeout_precommit_delta = "500ms" -# How long we wait after committing a block, before starting on the new -# height (this gives us a chance to receive some more precommits, even -# though we already have +2/3). -timeout_commit = "5s" - -# How many blocks to look back to check existence of the node's consensus votes before joining consensus -# When non-zero, the node will panic upon restart -# if the same consensus key was used to sign {double_sign_check_height} last blocks. -# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. -double_sign_check_height = 0 - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -####################################################### -### Storage Configuration Options ### -####################################################### -[storage] - -# Set to true to discard ABCI responses from the state store, which can save a -# considerable amount of disk space. Set to false to ensure ABCI responses are -# persisted. ABCI responses are required for /block_results RPC queries, and to -# reindex events in the command-line tool. -discard_abci_responses = false - -####################################################### -### Transaction Indexer Configuration Options ### -####################################################### -[tx_index] - -# What indexer to use for transactions -# -# The application will set which txs to index. In some cases a node operator will be able -# to decide which txs to index based on configuration set in the application. -# -# Options: -# 1) "null" -# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. -# 3) "psql" - the indexer services backed by PostgreSQL. -# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed. -indexer = "kv" - -# The PostgreSQL connection configuration, the connection format: -# postgresql://:@:/? -psql-conn = "" - -####################################################### -### Instrumentation Configuration Options ### -####################################################### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "cometbft" diff --git a/e2e-tests/.env.bak b/e2e-tests/.env.bak deleted file mode 100644 index fec3b693..00000000 --- a/e2e-tests/.env.bak +++ /dev/null @@ -1,71 +0,0 @@ -# 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=0x0dfb3d814afd8d0bf7a6010e8dd2b6ac835cabe4da9e2c1e80c6a14df3994dd4 - -# 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=new-sendUniversalTx - -# 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=0xddc31465c891443c6e3e5f30ca7808d66f8036163fd0b99f4ed5e05cd261ac7f -EVM_RPC=https://eth-sepolia.public.blastapi.io -SOLANA_RPC_URL=https://api.devnet.solana.com -SOLANA_PRIVATE_KEY=2NPV9cXdRuC8Zydqa3beEJ8xK9N6qgKqXYVYQ2PtpJhNvWrhuPJAZH67NFTW5Q1JsMjgPEsTY3ph2Sd1nGqqcNFv -PUSH_PRIVATE_KEY=0x0dfb3d814afd8d0bf7a6010e8dd2b6ac835cabe4da9e2c1e80c6a14df3994dd4 - -# 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/tokens/eth_sepolia_eth.json -CHAIN_CONFIG_PATH=./config/testnet-donut/chains/eth_sepolia_chain_config.json diff --git a/local-multi-validator/Dockerfile.unified b/local-multi-validator/Dockerfile.unified index 0ff6edc8..070594ad 100644 --- a/local-multi-validator/Dockerfile.unified +++ b/local-multi-validator/Dockerfile.unified @@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/go/pkg/mod,id=go-mod \ go mod tidy # Replace admin addresses for local-multi-validator setup -RUN sed -i 's/push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20/push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20/g' \ +RUN sed -i 's/push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a/push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20/g' \ ./x/uregistry/types/params.go \ ./x/utss/types/params.go \ ./x/uvalidator/types/params.go diff --git a/test/utils/constants.go b/test/utils/constants.go index 9123f790..d8ae6d7e 100644 --- a/test/utils/constants.go +++ b/test/utils/constants.go @@ -44,7 +44,7 @@ func GetDefaultAddresses() Addresses { ExternalUSDCAddr: common.HexToAddress("0x0000000000000000000000000000000000000e07"), UniversalGatewayPCAddr: common.HexToAddress("0x00000000000000000000000000000000000000C1"), MigratedUEAAddr: common.HexToAddress("0x0000000000000000000000000000000000000d08"), - DefaultTestAddr: "0x778d3206374f8ac265728e18e3fe2ae6b93e4ce4", + DefaultTestAddr: "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11", CosmosTestAddr: "cosmos18pjnzwr9xdnx2vnpv5mxywfnv56xxef5cludl5", TargetAddr: "\x86i\xbe\xd1!\xfe\xfa=\x9c\xf2\x82\x12s\xf4\x89\xe7\x17̩]", TargetAddr2: "0x527F3692F5C53CfA83F7689885995606F93b6164", diff --git a/x/uexecutor/types/constants.go b/x/uexecutor/types/constants.go index a39b1a50..37ffc74f 100644 --- a/x/uexecutor/types/constants.go +++ b/x/uexecutor/types/constants.go @@ -7,7 +7,7 @@ import ( const ( FACTORY_PROXY_ADDRESS_HEX = "0x00000000000000000000000000000000000000eA" - PROXY_ADMIN_OWNER_ADDRESS_HEX = "0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" + PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11" FACTORY_IMPL_ADDRESS_HEX = "0x00000000000000000000000000000000000000fa" PROXY_ADMIN_ADDRESS_HEX = "0x00000000000000000000000000000000000000AA" ) diff --git a/x/uregistry/types/constants.go b/x/uregistry/types/constants.go index 88e6d1b9..53c06eb5 100644 --- a/x/uregistry/types/constants.go +++ b/x/uregistry/types/constants.go @@ -14,7 +14,7 @@ var GATEWAY_METHOD = struct { EVM: struct{ AddFunds string }{AddFunds: "addFunds"}, } -const PROXY_ADMIN_OWNER_ADDRESS_HEX = "0x778D3206374f8AC265728E18E3fE2Ae6b93E4ce4" +const PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11" var ProxyAdminRuntimeBytecode = common.FromHex("0x608060405260043610610058575f3560e01c80639623609d116100415780639623609d146100aa578063ad3cb1cc146100bd578063f2fde38b14610112575f80fd5b8063715018a61461005c5780638da5cb5b14610072575b5f80fd5b348015610067575f80fd5b50610070610131565b005b34801561007d575f80fd5b505f5460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100706100b8366004610351565b610144565b3480156100c8575f80fd5b506101056040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516100a191906104c6565b34801561011d575f80fd5b5061007061012c3660046104df565b6101d5565b61013961023d565b6101425f61028f565b565b61014c61023d565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef2869034906101a290869086906004016104fa565b5f604051808303818588803b1580156101b9575f80fd5b505af11580156101cb573d5f803e3d5ffd5b5050505050505050565b6101dd61023d565b73ffffffffffffffffffffffffffffffffffffffff8116610231576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b61023a8161028f565b50565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610142576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610228565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff8116811461023a575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f805f60608486031215610363575f80fd5b833561036e81610303565b9250602084013561037e81610303565b9150604084013567ffffffffffffffff811115610399575f80fd5b8401601f810186136103a9575f80fd5b803567ffffffffffffffff8111156103c3576103c3610324565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff8211171561042f5761042f610324565b604052818152828201602001881015610446575f80fd5b816020840160208301375f602083830101528093505050509250925092565b5f81518084525f5b818110156104895760208185018101518683018201520161046d565b505f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f6104d86020830184610465565b9392505050565b5f602082840312156104ef575f80fd5b81356104d881610303565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201525f6105286040830184610465565b94935050505056fea26469706673582212209ce80139bf41b00bc44c4532122ff649c1e8542240b8a5c13f39af0d72f21b2364736f6c634300081a0033") var PROXY_ADMIN_SLOT = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103") diff --git a/x/uregistry/types/params.go b/x/uregistry/types/params.go index 5400d4f2..548788eb 100755 --- a/x/uregistry/types/params.go +++ b/x/uregistry/types/params.go @@ -8,7 +8,7 @@ import ( func DefaultParams() Params { // TODO: return Params{ - Admin: "push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60", + Admin: "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", } } diff --git a/x/utss/types/params.go b/x/utss/types/params.go index b5def128..b137d735 100755 --- a/x/utss/types/params.go +++ b/x/utss/types/params.go @@ -7,7 +7,7 @@ import ( // DefaultParams returns default module parameters. func DefaultParams() Params { return Params{ - Admin: "push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60", + Admin: "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", } } diff --git a/x/uvalidator/types/params.go b/x/uvalidator/types/params.go index b5def128..b137d735 100755 --- a/x/uvalidator/types/params.go +++ b/x/uvalidator/types/params.go @@ -7,7 +7,7 @@ import ( // DefaultParams returns default module parameters. func DefaultParams() Params { return Params{ - Admin: "push1w7xnyp3hf79vyetj3cvw8l32u6unun8yr6zn60", + Admin: "push1negskcfqu09j5zvpk7nhvacnwyy2mafffy7r6a", } } From 782bf3b5f32fcc4e49d30f35c7f6dfdcae7e2d7d Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 17:51:11 +0530 Subject: [PATCH 20/23] refactor: minor clean ups --- config/testnet-donut/solana_devnet/tokens/sol.json | 2 +- e2e-tests/.gitignore | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config/testnet-donut/solana_devnet/tokens/sol.json b/config/testnet-donut/solana_devnet/tokens/sol.json index 68c8acfe..05f65f7f 100644 --- a/config/testnet-donut/solana_devnet/tokens/sol.json +++ b/config/testnet-donut/solana_devnet/tokens/sol.json @@ -9,6 +9,6 @@ "token_type": 4, "native_representation": { "denom": "", - "contract_address": "0xB2cf4B3aec93F4A8F92b292d2F605591dB3e3011" + "contract_address": "0x5D525Df2bD99a6e7ec58b76aF2fd95F39874EBed" } } diff --git a/e2e-tests/.gitignore b/e2e-tests/.gitignore index ef853ca1..4ea7f858 100644 --- a/e2e-tests/.gitignore +++ b/e2e-tests/.gitignore @@ -1,3 +1,2 @@ .env -logs/ -repos/ +logs/ \ No newline at end of file From e2f4f6ccf5c207ca51044600e92bc3af3b99b8a6 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:46:21 +0530 Subject: [PATCH 21/23] fix: Push localnet allocation in sdk --- e2e-tests/setup.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/e2e-tests/setup.sh b/e2e-tests/setup.sh index e70c1cb6..7541d63c 100755 --- a/e2e-tests/setup.sh +++ b/e2e-tests/setup.sh @@ -447,8 +447,14 @@ step_setup_push_chain_sdk() { exit 1 fi - perl -0pi -e 's/\bCHAIN\.PUSH_TESTNET_DONUT\b/CHAIN.PUSH_LOCALNET/g' "$sdk_account_file" - log_ok "Replaced CHAIN.PUSH_TESTNET_DONUT with CHAIN.PUSH_LOCALNET in $sdk_account_file" + perl -0pi -e ' + s{(function\s+convertExecutorToOriginAccount\b.*?\{)(.*?)(\n\})}{ + my ($head, $body, $tail) = ($1, $2, $3); + $body =~ s/\bCHAIN\.PUSH_TESTNET_DONUT\b/CHAIN.PUSH_LOCALNET/g; + "$head$body$tail"; + }gse; + ' "$sdk_account_file" + log_ok "Replaced CHAIN.PUSH_TESTNET_DONUT with CHAIN.PUSH_LOCALNET only in convertExecutorToOriginAccount() in $sdk_account_file" log_info "Installing push-chain-sdk dependencies" ( From ae14e680c7c779c0a03ffe6cc785d6f03137e20c Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:47:08 +0530 Subject: [PATCH 22/23] refactor: minor cleaning --- e2e-tests/deploy_addresses.json | 55 --------------------------------- 1 file changed, 55 deletions(-) diff --git a/e2e-tests/deploy_addresses.json b/e2e-tests/deploy_addresses.json index 4a38b519..e69de29b 100644 --- a/e2e-tests/deploy_addresses.json +++ b/e2e-tests/deploy_addresses.json @@ -1,55 +0,0 @@ -{ - "generatedAt": "2026-03-05T07:13:22Z", - "contracts": { - "WPC": "0x057931Df99f61caB5e5DbDb6224D7003E64F659e", - "Factory": "0xe0b7A8833f77C5728295D489F4B64f9DA236E4C8", - "SwapRouter": "0x7fd62fe2Aba9af8bF4d08a6cce49beA8c8Ca6d97", - "QuoterV2": "0x484aC6ED747090fe8C82c5F10427ccC2F2998930", - "PositionManager": "0x95cE5e63366D3A11E9BCCe71917bB37C23Fd0002", - "UEA_PROXY_IMPLEMENTATION": "0x00cb38A885cf8D0B2dDfd19Bd1c04aAAC44C5a86" - }, - "tokens": [ - { - "name": "pETH.eth", - "symbol": "pETH", - "address": "0x69c5560bB765a935C345f507D2adD34253FBe41b", - "source": "core-contracts", - "decimals": 18 - }, - { - "name": "USDT.eth", - "symbol": "USDT.eth", - "address": "0xc2055dD3A7Ad875520BdB5c91300F964F7038C73", - "source": "core-contracts", - "decimals": 6 - }, - { - "name": "pETH.base", - "symbol": "pETH.base", - "address": "0x697164dD5f2727a4d6EfcF977dCc080Ff10c7459", - "source": "core-contracts", - "decimals": 18 - }, - { - "name": "pETH.arb", - "symbol": "pETH.arb", - "address": "0x90bFeD13b1D7db6243Dfb554c336b0254F099596", - "source": "core-contracts", - "decimals": 18 - }, - { - "name": "pBNB", - "symbol": "pBNB", - "address": "0xD19a6d5ed3BBb15B70843152610705ba25fF6df2", - "source": "core-contracts", - "decimals": 18 - }, - { - "name": "pSOL", - "symbol": "pSOL", - "address": "0xB2cf4B3aec93F4A8F92b292d2F605591dB3e3011", - "source": "core-contracts", - "decimals": 9 - } - ] -} From 132b5f96aa6b0a14299221b15d873b188809ccc0 Mon Sep 17 00:00:00 2001 From: Arya Lanjewar <102943033+AryaLanjewar3005@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:56:25 +0530 Subject: [PATCH 23/23] fix: some more address adjustments --- test/utils/constants.go | 2 +- x/uexecutor/types/constants.go | 2 +- x/uregistry/types/constants.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/utils/constants.go b/test/utils/constants.go index d8ae6d7e..9123f790 100644 --- a/test/utils/constants.go +++ b/test/utils/constants.go @@ -44,7 +44,7 @@ func GetDefaultAddresses() Addresses { ExternalUSDCAddr: common.HexToAddress("0x0000000000000000000000000000000000000e07"), UniversalGatewayPCAddr: common.HexToAddress("0x00000000000000000000000000000000000000C1"), MigratedUEAAddr: common.HexToAddress("0x0000000000000000000000000000000000000d08"), - DefaultTestAddr: "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11", + DefaultTestAddr: "0x778d3206374f8ac265728e18e3fe2ae6b93e4ce4", CosmosTestAddr: "cosmos18pjnzwr9xdnx2vnpv5mxywfnv56xxef5cludl5", TargetAddr: "\x86i\xbe\xd1!\xfe\xfa=\x9c\xf2\x82\x12s\xf4\x89\xe7\x17̩]", TargetAddr2: "0x527F3692F5C53CfA83F7689885995606F93b6164", diff --git a/x/uexecutor/types/constants.go b/x/uexecutor/types/constants.go index 37ffc74f..35d94535 100644 --- a/x/uexecutor/types/constants.go +++ b/x/uexecutor/types/constants.go @@ -7,7 +7,7 @@ import ( const ( FACTORY_PROXY_ADDRESS_HEX = "0x00000000000000000000000000000000000000eA" - PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11" + PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96CaA79eb2312DbEb0B8E93c1Ce84C98b67bF11" FACTORY_IMPL_ADDRESS_HEX = "0x00000000000000000000000000000000000000fa" PROXY_ADMIN_ADDRESS_HEX = "0x00000000000000000000000000000000000000AA" ) diff --git a/x/uregistry/types/constants.go b/x/uregistry/types/constants.go index 53c06eb5..55f706fe 100644 --- a/x/uregistry/types/constants.go +++ b/x/uregistry/types/constants.go @@ -14,7 +14,7 @@ var GATEWAY_METHOD = struct { EVM: struct{ AddFunds string }{AddFunds: "addFunds"}, } -const PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96caa79eb2312dbeb0b8e93c1ce84c98b67bf11" +const PROXY_ADMIN_OWNER_ADDRESS_HEX = "0xa96CaA79eb2312DbEb0B8E93c1Ce84C98b67bF11" var ProxyAdminRuntimeBytecode = common.FromHex("0x608060405260043610610058575f3560e01c80639623609d116100415780639623609d146100aa578063ad3cb1cc146100bd578063f2fde38b14610112575f80fd5b8063715018a61461005c5780638da5cb5b14610072575b5f80fd5b348015610067575f80fd5b50610070610131565b005b34801561007d575f80fd5b505f5460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100706100b8366004610351565b610144565b3480156100c8575f80fd5b506101056040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516100a191906104c6565b34801561011d575f80fd5b5061007061012c3660046104df565b6101d5565b61013961023d565b6101425f61028f565b565b61014c61023d565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef2869034906101a290869086906004016104fa565b5f604051808303818588803b1580156101b9575f80fd5b505af11580156101cb573d5f803e3d5ffd5b5050505050505050565b6101dd61023d565b73ffffffffffffffffffffffffffffffffffffffff8116610231576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b61023a8161028f565b50565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610142576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610228565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff8116811461023a575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f805f60608486031215610363575f80fd5b833561036e81610303565b9250602084013561037e81610303565b9150604084013567ffffffffffffffff811115610399575f80fd5b8401601f810186136103a9575f80fd5b803567ffffffffffffffff8111156103c3576103c3610324565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff8211171561042f5761042f610324565b604052818152828201602001881015610446575f80fd5b816020840160208301375f602083830101528093505050509250925092565b5f81518084525f5b818110156104895760208185018101518683018201520161046d565b505f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f6104d86020830184610465565b9392505050565b5f602082840312156104ef575f80fd5b81356104d881610303565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201525f6105286040830184610465565b94935050505056fea26469706673582212209ce80139bf41b00bc44c4532122ff649c1e8542240b8a5c13f39af0d72f21b2364736f6c634300081a0033") var PROXY_ADMIN_SLOT = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")