pub struct StreamSlashData {
pub hash: B256,
pub ok: bool,
pub rate_per_mb: u64,
pub total_bytes: u64,
pub pool_id: B256,
pub timestamp_us: u64,
}Expand description
The signed field set of a StreamResponse (ADR 014 §1).
hash and pool_id are request-context fields echoed back in the
response body; timestamp_us is the requester-generated timestamp echoed
from the StreamRequest. Together with ok, rate_per_mb, and
total_bytes, these are exactly the fields the on-chain SlashJudge
reconstructs to verify rate-manipulation and blacklist-violation evidence.
Fields§
§hash: B256BLAKE3 hash of the delivered blob (iroh Hash bytes).
ok: boolWhether the node committed to serving the blob.
rate_per_mb: u64The node’s quoted rate in token base units per MB.
total_bytes: u64Total blob size in bytes.
pool_id: B256The shared payment pool this response is bound to.
timestamp_us: u64Requester-generated microsecond timestamp echoed from the request.
Implementations§
Source§impl StreamSlashData
impl StreamSlashData
Sourcepub fn from_response_body(body: &StreamResponseBody) -> Self
pub fn from_response_body(body: &StreamResponseBody) -> Self
Build the signed-field view from a wire StreamResponseBody.
Sourcepub fn signing_hash(&self, domain: &Eip712Domain) -> B256
pub fn signing_hash(&self, domain: &Eip712Domain) -> B256
EIP-712 signing hash bound to domain. This is the 32-byte digest
passed into ecrecover on-chain; it depends only on the data and
domain and is independent of the signing key.
Sourcepub fn struct_hash(&self) -> B256
pub fn struct_hash(&self) -> B256
EIP-712 struct hash (keccak256(abi.encode(STREAM_RESPONSE_TYPEHASH, fields...))), independent of any domain — the per-message hash
SlashJudge folds into its evidenceHash commit (#1032, G-NODE-05).
Sourcepub fn sign<S: SignerSync>(
&self,
signer: &S,
domain: &Eip712Domain,
) -> Result<Signature, Error>
pub fn sign<S: SignerSync>( &self, signer: &S, domain: &Eip712Domain, ) -> Result<Signature, Error>
Sign the stream response with signer for the given EIP-712 domain,
returning the 65-byte (r‖s‖v) signature for the wire slash_sig.
§Errors
Propagates any error returned by the underlying signer (key locked, remote signer offline, etc.).
Sourcepub fn recover_signer(
&self,
signature: &Signature,
domain: &Eip712Domain,
) -> Result<Address, StreamSlashError>
pub fn recover_signer( &self, signature: &Signature, domain: &Eip712Domain, ) -> Result<Address, StreamSlashError>
Recover the address that produced signature over this data under
domain.
§Errors
Returns StreamSlashError::InvalidSignature if the signature is
malformed (non-canonical s, invalid recovery id, etc.).
Sourcepub fn verify_signer(
&self,
signature: &Signature,
expected: Address,
domain: &Eip712Domain,
) -> Result<(), StreamSlashError>
pub fn verify_signer( &self, signature: &Signature, expected: Address, domain: &Eip712Domain, ) -> Result<(), StreamSlashError>
Verify signature was produced by expected for domain.
§Errors
StreamSlashError::InvalidSignature— signature is malformed.StreamSlashError::WrongSigner— recovered address differs fromexpected.
Trait Implementations§
Source§impl Clone for StreamSlashData
impl Clone for StreamSlashData
impl Copy for StreamSlashData
Source§impl Debug for StreamSlashData
impl Debug for StreamSlashData
impl Eq for StreamSlashData
Source§impl PartialEq for StreamSlashData
impl PartialEq for StreamSlashData
impl StructuralPartialEq for StreamSlashData
Auto Trait Implementations§
impl Freeze for StreamSlashData
impl RefUnwindSafe for StreamSlashData
impl Send for StreamSlashData
impl Sync for StreamSlashData
impl Unpin for StreamSlashData
impl UnsafeUnpin for StreamSlashData
impl UnwindSafe for StreamSlashData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more