Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gas limit too low error #1625

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions core/api/src/jsonrpc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ pub enum RpcError {
GasLimitIsTooLow,
#[display(fmt = "Gas limit is too large")]
GasLimitIsTooLarge,
#[display(fmt = "Gas limit is zero")]
GasLimitIsZero,
#[display(fmt = "Transaction is not signed")]
TransactionIsNotSigned,
#[display(fmt = "Cannot get latest block")]
Expand Down Expand Up @@ -78,7 +76,6 @@ impl RpcError {
RpcError::GasPriceIsTooLarge => -40007,
RpcError::GasLimitIsTooLow => -40008,
RpcError::GasLimitIsTooLarge => -40009,
RpcError::GasLimitIsZero => -40010,
RpcError::TransactionIsNotSigned => -40011,
RpcError::CannotGetLatestBlock => -40013,
RpcError::InvalidBlockHash => -40014,
Expand Down Expand Up @@ -116,7 +113,6 @@ impl From<RpcError> for ErrorObjectOwned {
RpcError::GasPriceIsTooLarge => ErrorObject::owned(err_code, err, none_data),
RpcError::GasLimitIsTooLow => ErrorObject::owned(err_code, err, none_data),
RpcError::GasLimitIsTooLarge => ErrorObject::owned(err_code, err, none_data),
RpcError::GasLimitIsZero => ErrorObject::owned(err_code, err, none_data),
RpcError::TransactionIsNotSigned => ErrorObject::owned(err_code, err, none_data),
RpcError::CannotGetLatestBlock => ErrorObject::owned(err_code, err, none_data),
RpcError::InvalidBlockHash => ErrorObject::owned(err_code, err, none_data),
Expand Down
4 changes: 2 additions & 2 deletions core/api/src/jsonrpc/impl/web3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ impl<Adapter: APIAdapter + 'static> Web3RpcServer for Web3RpcImpl<Adapter> {
#[metrics_rpc("eth_estimateGas")]
async fn estimate_gas(&self, req: Web3CallRequest, number: Option<BlockId>) -> RpcResult<U256> {
if let Some(gas_limit) = req.gas.as_ref() {
if gas_limit == &U64::zero() {
return Err(RpcError::GasPriceIsZero.into());
if gas_limit < &(MIN_TRANSACTION_GAS_LIMIT.into()) {
return Err(RpcError::GasLimitIsTooLow.into());
}
}

Expand Down
Loading