Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
add internal and format import order
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp committed Jan 15, 2024
1 parent 6c52594 commit de88697
Show file tree
Hide file tree
Showing 84 changed files with 144 additions and 74 deletions.
1 change: 1 addition & 0 deletions bindings/encoding/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-client/bindings"
)

Expand Down
2 changes: 1 addition & 1 deletion bindings/encoding/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require"

"github.com/taikoxyz/taiko-client/bindings"
)

Expand Down
3 changes: 2 additions & 1 deletion cmd/flags/proposer.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package flags

import (
"github.com/taikoxyz/taiko-client/version"
"github.com/urfave/cli/v2"

"github.com/taikoxyz/taiko-client/internal/version"
)

// Required flags used by proposer.
Expand Down
5 changes: 3 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"fmt"
"os"

"github.com/urfave/cli/v2"

"github.com/taikoxyz/taiko-client/cmd/flags"
"github.com/taikoxyz/taiko-client/cmd/utils"
"github.com/taikoxyz/taiko-client/driver"
"github.com/taikoxyz/taiko-client/internal/version"
"github.com/taikoxyz/taiko-client/proposer"
"github.com/taikoxyz/taiko-client/prover"
"github.com/taikoxyz/taiko-client/version"
"github.com/urfave/cli/v2"
)

func main() {
Expand Down
5 changes: 3 additions & 2 deletions cmd/utils/sub_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"syscall"

"github.com/ethereum/go-ethereum/log"
"github.com/taikoxyz/taiko-client/cmd/logger"
"github.com/taikoxyz/taiko-client/metrics"
"github.com/urfave/cli/v2"

"github.com/taikoxyz/taiko-client/cmd/logger"
"github.com/taikoxyz/taiko-client/internal/metrics"
)

type SubcommandApplication interface {
Expand Down
1 change: 1 addition & 0 deletions driver/anchor_tx_constructor/anchor_tx_constructor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-client/driver/signer"
"github.com/taikoxyz/taiko-client/pkg/rpc"
)
Expand Down
3 changes: 2 additions & 1 deletion driver/anchor_tx_constructor/anchor_tx_constructor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/suite"
"github.com/taikoxyz/taiko-client/testutils"

"github.com/taikoxyz/taiko-client/internal/testutils"
)

type AnchorTxConstructorTestSuite struct {
Expand Down
1 change: 1 addition & 0 deletions driver/chain_syncer/beaconsync/progress_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-client/pkg/rpc"
)

Expand Down
3 changes: 2 additions & 1 deletion driver/chain_syncer/beaconsync/progress_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/suite"
"github.com/taikoxyz/taiko-client/testutils"

"github.com/taikoxyz/taiko-client/internal/testutils"
)

type BeaconSyncProgressTrackerTestSuite struct {
Expand Down
1 change: 1 addition & 0 deletions driver/chain_syncer/beaconsync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-client/bindings/encoding"
"github.com/taikoxyz/taiko-client/driver/state"
"github.com/taikoxyz/taiko-client/pkg/rpc"
Expand Down
3 changes: 2 additions & 1 deletion driver/chain_syncer/calldata/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"

"github.com/taikoxyz/taiko-client/bindings"
"github.com/taikoxyz/taiko-client/bindings/encoding"
anchorTxConstructor "github.com/taikoxyz/taiko-client/driver/anchor_tx_constructor"
"github.com/taikoxyz/taiko-client/driver/chain_syncer/beaconsync"
"github.com/taikoxyz/taiko-client/driver/state"
"github.com/taikoxyz/taiko-client/metrics"
"github.com/taikoxyz/taiko-client/internal/metrics"
eventIterator "github.com/taikoxyz/taiko-client/pkg/chain_iterator/event_iterator"
"github.com/taikoxyz/taiko-client/pkg/rpc"
txListValidator "github.com/taikoxyz/taiko-client/pkg/txlistvalidator"
Expand Down
6 changes: 3 additions & 3 deletions driver/chain_syncer/calldata/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/suite"

"github.com/taikoxyz/taiko-client/bindings"
"github.com/taikoxyz/taiko-client/common/utils"
"github.com/taikoxyz/taiko-client/driver/chain_syncer/beaconsync"
"github.com/taikoxyz/taiko-client/driver/state"
"github.com/taikoxyz/taiko-client/internal/testutils"
"github.com/taikoxyz/taiko-client/proposer"
"github.com/taikoxyz/taiko-client/testutils"

"github.com/taikoxyz/taiko-client/common/utils"
)

