Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8ec791c
fix: extract `L1_POL_TOKEN_ADDRESS` from kurtosis env
leovct Mar 24, 2026
cfa9ab1
fix: validator test to use POL instead of MATIC
leovct Mar 24, 2026
a349899
fix: use POL in all validator tests
leovct Mar 24, 2026
b20b02b
chore: nit
leovct Mar 24, 2026
cfe42f0
chore: use POL instead of MATIC during bridge tests
leovct Mar 24, 2026
b76f51b
feat: add POL bridge test
leovct Mar 24, 2026
6bb1629
chore: update doc
leovct Mar 24, 2026
62a6afe
feat: first part of pos exit
leovct Mar 24, 2026
ade16c3
fix: remove validor test
leovct Mar 24, 2026
882c097
fix: delegate/undelegate tests
leovct Mar 24, 2026
ae3bfa6
fix: bash overflows
leovct Mar 25, 2026
ba8ce6c
chore: nit
leovct Mar 25, 2026
6671b55
chore: nit
leovct Mar 25, 2026
db40a36
chore: update docs
leovct Mar 25, 2026
0b17f7e
chore: clean up
leovct Mar 25, 2026
bf5cb52
chore: nit
leovct Mar 25, 2026
2ec9135
feat: add bridge native L1 eth test
leovct Mar 25, 2026
4e7d9e0
chore: update docs
leovct Mar 25, 2026
ed07bd5
chore: nit
leovct Mar 25, 2026
e5fca85
fix: withdraw
leovct Mar 25, 2026
828ab47
chore: clean up
leovct Mar 25, 2026
d4ca7cb
chore: clean up
leovct Mar 25, 2026
5c630c4
chore: nit
leovct Mar 25, 2026
7f3ca55
chore: clean up
leovct Mar 25, 2026
9e3b08c
chore: nit
leovct Mar 25, 2026
5a55556
chore: nit
leovct Mar 25, 2026
66e9be9
feat: add test to withdraw rewards
leovct Mar 25, 2026
6ce955f
feat: generate exit paylod when withdrawing from pos
leovct Mar 25, 2026
9795540
feat: implement remaining withdraw tests
leovct Mar 25, 2026
9a88eb3
chore: add sections
leovct Mar 25, 2026
af2491f
chore: nit
leovct Mar 25, 2026
94819b5
fix: root chain address is missing
leovct Mar 25, 2026
0256f1c
fix: retrive root chain proxy
leovct Mar 25, 2026
9b644b1
chore: clean up
leovct Mar 25, 2026
fc4d141
fix: typos
leovct Mar 25, 2026
d30ac16
chore: nit
leovct Mar 25, 2026
03a7e3b
feat: allow to fail on exit payload generation and retry
leovct Mar 25, 2026
773196b
fix: typos
leovct Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ grep -hoR --include="*.bats" 'test_tags=[^ ]*' . | sed 's/.*test_tags=//' | tr '
- transaction-eoa
- transaction-erc20
- transaction-erc721
- transaction-eth
- transaction-matic
- transaction-pol
- transaction-uniswap
- transient-storage
Expand All @@ -358,6 +360,7 @@ grep -hoR --include="*.bats" 'test_tags=[^ ]*' . | sed 's/.*test_tags=//' | tr '
- validator-set
- warm-cold
- weth
- withdraw
- zkevm-batch
- zkevm-counters

