From 6727f8eda801241f021af9f4c70177e809edfe0c Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Tue, 30 May 2023 13:23:51 +0100 Subject: [PATCH] Updating Go v1.20 Prysm v4.0.5 Gethv1.11.6 (#1257) * Updating Go v1.20 Prysm v4.0.3 Gethv1.11.6 * fixing linter * fixing build CI * fix EOF on shutdown * updating geth and prysm * update beacon config * using go v1.20.4 * force same version of forks + add delay in host closing conns * update onboarding doc --- .github/workflows/build-pr.yml | 4 +-- .github/workflows/golangci-lint.yml | 6 ++-- .../workflows/manual-deploy-testnet-l2.yml | 4 +-- .../workflows/manual-upgrade-testnet-l2.yml | 4 +-- README.md | 6 +--- developer_onboarding_guide.md | 17 ++++++++-- dockerfiles/enclave.debug.Dockerfile | 2 +- dockerfiles/host.Dockerfile | 2 +- docs/_docs/testnet/starting-a-node.md | 4 +-- go.mod | 2 +- go/common/tracers/native/noop.go | 14 ++++----- go/common/tracers/native/prestate.go | 10 +++--- go/common/tracers/native/tracer.go | 2 +- go/enclave/components/batch_registry.go | 2 +- go/enclave/crosschain/message_bus_manager.go | 4 +-- go/enclave/db/sql/sql.go | 14 ++++----- go/enclave/db/storage.go | 8 ++--- go/enclave/enclave.go | 4 +-- go/enclave/enclave_test.go | 5 +-- go/enclave/evm/chain_context.go | 6 ++-- go/enclave/evm/no_op_engine.go | 31 ++++++++++--------- go/enclave/l2chain/l2_chain.go | 2 +- go/enclave/limiters/rolluplimiter.go | 2 +- go/enclave/rpc_server.go | 2 +- go/ethadapter/blockprovider_test.go | 16 +++++----- go/host/container/host_container.go | 7 ++++- go/host/db/batches.go | 24 +++++--------- go/host/host.go | 14 +++------ go/host/p2p/p2p.go | 2 ++ go/host/rpc/clientapi/client_api_debug.go | 4 +-- integration/eth2network/build_geth_binary.sh | 2 +- integration/eth2network/eth2_binaries.go | 4 +-- integration/eth2network/eth2_configs.go | 8 ++--- .../eth2network/rotation_writer_test.go | 4 +-- integration/ethereummock/node.go | 2 +- .../actions/native_fund_actions.go | 6 ++-- .../networktest/actions/util_actions.go | 8 ++--- .../networktest/userwallet/userwallet.go | 4 +-- .../simulation/network/geth_network.go | 2 +- integration/simulation/network/socket.go | 2 +- integration/simulation/output_stats.go | 2 +- .../simulation/p2p/in_mem_obscuro_client.go | 2 +- integration/simulation/simulation_tester.go | 2 +- .../smartcontract/smartcontracts_test.go | 2 +- testnet/contractdeployer.Dockerfile | 2 +- testnet/eth2network.Dockerfile | 2 +- testnet/hardhatdeployer.Dockerfile | 2 +- testnet/obscuroscan.Dockerfile | 2 +- testnet/walletextension.Dockerfile | 2 +- 49 files changed, 143 insertions(+), 141 deletions(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index ac56a5b15f..b2532d9539 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -16,9 +16,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: 1.20.4 # Makes sure the artifacts are built correctly - name: Build diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index b93463e24e..258f8eaa7e 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -20,15 +20,15 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: 1.20.4 - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.48.0 + version: v1.52.2 args: --timeout=5m --verbose skip-pkg-cache: true diff --git a/.github/workflows/manual-deploy-testnet-l2.yml b/.github/workflows/manual-deploy-testnet-l2.yml index 6a707ef646..a45cb4b794 100644 --- a/.github/workflows/manual-deploy-testnet-l2.yml +++ b/.github/workflows/manual-deploy-testnet-l2.yml @@ -39,9 +39,9 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: 1.20.4 - name: 'Login via Azure CLI' uses: azure/login@v1 diff --git a/.github/workflows/manual-upgrade-testnet-l2.yml b/.github/workflows/manual-upgrade-testnet-l2.yml index 07a515a82c..d161e6b0aa 100644 --- a/.github/workflows/manual-upgrade-testnet-l2.yml +++ b/.github/workflows/manual-upgrade-testnet-l2.yml @@ -40,9 +40,9 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: 1.20.4 - name: 'Login via Azure CLI' uses: azure/login@v1 diff --git a/README.md b/README.md index fd1a2852a2..4eb097a16d 100644 --- a/README.md +++ b/README.md @@ -279,14 +279,10 @@ written in [go](https://go.dev). Unless otherwise stated, all paths stated herei ### Dependencies The following dependencies are required to be installed locally; -- [go](https://go.dev) (version > 1.18) +- [go](https://go.dev) (version > 1.20) - [docker](https://docs.docker.com/get-docker/) (recommend latest version*) - [docker compose](https://docs.docker.com/compose/install/) (recommend latest version) -Whilst the recommended version of go is > 1.18, the reference implementation uses _only_ language features up to and -including 1.17. Using 1.18 is recommended for easier setup and installation and is backwards compatible with all 1.17 -language features. - ### Building To create the build artifacts local to the checkout of the repository the easiest approach is to build each component diff --git a/developer_onboarding_guide.md b/developer_onboarding_guide.md index 27eedb94e5..af4c645d4b 100644 --- a/developer_onboarding_guide.md +++ b/developer_onboarding_guide.md @@ -1,9 +1,22 @@ # Developer Onboarding Guide ## Prerequisites -- [go](https://go.dev/doc/install) (version > 1.18) +- [go](https://go.dev/doc/install) (version > 1.20.4) - [gofumpt](https://github.com/mvdan/gofumpt) -- [golangci-lint](https://golangci-lint.run/) (version 1.48.0) +- [golangci-lint](https://golangci-lint.run/) (version 1.52.2) + +# Update Setup quicksheet +- Install golangci-lint : + `curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2` +- Install go1.20.4 : + [Multiversion install](https://go.dev/doc/manage-install) example: +``` +$ go install golang.org/dl/go1.20.4@latest +$ go1.20.4 download +# update your .zshrc script so that go is in the PATH +$ export PATH="/Users/pedro/sdk/go1.20.4/bin/:/Users/pedro/go/bin:$PATH" + +``` ## Creating New PR and Getting It Ready to Be Merged to the Main Branch diff --git a/dockerfiles/enclave.debug.Dockerfile b/dockerfiles/enclave.debug.Dockerfile index c15568f8e9..aaac55681a 100644 --- a/dockerfiles/enclave.debug.Dockerfile +++ b/dockerfiles/enclave.debug.Dockerfile @@ -4,7 +4,7 @@ # build-enclave = copies over the source and builds the enclave using a go compiler cache # final = using the base system copies over only the enclave executable and creates the final image without source and dependencies. -FROM golang:1.18-alpine as system +FROM golang:1.20-alpine as system # install build utils RUN apk add build-base diff --git a/dockerfiles/host.Dockerfile b/dockerfiles/host.Dockerfile index 09da16ece1..2e42f3abcc 100644 --- a/dockerfiles/host.Dockerfile +++ b/dockerfiles/host.Dockerfile @@ -4,7 +4,7 @@ # build-host = copies over the source code and builds the binaries using a compiler cache # final = copies over only the executables in an alpine image that doesn't have any additional load. -FROM golang:1.18-alpine as system +FROM golang:1.20-alpine as system # set the base libs to build / run RUN apk add build-base bash ENV CGO_ENABLED=1 diff --git a/docs/_docs/testnet/starting-a-node.md b/docs/_docs/testnet/starting-a-node.md index 365cb1ae3b..b53aa77175 100644 --- a/docs/_docs/testnet/starting-a-node.md +++ b/docs/_docs/testnet/starting-a-node.md @@ -11,12 +11,12 @@ How to start a node in the Evan's Cat testnet. #### - Create an SGX enabled VM Recommended Standard DC4s v2 (4 vcpus, 16 GiB memory) in Azure. -#### - Install Docker & Go 1.17 +#### - Install Docker & Go ``` sudo apt-get update \ && curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh \ - && sudo snap refresh && sudo snap install --channel=1.17 go --classic + && sudo snap refresh && sudo snap install --channel=1.20 go --classic ``` #### - Download Obscuro repo diff --git a/go.mod b/go.mod index 80ef8a93ac..f0154f730a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/obscuronet/go-obscuro -go 1.18 +go 1.20 require ( github.com/Azure/azure-sdk-for-go v63.2.0+incompatible diff --git a/go/common/tracers/native/noop.go b/go/common/tracers/native/noop.go index 16f7855971..ba625bd854 100644 --- a/go/common/tracers/native/noop.go +++ b/go/common/tracers/native/noop.go @@ -44,28 +44,28 @@ func newNoopTracer() tracers.Tracer { } // CaptureStart implements the EVMLogger interface to initialize the tracing operation. -func (t *noopTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) { +func (t *noopTracer) CaptureStart(_ *vm.EVM, _ common.Address, _ common.Address, _ bool, _ []byte, _ uint64, _ *big.Int) { } // CaptureEnd is called after the call finishes to finalize the tracing. -func (t *noopTracer) CaptureEnd(output []byte, gasUsed uint64, _ time.Duration, err error) { +func (t *noopTracer) CaptureEnd(_ []byte, _ uint64, _ time.Duration, _ error) { } // CaptureState implements the EVMLogger interface to trace a single step of VM execution. -func (t *noopTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) { +func (t *noopTracer) CaptureState(_ uint64, _ vm.OpCode, _, _ uint64, _ *vm.ScopeContext, _ []byte, _ int, _ error) { } // CaptureFault implements the EVMLogger interface to trace an execution fault. -func (t *noopTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, _ *vm.ScopeContext, depth int, err error) { +func (t *noopTracer) CaptureFault(_ uint64, _ vm.OpCode, _, _ uint64, _ *vm.ScopeContext, _ int, _ error) { } // CaptureEnter is called when EVM enters a new scope (via call, create or selfdestruct). -func (t *noopTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { +func (t *noopTracer) CaptureEnter(_ vm.OpCode, _ common.Address, _ common.Address, _ []byte, _ uint64, _ *big.Int) { } // CaptureExit is called when EVM exits a scope, even if the scope didn't // execute any code. -func (t *noopTracer) CaptureExit(output []byte, gasUsed uint64, err error) { +func (t *noopTracer) CaptureExit(_ []byte, _ uint64, _ error) { } // GetResult returns an empty json object. @@ -74,5 +74,5 @@ func (t *noopTracer) GetResult() (json.RawMessage, error) { } // Stop terminates execution of the tracer at the first opportune moment. -func (t *noopTracer) Stop(err error) { +func (t *noopTracer) Stop(_ error) { } diff --git a/go/common/tracers/native/prestate.go b/go/common/tracers/native/prestate.go index f44f476ce8..4ba50698aa 100644 --- a/go/common/tracers/native/prestate.go +++ b/go/common/tracers/native/prestate.go @@ -102,7 +102,7 @@ func (t *prestateTracer) CaptureStart(env *vm.EVM, from common.Address, to commo } // CaptureEnd is called after the call finishes to finalize the tracing. -func (t *prestateTracer) CaptureEnd(output []byte, gasUsed uint64, _ time.Duration, err error) { +func (t *prestateTracer) CaptureEnd(_ []byte, _ uint64, _ time.Duration, _ error) { if t.create { // Exclude created contract. delete(t.prestate, t.to) @@ -110,7 +110,7 @@ func (t *prestateTracer) CaptureEnd(output []byte, gasUsed uint64, _ time.Durati } // CaptureState implements the EVMLogger interface to trace a single step of VM execution. -func (t *prestateTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) { +func (t *prestateTracer) CaptureState(_ uint64, op vm.OpCode, _, _ uint64, scope *vm.ScopeContext, _ []byte, _ int, _ error) { stack := scope.Stack stackData := stack.Data() stackLen := len(stackData) @@ -139,16 +139,16 @@ func (t *prestateTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, } // CaptureFault implements the EVMLogger interface to trace an execution fault. -func (t *prestateTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, _ *vm.ScopeContext, depth int, err error) { +func (t *prestateTracer) CaptureFault(_ uint64, _ vm.OpCode, _, _ uint64, _ *vm.ScopeContext, _ int, _ error) { } // CaptureEnter is called when EVM enters a new scope (via call, create or selfdestruct). -func (t *prestateTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { +func (t *prestateTracer) CaptureEnter(_ vm.OpCode, _ common.Address, _ common.Address, _ []byte, _ uint64, _ *big.Int) { } // CaptureExit is called when EVM exits a scope, even if the scope didn't // execute any code. -func (t *prestateTracer) CaptureExit(output []byte, gasUsed uint64, err error) { +func (t *prestateTracer) CaptureExit(_ []byte, _ uint64, _ error) { } // GetResult returns the json-encoded nested list of call traces, and any diff --git a/go/common/tracers/native/tracer.go b/go/common/tracers/native/tracer.go index c417851ab2..35c533ff93 100644 --- a/go/common/tracers/native/tracer.go +++ b/go/common/tracers/native/tracer.go @@ -73,7 +73,7 @@ func register(name string, ctor func() tracers.Tracer) { } // lookup returns a tracer, if one can be matched to the given name. -func lookup(name string, ctx *tracers.Context) (tracers.Tracer, error) { +func lookup(name string, _ *tracers.Context) (tracers.Tracer, error) { if ctors == nil { ctors = make(map[string]func() tracers.Tracer) } diff --git a/go/enclave/components/batch_registry.go b/go/enclave/components/batch_registry.go index ce2ce4ed5a..b670068aa3 100644 --- a/go/enclave/components/batch_registry.go +++ b/go/enclave/components/batch_registry.go @@ -214,7 +214,7 @@ func (br *batchRegistryImpl) getMissingBatches(fromHash *common.L2BatchHash) ([] func (br *batchRegistryImpl) FindAncestralBatchFor(block *common.L1Block) (*core.Batch, error) { currentBlock := block - var ancestorBatch *core.Batch = nil + var ancestorBatch *core.Batch var err error br.logger.Trace("Searching for ancestral batch") diff --git a/go/enclave/crosschain/message_bus_manager.go b/go/enclave/crosschain/message_bus_manager.go index 8161320b6d..a40c9a77eb 100644 --- a/go/enclave/crosschain/message_bus_manager.go +++ b/go/enclave/crosschain/message_bus_manager.go @@ -75,7 +75,7 @@ func (m *MessageBusManager) GetBusAddress() *common.L2Address { } // DeriveOwner - Generates the key pair that will be used to transact with the L2 message bus. -func (m *MessageBusManager) DeriveOwner(seed []byte) (*common.L2Address, error) { +func (m *MessageBusManager) DeriveOwner(_ []byte) (*common.L2Address, error) { // todo (#1549) - implement with cryptography epic return m.messageBusAddress, nil } @@ -123,7 +123,7 @@ func (m *MessageBusManager) ExtractOutboundMessages(receipts common.L2Receipts) // todo (@stefan) - fix ordering of messages, currently it is irrelevant. // todo (@stefan) - do not extract messages below their consistency level. Irrelevant security wise. // todo (@stefan) - surface errors -func (m *MessageBusManager) RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, rollupState *state.StateDB) common.CrossChainMessages { +func (m *MessageBusManager) RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, _ *state.StateDB) common.CrossChainMessages { messages := make(common.CrossChainMessages, 0) from := fromBlock.Hash() diff --git a/go/enclave/db/sql/sql.go b/go/enclave/db/sql/sql.go index 4395b156c9..77e9a8ad21 100644 --- a/go/enclave/db/sql/sql.go +++ b/go/enclave/db/sql/sql.go @@ -106,13 +106,13 @@ func (sqlDB *EnclaveDB) NewIterator(prefix []byte, start []byte) ethdb.Iterator } } -func (sqlDB *EnclaveDB) Stat(property string) (string, error) { +func (sqlDB *EnclaveDB) Stat(_ string) (string, error) { // todo - implement me sqlDB.logger.Crit("implement me") return "", nil } -func (sqlDB *EnclaveDB) Compact(start []byte, limit []byte) error { +func (sqlDB *EnclaveDB) Compact(_ []byte, _ []byte) error { // todo - implement me sqlDB.logger.Crit("implement me") return nil @@ -124,17 +124,17 @@ func (sqlDB *EnclaveDB) Compact(start []byte, limit []byte) error { var errNotSupported = errors.New("this operation is not supported") // HasAncient returns an error as we don't have a backing chain freezer. -func (sqlDB *EnclaveDB) HasAncient(kind string, number uint64) (bool, error) { +func (sqlDB *EnclaveDB) HasAncient(_ string, _ uint64) (bool, error) { return false, errNotSupported } // Ancient returns an error as we don't have a backing chain freezer. -func (sqlDB *EnclaveDB) Ancient(kind string, number uint64) ([]byte, error) { +func (sqlDB *EnclaveDB) Ancient(_ string, _ uint64) ([]byte, error) { return nil, errNotSupported } // AncientRange returns an error as we don't have a backing chain freezer. -func (sqlDB *EnclaveDB) AncientRange(kind string, start, max, maxByteSize uint64) ([][]byte, error) { +func (sqlDB *EnclaveDB) AncientRange(_ string, _, _, _ uint64) ([][]byte, error) { return nil, errNotSupported } @@ -144,7 +144,7 @@ func (sqlDB *EnclaveDB) Ancients() (uint64, error) { } // AncientSize returns an error as we don't have a backing chain freezer. -func (sqlDB *EnclaveDB) AncientSize(kind string) (uint64, error) { +func (sqlDB *EnclaveDB) AncientSize(_ string) (uint64, error) { return 0, errNotSupported } @@ -154,7 +154,7 @@ func (sqlDB *EnclaveDB) ModifyAncients(func(ethdb.AncientWriteOp) error) (int64, } // TruncateAncients returns an error as we don't have a backing chain freezer. -func (sqlDB *EnclaveDB) TruncateAncients(items uint64) error { +func (sqlDB *EnclaveDB) TruncateAncients(_ uint64) error { return errNotSupported } diff --git a/go/enclave/db/storage.go b/go/enclave/db/storage.go index 2c33a0e3ec..cbc82625be 100644 --- a/go/enclave/db/storage.go +++ b/go/enclave/db/storage.go @@ -522,7 +522,7 @@ func (s *storageImpl) loadLogs(requestingAccount *gethcommon.Address, whereCondi query += whereCondition queryParams = append(queryParams, whereParams...) - rows, err := s.db.GetSQLDB().Query(query, queryParams...) + rows, err := s.db.GetSQLDB().Query(query, queryParams...) //nolint: rowserrcheck if err != nil { return nil, err } @@ -545,7 +545,7 @@ func (s *storageImpl) loadLogs(requestingAccount *gethcommon.Address, whereCondi result = append(result, &l) } - if err = rows.Close(); err != nil { + if err = rows.Close(); err != nil { //nolint: sqlclosecheck return nil, syserr.NewInternalError(err) } @@ -567,7 +567,7 @@ func (s *storageImpl) DebugGetLogs(txHash common.TxHash) ([]*tracers.DebugLogs, result := make([]*tracers.DebugLogs, 0) - rows, err := s.db.GetSQLDB().Query(query, queryParams...) + rows, err := s.db.GetSQLDB().Query(query, queryParams...) //nolint: rowserrcheck if err != nil { return nil, err } @@ -615,7 +615,7 @@ func (s *storageImpl) DebugGetLogs(txHash common.TxHash) ([]*tracers.DebugLogs, result = append(result, &l) } - if err = rows.Close(); err != nil { + if err = rows.Close(); err != nil { //nolint: sqlclosecheck return nil, err } diff --git a/go/enclave/enclave.go b/go/enclave/enclave.go index 2b4a555ec0..515672c58d 100644 --- a/go/enclave/enclave.go +++ b/go/enclave/enclave.go @@ -1074,7 +1074,7 @@ func (e *enclaveImpl) GetLogs(encryptedParams common.EncryptedParamsGetLogs) (*r // once the work of obscuro gas mechanics is established this method should be simplified func (e *enclaveImpl) DoEstimateGas(args *gethapi.TransactionArgs, blkNumber *gethrpc.BlockNumber, gasCap uint64) (hexutil.Uint64, common.SystemError) { //nolint: gocognit // Binary search the gas requirement, as it may be higher than the amount used - var ( + var ( //nolint: revive lo = params.TxGas - 1 hi uint64 cap uint64 //nolint:predeclared @@ -1144,7 +1144,7 @@ func (e *enclaveImpl) DoEstimateGas(args *gethapi.TransactionArgs, blkNumber *ge e.logger.Warn("Caller gas above allowance, capping", "requested", hi, "cap", gasCap) hi = gasCap } - cap = hi + cap = hi //nolint: revive // Execute the binary search and hone in on an isGasEnough gas limit for lo+1 < hi { diff --git a/go/enclave/enclave_test.go b/go/enclave/enclave_test.go index 4e0f4fe651..5a7d132680 100644 --- a/go/enclave/enclave_test.go +++ b/go/enclave/enclave_test.go @@ -622,11 +622,8 @@ func injectNewBlockAndChangeBalance(enclave common.Enclave, funds []genesis.Acco if err = enclave.(*enclaveImpl).storage.UpdateHeadBatch(blockHash, batch, nil, dbBatch); err != nil { return err } - if err = enclave.(*enclaveImpl).storage.CommitBatch(dbBatch); err != nil { - return err - } - return nil + return enclave.(*enclaveImpl).storage.CommitBatch(dbBatch) } func checkExpectedBalance(enclave common.Enclave, blkNumber gethrpc.BlockNumber, w wallet.Wallet, expectedAmount *big.Int) error { diff --git a/go/enclave/evm/chain_context.go b/go/enclave/evm/chain_context.go index 0fadea0735..ab491ad962 100644 --- a/go/enclave/evm/chain_context.go +++ b/go/enclave/evm/chain_context.go @@ -32,8 +32,8 @@ func (occ *ObscuroChainContext) Engine() consensus.Engine { return &ObscuroNoOpConsensusEngine{logger: occ.logger} } -func (occ *ObscuroChainContext) GetHeader(hash common.Hash, height uint64) *types.Header { - batch, err := occ.storage.FetchBatchHeader(hash) +func (occ *ObscuroChainContext) GetHeader(hash common.Hash, _ uint64) *types.Header { + batch, err := occ.storage.FetchBatch(hash) if err != nil { if errors.Is(err, errutil.ErrNotFound) { return nil @@ -41,7 +41,7 @@ func (occ *ObscuroChainContext) GetHeader(hash common.Hash, height uint64) *type occ.logger.Crit("Could not retrieve rollup", log.ErrKey, err) } - h, err := gethencoding.ConvertToEthHeader(batch, secret(occ.storage)) + h, err := gethencoding.ConvertToEthHeader(batch.Header, secret(occ.storage)) if err != nil { occ.logger.Crit("Could not convert to eth header", log.ErrKey, err) return nil diff --git a/go/enclave/evm/no_op_engine.go b/go/enclave/evm/no_op_engine.go index cc7408714d..fba2dac3a5 100644 --- a/go/enclave/evm/no_op_engine.go +++ b/go/enclave/evm/no_op_engine.go @@ -22,58 +22,59 @@ type ObscuroNoOpConsensusEngine struct { logger gethlog.Logger } +func (e *ObscuroNoOpConsensusEngine) Finalize(_ consensus.ChainHeaderReader, _ *types.Header, _ *state.StateDB, _ []*types.Transaction, _ []*types.Header) { + // TODO implement me + panic("implement me") +} + // Author is used to determine where to send the gas collected from the fees. -func (e *ObscuroNoOpConsensusEngine) Author(header *types.Header) (common.Address, error) { +func (e *ObscuroNoOpConsensusEngine) Author(_ *types.Header) (common.Address, error) { return PoolAddress, nil } -func (e *ObscuroNoOpConsensusEngine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error { +func (e *ObscuroNoOpConsensusEngine) VerifyHeader(_ consensus.ChainHeaderReader, _ *types.Header, _ bool) error { e.logger.Crit("noop") return nil } -func (e *ObscuroNoOpConsensusEngine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { +func (e *ObscuroNoOpConsensusEngine) VerifyHeaders(_ consensus.ChainHeaderReader, _ []*types.Header, _ []bool) (chan<- struct{}, <-chan error) { e.logger.Crit("noop") return nil, nil } -func (e *ObscuroNoOpConsensusEngine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error { +func (e *ObscuroNoOpConsensusEngine) VerifyUncles(_ consensus.ChainReader, _ *types.Block) error { e.logger.Crit("noop") return nil } -func (e *ObscuroNoOpConsensusEngine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error { +func (e *ObscuroNoOpConsensusEngine) Prepare(_ consensus.ChainHeaderReader, _ *types.Header) error { e.logger.Crit("noop") return nil } -func (e *ObscuroNoOpConsensusEngine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header) { - e.logger.Crit("noop") -} - -func (e *ObscuroNoOpConsensusEngine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, - uncles []*types.Header, receipts []*types.Receipt, +func (e *ObscuroNoOpConsensusEngine) FinalizeAndAssemble(_ consensus.ChainHeaderReader, _ *types.Header, _ *state.StateDB, _ []*types.Transaction, + _ []*types.Header, _ []*types.Receipt, ) (*types.Block, error) { e.logger.Crit("noop") return nil, nil //nolint:nilnil } -func (e *ObscuroNoOpConsensusEngine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error { +func (e *ObscuroNoOpConsensusEngine) Seal(_ consensus.ChainHeaderReader, _ *types.Block, _ chan<- *types.Block, _ <-chan struct{}) error { e.logger.Crit("noop") return nil } -func (e *ObscuroNoOpConsensusEngine) SealHash(header *types.Header) common.Hash { +func (e *ObscuroNoOpConsensusEngine) SealHash(_ *types.Header) common.Hash { e.logger.Crit("noop") return common.Hash{} } -func (e *ObscuroNoOpConsensusEngine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int { +func (e *ObscuroNoOpConsensusEngine) CalcDifficulty(_ consensus.ChainHeaderReader, _ uint64, _ *types.Header) *big.Int { e.logger.Crit("noop") return nil } -func (e *ObscuroNoOpConsensusEngine) APIs(chain consensus.ChainHeaderReader) []rpc.API { +func (e *ObscuroNoOpConsensusEngine) APIs(_ consensus.ChainHeaderReader) []rpc.API { e.logger.Crit("noop") return nil } diff --git a/go/enclave/l2chain/l2_chain.go b/go/enclave/l2chain/l2_chain.go index df1c937197..279c2b0fde 100644 --- a/go/enclave/l2chain/l2_chain.go +++ b/go/enclave/l2chain/l2_chain.go @@ -168,7 +168,7 @@ func (oc *obscuroChain) ObsCallAtBlock(apiArgs *gethapi.TransactionArgs, blockNu // GetChainStateAtTransaction Returns the state of the chain at certain block height after executing transactions up to the selected transaction // TODO make this cacheable -func (oc *obscuroChain) GetChainStateAtTransaction(batch *core.Batch, txIndex int, reexec uint64) (gethcore.Message, vm.BlockContext, *state.StateDB, error) { +func (oc *obscuroChain) GetChainStateAtTransaction(batch *core.Batch, txIndex int, _ uint64) (gethcore.Message, vm.BlockContext, *state.StateDB, error) { // Short circuit if it's genesis batch. if batch.NumberU64() == 0 { return nil, vm.BlockContext{}, nil, errors.New("no transaction in genesis") diff --git a/go/enclave/limiters/rolluplimiter.go b/go/enclave/limiters/rolluplimiter.go index 2a70f06b4b..05800a10b9 100644 --- a/go/enclave/limiters/rolluplimiter.go +++ b/go/enclave/limiters/rolluplimiter.go @@ -30,7 +30,7 @@ func NewRollupLimiter(size uint64) RollupLimiter { func (rl *rollupLimiter) AcceptBatch(encodable interface{}) (bool, error) { encodedData, err := rlp.EncodeToBytes(encodable) if err != nil { - return false, fmt.Errorf("%w: %v", ErrFailedToEncode, err) + return false, fmt.Errorf("%w: %s", ErrFailedToEncode, err.Error()) } encodedSize := uint64(len(encodedData)) diff --git a/go/enclave/rpc_server.go b/go/enclave/rpc_server.go index 4f389510dc..8addc91e1e 100644 --- a/go/enclave/rpc_server.go +++ b/go/enclave/rpc_server.go @@ -258,7 +258,7 @@ func (s *RPCServer) DebugTraceTransaction(_ context.Context, req *generated.Debu } func (s *RPCServer) StreamL2Updates(request *generated.StreamL2UpdatesRequest, stream generated.EnclaveProto_StreamL2UpdatesServer) error { - var fromHash *common.L2BatchHash = nil + var fromHash *common.L2BatchHash if request.KnownHead != nil { knownHead := gethcommon.BytesToHash(request.KnownHead) fromHash = &knownHead diff --git a/go/ethadapter/blockprovider_test.go b/go/ethadapter/blockprovider_test.go index 335717c457..8da3e1b5af 100644 --- a/go/ethadapter/blockprovider_test.go +++ b/go/ethadapter/blockprovider_test.go @@ -172,19 +172,19 @@ func (e *ethClientMock) BlockNumber() (uint64, error) { panic("implement me") } -func (e *ethClientMock) SendTransaction(signedTx *types.Transaction) error { +func (e *ethClientMock) SendTransaction(_ *types.Transaction) error { panic("implement me") } -func (e *ethClientMock) TransactionReceipt(hash gethcommon.Hash) (*types.Receipt, error) { +func (e *ethClientMock) TransactionReceipt(_ gethcommon.Hash) (*types.Receipt, error) { panic("implement me") } -func (e *ethClientMock) Nonce(address gethcommon.Address) (uint64, error) { +func (e *ethClientMock) Nonce(_ gethcommon.Address) (uint64, error) { panic("implement me") } -func (e *ethClientMock) BalanceAt(account gethcommon.Address, blockNumber *big.Int) (*big.Int, error) { +func (e *ethClientMock) BalanceAt(_ gethcommon.Address, _ *big.Int) (*big.Int, error) { panic("implement me") } @@ -200,15 +200,15 @@ func (e *ethClientMock) FetchHeadBlock() (*types.Block, error) { return e.blksByNum[e.liveStreamingNext-1], nil } -func (e *ethClientMock) BlocksBetween(block *types.Block, head *types.Block) []*types.Block { +func (e *ethClientMock) BlocksBetween(_ *types.Block, _ *types.Block) []*types.Block { panic("implement me") } -func (e *ethClientMock) IsBlockAncestor(block *types.Block, proof common.L1BlockHash) bool { +func (e *ethClientMock) IsBlockAncestor(_ *types.Block, _ common.L1BlockHash) bool { panic("implement me") } -func (e *ethClientMock) CallContract(msg ethereum.CallMsg) ([]byte, error) { +func (e *ethClientMock) CallContract(_ ethereum.CallMsg) ([]byte, error) { panic("implement me") } @@ -228,7 +228,7 @@ func (e *ethClientMock) Alive() bool { return true } -func (e *ethClientMock) EstimateGasAndGasPrice(txData types.TxData, from gethcommon.Address) (types.TxData, error) { +func (e *ethClientMock) EstimateGasAndGasPrice(txData types.TxData, _ gethcommon.Address) (types.TxData, error) { return txData, nil } diff --git a/go/host/container/host_container.go b/go/host/container/host_container.go index f7febbd948..db1de83a61 100644 --- a/go/host/container/host_container.go +++ b/go/host/container/host_container.go @@ -2,6 +2,7 @@ package container import ( "fmt" + "time" "github.com/ethereum/go-ethereum/rpc" "github.com/obscuronet/go-obscuro/go/common" @@ -73,7 +74,11 @@ func (h *HostContainer) Stop() error { if h.rpcServer != nil { // rpc server cannot be stopped synchronously as it will kill current request - go h.rpcServer.Stop() + go func() { + // make sure it's not killing the connection before returning the response + time.Sleep(time.Second) // todo review this sleep + h.rpcServer.Stop() + }() } return nil diff --git a/go/host/db/batches.go b/go/host/db/batches.go index 9463ed1d07..171bf36858 100644 --- a/go/host/db/batches.go +++ b/go/host/db/batches.go @@ -178,10 +178,8 @@ func (db *DB) writeBatchHeader(header *common.BatchHeader) error { return err } key := batchHeaderKey(header.Hash()) - if err := db.kvStore.Put(key, data); err != nil { - return err - } - return nil + + return db.kvStore.Put(key, data) } // Stores the head batch header hash into the database. @@ -196,10 +194,8 @@ func (db *DB) writeHeadBatchHash(val gethcommon.Hash) error { // Stores a batch's hash in the database, keyed by the batch's number. func (db *DB) writeBatchHash(w ethdb.KeyValueWriter, header *common.BatchHeader) error { key := batchHashKey(header.Number) - if err := w.Put(key, header.Hash().Bytes()); err != nil { - return err - } - return nil + + return w.Put(key, header.Hash().Bytes()) } // Retrieves the hash for the batch with the given number.. @@ -236,10 +232,8 @@ func (db *DB) readBatchTxHashes(batchHash common.L2BatchHash) ([]gethcommon.Hash // Stores a batch's number in the database, keyed by the hash of a transaction in that rollup. func (db *DB) writeBatchNumber(w ethdb.KeyValueWriter, header *common.BatchHeader, txHash gethcommon.Hash) error { key := batchNumberKey(txHash) - if err := w.Put(key, header.Number.Bytes()); err != nil { - return err - } - return nil + + return w.Put(key, header.Number.Bytes()) } // Writes the transaction hashes against the batch containing them. @@ -249,10 +243,8 @@ func (db *DB) writeBatchTxHashes(w ethdb.KeyValueWriter, batchHash common.L2Batc return err } key := batchTxHashesKey(batchHash) - if err = w.Put(key, data); err != nil { - return err - } - return nil + + return w.Put(key, data) } // Retrieves the number of the batch containing the transaction with the given hash. diff --git a/go/host/host.go b/go/host/host.go index ac07ccf557..9dc4a817c2 100644 --- a/go/host/host.go +++ b/go/host/host.go @@ -307,25 +307,21 @@ func (h *host) Stop() error { h.shutdownGroup.Wait() if err := h.p2p.StopListening(); err != nil { - h.logger.Error("failed to close transaction P2P listener cleanly", log.ErrKey, err) - return err + return fmt.Errorf("failed to close transaction P2P listener cleanly - %w", err) } // Leave some time for all processing to finish before exiting the main loop. time.Sleep(time.Second) if err := h.enclaveClient.Stop(); err != nil { - h.logger.Error("could not stop enclave server", log.ErrKey, err) - return err + return fmt.Errorf("failed to stop enclave server - %w", err) } if err := h.enclaveClient.StopClient(); err != nil { - h.logger.Error("failed to stop enclave RPC client", log.ErrKey, err) - return err + return fmt.Errorf("failed to stop enclave RPC client - %w", err) } if err := h.db.Stop(); err != nil { - h.logger.Error("could not stop DB - %w", err) - return err + return fmt.Errorf("failed to stop DB - %w", err) } h.logger.Info("Host shut down successfully.") @@ -939,7 +935,7 @@ func (h *host) startBatchStreaming() { // TODO: Update this to start from persisted head streamChan, stop := h.enclaveClient.StreamL2Updates(nil) - var lastBatch *common.ExtBatch = nil + var lastBatch *common.ExtBatch for { select { case <-h.interrupter.Done(): diff --git a/go/host/p2p/p2p.go b/go/host/p2p/p2p.go index 3b0b751216..d52472aa70 100644 --- a/go/host/p2p/p2p.go +++ b/go/host/p2p/p2p.go @@ -99,6 +99,8 @@ func (p *p2pImpl) StopListening() error { p.logger.Info("Shutting down P2P.") if p.listener != nil { atomic.StoreInt32(p.listenerInterrupt, 1) + // todo immediately shutting down the listener seems to impact other hosts shutdown process + time.Sleep(time.Second) return p.listener.Close() } return nil diff --git a/go/host/rpc/clientapi/client_api_debug.go b/go/host/rpc/clientapi/client_api_debug.go index ba41d51c4d..bb5dc39974 100644 --- a/go/host/rpc/clientapi/client_api_debug.go +++ b/go/host/rpc/clientapi/client_api_debug.go @@ -22,7 +22,7 @@ func NewNetworkDebug(host host.Host) *NetworkDebug { // TraceTransaction returns the structured logs created during the execution of EVM // and returns them as a JSON object. -func (api *NetworkDebug) TraceTransaction(ctx context.Context, hash gethcommon.Hash, config *tracers.TraceConfig) (interface{}, error) { +func (api *NetworkDebug) TraceTransaction(_ context.Context, hash gethcommon.Hash, config *tracers.TraceConfig) (interface{}, error) { response, err := api.host.EnclaveClient().DebugTraceTransaction(hash, config) if err != nil { return "", err @@ -31,7 +31,7 @@ func (api *NetworkDebug) TraceTransaction(ctx context.Context, hash gethcommon.H } // EventLogRelevancy returns the events for a given transactions and the revelancy params -func (api *NetworkDebug) EventLogRelevancy(ctx context.Context, hash gethcommon.Hash) (interface{}, error) { +func (api *NetworkDebug) EventLogRelevancy(_ context.Context, hash gethcommon.Hash) (interface{}, error) { response, err := api.host.EnclaveClient().DebugEventLogRelevancy(hash) if err != nil { return "", err diff --git a/integration/eth2network/build_geth_binary.sh b/integration/eth2network/build_geth_binary.sh index 406652eece..47a4b6af21 100755 --- a/integration/eth2network/build_geth_binary.sh +++ b/integration/eth2network/build_geth_binary.sh @@ -7,7 +7,7 @@ help_and_exit() { echo "" - echo "Usage: $(basename "${0}") --version=v1.10.17 " + echo "Usage: $(basename "${0}") --version=v1.11.6 " echo "" echo " version *Required* Set the version of geth to build" echo "" diff --git a/integration/eth2network/eth2_binaries.go b/integration/eth2network/eth2_binaries.go index 3df2af09c0..cbe2f03f05 100644 --- a/integration/eth2network/eth2_binaries.go +++ b/integration/eth2network/eth2_binaries.go @@ -13,8 +13,8 @@ import ( ) const ( - _gethVersion = "1.10.26" - _prysmVersion = "v3.2.2" + _gethVersion = "1.11.6" + _prysmVersion = "v4.0.5" ) var ( diff --git a/integration/eth2network/eth2_configs.go b/integration/eth2network/eth2_configs.go index ed783c8eac..61796582fc 100644 --- a/integration/eth2network/eth2_configs.go +++ b/integration/eth2network/eth2_configs.go @@ -36,18 +36,18 @@ DEPOSIT_NETWORK_ID: %d # Genesis GENESIS_FORK_VERSION: 0x20000089 - # Altair ALTAIR_FORK_EPOCH: 2 -ALTAIR_FORK_VERSION: 0x20000090 +ALTAIR_FORK_VERSION: 0x20000089 # Merge BELLATRIX_FORK_EPOCH: 4 -BELLATRIX_FORK_VERSION: 0x20000091 +BELLATRIX_FORK_VERSION: 0x20000089 TERMINAL_TOTAL_DIFFICULTY: 10 # Capella -CAPELLA_FORK_VERSION: 0x20000092 +CAPELLA_FORK_EPOCH: 90000000000000000 +CAPELLA_FORK_VERSION: 0x20000089 # Time parameters SECONDS_PER_SLOT: 2 diff --git a/integration/eth2network/rotation_writer_test.go b/integration/eth2network/rotation_writer_test.go index 31c81b6443..f9748fe762 100644 --- a/integration/eth2network/rotation_writer_test.go +++ b/integration/eth2network/rotation_writer_test.go @@ -21,7 +21,7 @@ func TestNewRotatingLogWriter(t *testing.T) { // Use the rotating log writer with the standard log package data := make([]byte, 1024*1024) - rand.Read(data) //nolint:gosec + rand.Read(data) //nolint: gosec,staticcheck _, err = writer.Write(data) assert.Nil(t, err) @@ -29,7 +29,7 @@ func TestNewRotatingLogWriter(t *testing.T) { time.Sleep(2 * time.Second) // Use the rotating log writer with the standard log package - rand.Read(data) //nolint:gosec + rand.Read(data) //nolint: gosec,staticcheck _, err = writer.Write(data) assert.Nil(t, err) diff --git a/integration/ethereummock/node.go b/integration/ethereummock/node.go index ff9b843bd9..4cf77e4db2 100644 --- a/integration/ethereummock/node.go +++ b/integration/ethereummock/node.go @@ -85,7 +85,7 @@ type Node struct { logger gethlog.Logger } -func (m *Node) EstimateGasAndGasPrice(txData types.TxData, from gethcommon.Address) (types.TxData, error) { +func (m *Node) EstimateGasAndGasPrice(txData types.TxData, _ gethcommon.Address) (types.TxData, error) { return txData, nil } diff --git a/integration/networktest/actions/native_fund_actions.go b/integration/networktest/actions/native_fund_actions.go index 241936c853..5184eca0d7 100644 --- a/integration/networktest/actions/native_fund_actions.go +++ b/integration/networktest/actions/native_fund_actions.go @@ -67,7 +67,7 @@ func (c *VerifyBalanceAfterTest) Run(ctx context.Context, _ networktest.NetworkC return ctx, nil } -func (c *VerifyBalanceAfterTest) Verify(ctx context.Context, network networktest.NetworkConnector) error { +func (c *VerifyBalanceAfterTest) Verify(ctx context.Context, _ networktest.NetworkConnector) error { user, err := FetchTestUser(ctx, c.UserID) if err != nil { return err @@ -91,11 +91,11 @@ type VerifyBalanceDiffAfterTest struct { Snapshot string } -func (v *VerifyBalanceDiffAfterTest) Run(ctx context.Context, network networktest.NetworkConnector) (context.Context, error) { +func (v *VerifyBalanceDiffAfterTest) Run(ctx context.Context, _ networktest.NetworkConnector) (context.Context, error) { return ctx, nil } -func (v *VerifyBalanceDiffAfterTest) Verify(ctx context.Context, network networktest.NetworkConnector) error { +func (v *VerifyBalanceDiffAfterTest) Verify(ctx context.Context, _ networktest.NetworkConnector) error { snapshotBalance, err := FetchBalanceAtSnapshot(ctx, v.UserID, v.Snapshot) if err != nil { return fmt.Errorf("failed to fetch balance - %w", err) diff --git a/integration/networktest/actions/util_actions.go b/integration/networktest/actions/util_actions.go index 419be32a93..63663c9946 100644 --- a/integration/networktest/actions/util_actions.go +++ b/integration/networktest/actions/util_actions.go @@ -18,11 +18,11 @@ type contextValueAction struct { value interface{} } -func (c *contextValueAction) Run(ctx context.Context, network networktest.NetworkConnector) (context.Context, error) { +func (c *contextValueAction) Run(ctx context.Context, _ networktest.NetworkConnector) (context.Context, error) { return context.WithValue(ctx, c.key, c.value), nil } -func (c *contextValueAction) Verify(ctx context.Context, network networktest.NetworkConnector) error { +func (c *contextValueAction) Verify(_ context.Context, _ networktest.NetworkConnector) error { // nothing to verify return nil } @@ -39,12 +39,12 @@ type sleepAction struct { sleepDuration time.Duration } -func (s *sleepAction) Run(ctx context.Context, network networktest.NetworkConnector) (context.Context, error) { +func (s *sleepAction) Run(ctx context.Context, _ networktest.NetworkConnector) (context.Context, error) { time.Sleep(s.sleepDuration) return ctx, nil } -func (s *sleepAction) Verify(ctx context.Context, network networktest.NetworkConnector) error { +func (s *sleepAction) Verify(_ context.Context, _ networktest.NetworkConnector) error { // nothing to verify return nil } diff --git a/integration/networktest/userwallet/userwallet.go b/integration/networktest/userwallet/userwallet.go index 6fa1213243..d5d62e850d 100644 --- a/integration/networktest/userwallet/userwallet.go +++ b/integration/networktest/userwallet/userwallet.go @@ -165,7 +165,7 @@ func (s *UserWallet) EnsureClientSetup(ctx context.Context) error { // client already setup return nil } - authClient, err := obsclient.DialWithAuth(s.rpcEndpoint, s, s.logger) + authClient, err := obsclient.DialWithAuth(s.rpcEndpoint, s, s.logger) //nolint: contextcheck if err != nil { return err } @@ -188,7 +188,7 @@ func (s *UserWallet) ResetClient(ctx context.Context) error { // client already setup, close it before re-authenticating s.client.Close() } - authClient, err := obsclient.DialWithAuth(s.rpcEndpoint, s, s.logger) + authClient, err := obsclient.DialWithAuth(s.rpcEndpoint, s, s.logger) //nolint: contextcheck if err != nil { return err } diff --git a/integration/simulation/network/geth_network.go b/integration/simulation/network/geth_network.go index 0e3d838348..b34432a196 100644 --- a/integration/simulation/network/geth_network.go +++ b/integration/simulation/network/geth_network.go @@ -28,7 +28,7 @@ func NewNetworkInMemoryGeth(wallets *params.SimWallets) Network { } // Create inits and starts the nodes, wires them up, and populates the network objects -func (n *networkInMemGeth) Create(params *params.SimParams, stats *stats.Stats) (*RPCHandles, error) { +func (n *networkInMemGeth) Create(params *params.SimParams, _ *stats.Stats) (*RPCHandles, error) { // kickoff the network with the prefunded wallet addresses params.L1SetupData, n.gethClients, n.eth2Network = SetUpGethNetwork( n.wallets, diff --git a/integration/simulation/network/socket.go b/integration/simulation/network/socket.go index 4519f2cf4b..f6f8aebea4 100644 --- a/integration/simulation/network/socket.go +++ b/integration/simulation/network/socket.go @@ -39,7 +39,7 @@ func NewNetworkOfSocketNodes(wallets *params.SimWallets) Network { } } -func (n *networkOfSocketNodes) Create(simParams *params.SimParams, stats *stats.Stats) (*RPCHandles, error) { +func (n *networkOfSocketNodes) Create(simParams *params.SimParams, _ *stats.Stats) (*RPCHandles, error) { // kickoff the network with the prefunded wallet addresses simParams.L1SetupData, n.gethClients, n.eth2Network = SetUpGethNetwork( n.wallets, diff --git a/integration/simulation/output_stats.go b/integration/simulation/output_stats.go index 47fa536146..d5b8465364 100644 --- a/integration/simulation/output_stats.go +++ b/integration/simulation/output_stats.go @@ -77,7 +77,7 @@ func (o *OutputStats) countBlockChain() { } } -func (o *OutputStats) incrementStats(block *types.Block, l1Node ethadapter.EthClient) { //nolint:unparam +func (o *OutputStats) incrementStats(block *types.Block, _ ethadapter.EthClient) { for _, tx := range block.Transactions() { t := o.simulation.Params.MgmtContractLib.DecodeTx(tx) if t == nil { diff --git a/integration/simulation/p2p/in_mem_obscuro_client.go b/integration/simulation/p2p/in_mem_obscuro_client.go index 51ab6ad5e1..ab05418053 100644 --- a/integration/simulation/p2p/in_mem_obscuro_client.go +++ b/integration/simulation/p2p/in_mem_obscuro_client.go @@ -116,7 +116,7 @@ func (c *inMemObscuroClient) Call(result interface{}, method string, args ...int // CallContext not currently supported by in-memory obscuro client, the context will be ignored. func (c *inMemObscuroClient) CallContext(_ context.Context, result interface{}, method string, args ...interface{}) error { - return c.Call(result, method, args...) + return c.Call(result, method, args...) //nolint: contextcheck } func (c *inMemObscuroClient) Subscribe(context.Context, interface{}, string, interface{}, ...interface{}) (*gethrpc.ClientSubscription, error) { diff --git a/integration/simulation/simulation_tester.go b/integration/simulation/simulation_tester.go index b9b6afd819..6421ab8453 100644 --- a/integration/simulation/simulation_tester.go +++ b/integration/simulation/simulation_tester.go @@ -27,7 +27,7 @@ func testSimulation(t *testing.T, netw network.Network, params *params.SimParams testlog.Logger().Info(fmt.Sprintf("goroutine leak monitor - simulation end - %d goroutines currently running", runtime.NumGoroutine())) }() testlog.Logger().Info(fmt.Sprintf("goroutine leak monitor - simulation start - %d goroutines currently running", runtime.NumGoroutine())) - rand.Seed(time.Now().UnixNano()) + rand.Seed(time.Now().UnixNano()) //nolint: staticcheck uuid.EnableRandPool() stats := simstats.NewStats(params.NumberOfNodes) diff --git a/integration/smartcontract/smartcontracts_test.go b/integration/smartcontract/smartcontracts_test.go index 087689ea14..c9178c6142 100644 --- a/integration/smartcontract/smartcontracts_test.go +++ b/integration/smartcontract/smartcontracts_test.go @@ -682,7 +682,7 @@ func detectSimpleFork(t *testing.T, mgmtContractLib *debugMgmtContractLib, w *de _, receipt, err = w.AwaitedSignAndSendTransaction(client, txData) if err != nil { - t.Error(err) + t.Fatal(err) } if receipt.Status != types.ReceiptStatusSuccessful { diff --git a/testnet/contractdeployer.Dockerfile b/testnet/contractdeployer.Dockerfile index 97ecd35493..6d9628643f 100644 --- a/testnet/contractdeployer.Dockerfile +++ b/testnet/contractdeployer.Dockerfile @@ -4,7 +4,7 @@ # build-deployer = copies over the source code and builds the binaries using a compiler cache # final = copies over only the executables in an alpine image that doesn't have any additional load. -FROM golang:1.18-alpine as system +FROM golang:1.20-alpine as system # set the base libs to build / run RUN apk add build-base bash git diff --git a/testnet/eth2network.Dockerfile b/testnet/eth2network.Dockerfile index 94139b20dd..6ab31eed9a 100644 --- a/testnet/eth2network.Dockerfile +++ b/testnet/eth2network.Dockerfile @@ -9,7 +9,7 @@ # final = copies over the executables from the 'build-*' stages and prepares the final image. # Build stage for downloading dependencies based on the core defined system -FROM golang:1.18-buster as get-dependencies +FROM golang:1.20-buster as get-dependencies # setup container data structure RUN mkdir -p /home/obscuro/go-obscuro diff --git a/testnet/hardhatdeployer.Dockerfile b/testnet/hardhatdeployer.Dockerfile index 7559306de3..00c2bb0d2d 100644 --- a/testnet/hardhatdeployer.Dockerfile +++ b/testnet/hardhatdeployer.Dockerfile @@ -7,7 +7,7 @@ # final = copies over the solidity/hardhat source, takes the installed project from the 'install-npm-deps' and the final wallet executable # in a lightweight image. -FROM golang:1.18-alpine as system +FROM golang:1.20-alpine as system # set the base libs to build / run RUN apk add build-base bash git diff --git a/testnet/obscuroscan.Dockerfile b/testnet/obscuroscan.Dockerfile index ffadc09cb4..09d193aa07 100644 --- a/testnet/obscuroscan.Dockerfile +++ b/testnet/obscuroscan.Dockerfile @@ -4,7 +4,7 @@ # build-obscuroscan = copies over the source code and builds the binaries using a compiler cache # final = copies over only the executables in an alpine image that doesn't have any additional load. -FROM golang:1.18-alpine as system +FROM golang:1.20-alpine as system # set the base libs to build / run RUN apk add build-base bash git diff --git a/testnet/walletextension.Dockerfile b/testnet/walletextension.Dockerfile index 87466cb81d..95ea0846e6 100644 --- a/testnet/walletextension.Dockerfile +++ b/testnet/walletextension.Dockerfile @@ -4,7 +4,7 @@ # build-wallet = copies over the source code and builds the binaries using a compiler cache # final = copies over only the executables in an alpine image that doesn't have any additional load. -FROM golang:1.18-alpine as system +FROM golang:1.20-alpine as system # set the base libs to build / run RUN apk add build-base bash git