-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Split FEP and PP e2e tests - Add PP that check on aggsender database if there are 1 settle certificate - Add sqlite client to docker
- Loading branch information
1 parent
6e4577f
commit df57e65
Showing
12 changed files
with
191 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ jobs: | |
- "fork11-rollup" | ||
- "fork12-validium" | ||
- "fork12-rollup" | ||
- "fork12-pessimistic" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
|
@@ -70,7 +71,7 @@ jobs: | |
with: | ||
repository: 0xPolygon/kurtosis-cdk | ||
path: "kurtosis-cdk" | ||
ref: "v0.2.19" | ||
ref: "v0.2.21" | ||
|
||
- name: Setup Bats and bats libs | ||
uses: bats-core/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,3 @@ type EpochNotifier interface { | |
Start(ctx context.Context) | ||
String() string | ||
} | ||
|
||
type BridgeL2Syncer interface { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
test/access-list-e2e.bats → test/bats/fep/access-list-e2e.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
setup() { | ||
load 'helpers/common-setup' | ||
load '../../helpers/common-setup' | ||
_common_setup | ||
} | ||
|
||
@test "Verify batches" { | ||
echo "Waiting 10 minutes to get some verified batch...." | ||
run $PROJECT_ROOT/test/scripts/batch_verification_monitor.sh 0 600 | ||
run $PROJECT_ROOT/../scripts/batch_verification_monitor.sh 0 600 | ||
assert_success | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
setup() { | ||
load '../../helpers/common-setup' | ||
_common_setup | ||
load '../../helpers/common' | ||
load '../../helpers/lxly-bridge-test' | ||
|
||
if [ -z "$BRIDGE_ADDRESS" ]; then | ||
local combined_json_file="/opt/zkevm/combined.json" | ||
echo "BRIDGE_ADDRESS env variable is not provided, resolving the bridge address from the Kurtosis CDK '$combined_json_file'" >&3 | ||
|
||
# Fetching the combined JSON output and filtering to get polygonZkEVMBridgeAddress | ||
combined_json_output=$($contracts_service_wrapper "cat $combined_json_file" | tail -n +2) | ||
bridge_default_address=$(echo "$combined_json_output" | jq -r .polygonZkEVMBridgeAddress) | ||
BRIDGE_ADDRESS=$bridge_default_address | ||
fi | ||
echo "Bridge address=$BRIDGE_ADDRESS" >&3 | ||
|
||
readonly sender_private_key=${SENDER_PRIVATE_KEY:-"12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"} | ||
readonly sender_addr="$(cast wallet address --private-key $sender_private_key)" | ||
destination_net=${DESTINATION_NET:-"1"} | ||
destination_addr=${DESTINATION_ADDRESS:-"0x0bb7AA0b4FdC2D2862c088424260e99ed6299148"} | ||
ether_value=${ETHER_VALUE:-"0.0200000054"} | ||
amount=$(cast to-wei $ether_value ether) | ||
readonly native_token_addr=${NATIVE_TOKEN_ADDRESS:-"0x0000000000000000000000000000000000000000"} | ||
if [[ -n "$GAS_TOKEN_ADDR" ]]; then | ||
echo "Using provided GAS_TOKEN_ADDR: $GAS_TOKEN_ADDR" >&3 | ||
gas_token_addr="$GAS_TOKEN_ADDR" | ||
else | ||
echo "GAS_TOKEN_ADDR not provided, retrieving from rollup parameters file." >&3 | ||
readonly rollup_params_file=/opt/zkevm/create_rollup_parameters.json | ||
run bash -c "$contracts_service_wrapper 'cat $rollup_params_file' | tail -n +2 | jq -r '.gasTokenAddress'" | ||
assert_success | ||
assert_output --regexp "0x[a-fA-F0-9]{40}" | ||
gas_token_addr=$output | ||
fi | ||
readonly is_forced=${IS_FORCED:-"true"} | ||
readonly bridge_addr=$BRIDGE_ADDRESS | ||
readonly meta_bytes=${META_BYTES:-"0x"} | ||
|
||
readonly l1_rpc_url=${L1_ETH_RPC_URL:-"$(kurtosis port print $enclave el-1-geth-lighthouse rpc)"} | ||
readonly bridge_api_url=${BRIDGE_API_URL:-"$(kurtosis port print $enclave zkevm-bridge-service-001 rpc)"} | ||
|
||
readonly dry_run=${DRY_RUN:-"false"} | ||
readonly l1_rpc_network_id=$(cast call --rpc-url $l1_rpc_url $bridge_addr 'networkID() (uint32)') | ||
readonly l2_rpc_network_id=$(cast call --rpc-url $l2_rpc_url $bridge_addr 'networkID() (uint32)') | ||
gas_price=$(cast gas-price --rpc-url "$l2_rpc_url") | ||
readonly weth_token_addr=$(cast call --rpc-url $l2_rpc_url $bridge_addr 'WETHToken()' | cast parse-bytes32-address) | ||
} | ||
|
||
@test "Native gas token deposit to WETH" { | ||
destination_addr=$sender_addr | ||
local initial_receiver_balance=$(cast call --rpc-url "$l2_rpc_url" "$weth_token_addr" "$balance_of_fn_sig" "$destination_addr" | awk '{print $1}') | ||
echo "Initial receiver balance of native token on L2 $initial_receiver_balance" >&3 | ||
|
||
echo "=== Running LxLy deposit on L1 to network: $l2_rpc_network_id native_token: $native_token_addr" >&3 | ||
|
||
destination_net=$l2_rpc_network_id | ||
run bridgeAsset "$native_token_addr" "$l1_rpc_url" | ||
assert_success | ||
|
||
echo "=== Running LxLy claim on L2" >&3 | ||
timeout="120" | ||
claim_frequency="10" | ||
run wait_for_claim "$timeout" "$claim_frequency" "$l2_rpc_url" | ||
assert_success | ||
|
||
run verify_balance "$l2_rpc_url" "$weth_token_addr" "$destination_addr" "$initial_receiver_balance" "$ether_value" | ||
assert_success | ||
|
||
echo "=== bridgeAsset L2 WETH: $weth_token_addr to L1 ETH" >&3 | ||
destination_addr=$sender_addr | ||
destination_net=0 | ||
run bridgeAsset "$weth_token_addr" "$l2_rpc_url" | ||
assert_success | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
setup() { | ||
load '../../helpers/common-setup' | ||
_common_setup | ||
} | ||
|
||
@test "Verify batches" { | ||
echo "Waiting 10 minutes to get some settle certificate...." | ||
run $PROJECT_ROOT/../scripts/agglayer_certificates_monitor.sh 1 600 | ||
assert_success | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
args: | ||
agglayer_image: ghcr.io/agglayer/agglayer:0.2.0-rc.11 | ||
cdk_erigon_node_image: hermeznetwork/cdk-erigon:v2.60.0-beta8 | ||
cdk_node_image: cdk | ||
zkevm_bridge_proxy_image: haproxy:3.0-bookworm | ||
zkevm_bridge_service_image: hermeznetwork/zkevm-bridge-service:v0.6.0-RC1 | ||
zkevm_bridge_ui_image: leovct/zkevm-bridge-ui:multi-network | ||
zkevm_contracts_image: nulyjkdhthz/zkevm-contracts:v9.0.0-rc.3-pp-fork.12 | ||
additional_services: [] | ||
consensus_contract_type: pessimistic | ||
sequencer_type: erigon | ||
erigon_strict_mode: false | ||
zkevm_use_gas_token_contract: true | ||
enable_normalcy: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env bash | ||
# This script monitors the agglayer certificates progress of pessimistic proof. | ||
|
||
function parse_params(){ | ||
# Check if the required arguments are provided. | ||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $0 <settle_certificates_target> <timeout>" | ||
exit 1 | ||
fi | ||
|
||
# The number of batches to be verified. | ||
settle_certificates_target="$1" | ||
|
||
# The script timeout (in seconds). | ||
timeout="$2" | ||
} | ||
|
||
function check_timeout(){ | ||
local _end_time=$1 | ||
current_time=$(date +%s) | ||
if ((current_time > _end_time)); then | ||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ❌ Exiting... Timeout reached not found the expected numbers of settled certs!" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function check_num_certificates(){ | ||
local _cmd="echo 'select status, count(*) from certificate_info group by status;' | sqlite3 /tmp/aggsender.sqlite" | ||
local _outcmd=$(mktemp) | ||
kurtosis service exec cdk cdk-node-001 "$_cmd" > $_outcmd | ||
if [ $? -ne 0 ]; then | ||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Error executing command kurtosis service: $_cmd" | ||
# clean temp file | ||
rm $_outcmd | ||
return | ||
fi | ||
local num_certs=$(cat $_outcmd | tail -n +2 | cut -f 2 -d '|' | xargs |tr ' ' '+' | bc) | ||
# Get the number of settled certificates "4|0" | ||
local _num_settle_certs=$(cat $_outcmd | tail -n +2 | grep ^${aggsender_status_settled} | cut -d'|' -f2) | ||
[ -z "$_num_settle_certs" ] && _num_settle_certs=0 | ||
# clean temp file | ||
rm $_outcmd | ||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Num certificates on aggsender: $num_certs. Settled certificates : $_num_settle_certs" | ||
if [ $num_certs -ge $settle_certificates_target ]; then | ||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✅ Exiting... $num_certs certificates were settled! (total certs $num_certs)" | ||
exit 0 | ||
fi | ||
} | ||
|
||
# MAIN | ||
declare -A aggsender_status_map=( | ||
[0]="Pending" | ||
[1]="Proven" | ||
[2]="Candidate" | ||
[3]="InError" | ||
[4]="Settled" | ||
) | ||
|
||
readonly aggsender_status_settled=4 | ||
|
||
|
||
parse_params $* | ||
start_time=$(date +%s) | ||
end_time=$((start_time + timeout)) | ||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Start monitoring agglayer certificates progress..." | ||
while true; do | ||
check_num_certificates | ||
check_timeout $end_time | ||
sleep 10 | ||
done |