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

Estimate_gas return issues #363

Merged
merged 5 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion client/rpc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

## Unreleased

* `EthPubSubApi::new` takes an additional `overrides` parameter.
* `EthPubSubApi::new` takes an additional `overrides` parameter.
* Fix `estimate_gas` inaccurate issue.
8 changes: 4 additions & 4 deletions client/rpc/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,17 +821,17 @@ impl<B, C, P, CT, BE, H: ExHashT> EthApiT for EthApi<B, C, P, CT, BE, H> where
}

Err(err) => {
// if Err == OutofGas or OutofFund, we need more gas
// if Err == OutofGas, we need more gas
if err.code == ErrorCode::ServerError(0) {
lower = mid;
mid = (lower + upper + 1) / 2;
if mid == lower {
break;
}
} else {
boundless-forest marked this conversation as resolved.
Show resolved Hide resolved
// Other errors, return directly
return Err(err);
}

// Other errors, return directly
return Err(err);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub fn error_on_execution_failure(reason: &ExitReason, data: &[u8]) -> Result<()
match reason {
ExitReason::Succeed(_) => Ok(()),
ExitReason::Error(e) => {
if *e == ExitError::OutOfGas || *e == ExitError::OutOfFund {
if *e == ExitError::OutOfGas {
// `ServerError(0)` will be useful in estimate gas
return Err(Error {
code: ErrorCode::ServerError(0),
boundless-forest marked this conversation as resolved.
Show resolved Hide resolved
Expand Down