Expand description
Expression evaluation system for EDB.
This module provides a comprehensive expression evaluation system that enables real-time evaluation of Solidity-like expressions against debug snapshots. It supports variables, function calls, arithmetic operations, and blockchain context.
§Main Components
ExpressionEvaluator- Main evaluator for parsing and executing expressionshandlers- Handler traits and implementations for different evaluation contexts- Common types and utilities for expression evaluation
§Basic Usage
ⓘ
use edb_engine::eval::{ExpressionEvaluator, handlers::EdbHandler};
// Create evaluator with EDB handlers
let handlers = EdbHandler::create_handlers(engine_context);
let evaluator = ExpressionEvaluator::new(handlers);
// Evaluate expressions
let result = evaluator.eval("balances[msg.sender]", snapshot_id)?;
let result = evaluator.eval("totalSupply() > 1000000", snapshot_id)?;
let result = evaluator.eval("block.timestamp - lastUpdate > 3600", snapshot_id)?;§Supported Expressions
- Variables:
balance,owner,this - Mappings/Arrays:
balances[addr],users[0] - Function Calls:
balanceOf(user),totalSupply() - Member Access:
token.symbol,addr.balance - Arithmetic:
+,-,*,/,%,** - Comparison:
==,!=,<,<=,>,>= - Logical:
&&,||,! - Ternary:
condition ? true_value : false_value - Type Casting:
uint256(value),address(0x123...) - Blockchain Context:
msg.sender,msg.value,block.number,tx.origin
Modules§
- handlers
- Handler traits and types for the expression evaluator.
Structs§
- Expression
Evaluator - Main expression evaluator for Solidity-like expressions.
Functions§
- eval_
on_ snapshot - Evaluate a Solidity expression string within the context of a specific debug snapshot.