Struct ckb_script::TransactionScriptsVerifier [−][src]
This struct leverages CKB VM to verify transaction inputs.
FlatBufferBuilder owned Vec<u8>
that grows as needed, in the
future, we might refactor this to share buffer to achieve zero-copy
Implementations
impl<'a, DL: CellDataProvider + HeaderProvider> TransactionScriptsVerifier<'a, DL>
[src]
pub fn new(
rtx: &'a ResolvedTransaction,
data_loader: &'a DL
) -> TransactionScriptsVerifier<'a, DL>
[src]
rtx: &'a ResolvedTransaction,
data_loader: &'a DL
) -> TransactionScriptsVerifier<'a, DL>
Creates a script verifier for the transaction.
Params
rtx
- transaction which cell out points have been resolved.data_loader
- used to load cell data.
pub fn set_debug_printer<F: Fn(&Byte32, &str) + 'static>(&mut self, func: F)
[src]
Sets a callback to handle the debug syscall.
Script can print a message using the debug syscall.
The callback receives two parameters:
hash: &Byte32
: this is the script hash of currently running script group.message: &str
: message passed to the debug syscall.
pub fn extract_script(&self, script: &'a Script) -> Result<Bytes, ScriptError>
[src]
Extracts actual script binary either in dep cells.
pub fn verify(&self, max_cycles: Cycle) -> Result<Cycle, Error>
[src]
Verifies the transaction by running scripts.
Params
max_cycles
- Maximium allowed cycles to run the scripts. The verification quits early when the consumed cycles exceed the limit.
Returns
It returns the total consumed cycles on success, Otherwise it returns the verification error.
pub fn verify_single(
&self,
script_group_type: ScriptGroupType,
script_hash: &Byte32,
max_cycles: Cycle
) -> Result<Cycle, ScriptError>
[src]
&self,
script_group_type: ScriptGroupType,
script_hash: &Byte32,
max_cycles: Cycle
) -> Result<Cycle, ScriptError>
Runs a single script in current transaction, while this is not useful for CKB itself, it can be very helpful when building a CKB debugger.
pub fn find_script_group(
&self,
script_group_type: ScriptGroupType,
script_hash: &Byte32
) -> Option<&ScriptGroup>
[src]
&self,
script_group_type: ScriptGroupType,
script_hash: &Byte32
) -> Option<&ScriptGroup>
Finds the script group from cell deps.
pub fn cost_model(&self) -> Box<InstructionCycleFunc>
[src]
Gets the cost model.
Cost model is used to evaluate consumed cycles.
pub fn generate_syscalls(
&'a self,
script_group: &'a ScriptGroup
) -> Vec<Box<dyn Syscalls<Box<AsmCoreMachine>> + 'a>>
[src]
&'a self,
script_group: &'a ScriptGroup
) -> Vec<Box<dyn Syscalls<Box<AsmCoreMachine>> + 'a>>
Prepares syscalls.
Auto Trait Implementations
impl<'a, DL> !RefUnwindSafe for TransactionScriptsVerifier<'a, DL>
impl<'a, DL> !Send for TransactionScriptsVerifier<'a, DL>
impl<'a, DL> !Sync for TransactionScriptsVerifier<'a, DL>
impl<'a, DL> Unpin for TransactionScriptsVerifier<'a, DL>
impl<'a, DL> !UnwindSafe for TransactionScriptsVerifier<'a, DL>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,