Skip to content

Commit

Permalink
lint:
Browse files Browse the repository at this point in the history
  • Loading branch information
badgersrus committed Sep 20, 2024
1 parent c3de680 commit 60a1f3b
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 27 deletions.
1 change: 1 addition & 0 deletions go/enclave/rpc/GetTransactionCount.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rpc

import (
"fmt"

gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ten-protocol/go-ten/go/common/gethencoding"
Expand Down
1 change: 0 additions & 1 deletion go/enclave/storage/enclavedb/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const (

func WriteBatchHeader(ctx context.Context, dbtx *sql.Tx, batch *core.Batch, convertedHash gethcommon.Hash, blockId int64, isCanonical bool) error {
header, err := rlp.EncodeToBytes(batch.Header)

if err != nil {
return fmt.Errorf("could not encode batch header. Cause: %w", err)
}
Expand Down
7 changes: 3 additions & 4 deletions go/ethadapter/beacon_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func (bc *BeaconHTTPClient) request(ctx context.Context, dest any, reqPath strin
base = "http://" + base
}
baseURL, err := url.Parse(base)

if err != nil {
return fmt.Errorf("failed to parse base URL: %w", err)
}
Expand Down Expand Up @@ -258,9 +257,9 @@ func (cl *L1BeaconClient) GetBlobSidecars(ctx context.Context, b *types.Header,
for _, h := range hashes {
for _, sidecar := range resp.Data {
versionedHash := KZGToVersionedHash(kzg4844.Commitment(sidecar.KZGCommitment))
//println("Looking for versioned hash: ", h.Hex())
//println("Sidecars with versioned hash: ", versionedHash.Hex())
//println("")
// println("Looking for versioned hash: ", h.Hex())
// println("Sidecars with versioned hash: ", versionedHash.Hex())
// println("")
if h == versionedHash {
sidecars = append(sidecars, sidecar)
break
Expand Down
3 changes: 2 additions & 1 deletion go/ethadapter/beacon_client_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package ethadapter

import (
gethcommon "github.com/ethereum/go-ethereum/common"
"math/big"
"testing"

gethcommon "github.com/ethereum/go-ethereum/common"

"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/stretchr/testify/require"
"github.com/ten-protocol/go-ten/go/common"
Expand Down
4 changes: 2 additions & 2 deletions go/ethadapter/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func MakeSidecar(blobs []*kzg4844.Blob) (*types.BlobTxSidecar, []gethcommon.Hash
return nil, nil, fmt.Errorf("cannot compute KZG proof for fast commitment verification of blob %d in tx candidate: %w", i, err)
}
sidecar.Proofs = append(sidecar.Proofs, proof)
//blobHash := KZGToVersionedHash(commitment)
//println("created blob hash at ", call, blobHash.Hex())
// blobHash := KZGToVersionedHash(commitment)
// println("created blob hash at ", call, blobHash.Hex())
blobHashes = append(blobHashes, KZGToVersionedHash(commitment))
}
return sidecar, blobHashes, nil
Expand Down
3 changes: 2 additions & 1 deletion go/ethadapter/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/log"
"net/http"
"net/url"
"time"

"github.com/ethereum/go-ethereum/log"
)

const (
Expand Down
1 change: 0 additions & 1 deletion go/host/enclave/guardian.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ func (g *Guardian) processL1BlockTransactions(block *common.L1Block, rollupTxs [

// TODO (@will) this should be removed and pulled from the L1
err := g.storage.AddBlock(block.Header())

if err != nil {
g.logger.Error("Could not add block to host db.", log.ErrKey, err)
}
Expand Down
1 change: 1 addition & 0 deletions go/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"

gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ten-protocol/go-ten/go/host/l2"

Expand Down
4 changes: 2 additions & 2 deletions go/host/l1/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ func (p *Publisher) ExtractTenTransactionsAndBlobs(block *types.Block) ([]*ethad
}

func (p *Publisher) FetchLatestSeqNo() (*big.Int, error) {
//hash := *p.mgmtContractLib.GetContractAddr()
//println("contract address: ", hash.Hex())
// hash := *p.mgmtContractLib.GetContractAddr()
// println("contract address: ", hash.Hex())
return p.ethClient.FetchLastBatchSeqNo(*p.mgmtContractLib.GetContractAddr())
}

Expand Down
3 changes: 1 addition & 2 deletions integration/ethereummock/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ type Timer interface {
// SystemClock provides an instance of Clock that uses the system clock via methods in the time package.
var SystemClock Clock = systemClock{}

type systemClock struct {
}
type systemClock struct{}

func (s systemClock) Now() time.Time {
return time.Now()
Expand Down
3 changes: 2 additions & 1 deletion integration/ethereummock/mock_blob_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package ethereummock
import (
"context"
"fmt"
"sync"

"github.com/ethereum/go-ethereum"
gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ten-protocol/go-ten/go/ethadapter"
"github.com/ten-protocol/go-ten/go/host/l1"
"sync"
)

type BlobResolverInMem struct {
Expand Down
3 changes: 2 additions & 1 deletion integration/ethereummock/mock_blocks.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package ethereummock

import (
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ethereum/go-ethereum/trie"
"github.com/ten-protocol/go-ten/go/ethadapter"
"math/big"
)

var MockGenesisBlock, _ = NewBlock(nil, common.HexToAddress("0x0"), []*types.Transaction{}, 0)
Expand Down
7 changes: 4 additions & 3 deletions integration/ethereummock/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"context"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ten-protocol/go-ten/go/host/l1"
"math/big"
"sync"
"sync/atomic"
"time"

"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ten-protocol/go-ten/go/host/l1"

"github.com/ten-protocol/go-ten/go/common/async"

"github.com/google/uuid"
Expand Down Expand Up @@ -574,7 +575,7 @@ func NewMiner(
interrupt: new(int32),
p2pCh: make(chan *types.Block),
miningCh: make(chan *types.Block),
//miningCh: make(chan *BlockWithBlobs),
// miningCh: make(chan *BlockWithBlobs),
canonicalCh: make(chan *types.Block),
mempoolCh: make(chan *types.Transaction),
headInCh: make(chan bool),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
// Spins up a local network with a gateway, with all processes debuggable. The network will run until the test is stopped.
// Note: If you want to access the gateway frontend you need to `npm run build` its frontend with NEXT_PUBLIC_API_GATEWAY_URL=http://localhost:11180
func TestRunLocalNetwork(t *testing.T) {
//networktest.TestOnlyRunsInIDE(t)
// networktest.TestOnlyRunsInIDE(t)
networktest.EnsureTestLogsSetUp("local-geth-network")
networkConnector, cleanUp, err := env.LocalDevNetwork(devnetwork.WithGateway(), devnetwork.WithPredictableDeployer()).Prepare()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion integration/simulation/network/inmemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
type basicNetworkOfInMemoryNodes struct {
ethNodes []*ethereummock.Node
l2Clients []rpc.Client
//blobResolver *l1.BlobResolver
// blobResolver *l1.BlobResolver
}

func NewBasicNetworkOfInMemoryNodes() Network {
Expand Down
3 changes: 2 additions & 1 deletion integration/simulation/network/network_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package network

import (
"fmt"
gethlog "github.com/ethereum/go-ethereum/log"
"math"
"math/big"
"time"

gethlog "github.com/ethereum/go-ethereum/log"

"github.com/ethereum/go-ethereum/params"
"github.com/ten-protocol/go-ten/go/host"
"github.com/ten-protocol/go-ten/go/host/l1"
Expand Down
3 changes: 2 additions & 1 deletion integration/simulation/network/obscuro_node_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package network
import (
"context"
"fmt"
"github.com/ten-protocol/go-ten/integration/ethereummock"
"net"
"strings"
"time"

"github.com/ten-protocol/go-ten/integration/ethereummock"

"github.com/ten-protocol/go-ten/go/common/host"
"github.com/ten-protocol/go-ten/go/ethadapter"
hostcontainer "github.com/ten-protocol/go-ten/go/host/container"
Expand Down
3 changes: 2 additions & 1 deletion integration/simulation/network/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package network
import (
"bufio"
"fmt"
"github.com/ten-protocol/go-ten/go/host/l1"
"net/http"
"os/exec"
"regexp"
"strings"
"time"

"github.com/ten-protocol/go-ten/go/host/l1"

"github.com/ten-protocol/go-ten/integration/noderunner"

"github.com/ethereum/go-ethereum/crypto"
Expand Down
3 changes: 2 additions & 1 deletion integration/simulation/params/params.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package params

import (
"github.com/ten-protocol/go-ten/go/host/l1"
"time"

"github.com/ten-protocol/go-ten/go/host/l1"

"github.com/ethereum/go-ethereum/common"

"github.com/ten-protocol/go-ten/go/ethadapter/erc20contractlib"
Expand Down
3 changes: 2 additions & 1 deletion integration/simulation/validate_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package simulation
import (
"context"
"fmt"
"github.com/ten-protocol/go-ten/go/host/l1"
"math/big"
"sort"
"strings"
"sync"
"testing"
"time"

"github.com/ten-protocol/go-ten/go/host/l1"

"github.com/ethereum/go-ethereum/rlp"
"github.com/ten-protocol/go-ten/contracts/generated/MessageBus"

Expand Down
3 changes: 2 additions & 1 deletion integration/tenscan/tenscan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/ten-protocol/go-ten/go/common"
"math/big"
"net/http"
"strings"
"testing"
"time"

"github.com/ten-protocol/go-ten/go/common"

"github.com/ten-protocol/go-ten/tools/tenscan/backend/config"
"github.com/ten-protocol/go-ten/tools/tenscan/backend/container"

Expand Down

0 comments on commit 60a1f3b

Please sign in to comment.