aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

Improve error message when a transaction's max_gas is higher than what the account has

Open banool opened this issue 2 years ago • 3 comments

If I fund my account with X gas and then submit a request with max_gas X+1, this is the response you get (in this example, from the simulation endpoint):

        data: [
          {
            version: '4519',
            hash: '0x0000000000000000000000000000000000000000000000000000000000000000',
            state_root_hash: '0x0000000000000000000000000000000000000000000000000000000000000000',
            event_root_hash: '0x0000000000000000000000000000000000000000000000000000000000000000',
            gas_used: '0',
            success: false,
            vm_status: 'Move bytecode deserialization / verification failed, including script function not found or invalid arguments',
            accumulator_root_hash: '0x0000000000000000000000000000000000000000000000000000000000000000',
            changes: [],
            sender: '0xa2464e4dc79742c3f72906073f5deca0ca9b9887afb19372bd088495f0a24e16',
            sequence_number: '0',
            max_gas_amount: '1000001',
            gas_unit_price: '1',
            expiration_timestamp_secs: '1659888686',
            payload: [Object],
            signature: [Object],
            events: [],
            timestamp: '1659888675772427'
          }

This doesn't explain what went wrong in any specific detail, and in this case is probably misleading. In other words I wouldn't think to check max_gas based on this error message.

I'd expect something like "the request set max_gas 1000001, but the account does not have that much, it only has Y".

banool avatar Aug 07 '22 16:08 banool

Wow..

davidiw avatar Aug 07 '22 16:08 davidiw

Hmm, I don't remember getting this error, can you double check the error @banool?

One thing I added was that the simulation endpoint tells you all errors (as misc errors) if they don't fall under a "successful submission"

gregnazario avatar Sep 03 '22 01:09 gregnazario

I'll double check.

banool avatar Sep 12 '22 19:09 banool

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Dec 20 '22 01:12 github-actions[bot]