Optimize EVM ICS23 (#1613)
# Optimizations - Using custom and specific data types for all ics23 related stuff including specs. - Removed batch support. - Inlined `doHashOp` to support only `SHA256`. - Inlined `doLengthOp` to support only `VAR_PROTO`. - Removed spec compatibility checks regarding `hashOp` and `lengthOp` since we force them to be `SHA256` and `VAR_PROTO` now. - Inlined chained membership verification for loop. - Inlined all the common parts in specs. # Test improvements - Use `vm.pauseGasMeasurement()` and `vm.resumeGasMeasurement()` to only measure what's needed. # Results Seems like depending on the data, the improvements are around 40%. ## `main` branch with gas measurement improvements included ``` [PASS] test_accountExist() (gas: 262777) [PASS] test_accountNonExistence() (gas: 425305) [PASS] test_clientStateExist() (gas: 264675) [PASS] test_connectionExist() (gas: 262470) [PASS] test_existenceProofKeyMismatch() (gas: 112412) [PASS] test_existenceProofRootMismatch() (gas: 264297) [PASS] test_existenceProofValueMismatch() (gas: 114085) ``` ## This branch ``` [PASS] test_accountExistEthAbi() (gas: 95337) [PASS] test_accountNonExistenceEthAbi() (gas: 187945) [PASS] test_clientStateExist() (gas: 107367) [PASS] test_connectionExist() (gas: 105693) [PASS] test_existenceProofKeyMismatch() (gas: 71621) [PASS] test_existenceProofRootMismatch() (gas: 108029) [PASS] test_existenceProofValueMismatch() (gas: 72481) ``` ## This branch, optimized: ``` [PASS] test_accountExistEthAbi() (gas: 53711) [PASS] test_accountNonExistenceEthAbi() (gas: 97332) [PASS] test_clientStateExist() (gas: 65410) [PASS] test_connectionExist() (gas: 63781) [PASS] test_existenceProofKeyMismatch() (gas: 50192) [PASS] test_existenceProofRootMismatch() (gas: 65457) [PASS] test_existenceProofValueMismatch() (gas: 50775) ``` Closes #1024
B
ben committed
68c0a7490cf983aa938542563c57f48567c6b4ae
Committed by GitHub <noreply@github.com>
on 3/28/2024, 9:53:17 PM