Skip to content

Reason for failing SAFE smart contract accounts tests #228

@alindima

Description

@alindima

Almost all safe-smart-account-main tests from the scc-testing repo are failing due to the same issue, for both QnD and anvil-polkadot nodes

ErrorObject { code: ServerError(1010), message: "Invalid Transaction", data: Some(RawValue("Inability to pay some fees (e.g. account balance too low)")) }

As can be seen below, this is not failing on regular upstream anvil

Metric Anvil + EVM Anvil + PVM Original Anvil Dirty Node + EVM Dirty Node + PVM
Passed 4 4 416 4 4
Failed 445 445 33 445 445
Total 449 449 449 449 449
Status

I root-caused this and basically in the setup phase we send exactly 0.01 currency in eth denomination to this new account: 0xe1cb04a0fa36ddd16a06ea828007e35e1a3cbc37.

The code then sends a Raw transaction from this account. Being a raw transaction, it does not use the revive/anvil code for things such as estimating the gas price and gas limit. I'm assuming therefore it uses hardcoded values, which make sense for real ethereum networks (which is why they pass on regular EVM anvil).

Gas price hardcoded as 100000000000. For a real transaction in anvil-polkadot this is 1000000 normally.
Gas limit hardcoded as 100000. A typical balance transfer estimates a gas limit of 1002648517860.

Transaction that fails:

sender: 0xe1cb04a0fa36ddd16a06ea828007e35e1a3cbc37, Decoded tx: TransactionLegacySigned(
    TransactionLegacySigned {
        transaction_legacy_unsigned: TransactionLegacyUnsigned {
            chain_id: Some(
                31337,
            ),
            gas: 100000,
            gas_price: 100000000000,
            input: Bytes(0x604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601...),
            nonce: 0,
            to: None,
            type: TypeLegacy,
            value: 0,
        },
        r: 6227817185717690257735312482954220169676440596372792568998704553764417319269,
        s: 44968923103887660821256757572748535682208909450693086144684004361329279285393,
        v: 62709,
    },
)

The tests should be fixed such that we don't rely on hardcoded values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions