{"record":{"id":"a7e426acf6dcca27","repo":"linera-io/linera-protocol","slug":"it-is-illegal-to-call-function-summarize-events-fr","errorCode":null,"errorMessage":"It is illegal to call function summarize_events from an operation","messagePattern":"It is illegal to call function summarize_events from an operation","errorType":"validation","errorClass":"EvmExecutionError","httpStatus":null,"severity":"error","filePath":"linera-execution/src/evm/inputs.rs","lineNumber":177,"sourceCode":"/// This is the selector of `summarize_events`, which is called by the system on a\n/// checkpoint and never from a submitted operation.\npub(crate) const SUMMARIZE_EVENTS_SELECTOR: &[u8] =\n    &<summarize_eventsCall as alloy_sol_types::SolCall>::SELECTOR;\n\n/// This is the selector of `instantiate` that should be called\n/// only when creating a new instance of a shared contract\npub(crate) const INSTANTIATE_SELECTOR: &[u8] = &[156, 163, 60, 158];\n\npub(crate) fn forbid_execute_operation_origin(vec: &[u8]) -> Result<(), EvmExecutionError> {\n    ensure!(\n        vec != EXECUTE_MESSAGE_SELECTOR,\n        EvmExecutionError::IllegalOperationCall(\"function execute_message\".to_string(),)\n    );\n    ensure!(\n        vec != PROCESS_STREAMS_SELECTOR,\n        EvmExecutionError::IllegalOperationCall(\"function process_streams\".to_string(),)\n    );\n    ensure!(\n        vec != SUMMARIZE_EVENTS_SELECTOR,\n        EvmExecutionError::IllegalOperationCall(\"function summarize_events\".to_string(),)\n    );\n    ensure!(\n        vec != INSTANTIATE_SELECTOR,\n        EvmExecutionError::IllegalOperationCall(\"function instantiate\".to_string(),)\n    );\n    Ok(())\n}\n\npub(crate) fn ensure_message_length(\n    actual_length: usize,\n    min_length: usize,\n) -> Result<(), EvmExecutionError> {\n    ensure!(\n        actual_length >= min_length,\n        EvmExecutionError::OperationIsTooShort\n    );","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-execution/src/evm/inputs.rs#L159-L195","documentation":"Third guard in forbid_execute_operation_origin (used by execute_operation and init_transact): the operation calldata's 4-byte selector must not equal SUMMARIZE_EVENTS_SELECTOR, the function the system calls on a checkpoint and never from a submitted operation. Operations carrying that selector are rejected before execution, keeping checkpoint summarization system-only.","triggerScenarios":"An EVM operation or transact request whose calldata starts with the summarize_events selector — a contract exposing a same-named function that a user tries to invoke via an operation, or an unrelated function whose ABI selector collides.","commonSituations":"Checkpoint-aware contracts re-exporting the summarize_events ABI as callable; generated bindings that expose system entry points as ordinary functions; 4-byte collisions in contracts with many external functions.","solutions":["Rename the function or change its signature so the selector differs","Do not expose system checkpoint entry points as user-callable; mark them internal/only-system","Validate the selector prefix of every operation payload before submission"],"exampleFix":"// Solidity: hide the system entry point from user calls\n// before\nfunction summarize_events() external returns (bytes32) { ... }\n// after\nfunction summarize_events() internal view returns (bytes32) { ... }","handlingStrategy":"validation","validationCode":"fn targets_summarize_events(calldata: &[u8], summarize_events_selector: [u8; 4]) -> bool {\n    calldata.get(..4) == Some(&summarize_events_selector[..])\n}\n\n// compute the selector from your contract ABI, e.g. keccak(\"summarize_events(...)\")[..4]\nassert!(!targets_summarize_events(&operation_calldata, selector));","typeGuard":"fn is_illegal_summarize_events_call(err: &ExecutionError) -> bool {\n    matches!(\n        err,\n        ExecutionError::EvmError(evm_error!::IllegalOperationCall(ref f)) if f.contains(\"summarize_events\")\n    )\n}","tryCatchPattern":"match client.execute_operations(ops, vec![]).await {\n    Err(e) if is_illegal_summarize_events_call(&e) => {\n        Err(anyhow::anyhow!(\"operation targets reserved summarize_events selector: {e}\"))\n    }\n    other => other,\n}","preventionTips":["Do not expose checkpoint functions as external entry points in your contracts","Validate every operation's 4-byte selector against all four reserved selectors before submission","When porting contracts from other chains, audit for functions named execute_message/process_streams/summarize_events/instantiate"],"tags":["linera","evm","solidity","selector","checkpoint","entry-point"],"backgroundTag":"reserved-entrypoint-invocation","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}