Fantom-foundation / Aida

Aida is a block-processing testing infrastructure for EVM-compatible chains.
GNU Lesser General Public License v3.0
6 stars 12 forks source link

[Feature] --substate-encoding flag to switch between rlp/others #1170

Closed rpl-ffl closed 2 months ago

rpl-ffl commented 2 months ago

This change is in anticipation of the following change in substate: https://github.com/Fantom-foundation/Substate/pull/86.

Aida can now select between rlp/protobuf when decoding from disk using the flag --substate-encoding. The flag defaults to "default" -> which defaults to rlp.

Currently effective only for aida-vm.

Example usage:

# reading rlp with rlp
$ go run ./cmd/aida-vm --validate --chainid 1 --workers 1 --evm-impl aida --vm-impl geth --aida-db ~/dev/data/rlp  --substate-encoding rlp 0 100000

...
NOTICE: Total elapsed time: 0s; last block 46147; total transaction rate ~614.20 Tx/s, ~12.90 MGas/s
# reading rlp with pb
$ go run ./cmd/aida-vm --validate --chainid 1 --workers 1 --evm-impl aida --vm-impl geth --aida-db ~/dev/data/rlp  --substate-encoding rlp 0 100000

...
cannot decode data into protobuf block: 46147, tx 0; proto: cannot parse invalid wire-format data
# reading pb with pb
$ go run ./cmd/aida-vm --validate --chainid 1 --workers 1 --evm-impl aida --vm-impl geth --aida-db ~/dev/data/0-10M --substate-encoding pb 0 100000

...
NOTICE: Total elapsed time: 0s; last block 46147; total transaction rate ~25.80 Tx/s, ~0.54 MGas/s
# reading pb with rlp
$ go run ./cmd/aida-vm --validate --chainid 1 --workers 1 --evm-impl aida --vm-impl geth --aida-db ~/dev/data/0-10M --substate-encoding rlp 0 100000

...
cannot decode data into rlp block: 46147, tx 0; rlp: expected input list for rlp.RLP
# flag unset = read with rlp, backward compatible
$ go run ./cmd/aida-vm --validate --chainid 1 --workers 1 --evm-impl aida --vm-impl geth --aida-db ~/dev/data/rlp 0 100000

...
NOTICE: Total elapsed time: 0s; last block 46147; total transaction rate ~483.26 Tx/s, ~10.15 MGas/s

Type of change