Skip to content

Excessive proof size consumed by smart contract call #12236

@Zebedeusz

Description

@Zebedeusz

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

A call to a smart contract results with about 1,5 MB proof size consumed.

  Bare call ends:
    result=Ok(ExecReturnValue { flags: (empty), data: [] }),
    weight_consumed   = Weight { ref_time: 23_406_892_571, proof_size: 1_600_360 },
    weight_required   = Weight { ref_time: 23_406_892_571, proof_size: 1_600_776 },
    storage_deposit   = Charge(0),
    gas_consumed      = 45286,
    max_storage_deposit = Charge(3_715_200_000)

Tested flow:

Tested with:

Full flow for more context, but may be irrelevant: https://github.com/paritytech/individuality/issues/755 "Username Reservation Flow".

Steps to reproduce

For the direct smart contract call:

  1. https://github.com/paritytech/dotns/blob/master/contracts/registrars/RootGatewayDispatcher.sol

For full flow that got me to this discovery:

  1. Set the cap in runtimes/next-asset-hub-paseo/src/lib.rs:
    pub const DotnsMaxContractCallWeight: Weight =
    Weight::from_parts(50_000_000_000, (512 + 1024) * 1024); // 1.5 MiB
  2. Rebuild the runtime WASM:
    cd ../individuality && cargo build --release -p next-asset-hub-paseo-runtime
  3. Regenerate the chain spec and run the chain with -lruntime::revive=trace, deploy dotns contracts, set-up everything needed on chain (pnpm bootstrap from the scripts repo)
  4. From pop-dotns-testing, submit a reserve_name that exercises both lite + reserved-base paths:
    pnpm reserve usxxxx 40 usyyyy --network local (from the scripts repo)
  5. Observe failure in the script output:
    DispatchError: Module DotnsGateway.ContractCallFailed
  6. and in the collator log, the in-block trace shows:
    - meter starts with proof_size: 1572864
    - consumes ~1,569,557 of it (~99.8 %)
    - deepest frame returns Err(... error: [3,0,0,0], message: Some("OutOfGas") ...) (revive pallet index 100, variant 3 = OutOfGas, here meaning proof-size
    exhaustion, not ref_time)
    - all ancestor frames Absorb weight meter only and return flags: REVERT, data: [] → "unknown contract revert selector" warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    T7-smart_contractsThis PR/Issue is related to smart contracts.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions