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

[Protobuf] Working prototype #85

Merged
merged 28 commits into from
Oct 1, 2024
Merged

[Protobuf] Working prototype #85

merged 28 commits into from
Oct 1, 2024

Conversation

rpl-ffl
Copy link
Collaborator

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

Currently, geth transactions were recorded using RLP. The record-replay has switched to Protobuf instead, with 18M block onwards having only the Protobuf recording.

This change would allow substate to read Protobuf messages from disk along side RLP.

Todo: Create a decode function that takes a flag to select RLP/Protobuf
Note: Protobuf encode function is not implemented, but should be straight forward.

Type of change

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

@rpl-ffl rpl-ffl marked this pull request as draft September 18, 2024 06:54
@rpl-ffl rpl-ffl self-assigned this Sep 18, 2024
@rpl-ffl rpl-ffl changed the base branch from main to develop September 18, 2024 07:24
@rpl-ffl rpl-ffl changed the base branch from develop to main September 23, 2024 07:30
@rpl-ffl rpl-ffl force-pushed the rapol/feature/protobuf branch 5 times, most recently from 74fb259 to 6c8167f Compare September 23, 2024 08:02
@rpl-ffl rpl-ffl marked this pull request as ready for review September 23, 2024 08:03
Copy link
Contributor

@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.

I think this PR lacks proper unit testing.
Especially decode.go has some parts which we should make sure no one changes by adding test.

db/substate_db.go Outdated Show resolved Hide resolved
protobuf/decode.go Show resolved Hide resolved
protobuf/decode.go Show resolved Hide resolved
protobuf/decode.go Outdated Show resolved Hide resolved
protobuf/decode.go Outdated Show resolved Hide resolved
protobuf/decode.go Outdated Show resolved Hide resolved
protobuf/decode.go Outdated Show resolved Hide resolved
substate/env.go Outdated Show resolved Hide resolved
substate/substate.go Outdated Show resolved Hide resolved
@rpl-ffl rpl-ffl changed the base branch from main to rapol/feature/flag-substate-decoder September 25, 2024 02:48
@rpl-ffl rpl-ffl force-pushed the rapol/feature/flag-substate-decoder branch from e1c967b to 7f435fb Compare September 25, 2024 03:18
Base automatically changed from rapol/feature/flag-substate-decoder to main September 26, 2024 08:34
db/substate_encoding.go Outdated Show resolved Hide resolved
db/substate_encoding.go Outdated Show resolved Hide resolved
db/substate_encoding.go Outdated Show resolved Hide resolved
Comment on lines 89 to 95
// encodeSubstate defensively defaults to "default" if nil
func (db *substateDB) encodeSubstate(ss *substate.Substate, block uint64, tx int) ([]byte, error) {
if db.encoding == nil {
db.SetSubstateEncoding("default")
}
return db.encoding.encode(ss, block, tx)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

First I think implementation details does not belong to a func comment.
Second, do you think we should have this condition? I think this belongs into the factory func.

Copy link
Collaborator Author

@rpl-ffl rpl-ffl Sep 30, 2024

Choose a reason for hiding this comment

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

Defensive defaults now removed in favor of having SetSubstate("default") in all public constructor of substateDB.
79974a4

I understand the performance reason to do this, but this leaves direct instantiation of &substateDB{...} (in tests, for example) to panic if encoding is never set. Any advice on this?

go.mod Outdated Show resolved Hide resolved
protobuf/encode.go Outdated Show resolved Hide resolved
protobuf/encode.go Outdated Show resolved Hide resolved
protobuf/encode.go Outdated Show resolved Hide resolved
protobuf/encode.go Outdated Show resolved Hide resolved
protobuf/encode.go Outdated Show resolved Hide resolved
Copy link
Contributor

@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 iterating through this PR. lgtm now!

@rpl-ffl rpl-ffl merged commit 220a4fa into main Oct 1, 2024
@rpl-ffl rpl-ffl deleted the rapol/feature/protobuf branch October 1, 2024 08:34
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.

2 participants