Struct ckb_script::TransactionScriptsVerifier [−][src]
pub struct TransactionScriptsVerifier<'a, DL> { /* fields omitted */ }
Expand description
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
pub fn new(
rtx: &'a ResolvedTransaction,
data_loader: &'a DL
) -> TransactionScriptsVerifier<'a, DL>
pub fn new(
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.
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.
Extracts actual script binary either in dep cells.
pub fn verify_single(
&self,
script_group_type: ScriptGroupType,
script_hash: &Byte32,
max_cycles: Cycle
) -> Result<Cycle, ScriptError>
pub fn verify_single(
&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>
pub fn find_script_group(
&self,
script_group_type: ScriptGroupType,
script_hash: &Byte32
) -> Option<&ScriptGroup>
Finds the script group from cell deps.
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>>
pub fn generate_syscalls(
&'a self,
script_group: &'a ScriptGroup
) -> Vec<Box<dyn Syscalls<Box<AsmCoreMachine>> + 'a>>
Prepares syscalls.