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

EIP-6110 Deposit contract fix #2800

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion silkworm/core/types/eip_7685_requests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ Bytes extract_deposit(const Bytes& data) {
}

void FlatRequests::extract_deposits_from_logs(const std::vector<Log>& logs) {
// See EIP-6110: Supply validator deposits on chain
static constexpr evmc::bytes32 kDepositEventSignatureHash = 0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5_bytes32;
for (const auto& log : logs) {
if (log.address == protocol::kDepositContractAddress) {
const auto is_deposit_event = std::size(log.topics) > 0 && log.topics[0] == kDepositEventSignatureHash;
if (log.address == protocol::kDepositContractAddress && is_deposit_event) {
auto bytes = extract_deposit(log.data);
requests_[magic_enum::enum_integer(FlatRequestType::kDepositRequest)] += bytes;
}
Expand Down
3 changes: 2 additions & 1 deletion silkworm/core/types/eip_7685_requests_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ TEST_CASE("EIP-7585 tests") {
"0000000000000000000000000000000000000000000000000000000000")
.value();

const std::vector logs = {Log{.address = protocol::kDepositContractAddress, .topics = {}, .data = encoded_event}};
// Topics is a single-element vector containing hash of deposit event signature
const std::vector logs = {Log{.address = protocol::kDepositContractAddress, .topics = {0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5_bytes32}, .data = encoded_event}};

FlatRequests requests;
requests.extract_deposits_from_logs(logs);
Expand Down
Loading