Expand Down
28 changes: 17 additions & 11 deletions TESTSINVENTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ Table of tests currently implemented or being implemented in the E2E repository.
| TSTORE gas cost is less than SSTORE for zero-to-nonzero write | [Link](./tests/pos/execution-specs/evm/eip1153-tstore-tload-transient-storage.bats#L393) | |
| TSTORE in DELEGATECALL shares caller transient storage context | [Link](./tests/pos/execution-specs/evm/eip1153-tstore-tload-transient-storage.bats#L444) | |
| TSTORE reverted by sub-call REVERT is undone | [Link](./tests/pos/execution-specs/evm/eip1153-tstore-tload-transient-storage.bats#L284) | |
| add new validator | [Link](./tests/pos/validator.bats#L20) | |
| add new validator | [Link](./tests/pos/validator.bats#L44) | |
| all-opcode liveness smoke: deploy contracts exercising major opcode groups | [Link](./tests/pos/execution-specs/transactions/evm-transaction-fuzzing-and-liveness.bats#L896) | |
| base fee adjusts between blocks following EIP-1559 dynamics | [Link](./tests/pos/execution-specs/evm/bor-chain-specific-evm-behavior.bats#L272) | |
| base fee is present and positive on all recent blocks (PIP-79 invariant) | [Link](./tests/pos/execution-specs/protocol/pip79-bounded-basefee-validation.bats#L62) | |
Expand All @@ -378,15 +378,16 @@ Table of tests currently implemented or being implemented in the E2E repository.
| bor_getAuthor returns a valid address for latest block | [Link](./tests/pos/execution-specs/rpc/rpc-method-conformance-and-validation.bats#L486) | |
| bor_getCurrentValidators returns a non-empty validator list | [Link](./tests/pos/execution-specs/rpc/rpc-method-conformance-and-validation.bats#L509) | |
| bor_getSnapshot returns snapshot with validator data | [Link](./tests/pos/execution-specs/rpc/rpc-method-conformance-and-validation.bats#L463) | |
| bridge MATIC/POL from L1 to L2 and confirm L2 MATIC/POL balance increased | [Link](./tests/pos/bridge.bats#L50) | |
| bridge MATIC/POL, ERC20, and ERC721 from L1 to L2 and confirm L2 balances increased | [Link](./tests/pos/bridge.bats#L187) | |
| bridge an ERC721 token from L1 to L2 and confirm L2 ERC721 balance increased | [Link](./tests/pos/bridge.bats#L138) | |
| bridge some ERC20 tokens from L1 to L2 and confirm L2 ERC20 balance increased | [Link](./tests/pos/bridge.bats#L94) | |
| bridge ERC20 tokens from L1 to L2 and confirm ERC20 balance increased on L2 | [Link](./tests/pos/bridge.bats#L325) | |
| bridge ERC721 token from L1 to L2 and confirm ERC721 balance increased on L2 | [Link](./tests/pos/bridge.bats#L427) | |
| bridge ETH from L1 to L2 and confirm MaticWeth balance increased on L2 | [Link](./tests/pos/bridge.bats#L222) | |
| bridge MATIC from L1 to L2 and confirm native tokens balance increased on L2 | [Link](./tests/pos/bridge.bats#L119) | |
| bridge POL from L1 to L2 and confirm native tokens balance increased on L2 | [Link](./tests/pos/bridge.bats#L81) | |
| coinbase balance increases by at least the priority fee portion of gas cost | [Link](./tests/pos/execution-specs/transactions/transaction-balance-nonce-and-replay-invariants.bats#L318) | |
| concurrent write/read race: tx submissions and state reads do not interfere | [Link](./tests/pos/execution-specs/rpc/rpc-concurrent-load-and-stress.bats#L248) | |
| consecutive block baseFees are within ±5% of each other | [Link](./tests/pos/execution-specs/protocol/pip79-bounded-basefee-validation.bats#L183) | |
| contract-to-contract call fuzz: CALL/STATICCALL/DELEGATECALL | [Link](./tests/pos/execution-specs/transactions/evm-transaction-fuzzing-and-liveness.bats#L792) | |
| delegate MATIC/POL to a validator | [Link](./tests/pos/validator.bats#L181) | |
| delegate to a validator | [Link](./tests/pos/validator.bats#L166) | |
| deploy contract that returns 24577 runtime bytes is rejected by EIP-170 | [Link](./tests/pos/execution-specs/evm/contract-creation-and-deployment-limits.bats#L124) | |
| deploy contract that returns exactly 24576 runtime bytes succeeds (EIP-170 boundary) | [Link](./tests/pos/execution-specs/evm/contract-creation-and-deployment-limits.bats#L150) | |
| deploy contract that reverts in constructor leaves no code at deployed address | [Link](./tests/pos/execution-specs/evm/contract-creation-and-deployment-limits.bats#L48) | |
Expand Down Expand Up @@ -455,7 +456,7 @@ Table of tests currently implemented or being implemented in the E2E repository.
| out-of-gas transaction still increments sender nonce | [Link](./tests/pos/execution-specs/transactions/transaction-balance-nonce-and-replay-invariants.bats#L160) | |
| prune TxIndexer | [Link](./tests/pos/heimdall-v2.bats#L86) | |
| recipient balance increases by exactly the value sent | [Link](./tests/pos/execution-specs/transactions/transaction-balance-nonce-and-replay-invariants.bats#L53) | |
| remove validator | [Link](./tests/pos/validator.bats#L363) | |
| remove validator | [Link](./tests/pos/validator.bats#L333) | |
| replay protection: same signed tx submitted twice does not double-spend | [Link](./tests/pos/execution-specs/transactions/transaction-balance-nonce-and-replay-invariants.bats#L445) | |
| sender balance decreases by exactly gas cost plus value transferred | [Link](./tests/pos/execution-specs/transactions/transaction-balance-nonce-and-replay-invariants.bats#L18) | |
| sha3Uncles field is empty-list RLP hash (PoS has no uncles) | [Link](./tests/pos/execution-specs/rpc/rpc-method-conformance-and-validation.bats#L976) | |
Expand All @@ -472,12 +473,17 @@ Table of tests currently implemented or being implemented in the E2E repository.
| type 1 access list with multiple storage keys is accepted | [Link](./tests/pos/execution-specs/transactions/transaction-types-and-gas-pricing.bats#L207) | |
| type 2 (EIP-1559) effectiveGasPrice = baseFee + min(priorityFee, maxFee - baseFee) | [Link](./tests/pos/execution-specs/transactions/transaction-types-and-gas-pricing.bats#L130) | |
| type 2 maxFeePerGas below baseFee is rejected | [Link](./tests/pos/execution-specs/transactions/transaction-types-and-gas-pricing.bats#L175) | |
| undelegate MATIC/POL from a validator | [Link](./tests/pos/validator.bats#L275) | |
| update signer | [Link](./tests/pos/validator.bats#L147) | |
| update validator stake | [Link](./tests/pos/validator.bats#L60) | |
| update validator top-up fee | [Link](./tests/pos/validator.bats#L97) | |
| undelegate from a validator | [Link](./tests/pos/validator.bats#L241) | |
| update signer | [Link](./tests/pos/validator.bats#L141) | |
| update validator stake | [Link](./tests/pos/validator.bats#L79) | |
| update validator top-up fee | [Link](./tests/pos/validator.bats#L103) | |
| warm COINBASE access costs less than cold access to arbitrary address (EIP-3651) | [Link](./tests/pos/execution-specs/evm/evm-opcodes-cancun-shanghai-eips.bats#L457) | |
| web3_clientVersion returns a non-empty version string | [Link](./tests/pos/execution-specs/rpc/rpc-method-conformance-and-validation.bats#L400) | |
| withdraw ERC20 tokens from L2 to L1 and confirm ERC20 balance increased on L1 | [Link](./tests/pos/bridge.bats#L362) | |
| withdraw ERC721 token from L2 to L1 and confirm ERC721 balance increased on L1 | [Link](./tests/pos/bridge.bats#L471) | |
| withdraw MaticWeth from L2 and confirm ETH balance increased on L1 | [Link](./tests/pos/bridge.bats#L258) | |
| withdraw native tokens from L2 and confirm POL balance increased on L1 | [Link](./tests/pos/bridge.bats#L156) | |
| withdraw validator rewards | [Link](./tests/pos/validator.bats#L311) | |
| zero-value self-transfer: only gas consumed, nonce increments | [Link](./tests/pos/execution-specs/transactions/transaction-balance-nonce-and-replay-invariants.bats#L530) | |

## DApps Tests
Expand Down
20 changes: 20 additions & 0 deletions core/helpers/pos-setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ pos_setup() {
echo "L2_CL_API_URL=${L2_CL_API_URL}"

if [[ -z "${L1_GOVERNANCE_PROXY_ADDRESS:-}" ]] ||
[[ -z "${L1_ROOT_CHAIN_PROXY_ADDRESS:-}" ]] ||
[[ -z "${L1_DEPOSIT_MANAGER_PROXY_ADDRESS:-}" ]] ||
[[ -z "${L1_WITHDRAW_MANAGER_PROXY_ADDRESS:-}" ]] ||
[[ -z "${L1_STAKE_MANAGER_PROXY_ADDRESS:-}" ]] ||
[[ -z "${L1_STAKING_INFO_ADDRESS:-}" ]] ||
[[ -z "${L1_MATIC_TOKEN_ADDRESS:-}" ]] ||
[[ -z "${L1_POL_TOKEN_ADDRESS:-}" ]] ||
[[ -z "${L1_WETH_TOKEN_ADDRESS:-}" ]] ||
[[ -z "${L1_ERC20_TOKEN_ADDRESS:-}" ]] ||
[[ -z "${L1_ERC721_TOKEN_ADDRESS:-}" ]] ||
[[ -z "${L2_STATE_RECEIVER_ADDRESS:-}" ]] ||
[[ -z "${L2_WETH_TOKEN_ADDRESS:-}" ]] ||
[[ -z "${L2_ERC20_TOKEN_ADDRESS:-}" ]] ||
[[ -z "${L2_ERC721_TOKEN_ADDRESS:-}" ]]; then
matic_contract_addresses=$(kurtosis files inspect "${ENCLAVE_NAME}" matic-contract-addresses contractAddresses.json | jq)
Expand All @@ -44,9 +49,15 @@ pos_setup() {
export L1_GOVERNANCE_PROXY_ADDRESS=${L1_GOVERNANCE_PROXY_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.GovernanceProxy')}
echo "L1_GOVERNANCE_PROXY_ADDRESS=${L1_GOVERNANCE_PROXY_ADDRESS}"

export L1_ROOT_CHAIN_PROXY_ADDRESS=${L1_ROOT_CHAIN_PROXY_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.RootChainProxy')}
echo "L1_ROOT_CHAIN_PROXY_ADDRESS=${L1_ROOT_CHAIN_PROXY_ADDRESS}"

export L1_DEPOSIT_MANAGER_PROXY_ADDRESS=${L1_DEPOSIT_MANAGER_PROXY_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.DepositManagerProxy')}
echo "L1_DEPOSIT_MANAGER_PROXY_ADDRESS=${L1_DEPOSIT_MANAGER_PROXY_ADDRESS}"

export L1_WITHDRAW_MANAGER_PROXY_ADDRESS=${L1_WITHDRAW_MANAGER_PROXY_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.WithdrawManagerProxy')}
echo "L1_WITHDRAW_MANAGER_PROXY_ADDRESS=${L1_WITHDRAW_MANAGER_PROXY_ADDRESS}"

export L1_STAKE_MANAGER_PROXY_ADDRESS=${L1_STAKE_MANAGER_PROXY_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.StakeManagerProxy')}
echo "L1_STAKE_MANAGER_PROXY_ADDRESS=${L1_STAKE_MANAGER_PROXY_ADDRESS}"

Expand All @@ -56,6 +67,9 @@ pos_setup() {
export L1_MATIC_TOKEN_ADDRESS=${L1_MATIC_TOKEN_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.tokens.MaticToken')}
echo "L1_MATIC_TOKEN_ADDRESS=${L1_MATIC_TOKEN_ADDRESS}"

export L1_POL_TOKEN_ADDRESS=${L1_POL_TOKEN_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.tokens.PolToken')}
echo "L1_POL_TOKEN_ADDRESS=${L1_POL_TOKEN_ADDRESS}"

export L1_ERC20_TOKEN_ADDRESS=${L1_ERC20_TOKEN_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.tokens.TestToken')}
echo "L1_ERC20_TOKEN_ADDRESS=${L1_ERC20_TOKEN_ADDRESS}"

Expand All @@ -71,5 +85,11 @@ pos_setup() {

export L2_ERC721_TOKEN_ADDRESS=${L2_ERC721_TOKEN_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.child.tokens.RootERC721')}
echo "L2_ERC721_TOKEN_ADDRESS=${L2_ERC721_TOKEN_ADDRESS}"

export L1_WETH_TOKEN_ADDRESS=${L1_WETH_TOKEN_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.root.tokens.MaticWeth')}
echo "L1_WETH_TOKEN_ADDRESS=${L1_WETH_TOKEN_ADDRESS}"

export L2_WETH_TOKEN_ADDRESS=${L2_WETH_TOKEN_ADDRESS:-$(echo "${matic_contract_addresses}" | jq --raw-output '.child.tokens.MaticWeth')}
echo "L2_WETH_TOKEN_ADDRESS=${L2_WETH_TOKEN_ADDRESS}"
fi
}
35 changes: 32 additions & 3 deletions core/helpers/scripts/eventually.bash
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function assert_token_balance_eventually_greater_or_equal() {

balance=$(cast call --json --rpc-url "${rpc_url}" "${contract_address}" "balanceOf(address)(uint)" "${eoa_address}" | jq --raw-output ".[0]")
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Balance: ${balance} tokens"
if [[ "${balance}" -ge "${target}" ]]; then
if [ "$(echo "${balance} >= ${target}" | bc)" -eq 1 ]; then
break
fi

Expand Down Expand Up @@ -141,7 +141,36 @@ function assert_token_balance_eventually_lower_or_equal() {

balance=$(cast call --json --rpc-url "${rpc_url}" "${contract_address}" "balanceOf(address)(uint)" "${eoa_address}" | jq --raw-output ".[0]")
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Balance: ${balance} tokens"
if [[ "${balance}" -le "${target}" ]]; then
if [ "$(echo "${balance} <= ${target}" | bc)" -eq 1 ]; then
break
fi

sleep "${interval}"
done
}

function assert_ether_balance_eventually_lower_or_equal() {
local address="$1"
local target="$2"
local rpc_url="$3"
local timeout="${4:-90}"
local interval="${5:-10}"

echo "[$(date '+%Y-%m-%d %H:%M:%S')] Target: ${target}"

local start_time
start_time=$(date +%s)
local end_time
end_time=$((start_time + timeout))
while true; do
if [[ "$(date +%s)" -ge "${end_time}" ]]; then
echo "Timeout reached."
exit 1
fi

balance=$(cast balance --rpc-url "${rpc_url}" "${address}")
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Balance: ${balance} wei"
if [ "$(echo "${balance} <= ${target}" | bc)" -eq 1 ]; then
break
fi

Expand Down Expand Up @@ -170,7 +199,7 @@ function assert_ether_balance_eventually_greater_or_equal() {

balance=$(cast balance --rpc-url "${rpc_url}" "${address}")
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Balance: ${balance} wei"
if [[ "${balance}" -ge "${target}" ]]; then
if [ "$(echo "${balance} >= ${target}" | bc)" -eq 1 ]; then
break
fi

Expand Down
Loading
Loading