disable tests that need refactor to match new code
This commit is contained in:
parent
9e1be629ca
commit
0dcc324b61
4
TODO.md
4
TODO.md
|
@ -1,5 +1,9 @@
|
||||||
# Todo
|
# Todo
|
||||||
|
|
||||||
|
This is stale. Now that there is more than one dev, important things are tracked in GitHub Issues and Pull Requests.
|
||||||
|
|
||||||
|
One day I'll go through this and make sure everything is done, moved to an issue, or otherwise handled.
|
||||||
|
|
||||||
## MVP
|
## MVP
|
||||||
|
|
||||||
These are roughly in order of completition
|
These are roughly in order of completition
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -261,8 +261,11 @@ impl Web3Rpc {
|
||||||
|
|
||||||
let backup = self.backup;
|
let backup = self.backup;
|
||||||
|
|
||||||
let rate_limit_until =
|
let rate_limit_until = if let Some(hard_limit_until) = self.hard_limit_until.as_ref() {
|
||||||
(*self.hard_limit_until.as_ref().unwrap().borrow()).max(Instant::now());
|
(*hard_limit_until.borrow()).max(Instant::now())
|
||||||
|
} else {
|
||||||
|
Instant::now()
|
||||||
|
};
|
||||||
|
|
||||||
(
|
(
|
||||||
Reverse(rate_limit_until),
|
Reverse(rate_limit_until),
|
||||||
|
|
|
@ -329,17 +329,26 @@ impl OpenRequestHandle {
|
||||||
response,
|
response,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: move this to another helper
|
// TODO: move this to a helper function?
|
||||||
|
// true if we got a jsonrpc result. a jsonrpc error or other error is false.
|
||||||
|
// TODO: counters for errors vs jsonrpc vs success?
|
||||||
let response_is_success = match &response {
|
let response_is_success = match &response {
|
||||||
Ok(jsonrpc::SingleResponse::Parsed(x)) => match &x.payload {
|
Ok(jsonrpc::SingleResponse::Parsed(x)) => {
|
||||||
Payload::Success { .. } => true,
|
matches!(&x.payload, Payload::Success { .. })
|
||||||
_ => true,
|
}
|
||||||
},
|
Ok(jsonrpc::SingleResponse::Stream(..)) => false,
|
||||||
Ok(jsonrpc::SingleResponse::Stream(..)) => true,
|
|
||||||
Err(_) => false,
|
Err(_) => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if response_is_success {
|
if response_is_success {
|
||||||
|
// only track latency for successful requests
|
||||||
|
tokio::spawn(async move {
|
||||||
|
self.rpc.peak_latency.as_ref().unwrap().report(latency);
|
||||||
|
self.rpc.median_latency.as_ref().unwrap().record(latency);
|
||||||
|
|
||||||
|
// TODO: app-wide median and peak latency?
|
||||||
|
});
|
||||||
|
} else {
|
||||||
// only save reverts for some types of calls
|
// only save reverts for some types of calls
|
||||||
// TODO: do something special for eth_sendRawTransaction too
|
// TODO: do something special for eth_sendRawTransaction too
|
||||||
// we do **NOT** use self.error_handler here because it might have been modified
|
// we do **NOT** use self.error_handler here because it might have been modified
|
||||||
|
@ -353,7 +362,7 @@ impl OpenRequestHandle {
|
||||||
|
|
||||||
let response_type: ResponseType = match &response {
|
let response_type: ResponseType = match &response {
|
||||||
Ok(jsonrpc::SingleResponse::Parsed(x)) => match &x.payload {
|
Ok(jsonrpc::SingleResponse::Parsed(x)) => match &x.payload {
|
||||||
Payload::Success { .. } => unimplemented!(),
|
Payload::Success { .. } => unreachable!(),
|
||||||
Payload::Error { error } => {
|
Payload::Error { error } => {
|
||||||
trace!(?error, "jsonrpc error data");
|
trace!(?error, "jsonrpc error data");
|
||||||
|
|
||||||
|
@ -409,10 +418,15 @@ impl OpenRequestHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Ok(_) => unreachable!(),
|
Ok(jsonrpc::SingleResponse::Stream(..)) => unreachable!(),
|
||||||
Err(_) => ResponseType::Error,
|
Err(_) => ResponseType::Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if matches!(response_type, ResponseType::RateLimited) {
|
||||||
|
// TODO: how long?
|
||||||
|
self.rate_limit_for(Duration::from_secs(1));
|
||||||
|
}
|
||||||
|
|
||||||
match error_handler {
|
match error_handler {
|
||||||
RequestErrorHandler::DebugLevel => {
|
RequestErrorHandler::DebugLevel => {
|
||||||
// TODO: think about this revert check more. sometimes we might want reverts logged so this needs a flag
|
// TODO: think about this revert check more. sometimes we might want reverts logged so this needs a flag
|
||||||
|
@ -498,6 +512,7 @@ impl OpenRequestHandle {
|
||||||
warn!(
|
warn!(
|
||||||
%self.web3_request,
|
%self.web3_request,
|
||||||
?response,
|
?response,
|
||||||
|
?err,
|
||||||
"failed parsing eth_call params. unable to save revert",
|
"failed parsing eth_call params. unable to save revert",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -506,13 +521,6 @@ impl OpenRequestHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tokio::spawn(async move {
|
|
||||||
self.rpc.peak_latency.as_ref().unwrap().report(latency);
|
|
||||||
self.rpc.median_latency.as_ref().unwrap().record(latency);
|
|
||||||
|
|
||||||
// TODO: app median latency
|
|
||||||
});
|
|
||||||
|
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue