@@ -220,23 +220,24 @@ func (args *evmCallArgs) Call(addr common.Address, input []byte, gas uint64, val
220220	// methods to pass to [EVMInterpreter.Run], which are then propagated by the 
221221	// *CALL* opcodes as the caller. 
222222	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 
223227
224- 	asDelegate  :=  args .delegation  ==  delegated  // precompile was DELEGATECALLed 
225228	for  _ , o  :=  range  opts  {
226229		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 ())
230234		case  nil :
231235		default :
232236			return  nil , gas , fmt .Errorf ("unsupported option %T" , o )
233237		}
234238	}
235- 	if  asDelegate  {
236- 		precompile  =  precompile .AsDelegate ()
237- 	}
238239
239- 	return  args .evm .Call (precompile , addr , input , gas , value )
240+ 	return  args .evm .Call (caller , addr , input , gas , value )
240241}
241242
242243var  (
0 commit comments