Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
gballet and jsign authored Mar 17, 2024
1 parent 82e61c5 commit 2e01b63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,9 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]b
if interpreter.evm.chainRules.IsEIP4762 {
contractAddress := crypto.CreateAddress(scope.Contract.Address(), interpreter.evm.StateDB.GetNonce(scope.Contract.Address()))
statelessGas := interpreter.evm.Accesses.TouchAndChargeContractCreateInit(contractAddress.Bytes()[:], value.Sign() != 0)
scope.Contract.UseGas(statelessGas)
if !scope.Contract.UseGas(statelessGas) {
return nil, ErrExecutionReverted
}
}

// reuse size int for stackvalue
Expand Down Expand Up @@ -686,7 +688,9 @@ func opCreate2(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]
codeAndHash := &codeAndHash{code: input}
contractAddress := crypto.CreateAddress2(scope.Contract.Address(), salt.Bytes32(), codeAndHash.Hash().Bytes())
statelessGas := interpreter.evm.Accesses.TouchAndChargeContractCreateInit(contractAddress.Bytes()[:], endowment.Sign() != 0)
scope.Contract.UseGas(statelessGas)
if !scope.Contract.UseGas(statelessGas) {
return nil, ErrExecutionReverted
}
}

// Apply EIP150
Expand Down

0 comments on commit 2e01b63

Please sign in to comment.