Skip to content

Commit 902bd7e

Browse files
authored
Record external operation DelegationResolution (#333)
* fix: 🐛 record external operation DelegationResolution * refactor: ⚡ optimize delegated code retrieval
1 parent 9857b14 commit 902bd7e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/executor/stack/executor.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,20 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
10791079

10801080
// EIP-7702: Get execution code, following delegations if enabled
10811081
let code = if self.config.has_eip_7702 {
1082-
self.delegated_code(code_address)
1083-
.unwrap_or_else(|| self.code(code_address))
1082+
// Check for delegation and record external operation if needed
1083+
let original_code = self.code(code_address);
1084+
if let Some(delegated_address) = evm_core::extract_delegation_address(&original_code) {
1085+
if let Err(e) = self.record_external_operation(
1086+
crate::ExternalOperation::DelegationResolution(delegated_address),
1087+
) {
1088+
let _ = self.exit_substate(StackExitKind::Failed);
1089+
return Capture::Exit((ExitReason::Error(e), Vec::new()));
1090+
}
1091+
1092+
self.code(delegated_address)
1093+
} else {
1094+
original_code
1095+
}
10841096
} else {
10851097
self.code(code_address)
10861098
};

0 commit comments

Comments
 (0)