Skip to content

Commit

Permalink
core: merge BaseRuleSet with IRuleSet (#1941)
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis authored Mar 27, 2024
1 parent cca7354 commit 21f4e1e
Show file tree
Hide file tree
Showing 16 changed files with 316 additions and 379 deletions.
2 changes: 1 addition & 1 deletion silkworm/core/chain/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace protocol {
bool operator==(const CliqueConfig&) const = default;
};

//! \see IRuleSet
//! \see RuleSet
using PreMergeRuleSetConfig = std::variant<NoPreMergeConfig, EthashConfig, CliqueConfig, bor::Config>;

} // namespace protocol
Expand Down
2 changes: 1 addition & 1 deletion silkworm/core/execution/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace silkworm {

ExecutionProcessor::ExecutionProcessor(const Block& block, protocol::IRuleSet& rule_set, State& state,
ExecutionProcessor::ExecutionProcessor(const Block& block, protocol::RuleSet& rule_set, State& state,
const ChainConfig& config)
: state_{state}, rule_set_{rule_set}, evm_{block, state_, config} {
evm_.beneficiary = rule_set.get_beneficiary(block.header);
Expand Down
4 changes: 2 additions & 2 deletions silkworm/core/execution/processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ExecutionProcessor {
ExecutionProcessor(const ExecutionProcessor&) = delete;
ExecutionProcessor& operator=(const ExecutionProcessor&) = delete;

ExecutionProcessor(const Block& block, protocol::IRuleSet& rule_set, State& state, const ChainConfig& config);
ExecutionProcessor(const Block& block, protocol::RuleSet& rule_set, State& state, const ChainConfig& config);

/**
* Execute a transaction, but do not write to the DB yet.
Expand Down Expand Up @@ -69,7 +69,7 @@ class ExecutionProcessor {

uint64_t cumulative_gas_used_{0};
IntraBlockState state_;
protocol::IRuleSet& rule_set_;
protocol::RuleSet& rule_set_;
EVM evm_;
};

Expand Down
254 changes: 0 additions & 254 deletions silkworm/core/protocol/base_rule_set.cpp

This file was deleted.

77 changes: 0 additions & 77 deletions silkworm/core/protocol/base_rule_set.hpp

This file was deleted.

4 changes: 2 additions & 2 deletions silkworm/core/protocol/bor_rule_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ValidationResult BorRuleSet::validate_block_header(const BlockHeader& header, co
return ValidationResult::kInvalidMixDigest;
}

ValidationResult res{BaseRuleSet::validate_block_header(header, state, with_future_timestamp_check)};
ValidationResult res{RuleSet::validate_block_header(header, state, with_future_timestamp_check)};
if (res != ValidationResult::kOk) {
return res;
}
Expand Down Expand Up @@ -175,7 +175,7 @@ void BorRuleSet::add_fee_transfer_log(IntraBlockState& state, const intx::uint25
}

const bor::Config& BorRuleSet::config() const {
return std::get<bor::Config>(chain_config_.rule_set_config);
return std::get<bor::Config>(chain_config_->rule_set_config);
}

} // namespace silkworm::protocol
Loading

0 comments on commit 21f4e1e

Please sign in to comment.