Syscalls

Trait Syscalls 

Source
pub trait Syscalls {
    // Required methods
    fn verify_signature(
        &self,
        signature: &Signature,
        signer: &Address,
        plaintext: &[u8],
    ) -> Result<(), Error>;
    fn hash_blake2b(&self, data: &[u8]) -> [u8; 32];
    fn compute_unsealed_sector_cid(
        &self,
        proof_type: RegisteredSealProof,
        pieces: &[PieceInfo],
    ) -> Result<Cid, Error>;
    fn verify_seal(&self, vi: &SealVerifyInfo) -> Result<(), Error>;
    fn verify_post(
        &self,
        verify_info: &WindowPoStVerifyInfo,
    ) -> Result<(), Error>;
    fn verify_consensus_fault(
        &self,
        h1: &[u8],
        h2: &[u8],
        extra: &[u8],
    ) -> Result<Option<ConsensusFault>, Error>;
    fn verify_aggregate_seals(
        &self,
        aggregate: &AggregateSealVerifyProofAndInfos,
    ) -> Result<(), Error>;

    // Provided method
    fn batch_verify_seals(&self, batch: &[SealVerifyInfo]) -> Result<Vec<bool>> { ... }
}
Expand description

Pure functions implemented as primitives by the runtime.

Required Methods§

Source

fn verify_signature( &self, signature: &Signature, signer: &Address, plaintext: &[u8], ) -> Result<(), Error>

Verifies that a signature is valid for an address and plaintext.

Source

fn hash_blake2b(&self, data: &[u8]) -> [u8; 32]

Hashes input data using blake2b with 256 bit output.

Source

fn compute_unsealed_sector_cid( &self, proof_type: RegisteredSealProof, pieces: &[PieceInfo], ) -> Result<Cid, Error>

Computes an unsealed sector CID (CommD) from its constituent piece CIDs (CommPs) and sizes.

Source

fn verify_seal(&self, vi: &SealVerifyInfo) -> Result<(), Error>

Verifies a sector seal proof.

Source

fn verify_post(&self, verify_info: &WindowPoStVerifyInfo) -> Result<(), Error>

Verifies a window proof of spacetime.

Source

fn verify_consensus_fault( &self, h1: &[u8], h2: &[u8], extra: &[u8], ) -> Result<Option<ConsensusFault>, Error>

Verifies that two block headers provide proof of a consensus fault:

  • both headers mined by the same actor
  • headers are different
  • first header is of the same or lower epoch as the second
  • at least one of the headers appears in the current chain at or after epoch earliest
  • the headers provide evidence of a fault (see the spec for the different fault types). The parameters are all serialized block headers. The third “extra” parameter is consulted only for the “parent grinding fault”, in which case it must be the sibling of h1 (same parent tipset) and one of the blocks in the parent of h2 (i.e. h2’s grandparent). Returns nil and an error if the headers don’t prove a fault.
Source

fn verify_aggregate_seals( &self, aggregate: &AggregateSealVerifyProofAndInfos, ) -> Result<(), Error>

Provided Methods§

Implementors§