Skip to content

Commit

Permalink
Disabled tests the rely on MaxCodeSize
Browse files Browse the repository at this point in the history
We changed the value and the test fail for that reason. Some tests could
be updated, but I didn't get them to pass right away. So I'm going the
quick way for now and skip all problematic tests.
  • Loading branch information
karlb committed Jul 12, 2024
1 parent b26d3b8 commit 4e1561b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
17 changes: 9 additions & 8 deletions core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func TestStateProcessorErrors(t *testing.T) {
},
},
}
blockchain, _ = NewBlockChain(db, nil, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil, nil)
tooBigInitCode = [params.MaxInitCodeSize + 1]byte{}
blockchain, _ = NewBlockChain(db, nil, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil, nil)
//tooBigInitCode = [params.MaxInitCodeSize + 1]byte{}
)

defer blockchain.Stop()
Expand Down Expand Up @@ -234,12 +234,13 @@ func TestStateProcessorErrors(t *testing.T) {
},
want: "could not apply tx 0 [0xd82a0c2519acfeac9a948258c47e784acd20651d9d80f9a1c67b4137651c3a24]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 required balance exceeds 256 bits",
},
{ // ErrMaxInitCodeSizeExceeded
txs: []*types.Transaction{
mkDynamicCreationTx(0, 500000, common.Big0, big.NewInt(params.InitialBaseFee), tooBigInitCode[:]),
},
want: "could not apply tx 0 [0xd491405f06c92d118dd3208376fcee18a57c54bc52063ee4a26b1cf296857c25]: max initcode size exceeded: code size 49153 limit 49152",
},
// Disabled due to Celo MaxCodeSize change
// { // ErrMaxInitCodeSizeExceeded
// txs: []*types.Transaction{
// mkDynamicCreationTx(0, 500000, common.Big0, big.NewInt(params.InitialBaseFee), tooBigInitCode[:]),
// },
// want: "could not apply tx 0 [0xd491405f06c92d118dd3208376fcee18a57c54bc52063ee4a26b1cf296857c25]: max initcode size exceeded: code size 49153 limit 49152",
// },
{ // ErrIntrinsicGas: Not enough gas to cover init code
txs: []*types.Transaction{
mkDynamicCreationTx(0, 54299, common.Big0, big.NewInt(params.InitialBaseFee), make([]byte, 320)),
Expand Down
4 changes: 2 additions & 2 deletions core/vm/gas_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ var createGasTests = []struct {
// create2(0, 0, 0xc001, 0) without 3860
{"0x600061C00160006000f5" + "600052" + "60206000F3", false, 50471, 50471},
// create2(0, 0, 0xc001, 0) (too large), with 3860
{"0x600061C00160006000f5" + "600052" + "60206000F3", true, 32012, 100_000},
//{"0x600061C00160006000f5" + "600052" + "60206000F3", true, 32012, 100_000}, // Disabled due to Celo MaxCodeSize change
// create2(0, 0, 0xc000, 0)
// This case is trying to deploy code at (within) the limit
{"0x600061C00060006000f5" + "600052" + "60206000F3", true, 53528, 53528},
// create2(0, 0, 0xc001, 0)
// This case is trying to deploy code exceeding the limit
{"0x600061C00160006000f5" + "600052" + "60206000F3", true, 32024, 100000},
//{"0x600061C00160006000f5" + "600052" + "60206000F3", true, 32024, 100000}, // Disabled due to Celo MaxCodeSize change
}

func TestCreateGas(t *testing.T) {
Expand Down
8 changes: 8 additions & 0 deletions tests/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package tests

import (
"math/rand"
"regexp"
"runtime"
"testing"

Expand Down Expand Up @@ -69,6 +70,13 @@ func TestExecutionSpecBlocktests(t *testing.T) {
bt := new(testMatcher)

bt.walk(t, executionSpecBlockchainTestDir, func(t *testing.T, name string, test *BlockTest) {
matches, err := regexp.MatchString("blockchain_test-create2?-over_limit_(ones|zeros)", name)
if err != nil {
t.Errorf("Bad regexp: %s", err)
}
if matches {
t.Skipf("Celo has increased the MaxCodeSize, which makes some tests invalid")
}
execBlockTest(t, bt, test)
})
}
Expand Down
8 changes: 8 additions & 0 deletions tests/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os"
"path/filepath"
"reflect"
"regexp"
"runtime"
"strings"
"testing"
Expand Down Expand Up @@ -94,6 +95,13 @@ func TestExecutionSpecState(t *testing.T) {
st := new(testMatcher)

st.walk(t, executionSpecStateTestDir, func(t *testing.T, name string, test *StateTest) {
matches, err := regexp.MatchString("state_test-(create2?-)?over_limit_(ones|zeros)", name)
if err != nil {
t.Errorf("Bad regexp: %s", err)
}
if matches {
t.Skipf("Celo has increased the MaxCodeSize, which makes some tests invalid")
}
execStateTest(t, st, test)
})
}
Expand Down

0 comments on commit 4e1561b

Please sign in to comment.