From 8b6d536c50e7dabbd9a15bf611167a50c1f42553 Mon Sep 17 00:00:00 2001 From: Andy Wu Date: Mon, 7 Oct 2024 15:30:32 -0700 Subject: [PATCH 1/3] [fix] go-testing workflow --- .github/workflows/go.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 844cfb5d2..3303c3748 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,24 +1,39 @@ -name: i386 linux tests +name: Go tests on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] workflow_dispatch: jobs: build: - runs-on: self-hosted + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v5 with: go-version: 1.21.4 - cache: false + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-mod-cache-${{ hashFiles('**/go.mod', '**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-mod-cache-latest + + - name: Install dependencies + run: | + go mod download + - name: Run tests run: go test -short ./... env: GOOS: linux - GOARCH: 386 + GOARCH: amd64 From f94b64ee11ecfccfff864f13ba1c44183b6f02ae Mon Sep 17 00:00:00 2001 From: Kingster Date: Mon, 7 Oct 2024 17:03:01 -0700 Subject: [PATCH 2/3] fix failures --- tests/fuzzers/bls12381/precompile_fuzzer.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/fuzzers/bls12381/precompile_fuzzer.go b/tests/fuzzers/bls12381/precompile_fuzzer.go index 4df4db73d..8c5dcc9bc 100644 --- a/tests/fuzzers/bls12381/precompile_fuzzer.go +++ b/tests/fuzzers/bls12381/precompile_fuzzer.go @@ -19,6 +19,11 @@ package bls import ( "bytes" "fmt" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/params" + "github.com/holiman/uint256" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" @@ -70,6 +75,11 @@ func checkInput(id byte, inputLen int) bool { // // other values are reserved for future use. func fuzz(id byte, data []byte) int { + vmctx := vm.BlockContext{ + Transfer: func(vm.StateDB, common.Address, common.Address, *uint256.Int) {}, + } + statedb, _ := state.New(types.EmptyRootHash, state.NewDatabase(rawdb.NewMemoryDatabase()), nil) + evm := vm.NewEVM(vmctx, vm.TxContext{}, statedb, params.AllEthashProtocolChanges, vm.Config{}) // Even on bad input, it should not crash, so we still test the gas calc precompile := vm.PrecompiledContractsBLS[common.BytesToAddress([]byte{id})] gas := precompile.RequiredGas(data) @@ -82,7 +92,7 @@ func fuzz(id byte, data []byte) int { } cpy := make([]byte, len(data)) copy(cpy, data) - _, err := precompile.Run(cpy) + _, err := precompile.Run(evm, cpy) if !bytes.Equal(cpy, data) { panic(fmt.Sprintf("input data modified, precompile %d: %x %x", id, data, cpy)) } From 22809b1d787771c241ff60d52d2f5e7b3a45a5d1 Mon Sep 17 00:00:00 2001 From: Kingster Date: Mon, 7 Oct 2024 19:47:23 -0700 Subject: [PATCH 3/3] fix genesis block hash --- params/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/params/config.go b/params/config.go index c9c252b40..479d8eb3b 100644 --- a/params/config.go +++ b/params/config.go @@ -30,8 +30,8 @@ var ( HoleskyGenesisHash = common.HexToHash("0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4") SepoliaGenesisHash = common.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9") GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a") - IliadGenesisHash = common.HexToHash("0xf688549151cee34b707abd49c32c019aefb766d701488dd0c668601a91a67978") - LocalGenesisHash = common.HexToHash("0xc070ebc5e40309e00af74260326aaafe320bee14bf131a4852f73b089b592123") + IliadGenesisHash = common.HexToHash("0xf5ebc6f0982e8bf7fd532b3f959f84d12b3dedd2827af8d31f5389447bedafc6") + LocalGenesisHash = common.HexToHash("0x8f3fc56b0dc3a009e6771da99ff737900da84b9aeae15d1bae225cc8b4dbbdc3") ) func newUint64(val uint64) *uint64 { return &val }