Skip to content

Commit 755c3eb

Browse files
committed
Handle unusual call failures to system contracts
1 parent 7fcccf2 commit 755c3eb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

silkworm/core/protocol/validation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ ValidationResult validate_requests_root(const BlockHeader& header, const std::ve
342342
system_txn.data = Bytes{};
343343
system_txn.set_sender(kSystemAddress);
344344
const auto withdrawals = evm.execute(system_txn, kSystemCallGasLimit);
345+
if (withdrawals.status != EVMC_SUCCESS) {
346+
return ValidationResult::kSystemCallFailed;
347+
}
345348
evm.state().destruct_touched_dead();
346349
requests.add_request(FlatRequestType::kWithdrawalRequest, withdrawals.data);
347350
}
@@ -354,6 +357,9 @@ ValidationResult validate_requests_root(const BlockHeader& header, const std::ve
354357
system_txn.data = Bytes{};
355358
system_txn.set_sender(kSystemAddress);
356359
const auto consolidations = evm.execute(system_txn, kSystemCallGasLimit);
360+
if (consolidations.status != EVMC_SUCCESS) {
361+
return ValidationResult::kSystemCallFailed;
362+
}
357363
evm.state().destruct_touched_dead();
358364
requests.add_request(FlatRequestType::kConsolidationRequest, consolidations.data);
359365
}

silkworm/core/protocol/validation.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ enum class [[nodiscard]] ValidationResult {
104104
// EIP-7702 Set EOA account code
105105
kIncorrectAuthorization,
106106

107+
// EIP-6110 and EIP-7002 system call failures
108+
kSystemCallFailed,
109+
107110
// Bor validation errors. See https://github.com/erigontech/erigon/blob/main/consensus/bor/bor.go
108111
kMissingVanity, // Block's extra-data section is shorter than 32 bytes, which is required to store the signer vanity
109112
kMissingSignature, // Block's extra-data section doesn't seem to contain a 65 byte secp256k1 signature

0 commit comments

Comments
 (0)