Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
Sep 27, 2024

Conversation

rpl-ffl
Copy link
Collaborator

@rpl-ffl rpl-ffl commented Sep 19, 2024

This change is in anticipation of the following change in substate: Fantom-foundation/Substate#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

  • New feature (non-breaking change which adds functionality)

cabrador
cabrador previously approved these changes Sep 24, 2024
Copy link
Collaborator

@cabrador cabrador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing all the work on protobuf!

utils/flags.go Outdated Show resolved Hide resolved
utils/config.go Outdated Show resolved Hide resolved
utils/config.go Outdated Show resolved Hide resolved
@rpl-ffl rpl-ffl force-pushed the rapol/feature/flag-switch-rlp-pb branch from cc5466d to a3ba2f8 Compare September 26, 2024 08:56
@rpl-ffl rpl-ffl force-pushed the rapol/feature/flag-switch-rlp-pb branch from a3ba2f8 to b49cf9e Compare September 26, 2024 09:00
wsodsong
wsodsong previously approved these changes Sep 26, 2024
utils/flags.go Outdated Show resolved Hide resolved
matejmode
matejmode previously approved these changes Sep 26, 2024
@rpl-ffl rpl-ffl changed the title [Feature] --substate-encoding flag to switch between rlp/protobuf [Feature] --substate-encoding flag to switch between rlp/others Sep 27, 2024
cabrador
cabrador previously approved these changes Sep 27, 2024
Copy link
Collaborator

@cabrador cabrador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only minor comments. Otherwise LGTM!

executor/substate_provider.go Outdated Show resolved Hide resolved
executor/substate_provider.go Show resolved Hide resolved
@rpl-ffl rpl-ffl merged commit ea82e44 into develop Sep 27, 2024
4 checks passed
@rpl-ffl rpl-ffl deleted the rapol/feature/flag-switch-rlp-pb branch September 27, 2024 13:51
rpl-ffl added a commit that referenced this pull request Sep 27, 2024
* add --substate-encoding flag

* syntax error fix in flags

* add --substate-encoding to aida-vm

* SetDecoder->SetSubstateEncoding

* update Substate to access SubstateEncoding

* default->rlp

* error handling for SetSubstateEncoding

* lower case error
rpl-ffl added a commit that referenced this pull request Sep 28, 2024
* add --substate-encoding flag

* syntax error fix in flags

* add --substate-encoding to aida-vm

* SetDecoder->SetSubstateEncoding

* update Substate to access SubstateEncoding

* default->rlp

* error handling for SetSubstateEncoding

* lower case error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants