-
Notifications
You must be signed in to change notification settings - Fork 890
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
stem based flat db for verkle #7778
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
dd492e1
implement stem based flat db
matkt 8b8b4a4
merge verkle branch
matkt 146005e
stem flat db
matkt da189ea
update flat db based on stem
matkt 97e5547
update flat db based on stem
matkt 1f98215
merge verkle main
matkt b6c0cea
reset commit for dco issue
matkt e72c7bc
add missing files
matkt ae8ab83
merge luis
matkt 8858793
merge verkle branch
matkt 14f71a3
update stem flat db code and StateTrieAccountValue.java
matkt cc7201a
Move EIP-4762 gas charging for contract account creation from code su…
lu-pinto 1cb11a1
clear stem flat db code
matkt 059a146
merge verkle branch
matkt 440aac1
clean stem based PR
matkt db264ed
Merge branch 'verkle' into fork/stem-based-flat-db
matkt 0c3909b
Merge branch 'verkle' into fork/stem-based-flat-db
matkt 5b452ae
Do not use NotNull annotation and update plugin api hash
lu-pinto c632408
clean after review
matkt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
besu/src/main/java/org/hyperledger/besu/cli/options/storage/VerkleSubStorageOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.storage; | ||
|
||
import static org.hyperledger.besu.ethereum.worldstate.VerkleSubStorageConfiguration.VerkleUnstable.DEFAULT_STEM_FLAT_DB_ENABLED; | ||
|
||
import org.hyperledger.besu.cli.options.CLIOptions; | ||
import org.hyperledger.besu.cli.util.CommandLineUtils; | ||
import org.hyperledger.besu.ethereum.worldstate.ImmutableVerkleSubStorageConfiguration; | ||
import org.hyperledger.besu.ethereum.worldstate.VerkleSubStorageConfiguration; | ||
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat; | ||
|
||
import java.util.List; | ||
|
||
import picocli.CommandLine; | ||
import picocli.CommandLine.Option; | ||
|
||
/** The Data storage CLI options. */ | ||
public class VerkleSubStorageOptions implements CLIOptions<VerkleSubStorageConfiguration> { | ||
|
||
@CommandLine.ArgGroup(validate = false) | ||
private final VerkleSubStorageOptions.Unstable unstableOptions = new Unstable(); | ||
|
||
/** Default Constructor. */ | ||
VerkleSubStorageOptions() {} | ||
|
||
/** The unstable options for data storage. */ | ||
public static class Unstable { | ||
|
||
@Option( | ||
hidden = true, | ||
names = { | ||
"--Xverkle-stem-flat-db-enabled", | ||
}, | ||
arity = "1", | ||
description = "Enables stem flat database strategy for verkle. (default: ${DEFAULT-VALUE})") | ||
private Boolean stemFlatDbEnabled = DEFAULT_STEM_FLAT_DB_ENABLED; | ||
|
||
/** Default Constructor. */ | ||
Unstable() {} | ||
} | ||
|
||
/** | ||
* Create data storage options. | ||
* | ||
* @return the data storage options | ||
*/ | ||
public static VerkleSubStorageOptions create() { | ||
return new VerkleSubStorageOptions(); | ||
} | ||
|
||
/** | ||
* Validates the data storage options | ||
* | ||
* @param commandLine the full commandLine to check all the options specified by the user | ||
* @param dataStorageFormat the selected data storage format which determines the validation rules | ||
* to apply. | ||
*/ | ||
public void validate(final CommandLine commandLine, final DataStorageFormat dataStorageFormat) { | ||
// no op | ||
} | ||
|
||
/** | ||
* Converts to options from the configuration | ||
* | ||
* @param domainObject to be reversed | ||
* @return the options that correspond to the configuration | ||
*/ | ||
public static VerkleSubStorageOptions fromConfig( | ||
final VerkleSubStorageConfiguration domainObject) { | ||
final VerkleSubStorageOptions dataStorageOptions = VerkleSubStorageOptions.create(); | ||
dataStorageOptions.unstableOptions.stemFlatDbEnabled = | ||
domainObject.getUnstable().getStemFlatDbEnabled(); | ||
return dataStorageOptions; | ||
} | ||
|
||
@Override | ||
public final VerkleSubStorageConfiguration toDomainObject() { | ||
return ImmutableVerkleSubStorageConfiguration.builder() | ||
.unstable( | ||
ImmutableVerkleSubStorageConfiguration.VerkleUnstable.builder() | ||
.stemFlatDbEnabled(unstableOptions.stemFlatDbEnabled) | ||
.build()) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public List<String> getCLIOptions() { | ||
return CommandLineUtils.getCLIOptions(this, new VerkleSubStorageOptions()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you call
validate
? It's a noop, not even part of an interface or abstractThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just to ensure that all the logic is coded in the same way so that if tomorrow someone adds a flag that requires a check, they don’t have to wonder why it doesn’t work or how to do it. They just need to follow the same approach as in other parts of the code and simply implement the check in
validate
. But if you think it's better to remove why notThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no strong opinions, you can leave it