From 1a24075da7df9b5f92283e725a83508975adcd30 Mon Sep 17 00:00:00 2001 From: i-norden Date: Mon, 8 Aug 2022 13:52:36 -0500 Subject: [PATCH 1/2] ChainID adjustment --- pkg/eth/api.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/eth/api.go b/pkg/eth/api.go index 034d66e3c..bc6e67924 100644 --- a/pkg/eth/api.go +++ b/pkg/eth/api.go @@ -66,6 +66,9 @@ type PublicEthAPI struct { // NewPublicEthAPI creates a new PublicEthAPI with the provided underlying Backend func NewPublicEthAPI(b *Backend, client *rpc.Client, supportsStateDiff, forwardEthCalls, proxyOnError bool) (*PublicEthAPI, error) { + if b == nil { + return nil, errors.New("ipld-eth-server must be configured with an ethereum backend") + } if forwardEthCalls && client == nil { return nil, errors.New("ipld-eth-server is configured to forward eth_calls to proxy node but no proxy node is configured") } @@ -191,8 +194,7 @@ func (pea *PublicEthAPI) GetBlockByHash(ctx context.Context, hash common.Hash, f // ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. func (pea *PublicEthAPI) ChainId() *hexutil.Big { - block, err := pea.B.CurrentBlock() - if err != nil { + if pea.B.Config.ChainConfig.ChainID == nil || pea.B.Config.ChainConfig.ChainID.Cmp(big.NewInt(0)) <= 0 { if pea.proxyOnError { if id, err := pea.ethClient.ChainID(context.Background()); err == nil { return (*hexutil.Big)(id) @@ -201,10 +203,7 @@ func (pea *PublicEthAPI) ChainId() *hexutil.Big { return nil } - if config := pea.B.Config.ChainConfig; config.IsEIP155(block.Number()) { - return (*hexutil.Big)(config.ChainID) - } - return nil + return (*hexutil.Big)(pea.B.Config.ChainConfig.ChainID) } /* From cc35b06ddfae168ff474f97ccc34ad56f8eea4a6 Mon Sep 17 00:00:00 2001 From: i-norden Date: Mon, 8 Aug 2022 14:20:12 -0500 Subject: [PATCH 2/2] use go 1.18 --- .github/workflows/tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c86d07c44..9046321da 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -37,7 +37,7 @@ jobs: BUILD_KEY: ${{ secrets.BUILD_KEY }} #strategy: # matrix: - # go-version: [1.16.x, 1.17.x] + # go-version: [1.16.x, 1.17.x, 1.18.x] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -89,7 +89,7 @@ jobs: run: mkdir -p /tmp/go - uses: actions/setup-go@v3 with: - go-version: ">=1.18.0" + go-version: "1.18.x" check-latest: true - uses: actions/checkout@v2 with: @@ -157,7 +157,7 @@ jobs: run: mkdir -p /tmp/go - uses: actions/setup-go@v3 with: - go-version: ">=1.18.0" + go-version: "1.18.x" check-latest: true - uses: actions/checkout@v2 with: