NethermindEth / blockifier-tester

A testing utility to run juno with our version of the blockifier that uses cairo native, and compare it to results from mainnet or from juno using the unmodified blockifier
1 stars 1 forks source link

feat: add broadcast tx conversion for deploy account transactions + skip L1 handler tx #63

Closed marcuspang closed 2 months ago

marcuspang commented 3 months ago

Fixes https://github.com/NethermindEth/blockifier-tester/issues/59

Changes

Examples

For block 642265 (which currently crashes), the L1Handler transaction now looks like this

{
  {
    "contract_dependencies": "Not found",
    "expected_result": "Success",
    "simulated_result": "L1Handler",
    "storage_dependencies": "Not found",
    "tx_hash": "0x1294b3ca121af15ddc7e9ee01d16ca0c90189eccfe87f7e1460d614e51669c9"
  },
}

Tested DEPLOY_ACCOUNT v1 and v3 in block 640092, it appears to be working where there are 3 Same(DEPLOY_ACCOUNT) instances.

Other solutions

  1. adding a boolean is_l1_handler to TransactionToSimulate, so that we can check this field in simulate_block on top of doing an is_none() check
    • felt that this is unnecessary. in the event that L1 handler is supported in the future, the current solution would work by modifying block_transaction_to_broadcasted_transaction. this solution would require the removal of this boolean
  2. update block_transaction_to_broadcasted_transaction to return an Option<BroadcastedTransaction>
    • similar to 1., I feel this logic would make it harder for future migration, and out of place for a marshalling / conversion method
    • the current solution is basically equivalent to this, without modifying the API of block_transaction_to_broadcasted_transaction
  3. update get_transactions_to_simulate to return Result<Vec<Option<TransactionToSimulate>>, ManagerError>
    • doing this strips away the other fields in TransactionToSimulate that is being used in block simulation, i.e. hash and expected_result, which may be used by other consumers, even if the transaction was not sent to RPC for simulation