Trait forest_runtime::Syscalls
source · [−]pub trait Syscalls {
fn verify_signature(
&self,
signature: &Signature,
signer: &Address,
plaintext: &[u8]
) -> Result<(), Box<dyn StdError>>;
fn verify_seal(&self, vi: &SealVerifyInfo) -> Result<(), Box<dyn StdError>>;
fn verify_post(
&self,
verify_info: &WindowPoStVerifyInfo
) -> Result<bool, Box<dyn StdError>>;
fn verify_consensus_fault(
&self,
h1: &[u8],
h2: &[u8],
extra: &[u8]
) -> Result<Option<ConsensusFault>, Box<dyn StdError>>;
fn verify_aggregate_seals(
&self,
aggregate: &AggregateSealVerifyProofAndInfos
) -> Result<(), Box<dyn StdError>>;
fn hash_blake2b(&self, data: &[u8]) -> Result<[u8; 32], Box<dyn StdError>> { ... }
fn compute_unsealed_sector_cid(
&self,
proof_type: RegisteredSealProof,
pieces: &[PieceInfo]
) -> Result<Cid, Box<dyn StdError>> { ... }
fn batch_verify_seals(
&self,
vis: &[(&Address, &Vec<SealVerifyInfo>)]
) -> Result<HashMap<Address, Vec<bool>>, Box<dyn StdError>> { ... }
}
Expand description
Pure functions implemented as primitives by the runtime.
Required methods
Verifies that a signature is valid for an address and plaintext.
fn verify_seal(&self, vi: &SealVerifyInfo) -> Result<(), Box<dyn StdError>>
fn verify_seal(&self, vi: &SealVerifyInfo) -> Result<(), Box<dyn StdError>>
Verifies a sector seal proof.
fn verify_post(
&self,
verify_info: &WindowPoStVerifyInfo
) -> Result<bool, Box<dyn StdError>>
fn verify_post(
&self,
verify_info: &WindowPoStVerifyInfo
) -> Result<bool, Box<dyn StdError>>
Verifies a window proof of spacetime.
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.
fn verify_aggregate_seals(
&self,
aggregate: &AggregateSealVerifyProofAndInfos
) -> Result<(), Box<dyn StdError>>
Provided methods
Hashes input data using blake2b with 256 bit output.
fn compute_unsealed_sector_cid(
&self,
proof_type: RegisteredSealProof,
pieces: &[PieceInfo]
) -> Result<Cid, Box<dyn StdError>>
fn compute_unsealed_sector_cid(
&self,
proof_type: RegisteredSealProof,
pieces: &[PieceInfo]
) -> Result<Cid, Box<dyn StdError>>
Computes an unsealed sector CID (CommD) from its constituent piece CIDs (CommPs) and sizes.