[go: up one dir, main page]

EVM/Execution: rely on caching for r/w access of global storage slots

Context

See Etherlink Benchmarks for a quick overview of the issue.

The goal is to rely on a cache for r/w access of global storage slots to avoid the overhead of always accessing the durable storage, by doing this we should greatly reduce the execution time.

Manually testing the MR

Check if EVM's semantic is still valid:

./evm-evaluation-assessor --eth-tests ~/ethereum/tests/ -o test.logs --resources ./etherlink/kernel_evm/evm_evaluation/resources -h -r

This should output:

SUCCESSES IN TOTAL: 19038
FAILURES IN TOTAL: 0
SKIPPED IN TOTAL: 111

Otherwise trust the CI to ensure the semantic wasn't broken.

Benchmark

NB: The test/benchmark is done at the VM level more specifically at the handler level, so any overhead around the execution is omitted whereas in the initial document it's more an E2E test/benchmark.

When running bf0a88d0 (the bytecode of the contract was taken from Etherlink Benchmarks) we get this before the patch:

test result: ok. 1 passed; [..] finished in 1.64s

With the patch we get:

test result: ok. 1 passed; [..] finished in 0.71s

Divided by 2 w/ rust native execution, but that's not the most relevant scenario.

On the other hand, on a tezt network, by deploying the GazGuzzler contract from Etherlink Benchmarks and re-adapting the script from the document to benchmark the contract from the tezt network, we get:

Without the patch:

{ numCalls: 1, incrementAmount: 100, method: 'incrementGlobalSum' } --> 113 ms (0.1s)
{ numCalls: 10, incrementAmount: 100, method: 'incrementGlobalSum' } --> 672 ms (0.6s)
{ numCalls: 1, incrementAmount: 10000, method: 'incrementGlobalSum' } --> 3245 ms (3.2s)
{ numCalls: 10, incrementAmount: 5000, method: 'incrementGlobalSum' } --> 9173 ms (9.1s)

With the patch:

{ numCalls: 1, incrementAmount: 100, method: 'incrementGlobalSum' } --> 59 ms (0.06s)
{ numCalls: 10, incrementAmount: 100, method: 'incrementGlobalSum' } --> 96 ms (0.1s)
{ numCalls: 1, incrementAmount: 10000, method: 'incrementGlobalSum' } --> 279 ms (0.28s)
{ numCalls: 10, incrementAmount: 5000, method: 'incrementGlobalSum' } --> 313 ms (0.32s)

The relevant code for the test can be found on db5d3dc5, just tweak the endpoint address from your tezt by running:

dune exec etherlink/tezt/tests/main.exe -- --verbose --file evm_sequencer.ml evm gaz_guzzler /threshold_encryption /dal

Divided by almost 30 w/ an E2E scenario.

Edited by Rodi-Can Bozman

Merge request reports

Loading