Skip to content

Commit 9be07de

Browse files
holimankaralabe
authored andcommitted
params: Updated finalized gascosts for ECMUL/MODEXP (#15135)
* params: Updated finalized gascosts for ECMUL/MODEXP * core,tests: Updates pending new tests * tests: Updated with new tests * core: revert state transition bugfix * tests: Add expected failures due to #15119
1 parent 885c13c commit 9be07de

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

core/vm/evm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
299299

300300
// Create creates a new contract using code as deployment code.
301301
func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) {
302-
if evm.vmConfig.NoRecursion && evm.depth > 0 {
303-
return nil, common.Address{}, gas, nil
304-
}
305302

306303
// Depth check execution. Fail if we're trying to execute above the
307304
// limit.
@@ -334,6 +331,9 @@ func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.I
334331
contract := NewContract(caller, AccountRef(contractAddr), value, gas)
335332
contract.SetCallCode(&contractAddr, crypto.Keccak256Hash(code), code)
336333

334+
if evm.vmConfig.NoRecursion && evm.depth > 0 {
335+
return nil, contractAddr, gas, nil
336+
}
337337
ret, err = run(evm, snapshot, contract, nil)
338338
// check whether the max code size has been exceeded
339339
maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize

params/protocol_params.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ const (
6464
Ripemd160PerWordGas uint64 = 120 // Per-word price for a RIPEMD160 operation
6565
IdentityBaseGas uint64 = 15 // Base price for a data copy operation
6666
IdentityPerWordGas uint64 = 3 // Per-work price for a data copy operation
67-
ModExpQuadCoeffDiv uint64 = 100 // Divisor for the quadratic particle of the big int modular exponentiation
67+
ModExpQuadCoeffDiv uint64 = 20 // Divisor for the quadratic particle of the big int modular exponentiation
6868
Bn256AddGas uint64 = 500 // Gas needed for an elliptic curve addition
69-
Bn256ScalarMulGas uint64 = 2000 // Gas needed for an elliptic curve scalar multiplication
69+
Bn256ScalarMulGas uint64 = 40000 // Gas needed for an elliptic curve scalar multiplication
7070
Bn256PairingBaseGas uint64 = 100000 // Base price for an elliptic curve pairing check
7171
Bn256PairingPerPointGas uint64 = 80000 // Per-point price for an elliptic curve pairing check
7272
)

tests/block_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ func TestBlockchain(t *testing.T) {
3232
bt.skipLoad(`^bcTotalDifficultyTest/(lotsOfLeafs|lotsOfBranches|sideChainWithMoreTransactions)`)
3333
// Constantinople is not implemented yet.
3434
bt.skipLoad(`(?i)(constantinople)`)
35-
// Expected failures:
36-
bt.fails(`^TransitionTests/bcHomesteadToDao/DaoTransactions(|_UncleExtradata|_EmptyTransactionAndForkBlocksAhead)\.json`, "issue in test")
3735

3836
// Still failing tests
3937
bt.skipLoad(`^bcWalletTest.*_Byzantium$`)

tests/state_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ func TestState(t *testing.T) {
3939
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/EIP158`, "bug in test")
4040
st.fails(`^stRevertTest/RevertPrecompiledTouch\.json/Byzantium`, "bug in test")
4141
st.fails(`^stRevertTest/RevertPrefoundEmptyOOG\.json/Byzantium`, "bug in test")
42+
st.fails( `^stRandom/randomStatetest645\.json/EIP150/.*`, "known bug #15119")
43+
st.fails( `^stRandom/randomStatetest645\.json/Frontier/.*`, "known bug #15119")
44+
st.fails( `^stRandom/randomStatetest645\.json/Homestead/.*`, "known bug #15119")
45+
st.fails( `^stRandom/randomStatetest644\.json/EIP150/.*`, "known bug #15119")
46+
st.fails( `^stRandom/randomStatetest644\.json/Frontier/.*`, "known bug #15119")
47+
st.fails( `^stRandom/randomStatetest644\.json/Homestead/.*`, "known bug #15119")
48+
4249

4350
st.walk(t, stateTestDir, func(t *testing.T, name string, test *StateTest) {
4451
for _, subtest := range test.Subtests() {
@@ -59,7 +66,8 @@ func TestState(t *testing.T) {
5966
}
6067

6168
// Transactions with gasLimit above this value will not get a VM trace on failure.
62-
const traceErrorLimit = 400000
69+
//const traceErrorLimit = 400000
70+
const traceErrorLimit = 0
6371

6472
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
6573
err := test(vm.Config{})

tests/testdata

Submodule testdata updated 8288 files

0 commit comments

Comments
 (0)