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
zkvm: refactor encoding/decoding #424
Comments
This was referenced Apr 24, 2020
But CustomMessage trait placed in p2p, so p2p will be in blockchain dependencies. Moving this trait into another place seems illogical to me. |
How about this:
|
Final results:
|
#430 seems to be the final nail in this coffin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We currently have multiple uses for encoding throughout
zkvm
,blockchain
andp2p
crates:Downsides of the current approach:
zkvm::Contract::id()
andblockchain::BlockTx::witness_hash()
).bytes::BytesMut
/BufMut
), but keep the rest of the system independent from Tokio or any I/O framework.Requirements
We need a pair of traits
Reader/Writer
akin to Buf/BufMut, but with several modifications:&'static str
that can be used with the Transcript (or JSON ;-)) Binary buffers will simply ignore the label._le
explicit in the naming, though.)Organization
readerwriter
crate.bytes
(for interop with Bytes/Buf), with corresponding modulebytes_impls.rs
enabled on#[cfg(feature="bytes")]
.merlin
(for interop with Transcript), with corresponding modulemerlin_impls.rs
enabled on#[cfg(feature="merlin")]
.zkvm
depends onreaderwriter
, SliceReader is removed.zkvm
andblockchain
: encoding/decoding methods are changed to use Reader/Writer API. Hashing is redefined in the spec to write data to transcript field-by-field.blockchain
depends onreaderwriter
, but not onp2p
.p2p
uses samereaderwriter
API for its encoding needs.The text was updated successfully, but these errors were encountered: