Add trace information to eth_estimateGas (#10519)

* Add trace information to eth_estimateGas

* replace unwrap better version

* change vm::Error formatter to more user-friendly

* remove extra error format

* use map_or instead sequence of map/unwrap_or
This commit is contained in:
Kirill Fomichev
2019-03-27 10:01:05 +03:00
committed by soc1c
parent aa8487c1d0
commit 3b23817936
3 changed files with 17 additions and 12 deletions

View File

@@ -173,11 +173,11 @@ pub fn state_corrupt() -> Error {
internal("State corrupt", "")
}
pub fn exceptional() -> Error {
pub fn exceptional<T: fmt::Display>(data: T) -> Error {
Error {
code: ErrorCode::ServerError(codes::EXCEPTION_ERROR),
message: "The execution failed due to an exception.".into(),
data: None,
data: Some(Value::String(data.to_string())),
}
}
@@ -467,7 +467,7 @@ pub fn call(error: CallError) -> Error {
match error {
CallError::StatePruned => state_pruned(),
CallError::StateCorrupt => state_corrupt(),
CallError::Exceptional => exceptional(),
CallError::Exceptional(e) => exceptional(e),
CallError::Execution(e) => execution(e),
CallError::TransactionNotFound => internal("{}, this should not be the case with eth_call, most likely a bug.", CallError::TransactionNotFound),
}