type CalldataSyncerTestSuite struct {
Expand Down
1 change: 1 addition & 0 deletions driver/chain_syncer/chain_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-client/driver/chain_syncer/beaconsync"
"github.com/taikoxyz/taiko-client/driver/chain_syncer/calldata"
"github.com/taikoxyz/taiko-client/driver/state"
Expand Down
3 changes: 2 additions & 1 deletion driver/chain_syncer/chain_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/suite"

"github.com/taikoxyz/taiko-client/driver/state"
"github.com/taikoxyz/taiko-client/internal/testutils"
"github.com/taikoxyz/taiko-client/pkg/rpc"
"github.com/taikoxyz/taiko-client/proposer"
"github.com/taikoxyz/taiko-client/testutils"
)

type ChainSyncerTestSuite struct {
Expand Down
3 changes: 2 additions & 1 deletion driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/urfave/cli/v2"

"github.com/taikoxyz/taiko-client/cmd/flags"
"github.com/taikoxyz/taiko-client/pkg/jwt"
"github.com/urfave/cli/v2"
)

// Config contains the configurations to initialize a Taiko driver.
Expand Down
3 changes: 2 additions & 1 deletion driver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"os"
"time"

"github.com/taikoxyz/taiko-client/cmd/flags"
"github.com/urfave/cli/v2"

"github.com/taikoxyz/taiko-client/cmd/flags"
)

var (
Expand Down
1 change: 1 addition & 0 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"

chainSyncer "github.com/taikoxyz/taiko-client/driver/chain_syncer"
"github.com/taikoxyz/taiko-client/driver/state"
"github.com/taikoxyz/taiko-client/pkg/rpc"
Expand Down
7 changes: 4 additions & 3 deletions driver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/suite"

"github.com/taikoxyz/taiko-client/bindings/encoding"
"github.com/taikoxyz/taiko-client/internal/testutils"
"github.com/taikoxyz/taiko-client/pkg/jwt"
"github.com/taikoxyz/taiko-client/proposer"
"github.com/taikoxyz/taiko-client/testutils"
)

type DriverTestSuite struct {
Expand Down Expand Up @@ -51,7 +52,7 @@ func (s *DriverTestSuite) SetupTest() {
s.Nil(err)

proposeInterval := 1024 * time.Hour // No need to periodically propose transactions list in unit tests
s.Nil(proposer.InitFromConfig(context.Background(), p, (&proposer.Config{
s.Nil(proposer.InitFromConfig(context.Background(), p, &proposer.Config{
L1Endpoint: os.Getenv("L1_NODE_WS_ENDPOINT"),
L2Endpoint: os.Getenv("L2_EXECUTION_ENGINE_WS_ENDPOINT"),
TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")),
Expand All @@ -69,7 +70,7 @@ func (s *DriverTestSuite) SetupTest() {
SgxAndPseZkevmTierFee: common.Big256,
MaxTierFeePriceBumps: 3,
TierFeePriceBump: common.Big2,
})))
}))
s.p = p
}

Expand Down
3 changes: 2 additions & 1 deletion driver/signer/fixed_k_signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/stretchr/testify/require"
"github.com/taikoxyz/taiko-client/testutils"

"github.com/taikoxyz/taiko-client/internal/testutils"
)

func TestSignWithK(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion driver/state/l1_current_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/taikoxyz/taiko-client/testutils"

"github.com/taikoxyz/taiko-client/internal/testutils"
)

func (s *DriverStateTestSuite) TestGetL1Current() {
Expand Down
3 changes: 2 additions & 1 deletion driver/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-client/bindings"
"github.com/taikoxyz/taiko-client/metrics"
"github.com/taikoxyz/taiko-client/internal/metrics"
"github.com/taikoxyz/taiko-client/pkg/rpc"
)

Expand Down
2 changes: 1 addition & 1 deletion driver/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/suite"
"github.com/taikoxyz/taiko-client/testutils"

"github.com/taikoxyz/taiko-client/common/utils"
"github.com/taikoxyz/taiko-client/internal/testutils"
)

type DriverStateTestSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions integration_test/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# How to debug test cases?
* start docker compose
```
./docker/start.sh
./internal/docker/start.sh
```

* deploy L1 contracts
Expand All @@ -19,5 +19,5 @@ TAIKO_MONO_DIR=$taiko-mono ./integration_test/test_env.sh
* copy the result of previous step and paste it into `Debug configurations`
> after debugging, don't forget stop docker compose!
```
./docker/stop.sh
./internal/docker/stop.sh
```
4 changes: 2 additions & 2 deletions integration_test/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ check_command "forge"
check_command "docker"

# start and stop docker compose
docker/start.sh
trap "docker/stop.sh" EXIT INT KILL ERR
internal/docker/start.sh
trap "internal/docker/stop.sh" EXIT INT KILL ERR

# deploy l1 contracts
integration_test/deploy_l1_contract.sh
Expand Down
2 changes: 1 addition & 1 deletion integration_test/l1_env.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source docker/docker_env.sh
source internal/docker/docker_env.sh

export PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
export TAIKO_L2_ADDRESS=0x1670010000000000000000000000000000010001
Expand Down
2 changes: 1 addition & 1 deletion integration_test/test_env.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source docker/docker_env.sh
source internal/docker/docker_env.sh
source scripts/common.sh

# make sure environment variables are set.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/start.sh → internal/docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

source scripts/common.sh
source docker/docker_env.sh
source internal/docker/docker_env.sh

# start docker compose service list
echo "start docker compose service: ${DOCKER_SERVICE_LIST[*]}"
Expand Down
2 changes: 1 addition & 1 deletion docker/stop.sh → internal/docker/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


source scripts/common.sh
source docker/docker_env.sh
source internal/docker/docker_env.sh

echo "stop docker compose service: ${DOCKER_SERVICE_LIST[*]}"

Expand Down
3 changes: 2 additions & 1 deletion metrics/metrics.go → internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/prometheus"
"github.com/taikoxyz/taiko-client/cmd/flags"
"github.com/urfave/cli/v2"

"github.com/taikoxyz/taiko-client/cmd/flags"
)

// Metrics
Expand Down
1 change: 1 addition & 0 deletions testutils/helper.go → internal/testutils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/ethereum/go-ethereum/rlp"
"github.com/go-resty/resty/v2"
"github.com/phayes/freeport"

"github.com/taikoxyz/taiko-client/bindings"
"github.com/taikoxyz/taiko-client/prover/server"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/ethereum/go-ethereum/core/types"

"github.com/taikoxyz/taiko-client/cmd/utils"
)

Expand Down
1 change: 1 addition & 0 deletions testutils/suite.go → internal/testutils/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/suite"

"github.com/taikoxyz/taiko-client/bindings"
"github.com/taikoxyz/taiko-client/pkg/jwt"
"github.com/taikoxyz/taiko-client/pkg/rpc"
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions pkg/chain_iterator/block_batch_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-client/pkg/rpc"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/chain_iterator/block_batch_iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/suite"
"github.com/taikoxyz/taiko-client/testutils"

"github.com/taikoxyz/taiko-client/internal/testutils"
)

type BlockBatchIteratorTestSuite struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"

"github.com/taikoxyz/taiko-client/bindings"
chainIterator "github.com/taikoxyz/taiko-client/pkg/chain_iterator"
"github.com/taikoxyz/taiko-client/pkg/rpc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"

"github.com/taikoxyz/taiko-client/bindings"
chainIterator "github.com/taikoxyz/taiko-client/pkg/chain_iterator"
"github.com/taikoxyz/taiko-client/pkg/rpc"
Expand Down
Loading

0 comments on commit de88697

Please sign in to comment.