core: fix collisions

This commit is contained in:
MariusVanDerWijden 2026-04-30 13:35:24 +02:00
parent d55c8f41d7
commit 6c1c599804

View file

@ -544,10 +544,12 @@ func (evm *EVM) create(caller common.Address, code []byte, gas GasBudget, value
if evm.Config.Tracer != nil && evm.Config.Tracer.OnGasChange != nil { if evm.Config.Tracer != nil && evm.Config.Tracer.OnGasChange != nil {
evm.Config.Tracer.OnGasChange(gas.RegularGas, 0, tracing.GasChangeCallFailedExecution) evm.Config.Tracer.OnGasChange(gas.RegularGas, 0, tracing.GasChangeCallFailedExecution)
} }
// Record all burned gas // Drain the entire budget on collision
burned := gas.RegularGas
gas.Exhaust() gas.Exhaust()
return nil, common.Address{}, gas, GasUsed{RegularGas: burned}, ErrContractAddressCollision if evm.chainRules.IsAmsterdam {
gas.StateGas = 0
}
return nil, common.Address{}, gas, GasUsed{}, ErrContractAddressCollision
} }
// Create a new account on the state only if the object was not present. // Create a new account on the state only if the object was not present.
// It might be possible the contract code is deployed to a pre-existent // It might be possible the contract code is deployed to a pre-existent