Compare commits

..
13 changed files with 24 additions and 110 deletions
+4 -8
View File
@@ -29,7 +29,7 @@ jobs:
BUILD_KEY: ${{ secrets.BUILD_KEY }} BUILD_KEY: ${{ secrets.BUILD_KEY }}
with: with:
STACK_ORCHESTRATOR_REF: "f2fd766f5400fcb9eb47b50675d2e3b1f2753702" STACK_ORCHESTRATOR_REF: "f2fd766f5400fcb9eb47b50675d2e3b1f2753702"
GO_ETHEREUM_REF: "0c1e451c9865d8d47797b35526c4875f0d224772" GO_ETHEREUM_REF: "be1757b9fd884cb20c8d7faac8fa81fc49bb7216"
IPLD_ETH_DB_REF: "be345e0733d2c025e4082c5154e441317ae94cf7" IPLD_ETH_DB_REF: "be345e0733d2c025e4082c5154e441317ae94cf7"
build: build:
name: Run docker build name: Run docker build
@@ -43,17 +43,13 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Get the version - name: Get the version
id: vars id: vars
run: | run: echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})
- name: Run docker build - name: Run docker build
run: make docker-build run: make docker-build
- name: Tag docker image SHA - name: Tag docker image
run: docker tag cerc-io/ipld-eth-server git.vdb.to/cerc-io/ipld-eth-server/ipld-eth-server:${{steps.vars.outputs.sha}} run: docker tag cerc-io/ipld-eth-server git.vdb.to/cerc-io/ipld-eth-server/ipld-eth-server:${{steps.vars.outputs.sha}}
- name: Tag docker image TAG
run: docker tag git.vdb.to/cerc-io/ipld-eth-server/ipld-eth-server:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/ipld-eth-server/ipld-eth-server:${{steps.vars.outputs.tag}}
- name: Docker Login - name: Docker Login
run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin
- name: Docker Push - name: Docker Push
run: docker push git.vdb.to/cerc-io/ipld-eth-server/ipld-eth-server:${{steps.vars.outputs.sha}} run: docker push git.vdb.to/cerc-io/ipld-eth-server/ipld-eth-server:${{steps.vars.outputs.sha}}
+3 -3
View File
@@ -51,19 +51,19 @@ TEST_CONNECT_STRING = postgresql://$(DATABASE_USER):$(DATABASE_PASSWORD)@$(DATAB
TEST_CONNECT_STRING_LOCAL = postgresql://$(USER)@$(HOST_NAME):$(PORT)/$(TEST_DB)?sslmode=disable TEST_CONNECT_STRING_LOCAL = postgresql://$(USER)@$(HOST_NAME):$(PORT)/$(TEST_DB)?sslmode=disable
.PHONY: test .PHONY: test
test: test: | $(GOOSE)
go vet ./... go vet ./...
go fmt ./... go fmt ./...
go run github.com/onsi/ginkgo/ginkgo -r --skipPackage=test go run github.com/onsi/ginkgo/ginkgo -r --skipPackage=test
.PHONY: integrationtest .PHONY: integrationtest
integrationtest: integrationtest: | $(GOOSE)
go vet ./... go vet ./...
go fmt ./... go fmt ./...
go run github.com/onsi/ginkgo/ginkgo -r test/ -v go run github.com/onsi/ginkgo/ginkgo -r test/ -v
.PHONY: test_local .PHONY: test_local
test_local: test_local: | $(GOOSE)
go vet ./... go vet ./...
go fmt ./... go fmt ./...
./scripts/run_unit_test.sh ./scripts/run_unit_test.sh
+1 -1
View File
@@ -133,7 +133,7 @@ func startServers(server s.Server, settings *s.Config) error {
if settings.HTTPEnabled { if settings.HTTPEnabled {
logWithCommand.Info("starting up HTTP server") logWithCommand.Info("starting up HTTP server")
_, err := srpc.StartHTTPEndpoint(settings.HTTPEndpoint, server.APIs(), []string{"vdb", "eth", "debug", "net"}, nil, []string{"*"}, rpc.HTTPTimeouts{}) _, err := srpc.StartHTTPEndpoint(settings.HTTPEndpoint, server.APIs(), []string{"vdb", "eth", "net"}, nil, []string{"*"}, rpc.HTTPTimeouts{})
if err != nil { if err != nil {
return err return err
} }
-54
View File
@@ -1,54 +0,0 @@
// VulcanizeDB
// Copyright © 2022 Vulcanize
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package debug
import (
"context"
"errors"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/rpc"
"github.com/cerc-io/ipld-eth-server/v4/pkg/eth"
)
var _ tracers.Backend = &Backend{}
var (
errMethodNotSupported = errors.New("backend method not supported")
)
// Backend implements tracers.Backend interface
type Backend struct {
eth.Backend
}
// StateAtBlock retrieves the state database associated with a certain block
func (b *Backend) StateAtBlock(ctx context.Context, block *types.Block, reexec uint64, base *state.StateDB, checkLive, preferDisk bool) (*state.StateDB, error) {
rpcBlockNumber := rpc.BlockNumber(block.NumberU64())
statedb, _, err := b.StateAndHeaderByNumberOrHash(ctx, rpc.BlockNumberOrHashWithNumber(rpcBlockNumber))
return statedb, err
}
// StateAtTransaction returns the execution environment of a certain transaction
func (b *Backend) StateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (core.Message, vm.BlockContext, *state.StateDB, error) {
return nil, vm.BlockContext{}, nil, errMethodNotSupported
}
+4 -14
View File
@@ -45,11 +45,6 @@ import (
"github.com/cerc-io/ipld-eth-server/v4/pkg/shared" "github.com/cerc-io/ipld-eth-server/v4/pkg/shared"
) )
const (
defaultEVMTimeout = 30 * time.Second
defaultStateDiffTimeout = 240 * time.Second
)
// APIName is the namespace for the watcher's eth api // APIName is the namespace for the watcher's eth api
const APIName = "eth" const APIName = "eth"
@@ -932,7 +927,7 @@ func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash
return hex, err return hex, err
} }
result, err := DoCall(ctx, pea.B, args, blockNrOrHash, overrides, defaultEVMTimeout, pea.B.Config.RPCGasCap.Uint64()) result, err := DoCall(ctx, pea.B, args, blockNrOrHash, overrides, 5*time.Second, pea.B.Config.RPCGasCap.Uint64())
// If the result contains a revert reason, try to unpack and return it. // If the result contains a revert reason, try to unpack and return it.
if err == nil { if err == nil {
@@ -950,12 +945,7 @@ func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash
return hex, nil return hex, nil
} }
} }
return result.Return(), err
if result != nil {
return result.Return(), err
} else {
return nil, err
}
} }
func DoCall(ctx context.Context, b *Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, timeout time.Duration, globalGasCap uint64) (*core.ExecutionResult, error) { func DoCall(ctx context.Context, b *Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, timeout time.Duration, globalGasCap uint64) (*core.ExecutionResult, error) {
@@ -1064,7 +1054,7 @@ func (pea *PublicEthAPI) writeStateDiffAt(height int64) {
return return
} }
// we use a separate context than the one provided by the client // we use a separate context than the one provided by the client
ctx, cancel := context.WithTimeout(context.Background(), defaultStateDiffTimeout) ctx, cancel := context.WithTimeout(context.Background(), 240*time.Second)
defer cancel() defer cancel()
var data json.RawMessage var data json.RawMessage
params := statediff.Params{ params := statediff.Params{
@@ -1086,7 +1076,7 @@ func (pea *PublicEthAPI) writeStateDiffFor(blockHash common.Hash) {
return return
} }
// we use a separate context than the one provided by the client // we use a separate context than the one provided by the client
ctx, cancel := context.WithTimeout(context.Background(), defaultStateDiffTimeout) ctx, cancel := context.WithTimeout(context.Background(), 240*time.Second)
defer cancel() defer cancel()
var data json.RawMessage var data json.RawMessage
params := statediff.Params{ params := statediff.Params{
+2 -7
View File
@@ -258,11 +258,6 @@ func (b *Backend) GetTd(blockHash common.Hash) (*big.Int, error) {
return td, nil return td, nil
} }
// ChainConfig returns the active chain configuration.
func (b *Backend) ChainConfig() *params.ChainConfig {
return b.Config.ChainConfig
}
// CurrentBlock returns the current block // CurrentBlock returns the current block
func (b *Backend) CurrentBlock() (*types.Block, error) { func (b *Backend) CurrentBlock() (*types.Block, error) {
block, err := b.BlockByNumber(context.Background(), rpc.LatestBlockNumber) block, err := b.BlockByNumber(context.Background(), rpc.LatestBlockNumber)
@@ -854,8 +849,8 @@ func (b *Backend) ValidateTrie(stateRoot common.Hash) error {
} }
// RPCGasCap returns the configured gas cap for the rpc server // RPCGasCap returns the configured gas cap for the rpc server
func (b *Backend) RPCGasCap() uint64 { func (b *Backend) RPCGasCap() *big.Int {
return b.Config.RPCGasCap.Uint64() return b.Config.RPCGasCap
} }
func (b *Backend) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription { func (b *Backend) SubscribeNewTxsEvent(chan<- core.NewTxsEvent) event.Subscription {
+1 -1
View File
@@ -838,7 +838,7 @@ func (b *Block) Call(ctx context.Context, args struct {
return nil, err return nil, err
} }
} }
result, err := eth.DoCall(ctx, b.backend, args.Data, *b.numberOrHash, nil, 5*time.Second, b.backend.RPCGasCap()) result, err := eth.DoCall(ctx, b.backend, args.Data, *b.numberOrHash, nil, 5*time.Second, b.backend.RPCGasCap().Uint64())
if err != nil { if err != nil {
return nil, err return nil, err
} }
-1
View File
@@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/netutil" "github.com/ethereum/go-ethereum/p2p/netutil"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/cerc-io/ipld-eth-server/v4/pkg/prom" "github.com/cerc-io/ipld-eth-server/v4/pkg/prom"
) )
-2
View File
@@ -219,8 +219,6 @@ func NewConfig() (*Config, error) {
if rpcGasCap, ok := new(big.Int).SetString(rpcGasCapStr, 10); ok { if rpcGasCap, ok := new(big.Int).SetString(rpcGasCapStr, 10); ok {
c.RPCGasCap = rpcGasCap c.RPCGasCap = rpcGasCap
} }
} else {
c.RPCGasCap = big.NewInt(0)
} }
chainConfigPath := viper.GetString("ethereum.chainConfig") chainConfigPath := viper.GetString("ethereum.chainConfig")
if chainConfigPath != "" { if chainConfigPath != "" {
+6 -15
View File
@@ -24,7 +24,6 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/tracers"
ethnode "github.com/ethereum/go-ethereum/node" ethnode "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
@@ -32,7 +31,6 @@ import (
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/cerc-io/ipld-eth-server/v4/pkg/debug"
"github.com/cerc-io/ipld-eth-server/v4/pkg/eth" "github.com/cerc-io/ipld-eth-server/v4/pkg/eth"
"github.com/cerc-io/ipld-eth-server/v4/pkg/net" "github.com/cerc-io/ipld-eth-server/v4/pkg/net"
) )
@@ -141,23 +139,16 @@ func (sap *Service) APIs() []rpc.API {
Public: true, Public: true,
}, },
} }
ethAPI, err := eth.NewPublicEthAPI(sap.backend, sap.client, sap.supportsStateDiffing, sap.forwardEthCalls, sap.proxyOnError) ethAPI, err := eth.NewPublicEthAPI(sap.backend, sap.client, sap.supportsStateDiffing, sap.forwardEthCalls, sap.proxyOnError)
if err != nil { if err != nil {
log.Fatalf("unable to create public eth api: %v", err) log.Fatalf("unable to create public eth api: %v", err)
} }
return append(apis, rpc.API{
debugTracerAPI := tracers.APIs(&debug.Backend{Backend: *sap.backend})[0] Namespace: eth.APIName,
Version: eth.APIVersion,
return append(apis, Service: ethAPI,
rpc.API{ Public: true,
Namespace: eth.APIName, })
Version: eth.APIVersion,
Service: ethAPI,
Public: true,
},
debugTracerAPI,
)
} }
// Serve listens for incoming converter data off the screenAndServePayload from the Sync process // Serve listens for incoming converter data off the screenAndServePayload from the Sync process
+2 -2
View File
@@ -10,10 +10,10 @@
git checkout v4.2.1-alpha git checkout v4.2.1-alpha
``` ```
- Checkout [v4 release](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.23-statediff-4.2.0-alpha) in go-ethereum repo. - Checkout [v4 release](https://github.com/vulcanize/go-ethereum/releases/tag/v1.10.21-statediff-4.1.2-alpha) in go-ethereum repo.
```bash ```bash
# In go-ethereum repo. # In go-ethereum repo.
git checkout v1.10.23-statediff-4.2.0-alpha git checkout v1.10.21-statediff-4.1.2-alpha
``` ```
- Checkout working commit in stack-orchestrator repo. - Checkout working commit in stack-orchestrator repo.
-1
View File
@@ -13,7 +13,6 @@ import (
sdtypes "github.com/ethereum/go-ethereum/statediff/types" sdtypes "github.com/ethereum/go-ethereum/statediff/types"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
integration "github.com/cerc-io/ipld-eth-server/v4/test" integration "github.com/cerc-io/ipld-eth-server/v4/test"
) )
+1 -1
View File
@@ -21,7 +21,7 @@ import "fmt"
const ( const (
Major = 4 // Major version component of the current release Major = 4 // Major version component of the current release
Minor = 1 // Minor version component of the current release Minor = 1 // Minor version component of the current release
Patch = 9 // Patch version component of the current release Patch = 5 // Patch version component of the current release
Meta = "alpha" // Version metadata to append to the version string Meta = "alpha" // Version metadata to append to the version string
) )