Skip to main content

ProducerInfo

Struct ProducerInfo 

Source
pub struct ProducerInfo {
    pub name: String,
    pub version: String,
    pub candid_version: String,
    pub candid_parser_version: String,
}
Expand description

Untrusted, caller-supplied provenance about the tool that produced a Contract.

Producer metadata is deliberately outside the semantic Contract identities. The candid-core:contract:v1 and candid-core:interface:v1 hashes (see docs/canonicalization-v1.md) are computed over the type graph, declarations, actor, and format/profile markers only — never over producer. Two Contracts that differ only in their producer therefore share the same contract_id and interface_id, even though they are byte-different on the wire (producer is part of the canonical serialized JSON — and identical in every feature configuration). No unkeyed content ID authenticates itself, so neither identity authenticates these claims; a signature over one commits to the semantic Contract and callers must treat producer metadata as unverified.

A caller that must commit to the producer bytes it actually received commits to a detached artifact_id_with_limits instead, and what that binds depends on the ArtifactKind named: ContractJsonV1 covers the Contract document’s octets, producer included and nothing more, while the envelope and compilation kinds cover those octets plus extensions or the provenance sidecar respectively. The semantic identities exclude producer metadata under every kind.

This boundary is load-bearing for compatibility: binding producer into the identity payload would change every existing contract_id. The bytes are still bounded — see crate::Limits::max_producer_bytes — so untrusted producer strings cannot grow without limit; they simply never influence an identity.

Fields§

§name: String§version: String§candid_version: String§candid_parser_version: String

Implementations§

Source§

impl ProducerInfo

Source

pub fn current() -> Self

The producer metadata describing this build of candid-core itself: the crate name and version plus the exact pinned candid and candid_parser dependency versions. This is the producer a ContractDraft builds with when none is supplied explicitly.

The four fields are present and identical in every feature configuration. candid and candid_parser are optional dependencies enabled by the compiler feature, but the versions reported here are read out of this package’s own manifest text at compile time, not from a linked crate, so a default-features = false build of a given candid-core version reports exactly the same producer bytes as a full one. That is deliberate: producer metadata is untrusted provenance about this package, and making it vary by feature would fork the serialized shape of otherwise identical Contracts.

Trait Implementations§

Source§

impl Clone for ProducerInfo

Source§

fn clone(&self) -> ProducerInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProducerInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProducerInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ProducerInfo

Source§

impl PartialEq for ProducerInfo

Source§

fn eq(&self, other: &ProducerInfo) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ProducerInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ProducerInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.