@@ -220,23 +220,24 @@ func (args *evmCallArgs) Call(addr common.Address, input []byte, gas uint64, val
220
220
// methods to pass to [EVMInterpreter.Run], which are then propagated by the
221
221
// *CALL* opcodes as the caller.
222
222
precompile := NewContract (args .caller , AccountRef (args .self ()), args .value , args .gas )
223
+ if args .delegation == delegated {
224
+ precompile = precompile .AsDelegate ()
225
+ }
226
+ var caller ContractRef = precompile
223
227
224
- asDelegate := args .delegation == delegated // precompile was DELEGATECALLed
225
228
for _ , o := range opts {
226
229
switch o := o .(type ) {
227
- case callOptForceDelegate :
228
- // See documentation of [WithUNSAFEForceDelegate].
229
- asDelegate = true
230
+ case callOptUNSAFECallerAddressProxy :
231
+ // Note that, in addition to being unsafe, this breaks an EVM
232
+ // assumption that the caller ContractRef is always a *Contract.
233
+ caller = AccountRef (args .caller .Address ())
230
234
case nil :
231
235
default :
232
236
return nil , gas , fmt .Errorf ("unsupported option %T" , o )
233
237
}
234
238
}
235
- if asDelegate {
236
- precompile = precompile .AsDelegate ()
237
- }
238
239
239
- return args .evm .Call (precompile , addr , input , gas , value )
240
+ return args .evm .Call (caller , addr , input , gas , value )
240
241
}
241
242
242
243
var (
0 commit comments