diff --git a/fvm/src/kernel/default.rs b/fvm/src/kernel/default.rs index 5e5c0a9b9d..4601d8f6d3 100644 --- a/fvm/src/kernel/default.rs +++ b/fvm/src/kernel/default.rs @@ -593,17 +593,6 @@ where })) } - fn verify_post(&self, verify_info: &WindowPoStVerifyInfo) -> Result { - let t = self - .call_manager - .charge_gas(self.call_manager.price_list().on_verify_post(verify_info))?; - - // This is especially important to catch as, otherwise, a bad "post" could be undisputable. - t.record(catch_and_log_panic("verifying post", || { - verify_post(verify_info) - })) - } - fn verify_consensus_fault( &self, h1: &[u8], diff --git a/fvm/src/kernel/mod.rs b/fvm/src/kernel/mod.rs index 13ccffc719..8572d8b2a8 100644 --- a/fvm/src/kernel/mod.rs +++ b/fvm/src/kernel/mod.rs @@ -304,9 +304,6 @@ pub trait CryptoOps { pieces: &[PieceInfo], ) -> Result; - /// Verifies a window proof of spacetime. - fn verify_post(&self, verify_info: &WindowPoStVerifyInfo) -> Result; - /// Verifies that two block headers provide proof of a consensus fault: /// - both headers mined by the same actor /// - headers are different diff --git a/fvm/src/syscalls/crypto.rs b/fvm/src/syscalls/crypto.rs index e389e87847..993db0f7fc 100644 --- a/fvm/src/syscalls/crypto.rs +++ b/fvm/src/syscalls/crypto.rs @@ -9,7 +9,6 @@ use fvm_shared::crypto::signature::{ use fvm_shared::piece::PieceInfo; use fvm_shared::sector::{ AggregateSealVerifyProofAndInfos, RegisteredSealProof, ReplicaUpdateInfo, SealVerifyInfo, - WindowPoStVerifyInfo, }; use fvm_shared::sys; use num_traits::FromPrimitive; @@ -124,25 +123,6 @@ pub fn compute_unsealed_sector_cid( context.memory.write_cid(&cid, cid_off, cid_len) } -/// Verifies a window proof of spacetime. -/// -/// The return i32 indicates the status code of the verification: -/// - 0: verification ok. -/// - -1: verification failed. -pub fn verify_post( - context: Context<'_, impl Kernel>, - info_off: u32, // WindowPoStVerifyInfo, - info_len: u32, -) -> Result { - let info = context - .memory - .read_cbor::(info_off, info_len)?; - context - .kernel - .verify_post(&info) - .map(|v| if v { 0 } else { -1 }) -} - /// Verifies that two block headers provide proof of a consensus fault: /// - both headers mined by the same actor /// - headers are different diff --git a/fvm/src/syscalls/filecoin.rs b/fvm/src/syscalls/filecoin.rs new file mode 100644 index 0000000000..f8fcd388d6 --- /dev/null +++ b/fvm/src/syscalls/filecoin.rs @@ -0,0 +1,25 @@ +use fvm_shared::sector::WindowPoStVerifyInfo; + +use crate::kernel::FilecoinKernel; + +use super::Context; +use crate::kernel::Result; + +/// Verifies a window proof of spacetime. +/// +/// The return i32 indicates the status code of the verification: +/// - 0: verification ok. +/// - -1: verification failed. +pub fn verify_post( + context: Context<'_, impl FilecoinKernel>, + info_off: u32, // WindowPoStVerifyInfo, + info_len: u32, +) -> Result { + let info = context + .memory + .read_cbor::(info_off, info_len)?; + context + .kernel + .verify_post(&info) + .map(|v| if v { 0 } else { -1 }) +} diff --git a/fvm/src/syscalls/mod.rs b/fvm/src/syscalls/mod.rs index 6aff7e7cd0..9fc845fdef 100644 --- a/fvm/src/syscalls/mod.rs +++ b/fvm/src/syscalls/mod.rs @@ -19,6 +19,7 @@ mod context; mod crypto; mod debug; mod event; +mod filecoin; mod gas; mod ipld; mod network; @@ -301,7 +302,6 @@ where crypto::recover_secp_public_key, )?; linker.bind("crypto", "hash", crypto::hash)?; - linker.bind("crypto", "verify_post", crypto::verify_post)?; linker.bind( "crypto", "compute_unsealed_sector_cid", @@ -355,7 +355,7 @@ where self.0.bind_syscalls(linker)?; // Now bind the crypto syscalls. - linker.bind("crypto", "verify_post", crypto::verify_post)?; + linker.bind("crypto", "verify_post", filecoin::verify_post)?; Ok(()) }