-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update jsonrpc dependencies and rewrite dapps to futures. #6522
Conversation
doesn't build.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall, looks fine, but the pr of that size is simply unreviewable
Cargo.toml
Outdated
@@ -117,4 +117,5 @@ lto = false | |||
panic = "abort" | |||
|
|||
[workspace] | |||
members = ["ethstore/cli", "ethkey/cli", "evmbin", "whisper", "chainspec", "dapps/node-health"] | |||
members = ["ethstore/cli", "ethkey/cli", "evmbin", "whisper", "chainspec"] | |||
exclude = ["dapps/js-glue"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it excluded?
dapps/src/handlers/fetch.rs
Outdated
FetchState::Done(_, ref mut response) => { | ||
return response.poll() | ||
}, | ||
_ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's reachable by FetchState::Empty
FetchState::Streaming(response) => { | ||
return Ok(futures::Async::Ready(response)); | ||
}, | ||
any => any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo, it's better to write:
if let FetchState::Error(ref mut error) = self.status {
// here do mem::replace on error
// and return Ok(..)
}
if let FetchState::Streaming(ref mut response) = self.response {
// here do mem::replace on response
// and return Ok(..)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't give you the ownership of error
required for return
.
dapps/src/handlers/reader.rs
Outdated
|
||
const MAX_CHUNK_SIZE: usize = 32 * 1024; | ||
|
||
pub struct Reader<R: io::Read> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This structure requires very descriptive documentation. I've spent over 10 minutes looking at it to understand why it's done like that.
And if I understand correctly, sending
is a sink, which sends data directly to a server client. Is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I can see that hyper::Response
is generic over Body
, so maybe there is a way to use it with every structure which implements stream of Chunks
? Or anything that implements AsRef<u8>
. Anyway, even if this is not possible now, maybe we should just open an issue in hyper repo. Just to avoid unnecessary allocation, when read value is moved to a heap when creating a `Chunk.
There are a lot of warnings about |
The warnings are most likely coming from |
@tomusdrw exact list of libs with warnings, mined from this log - https://travis-ci.org/cyberFund/cybernode/builds/281880085#L1321
|
With versions:
|
So because most of the lines are in That said, I'm fine with doing that if @paritytech/core-devs believe it will help with getting this PR through. |
} | ||
|
||
fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { | ||
future::done(self.block(num.into(), include_txs)).boxed() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the change from .boxed()
to Box::new
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boxed()
has been deprecated. rust-lang/futures-rs#228
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation is that .boxed()
requires Future + Send + 'static
and sometimes it's not needed. Wrapping with Box::new
covers both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And usage of boxed causes warning during the compilation. It litters the build log significantly
@@ -274,10 +274,6 @@ impl ClusterCore { | |||
Box::new(net_connect(&node_address, handle, data.self_key_pair.clone(), disconnected_nodes) | |||
.then(move |result| ClusterCore::process_connection_result(data, Some(node_address), result)) | |||
.then(|_| finished(()))) | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks!
It is still |
futures
to latest version and removes all.boxed()
andBoxFuture
occurrences (deprecated).Awaiting for paritytech/jsonrpc#199 to be reviewed and merged first (so that we can branch out asparity-1.8
)Closes #6261, #6476