Module darkfi::validator::verification
source Β· Expand description
Verification functions
Functions§
- Apply given producer
Transaction
to the provided overlay, without formal verification. Returns transaction signature public key. Additionally, append its hash to the provided Merkle tree. - apply_transaction πApply given
Transaction
to the provided overlay. Additionally, append its hash to the provided Merkle tree. - apply_transactions πApply given set of
Transaction
in sequence, without formal verification. In case any of the transactions fail, they will be returned to the caller as an error. Additionally, their hash is appended to the provided Merkle tree. - A block is considered valid when the following rules apply: 1. Block version is correct for its height 2. Parent hash is equal to the hash of the previous block 3. Block height increments previous block height by 1 4. Timestamp is valid based on PoWModule validation 5. Block hash is valid based on PoWModule validation Additional validity rules can be applied.
- A blockchain is considered valid, when every block is valid, based on validate_block checks. Be careful as this will try to load everything in memory.
- Verify given
BlockInfo
, and apply it to the provided overlay. - Verify given checkpoint
BlockInfo
, and apply it to the provided overlay. - Verify given genesis
BlockInfo
, and apply it to the provided overlay. - Verify block proposer signature, using the producer transaction signature as signing key over blocks header hash.
- Verify WASM execution, signatures, and ZK proofs for a given producer
Transaction
, and apply it to the provided overlay. Returns transaction signature public key. Additionally, append its hash to the provided Merkle tree. - Verify given
Proposal
against provided consensus state, A proposal is considered valid when the following rules apply: 1. Proposal hash matches the actual block one 2. Block transactions donβt exceed set limit 3. Block is valid Additional validity rules can be applied. - Verify WASM execution, signatures, and ZK proofs for a given
Transaction
, and apply it to the provided overlay. Additionally, append its hash to the provided Merkle tree. - Verify a set of
Transaction
in sequence and apply them if all are valid. In case any of the transactions fail, they will be returned to the caller as an error. If all transactions are valid, the function will return the total gas used and total paid fees from all the transactions. Additionally, their hash is appended to the provided Merkle tree.