mantlenetworkio / mantle

Mantle | Mass adoption of decentralized & token-governed technologies. With Mantle Network, Mantle Treasury, and token holder-governed products initiatives.
https://www.mantle.xyz
MIT License
226 stars 101 forks source link

bug fix about estimateGas rpc parameters #1379

Closed idyllsss closed 11 months ago

idyllsss commented 11 months ago

Goals of PR

Core changes:

Regarding the DoEstimateGas method in l2geth/internal/ethapi/api.go,

result, err := DoCall(ctx, b, args, blockNrOrHash, nil, &vm.Config{}, 0, gasCap)
if err != nil {
    if errors.Is(err, core.ErrIntrinsicGas) {
        return true, nil, nil // Special case, raise gas limit
    }
    return true, nil, err
}

A new error scenario has been added in l2geth/core/state_transition.go : when the gas for StateTransition is less than the intrinsic gas, the ErrIntrinsicGas exception is thrown.