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

Consensus parameters storage #124

Merged
merged 9 commits into from
Feb 29, 2024
Merged

Conversation

yarkinwho
Copy link
Contributor

@yarkinwho yarkinwho commented Feb 5, 2024

1 Add a way to store general consensus parameters, indexed by active block number.
2 currently it holds 5 gas fee parameters and the gas price
3 may subject to changes

Should be reviewed and merged together with other related changes in node.

Resolve #121

@arhag arhag requested a review from elmato February 6, 2024 01:42
eosevm/consensus_parameters.cpp Outdated Show resolved Hide resolved
eosevm/consensus_parameters.cpp Outdated Show resolved Hide resolved
eosevm/consensus_parameters.hpp Outdated Show resolved Hide resolved
silkworm/core/types/block.cpp Outdated Show resolved Hide resolved
silkworm/core/types/block.cpp Outdated Show resolved Hide resolved
silkworm/node/db/util_test.cpp Outdated Show resolved Hide resolved
silkworm/silkrpc/json/types.cpp Outdated Show resolved Hide resolved
silkworm/silkrpc/json/types_test.cpp Outdated Show resolved Hide resolved
silkworm/silkrpc/json/types_test.cpp Outdated Show resolved Hide resolved
silkworm/silkrpc/json/types_test.cpp Outdated Show resolved Hide resolved
@yarkinwho
Copy link
Contributor Author

Updated to move the index to body.

TODO: change the serialization method

@yarkinwho yarkinwho marked this pull request as ready for review February 27, 2024 01:09
friend bool operator==(const BlockBody&, const BlockBody&);
};

struct Block : public BlockBody {
BlockHeader header;

bool irreversible{false};
std::optional<eosevm::ConsensusParameters> consensus_parameters_cache;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to have this cache here?
I thought it will be local to the function that prepares the execution of the block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because we are currently only passing block around: from block_conversion_plugin to blockchain_plugin, from blockchain_plugin to the executor

It will be safer to copy and pass this piece of information with block. otherwise we will have to let executor read the new parameters from somewhere, and that will start to encounter thread safety issues.

This approach might not be ideal, Feel free to suggest other approaches.

@yarkinwho yarkinwho merged commit aaf7858 into master Feb 29, 2024
5 checks passed
@yarkinwho yarkinwho deleted the yarkin/consensus_parameters_storage branch February 29, 2024 06:52
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.

Store minimum gas price and 5 gas fee parameters in state associated to each block
2 participants