@@ -314,7 +314,8 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
314314
315315 // It is allowed to call precompiles, even via delegatecall
316316 if p , isPrecompile := evm .Precompile (addr ); isPrecompile {
317- ret , gas , err = evm .RunPrecompiledContract (p , caller , input , gas , nil , true )
317+ // Note: delegate call is allowed to modify state
318+ ret , gas , err = evm .RunPrecompiledContract (p , caller , input , gas , nil , false )
318319 } else {
319320 addrCopy := addr
320321 // Initialise a new contract and make initialise the delegate values
@@ -363,8 +364,8 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
363364 }
364365
365366 if p , isPrecompile := evm .Precompile (addr ); isPrecompile {
366- // Note: delegate call is not allowed to modify state on precompiles
367- ret , gas , err = evm .RunPrecompiledContract (p , caller , input , gas , new (big.Int ), true )
367+ // Note: static call is not allowed to modify state on precompiles
368+ ret , gas , err = evm .RunPrecompiledContract (p , caller , input , gas , new (big.Int ), true /*read only*/ )
368369 } else {
369370 // At this point, we use a copy of address. If we don't, the go compiler will
370371 // leak the 'contract' to the outer scope, and make allocation for 'contract'
0 commit comments