mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-08 21:08:04 -05:00
add methods wants_write and wants_read and remove mpc
This commit is contained in:
5
Cargo.lock
generated
5
Cargo.lock
generated
@@ -3176,11 +3176,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "futures-plex"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/tlsnotary/tlsn-utils?rev=0b46dc0#0b46dc0b11229bd606c6262de0de5ac8f2b76f41"
|
||||
source = "git+https://github.com/tlsnotary/tlsn-utils?rev=a35cd02#a35cd02c465534f6126941c8b3b695fd78cacf49"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"futures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -80,7 +80,7 @@ mpz-zk = { git = "https://github.com/privacy-ethereum/mpz", rev = "bd80826" }
|
||||
mpz-hash = { git = "https://github.com/privacy-ethereum/mpz", rev = "bd80826" }
|
||||
mpz-ideal-vm = { git = "https://github.com/privacy-ethereum/mpz", rev = "bd80826" }
|
||||
|
||||
futures-plex = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "0b46dc0" }
|
||||
futures-plex = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "a35cd02" }
|
||||
rangeset = { version = "0.2" }
|
||||
serio = { version = "0.2" }
|
||||
spansy = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "6168663" }
|
||||
|
||||
@@ -231,13 +231,14 @@ impl Prover<state::CommitAccepted> {
|
||||
Ok(prover)
|
||||
}
|
||||
|
||||
/// Writes bytes for the verifier into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_mpc(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
/// Returns `true` if the prover wants to read data from the verifier.
|
||||
pub fn wants_read_verifier(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining_mut() > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if the prover wants to write data to the verifier.
|
||||
pub fn wants_write_verifier(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining() > 0
|
||||
}
|
||||
|
||||
/// Reads bytes for the prover from a buffer.
|
||||
@@ -245,9 +246,18 @@ impl Prover<state::CommitAccepted> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn read_mpc(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
pub fn read_verifier(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the verifier into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_verifier(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
}
|
||||
}
|
||||
|
||||
impl Prover<state::Connected> {
|
||||
@@ -307,13 +317,14 @@ impl Prover<state::Connected> {
|
||||
self.state.tls_client.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the verifier into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_mpc(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
/// Returns `true` if the prover wants to read data from the verifier.
|
||||
pub fn wants_read_verifier(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining_mut() > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if the prover wants to write data to the verifier.
|
||||
pub fn wants_write_verifier(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining() > 0
|
||||
}
|
||||
|
||||
/// Reads bytes for the prover from a buffer.
|
||||
@@ -321,10 +332,19 @@ impl Prover<state::Connected> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn read_mpc(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
pub fn read_verifier(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the verifier into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_verifier(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
}
|
||||
|
||||
/// Closes the connection from the client side.
|
||||
pub fn client_close(&mut self) -> Result<(), ProverError> {
|
||||
self.state.tls_client.client_close()
|
||||
@@ -411,13 +431,14 @@ impl Prover<state::Committed> {
|
||||
&self.state.transcript
|
||||
}
|
||||
|
||||
/// Writes bytes for the verifier into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_mpc(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
/// Returns `true` if the prover wants to read data from the verifier.
|
||||
pub fn wants_read_verifier(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining_mut() > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if the prover wants to write data to the verifier.
|
||||
pub fn wants_write_verifier(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining() > 0
|
||||
}
|
||||
|
||||
/// Reads bytes for the prover from a buffer.
|
||||
@@ -425,10 +446,19 @@ impl Prover<state::Committed> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn read_mpc(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
pub fn read_verifier(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the verifier into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_verifier(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
}
|
||||
|
||||
/// Proves information to the verifier.
|
||||
///
|
||||
/// # Arguments
|
||||
|
||||
@@ -186,13 +186,14 @@ impl Verifier<state::CommitStart> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_mpc(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
/// Returns `true` if the verifier wants to read data from the prover.
|
||||
pub fn wants_read_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining_mut() > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if the verifier wants to write data to the prover.
|
||||
pub fn wants_write_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining() > 0
|
||||
}
|
||||
|
||||
/// Reads bytes for the verifier from a buffer.
|
||||
@@ -200,9 +201,18 @@ impl Verifier<state::CommitStart> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn read_mpc(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
pub fn read_prover(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_prover(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
}
|
||||
}
|
||||
|
||||
impl Verifier<state::CommitAccepted> {
|
||||
@@ -278,13 +288,14 @@ impl Verifier<state::CommitAccepted> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_mpc(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
/// Returns `true` if the verifier wants to read data from the prover.
|
||||
pub fn wants_read_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining_mut() > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if the verifier wants to write data to the prover.
|
||||
pub fn wants_write_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining() > 0
|
||||
}
|
||||
|
||||
/// Reads bytes for the verifier from a buffer.
|
||||
@@ -292,9 +303,18 @@ impl Verifier<state::CommitAccepted> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn read_mpc(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
pub fn read_prover(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_prover(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
}
|
||||
}
|
||||
|
||||
impl Verifier<state::Committed> {
|
||||
@@ -342,13 +362,14 @@ impl Verifier<state::Committed> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_mpc(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
/// Returns `true` if the verifier wants to read data from the prover.
|
||||
pub fn wants_read_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining_mut() > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if the verifier wants to write data to the prover.
|
||||
pub fn wants_write_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining() > 0
|
||||
}
|
||||
|
||||
/// Reads bytes for the verifier from a buffer.
|
||||
@@ -356,10 +377,19 @@ impl Verifier<state::Committed> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn read_mpc(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
pub fn read_prover(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_prover(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
}
|
||||
|
||||
/// Closes the connection with the prover.
|
||||
#[instrument(parent = &self.span, level = "info", skip_all, err)]
|
||||
pub async fn close(self) -> Result<(), VerifierError> {
|
||||
@@ -475,13 +505,14 @@ impl Verifier<state::Verify> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_mpc(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
/// Returns `true` if the verifier wants to read data from the prover.
|
||||
pub fn wants_read_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining_mut() > 0
|
||||
}
|
||||
|
||||
/// Returns `true` if the verifier wants to write data to the prover.
|
||||
pub fn wants_write_prover(&self) -> bool {
|
||||
self.state.mpc_duplex.remaining() > 0
|
||||
}
|
||||
|
||||
/// Reads bytes for the verifier from a buffer.
|
||||
@@ -489,7 +520,16 @@ impl Verifier<state::Verify> {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn read_mpc(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
pub fn read_prover(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.write(buf)
|
||||
}
|
||||
|
||||
/// Writes bytes for the prover into a buffer.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `buf` - The buffer.
|
||||
pub fn write_prover(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.state.mpc_duplex.read(buf)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user