Skip to content

Commit

Permalink
Merge pull request #182 from vulcanize/geth1.10.21-update-wip
Browse files Browse the repository at this point in the history
geth 1.10.21 update with changes for API update in issue 177
  • Loading branch information
ABastionOfSanity authored Aug 3, 2022
2 parents ba01123 + 9eb7b22 commit c9e6055
Show file tree
Hide file tree
Showing 9 changed files with 546 additions and 374 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/on-pr-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
BUILD_KEY: ${{ secrets.BUILD_KEY }}
with:
STACK_ORCHESTRATOR_REF: "f2fd766f5400fcb9eb47b50675d2e3b1f2753702"
GO_ETHEREUM_REF: "7b4ef34de2b9469c3f82972b60e38b34c99c5382"
IPLD_ETH_DB_REF: "b59505eab252670c622b42ce60621e9747fb64f9"
GO_ETHEREUM_REF: "2cea7024b4db754e43f36e39eb8d06fa42293df2"
IPLD_ETH_DB_REF: "be345e0733d2c025e4082c5154e441317ae94cf7"
build:
name: Run docker build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func startServers(server s.Server, settings *s.Config) error {

if settings.WSEnabled {
logWithCommand.Info("starting up WS server")
_, _, err := srpc.StartWSEndpoint(settings.WSEndpoint, server.APIs(), []string{"vdb", "net"}, nil, true)
_, _, err := srpc.StartWSEndpoint(settings.WSEndpoint, server.APIs(), []string{"vdb", "net"}, nil)
if err != nil {
return err
}
Expand Down
233 changes: 118 additions & 115 deletions go.mod

Large diffs are not rendered by default.

658 changes: 411 additions & 247 deletions go.sum

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pkg/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,21 @@ 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, error) {
func (pea *PublicEthAPI) ChainId() *hexutil.Big {
block, err := pea.B.CurrentBlock()
if err != nil {
if pea.proxyOnError {
if id, err := pea.ethClient.ChainID(context.Background()); err == nil {
return (*hexutil.Big)(id), nil
return (*hexutil.Big)(id)
}
}
return nil, err
return nil
}

if config := pea.B.Config.ChainConfig; config.IsEIP155(block.Number()) {
return (*hexutil.Big)(config.ChainID), nil
return (*hexutil.Big)(config.ChainID)
}
return nil, fmt.Errorf("chain not synced beyond EIP-155 replay-protection fork block")
return nil
}

/*
Expand Down
5 changes: 5 additions & 0 deletions pkg/eth/backend_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
result.TransactionIndex = (*hexutil.Uint64)(&index)
}
switch tx.Type() {
case types.LegacyTxType:
// if a legacy transaction has an EIP-155 chain id, include it explicitly
if id := tx.ChainId(); id.Sign() != 0 {
result.ChainID = (*hexutil.Big)(id)
}
case types.AccessListTxType:
al := tx.AccessList()
result.Accesses = &al
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func StartHTTPEndpoint(endpoint string, apis []rpc.API, modules []string, cors []string, vhosts []string, timeouts rpc.HTTPTimeouts) (*rpc.Server, error) {

srv := rpc.NewServer()
err := node.RegisterApis(apis, modules, srv, false)
err := node.RegisterApis(apis, modules, srv)
if err != nil {
utils.Fatalf("Could not register HTTP API: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/rpc/ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
)

// StartWSEndpoint starts a websocket endpoint.
func StartWSEndpoint(endpoint string, apis []rpc.API, modules []string, wsOrigins []string, exposeAll bool) (net.Listener, *rpc.Server, error) {
func StartWSEndpoint(endpoint string, apis []rpc.API, modules []string, wsOrigins []string) (net.Listener, *rpc.Server, error) {
// All APIs registered, start the HTTP listener
var (
listener net.Listener
Expand All @@ -37,7 +37,7 @@ func StartWSEndpoint(endpoint string, apis []rpc.API, modules []string, wsOrigin

// Register all the APIs exposed by the services
handler := rpc.NewServer()
err = node.RegisterApis(apis, modules, handler, exposeAll)
err = node.RegisterApis(apis, modules, handler)
if err != nil {
utils.Fatalf("Could not register WS API: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion test/direct_proxy_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ var _ = Describe("Integration test", func() {
Expect(err).ToNot(HaveOccurred())

_, err = ipldClient.ChainID(ctx)
Expect(err).To(HaveOccurred())
Expect(err).ToNot(HaveOccurred())
})
})
})

0 comments on commit c9e6055

Please sign in to comment.