From 755c3eb514297ba27a69f4ea41ab99392d2b29f5 Mon Sep 17 00:00:00 2001 From: Bartosz Zawistowski Date: Mon, 28 Apr 2025 08:36:15 +0200 Subject: [PATCH] Handle unusual call failures to system contracts --- silkworm/core/protocol/validation.cpp | 6 ++++++ silkworm/core/protocol/validation.hpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/silkworm/core/protocol/validation.cpp b/silkworm/core/protocol/validation.cpp index 20a7def3c4..6cf45f6c65 100644 --- a/silkworm/core/protocol/validation.cpp +++ b/silkworm/core/protocol/validation.cpp @@ -342,6 +342,9 @@ ValidationResult validate_requests_root(const BlockHeader& header, const std::ve system_txn.data = Bytes{}; system_txn.set_sender(kSystemAddress); const auto withdrawals = evm.execute(system_txn, kSystemCallGasLimit); + if (withdrawals.status != EVMC_SUCCESS) { + return ValidationResult::kSystemCallFailed; + } evm.state().destruct_touched_dead(); requests.add_request(FlatRequestType::kWithdrawalRequest, withdrawals.data); } @@ -354,6 +357,9 @@ ValidationResult validate_requests_root(const BlockHeader& header, const std::ve system_txn.data = Bytes{}; system_txn.set_sender(kSystemAddress); const auto consolidations = evm.execute(system_txn, kSystemCallGasLimit); + if (consolidations.status != EVMC_SUCCESS) { + return ValidationResult::kSystemCallFailed; + } evm.state().destruct_touched_dead(); requests.add_request(FlatRequestType::kConsolidationRequest, consolidations.data); } diff --git a/silkworm/core/protocol/validation.hpp b/silkworm/core/protocol/validation.hpp index 302c6d7d48..24564538e9 100644 --- a/silkworm/core/protocol/validation.hpp +++ b/silkworm/core/protocol/validation.hpp @@ -104,6 +104,9 @@ enum class [[nodiscard]] ValidationResult { // EIP-7702 Set EOA account code kIncorrectAuthorization, + // EIP-6110 and EIP-7002 system call failures + kSystemCallFailed, + // Bor validation errors. See https://github.com/erigontech/erigon/blob/main/consensus/bor/bor.go kMissingVanity, // Block's extra-data section is shorter than 32 bytes, which is required to store the signer vanity kMissingSignature, // Block's extra-data section doesn't seem to contain a 65 byte secp256k1 signature