Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/running_tests/execute/remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ These transactions are created from the seed or worker accounts provided via the

When the test is executed, all `pre.fund_eoa` and `pre.deploy_contract` calls generate transactions that create the accounts on chain, instead of placing them directly in the `pre` object like `fill` does.

If a test uses `pre.deterministic_deploy_contract`, the `execute` command first checks if the contract is already present on chain before attempting to deploy it. If the proxy used for deterministic deployment is not present on chain either, the command will automatically deploy it too. The address of these contracts is calculated using `keccak256( 0xff ++ 0x4E59B44847B379578588920CA78FBF26C0B4956C ++ salt ++ keccak256(init_code))[12:]`.

The transactions are collected and only sent after the test function finishes execution. This is done in order to perform optimizations based on the transactions that the test requires to perform its verifications.

One optimization is the deferred calculation of the funding amount for the EOA, which is calculated on the fly depending the test transactions that use the account as sender, and this amount is the minimum balance that the account would need in order for the transactions to be included given the current network gas prices.
Expand Down
1 change: 1 addition & 0 deletions docs/running_tests/execute/transaction_metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Each transaction includes a `TransactionTestMetadata` object with the following
Transactions that prepare the test environment:

- **`deploy_contract`**: Contract deployment transactions
- **`deterministic_deploy_contract`**: Deterministic contract deployments using `CREATE2`
- **`fund_eoa`**: Funding EOAs with initial balances
- **`eoa_storage_set`**: Setting storage values for EOAs
- **`fund_address`**: Funding specific addresses
Expand Down
2 changes: 2 additions & 0 deletions packages/testing/src/execution_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
ceiling_division,
compute_create2_address,
compute_create_address,
compute_deterministic_create2_address,
compute_eofcreate_address,
keccak256,
)
Expand Down Expand Up @@ -210,6 +211,7 @@
"ceiling_division",
"compute_create_address",
"compute_create2_address",
"compute_deterministic_create2_address",
"compute_eofcreate_address",
"extend_with_defaults",
"gas_test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,20 +658,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
# send the funds to the required sender accounts
pre.send_pending_transactions()

# wait for pre-requisite transactions to be included in blocks
pre.wait_for_transactions()
for (
deployed_contract,
expected_code,
) in pre._deployed_contracts:
actual_code = eth_rpc.get_code(deployed_contract)
if actual_code != expected_code:
raise Exception(
msg = (
f"Deployed test contract didn't match expected code at address "
f"{deployed_contract} (not enough gas_limit?).\n"
f"Expected: {expected_code}\n"
f"Actual: {actual_code}"
)
logger.error(msg)
raise Exception(msg)
request.node.config.funded_accounts = ", ".join(
[str(eoa) for eoa in pre._funded_eoa]
)
Expand Down
Loading
Loading