### **Biweekly Update** #### **Recent Progress** ##### **Key Tasks or Features Worked On** - The IL-EVM supports two major modes: **Pattern Matching** and **JIT**. - **Pattern Matching**: This mode involves replacing a sequence of opcodes with a non-IL (Intermediate Language) implementation. This approach can potentially improve performance by combining opcodes, allowing simpler and faster execution compared to the traditional method of processing each opcode individually. But is primarily targetted towards pattern detection. - **JIT Mode**: Activated when code surpasses a call threshold, this mode compiles opcodes using the Intermediate Language of .NET. This enables more optimized execution for frequently executed code segments and also leverages dotnet's JIT optimization of IL. - The first set of patterns has been merged. A pull request for a second set, consisting of **11 larger patterns (5-8 opcodes each)**, is currently under review. [PR #7638](https://github.com/NethermindEth/nethermind/pull/7638). - A **script** was developed to automate the selection of the next opcode patterns for development. This script utilizes the output from the stat analyzer’s JSON file, ensuring that selected patterns do not overlap with already completed implementations. - Towards the end of last week, efforts shifted towards **testing IL-EVM opcode implementations**. This is a complex task due to the challenge of debugging IL implementations, which are not accessible via traditional debugging tools. ##### **Bug Fixes or Code Improvements** - Testing includes validation of **endianness** and **metadata**. While running a basic test to verify stack behavior and storage changes (via `sstore`), some issues were encountered. These are currently under investigation to see if its a test issue or an implementation issue. #### **Challenges or Blockers** ##### **Key Challenges** - One of the biggest challenges involved filtering out opcode patterns that already included completed patterns. A shell script was created to address this, allowing for efficient pattern selection by excluding those with existing implementations. ```sh #!/bin/bash # Check if the JSON file argument is provided if [ -z "$1" ]; then echo "Usage: $0 <json-file>" exit 1 fi json_file="$1" # Define the array of ignore patterns ignore_patterns=("PUSH1 PUSH1 MSTORE CALLVALUE DUP1" "EXTCODESIZE DUP1 ISZERO" "POP POP" "POP JUMP" "SWAP1 POP" "SWAP2 POP" "PUSH1 PUSH1 SHL" "DUP1 PUSH4 EQ" "DUP1 PUSH4 GT" "DUP2 MSTORE" "PUSH1 DUP2" "PUSH1 DUP3" "SWAP2 SWAP1" "PUSH2 JUMP" "PUSH2 JUMPI") # Check if the ignore_patterns array is empty if [ ${#ignore_patterns[@]} -eq 0 ]; then cat "$json_file" | jq ".stats | .[].pattern | select(length > 28)" | less else # Initialize the sed command sed_command="" # If the array is not empty, construct the sed command for pattern in "${ignore_patterns[@]}"; do modified_pattern=$(echo "$pattern" | sed 's/ /.* /g') # Append the delete command for this pattern to sed sed_command+=" /^.*$modified_pattern/d;" done # Use the constructed sed command within the pipeline cat "$json_file" | jq ".stats | .[].pattern | select(length > 20)" | sed "$sed_command" | less fi ``` ##### **Unresolved Issues** - Errors encountered in basic stack and `sstore` tests require further debugging. Additional support might be necessary if challenges persist with endianness or IL-specific implementation issues. #### **Immediate Next Steps (Next Month)** ##### **Top Priorities** - Focus remains on **testing and debugging IL-EVM opcode implementations**. The goal is to stabilize the node as much as possible before moving to the **benchmarking** phase. - This testing process will likely extend beyond the current target EPF completion date due to its complexity. Further emphasis on debugging and stability will ensure the node's readiness for benchmarks.