From fdcb4bc8212ffe654a1784bb6f4e2dc6c2119367 Mon Sep 17 00:00:00 2001 From: maskpp Date: Mon, 15 Jan 2024 23:52:26 +0800 Subject: [PATCH] feat(internal): add `internal` dir and format import order (#506) --- bindings/encoding/input.go | 1 + bindings/encoding/input_test.go | 2 +- bindings/encoding/struct_test.go | 2 +- cmd/flags/proposer.go | 3 ++- cmd/main.go | 5 +++-- cmd/utils/sub_command.go | 5 +++-- .../anchor_tx_constructor.go | 1 + .../anchor_tx_constructor_test.go | 3 ++- .../chain_syncer/beaconsync/progress_tracker.go | 1 + .../beaconsync/progress_tracker_test.go | 3 ++- driver/chain_syncer/beaconsync/syncer.go | 1 + driver/chain_syncer/calldata/syncer.go | 3 ++- driver/chain_syncer/calldata/syncer_test.go | 6 +++--- driver/chain_syncer/chain_syncer.go | 1 + driver/chain_syncer/chain_syncer_test.go | 3 ++- driver/config.go | 3 ++- driver/config_test.go | 3 ++- driver/driver.go | 1 + driver/driver_test.go | 7 ++++--- driver/signer/fixed_k_signer_test.go | 3 ++- driver/state/l1_current_test.go | 3 ++- driver/state/state.go | 3 ++- driver/state/state_test.go | 4 ++-- integration_test/README.md | 4 ++-- integration_test/entrypoint.sh | 4 ++-- integration_test/l1_env.sh | 2 +- integration_test/test_env.sh | 2 +- {docker => internal/docker}/docker_env.sh | 0 .../docker}/nodes/docker-compose.yml | 0 {docker => internal/docker}/nodes/jwt.hex | 0 {docker => internal/docker}/start.sh | 2 +- {docker => internal/docker}/stop.sh | 2 +- {metrics => internal/metrics}/metrics.go | 3 ++- {testutils => internal/testutils}/helper.go | 1 + {testutils => internal/testutils}/interfaces.go | 1 + {testutils => internal/testutils}/suite.go | 1 + {common => internal}/utils/utils.go | 2 +- {version => internal/version}/version.go | 0 pkg/chain_iterator/block_batch_iterator.go | 1 + pkg/chain_iterator/block_batch_iterator_test.go | 3 ++- .../event_iterator/block_proposed_iterator.go | 1 + .../event_iterator/transition_proven_iterator.go | 1 + pkg/rpc/client.go | 1 + pkg/rpc/methods.go | 3 ++- pkg/rpc/subscription.go | 1 + pkg/rpc/subscription_test.go | 1 + pkg/rpc/utils.go | 2 +- pkg/txlistvalidator/tx_list_validator.go | 1 + proposer/config.go | 3 ++- proposer/config_test.go | 3 ++- proposer/proposer.go | 9 +++++---- proposer/proposer_test.go | 7 ++++--- proposer/prover_selector/eth_fee_eoa_selector.go | 1 + .../prover_selector/eth_fee_eoa_selector_test.go | 3 ++- proposer/prover_selector/interface.go | 1 + prover/anchor_tx_validator/anchor_tx_validator.go | 1 + .../anchor_tx_validator_test.go | 3 ++- prover/config.go | 3 ++- prover/config_test.go | 3 ++- prover/guardian_prover_sender/guardian_prover.go | 1 + prover/proof_producer/dummy_producer.go | 1 + prover/proof_producer/dummy_producer_test.go | 1 + prover/proof_producer/guardian_producer.go | 1 + prover/proof_producer/guardian_producer_test.go | 1 + prover/proof_producer/optimistic_producer.go | 1 + prover/proof_producer/optimistic_producer_test.go | 1 + prover/proof_producer/proof_producer.go | 1 + .../proof_producer/sgx_and_zkevm_rpcd_producer.go | 3 ++- prover/proof_producer/sgx_producer.go | 3 ++- prover/proof_producer/sgx_producer_test.go | 1 + prover/proof_producer/zkevm_rpcd_producer.go | 3 ++- prover/proof_producer/zkevm_rpcd_producer_test.go | 1 + prover/proof_submitter/interface.go | 1 + prover/proof_submitter/proof_contester.go | 1 + prover/proof_submitter/proof_contester_test.go | 3 ++- prover/proof_submitter/proof_submitter.go | 9 +++++---- prover/proof_submitter/proof_submitter_test.go | 15 ++++++++------- prover/proof_submitter/transaction/builder.go | 1 + .../proof_submitter/transaction/builder_test.go | 1 + prover/proof_submitter/transaction/sender.go | 11 ++++++----- prover/proof_submitter/transaction/sender_test.go | 13 +++++++------ prover/prover.go | 5 +++-- prover/prover_test.go | 3 ++- prover/server/api.go | 1 + prover/server/api_test.go | 1 + prover/server/server.go | 3 ++- scripts/common.sh | 2 +- 87 files changed, 151 insertions(+), 81 deletions(-) rename {docker => internal/docker}/docker_env.sh (100%) rename {docker => internal/docker}/nodes/docker-compose.yml (100%) rename {docker => internal/docker}/nodes/jwt.hex (100%) rename {docker => internal/docker}/start.sh (91%) rename {docker => internal/docker}/stop.sh (79%) rename {metrics => internal/metrics}/metrics.go (99%) rename {testutils => internal/testutils}/helper.go (99%) rename {testutils => internal/testutils}/interfaces.go (99%) rename {testutils => internal/testutils}/suite.go (99%) rename {common => internal}/utils/utils.go (93%) rename {version => internal/version}/version.go (100%) diff --git a/bindings/encoding/input.go b/bindings/encoding/input.go index 5f35cb03d..ef7e73345 100644 --- a/bindings/encoding/input.go +++ b/bindings/encoding/input.go @@ -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" ) diff --git a/bindings/encoding/input_test.go b/bindings/encoding/input_test.go index 07cc76707..fbec4d037 100644 --- a/bindings/encoding/input_test.go +++ b/bindings/encoding/input_test.go @@ -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" ) diff --git a/bindings/encoding/struct_test.go b/bindings/encoding/struct_test.go index a8713fc44..f0776e123 100644 --- a/bindings/encoding/struct_test.go +++ b/bindings/encoding/struct_test.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/stretchr/testify/require" - "github.com/taikoxyz/taiko-client/common/utils" + "github.com/taikoxyz/taiko-client/internal/utils" ) var ( diff --git a/cmd/flags/proposer.go b/cmd/flags/proposer.go index a7d252ffa..d6e75f66e 100644 --- a/cmd/flags/proposer.go +++ b/cmd/flags/proposer.go @@ -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. diff --git a/cmd/main.go b/cmd/main.go index 46eeacc0b..faa81b916 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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() { diff --git a/cmd/utils/sub_command.go b/cmd/utils/sub_command.go index 3b35e12d8..b9845eb7c 100644 --- a/cmd/utils/sub_command.go +++ b/cmd/utils/sub_command.go @@ -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 { diff --git a/driver/anchor_tx_constructor/anchor_tx_constructor.go b/driver/anchor_tx_constructor/anchor_tx_constructor.go index feec1605d..31990f5c6 100644 --- a/driver/anchor_tx_constructor/anchor_tx_constructor.go +++ b/driver/anchor_tx_constructor/anchor_tx_constructor.go @@ -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" ) diff --git a/driver/anchor_tx_constructor/anchor_tx_constructor_test.go b/driver/anchor_tx_constructor/anchor_tx_constructor_test.go index f0a00fed1..c185b5c15 100644 --- a/driver/anchor_tx_constructor/anchor_tx_constructor_test.go +++ b/driver/anchor_tx_constructor/anchor_tx_constructor_test.go @@ -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 { diff --git a/driver/chain_syncer/beaconsync/progress_tracker.go b/driver/chain_syncer/beaconsync/progress_tracker.go index 520896205..d9c23d6be 100644 --- a/driver/chain_syncer/beaconsync/progress_tracker.go +++ b/driver/chain_syncer/beaconsync/progress_tracker.go @@ -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" ) diff --git a/driver/chain_syncer/beaconsync/progress_tracker_test.go b/driver/chain_syncer/beaconsync/progress_tracker_test.go index c84c9f564..37d0a03a0 100644 --- a/driver/chain_syncer/beaconsync/progress_tracker_test.go +++ b/driver/chain_syncer/beaconsync/progress_tracker_test.go @@ -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 { diff --git a/driver/chain_syncer/beaconsync/syncer.go b/driver/chain_syncer/beaconsync/syncer.go index 3c70ae00a..3db0bbf9a 100644 --- a/driver/chain_syncer/beaconsync/syncer.go +++ b/driver/chain_syncer/beaconsync/syncer.go @@ -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" diff --git a/driver/chain_syncer/calldata/syncer.go b/driver/chain_syncer/calldata/syncer.go index e17c1d286..0d34e8142 100644 --- a/driver/chain_syncer/calldata/syncer.go +++ b/driver/chain_syncer/calldata/syncer.go @@ -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" diff --git a/driver/chain_syncer/calldata/syncer_test.go b/driver/chain_syncer/calldata/syncer_test.go index e4be9b2da..8b8fc323f 100644 --- a/driver/chain_syncer/calldata/syncer_test.go +++ b/driver/chain_syncer/calldata/syncer_test.go @@ -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/driver/chain_syncer/beaconsync" "github.com/taikoxyz/taiko-client/driver/state" + "github.com/taikoxyz/taiko-client/internal/testutils" + "github.com/taikoxyz/taiko-client/internal/utils" "github.com/taikoxyz/taiko-client/proposer" - "github.com/taikoxyz/taiko-client/testutils" - - "github.com/taikoxyz/taiko-client/common/utils" ) type CalldataSyncerTestSuite struct { diff --git a/driver/chain_syncer/chain_syncer.go b/driver/chain_syncer/chain_syncer.go index b07041039..e052c9a36 100644 --- a/driver/chain_syncer/chain_syncer.go +++ b/driver/chain_syncer/chain_syncer.go @@ -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" diff --git a/driver/chain_syncer/chain_syncer_test.go b/driver/chain_syncer/chain_syncer_test.go index 03094fd06..99bac25d4 100644 --- a/driver/chain_syncer/chain_syncer_test.go +++ b/driver/chain_syncer/chain_syncer_test.go @@ -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 { diff --git a/driver/config.go b/driver/config.go index 443a2a673..c8cb1bf69 100644 --- a/driver/config.go +++ b/driver/config.go @@ -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. diff --git a/driver/config_test.go b/driver/config_test.go index c48bdc1ca..a95c1febb 100644 --- a/driver/config_test.go +++ b/driver/config_test.go @@ -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 ( diff --git a/driver/driver.go b/driver/driver.go index 0f48a726d..d12775081 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -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" diff --git a/driver/driver_test.go b/driver/driver_test.go index b602d0934..b61560a15 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -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 { @@ -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")), @@ -69,7 +70,7 @@ func (s *DriverTestSuite) SetupTest() { SgxAndPseZkevmTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, - }))) + })) s.p = p } diff --git a/driver/signer/fixed_k_signer_test.go b/driver/signer/fixed_k_signer_test.go index 10feffbc6..a5a3bf7c0 100644 --- a/driver/signer/fixed_k_signer_test.go +++ b/driver/signer/fixed_k_signer_test.go @@ -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) { diff --git a/driver/state/l1_current_test.go b/driver/state/l1_current_test.go index 399a76984..8ecd9a5c5 100644 --- a/driver/state/l1_current_test.go +++ b/driver/state/l1_current_test.go @@ -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() { diff --git a/driver/state/state.go b/driver/state/state.go index d9e259ce3..27d381642 100644 --- a/driver/state/state.go +++ b/driver/state/state.go @@ -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" ) diff --git a/driver/state/state_test.go b/driver/state/state_test.go index fad9d9b5a..45c7d45f2 100644 --- a/driver/state/state_test.go +++ b/driver/state/state_test.go @@ -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" + "github.com/taikoxyz/taiko-client/internal/utils" ) type DriverStateTestSuite struct { diff --git a/integration_test/README.md b/integration_test/README.md index c2e4d3ff6..393c2f9a6 100644 --- a/integration_test/README.md +++ b/integration_test/README.md @@ -1,7 +1,7 @@ # How to debug test cases? * start docker compose ``` -./docker/start.sh +./internal/docker/start.sh ``` * deploy L1 contracts @@ -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 ``` \ No newline at end of file diff --git a/integration_test/entrypoint.sh b/integration_test/entrypoint.sh index 6e7447478..437cda73c 100755 --- a/integration_test/entrypoint.sh +++ b/integration_test/entrypoint.sh @@ -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 diff --git a/integration_test/l1_env.sh b/integration_test/l1_env.sh index 870294b7f..9bbf2c098 100755 --- a/integration_test/l1_env.sh +++ b/integration_test/l1_env.sh @@ -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 diff --git a/integration_test/test_env.sh b/integration_test/test_env.sh index ec3e2ad1f..0a3d038b6 100755 --- a/integration_test/test_env.sh +++ b/integration_test/test_env.sh @@ -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. diff --git a/docker/docker_env.sh b/internal/docker/docker_env.sh similarity index 100% rename from docker/docker_env.sh rename to internal/docker/docker_env.sh diff --git a/docker/nodes/docker-compose.yml b/internal/docker/nodes/docker-compose.yml similarity index 100% rename from docker/nodes/docker-compose.yml rename to internal/docker/nodes/docker-compose.yml diff --git a/docker/nodes/jwt.hex b/internal/docker/nodes/jwt.hex similarity index 100% rename from docker/nodes/jwt.hex rename to internal/docker/nodes/jwt.hex diff --git a/docker/start.sh b/internal/docker/start.sh similarity index 91% rename from docker/start.sh rename to internal/docker/start.sh index 65fa77d00..641bf3667 100755 --- a/docker/start.sh +++ b/internal/docker/start.sh @@ -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[*]}" diff --git a/docker/stop.sh b/internal/docker/stop.sh similarity index 79% rename from docker/stop.sh rename to internal/docker/stop.sh index 919bb3521..0bb580635 100755 --- a/docker/stop.sh +++ b/internal/docker/stop.sh @@ -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[*]}" diff --git a/metrics/metrics.go b/internal/metrics/metrics.go similarity index 99% rename from metrics/metrics.go rename to internal/metrics/metrics.go index 1eb58413f..97344dfcd 100644 --- a/metrics/metrics.go +++ b/internal/metrics/metrics.go @@ -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 diff --git a/testutils/helper.go b/internal/testutils/helper.go similarity index 99% rename from testutils/helper.go rename to internal/testutils/helper.go index 4a45565c1..b5d7f9600 100644 --- a/testutils/helper.go +++ b/internal/testutils/helper.go @@ -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" ) diff --git a/testutils/interfaces.go b/internal/testutils/interfaces.go similarity index 99% rename from testutils/interfaces.go rename to internal/testutils/interfaces.go index 7aa9e273e..f53c234a1 100644 --- a/testutils/interfaces.go +++ b/internal/testutils/interfaces.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/cmd/utils" ) diff --git a/testutils/suite.go b/internal/testutils/suite.go similarity index 99% rename from testutils/suite.go rename to internal/testutils/suite.go index 361ebff61..709f563d7 100644 --- a/testutils/suite.go +++ b/internal/testutils/suite.go @@ -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" diff --git a/common/utils/utils.go b/internal/utils/utils.go similarity index 93% rename from common/utils/utils.go rename to internal/utils/utils.go index 3c6bc88dc..cda3ad46c 100644 --- a/common/utils/utils.go +++ b/internal/utils/utils.go @@ -29,5 +29,5 @@ func RandUint32(max *big.Int) uint32 { // IsNil checks if the interface is empty. func IsNil(i interface{}) bool { - return i == nil || reflect2.IsNil(i) + return reflect2.IsNil(i) } diff --git a/version/version.go b/internal/version/version.go similarity index 100% rename from version/version.go rename to internal/version/version.go diff --git a/pkg/chain_iterator/block_batch_iterator.go b/pkg/chain_iterator/block_batch_iterator.go index e8631b90f..0bcefd168 100644 --- a/pkg/chain_iterator/block_batch_iterator.go +++ b/pkg/chain_iterator/block_batch_iterator.go @@ -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" ) diff --git a/pkg/chain_iterator/block_batch_iterator_test.go b/pkg/chain_iterator/block_batch_iterator_test.go index 82669e37a..f6186b38d 100644 --- a/pkg/chain_iterator/block_batch_iterator_test.go +++ b/pkg/chain_iterator/block_batch_iterator_test.go @@ -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 { diff --git a/pkg/chain_iterator/event_iterator/block_proposed_iterator.go b/pkg/chain_iterator/event_iterator/block_proposed_iterator.go index c7774907e..d003747eb 100644 --- a/pkg/chain_iterator/event_iterator/block_proposed_iterator.go +++ b/pkg/chain_iterator/event_iterator/block_proposed_iterator.go @@ -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" diff --git a/pkg/chain_iterator/event_iterator/transition_proven_iterator.go b/pkg/chain_iterator/event_iterator/transition_proven_iterator.go index 2c11de17c..4b02568b5 100644 --- a/pkg/chain_iterator/event_iterator/transition_proven_iterator.go +++ b/pkg/chain_iterator/event_iterator/transition_proven_iterator.go @@ -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" diff --git a/pkg/rpc/client.go b/pkg/rpc/client.go index 6dbf9f04f..e0b2706bc 100644 --- a/pkg/rpc/client.go +++ b/pkg/rpc/client.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/ethereum/go-ethereum/rpc" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/pkg/rpc/methods.go b/pkg/rpc/methods.go index 11c621ef2..a8ec44f09 100644 --- a/pkg/rpc/methods.go +++ b/pkg/rpc/methods.go @@ -16,8 +16,9 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/ethereum/go-ethereum/log" - "github.com/taikoxyz/taiko-client/bindings" "golang.org/x/sync/errgroup" + + "github.com/taikoxyz/taiko-client/bindings" ) var ( diff --git a/pkg/rpc/subscription.go b/pkg/rpc/subscription.go index 3af4e5e41..ac16bc190 100644 --- a/pkg/rpc/subscription.go +++ b/pkg/rpc/subscription.go @@ -7,6 +7,7 @@ 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" ) diff --git a/pkg/rpc/subscription_test.go b/pkg/rpc/subscription_test.go index 15c592460..abb6525df 100644 --- a/pkg/rpc/subscription_test.go +++ b/pkg/rpc/subscription_test.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/pkg/rpc/utils.go b/pkg/rpc/utils.go index b3b809329..7ff3cf3e9 100644 --- a/pkg/rpc/utils.go +++ b/pkg/rpc/utils.go @@ -19,7 +19,7 @@ import ( "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-client/common/utils" + "github.com/taikoxyz/taiko-client/internal/utils" ) var ( diff --git a/pkg/txlistvalidator/tx_list_validator.go b/pkg/txlistvalidator/tx_list_validator.go index 53bfe2bd3..523b882bd 100644 --- a/pkg/txlistvalidator/tx_list_validator.go +++ b/pkg/txlistvalidator/tx_list_validator.go @@ -6,6 +6,7 @@ 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/encoding" ) diff --git a/proposer/config.go b/proposer/config.go index ecb08ac7c..24778c516 100644 --- a/proposer/config.go +++ b/proposer/config.go @@ -10,8 +10,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/taikoxyz/taiko-client/cmd/flags" "github.com/urfave/cli/v2" + + "github.com/taikoxyz/taiko-client/cmd/flags" ) // Config contains all configurations to initialize a Taiko proposer. diff --git a/proposer/config_test.go b/proposer/config_test.go index 0a265b1cb..62136eaa8 100644 --- a/proposer/config_test.go +++ b/proposer/config_test.go @@ -9,8 +9,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/taikoxyz/taiko-client/cmd/flags" "github.com/urfave/cli/v2" + + "github.com/taikoxyz/taiko-client/cmd/flags" ) var ( diff --git a/proposer/proposer.go b/proposer/proposer.go index 02f107377..5a7499842 100644 --- a/proposer/proposer.go +++ b/proposer/proposer.go @@ -21,13 +21,14 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rlp" + "github.com/urfave/cli/v2" + "golang.org/x/sync/errgroup" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-client/metrics" + "github.com/taikoxyz/taiko-client/internal/metrics" "github.com/taikoxyz/taiko-client/pkg/rpc" selector "github.com/taikoxyz/taiko-client/proposer/prover_selector" - "github.com/urfave/cli/v2" - "golang.org/x/sync/errgroup" ) var ( @@ -78,7 +79,7 @@ type Proposer struct { cfg *Config } -// New initializes the given proposer instance based on the command line flags. +// InitFromCli New initializes the given proposer instance based on the command line flags. func (p *Proposer) InitFromCli(ctx context.Context, c *cli.Context) error { cfg, err := NewConfigFromCliContext(c) if err != nil { diff --git a/proposer/proposer_test.go b/proposer/proposer_test.go index 44385d402..8303e36db 100644 --- a/proposer/proposer_test.go +++ b/proposer/proposer_test.go @@ -12,8 +12,9 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-client/bindings" - "github.com/taikoxyz/taiko-client/testutils" + "github.com/taikoxyz/taiko-client/internal/testutils" ) type ProposerTestSuite struct { @@ -33,7 +34,7 @@ func (s *ProposerTestSuite) SetupTest() { ctx, cancel := context.WithCancel(context.Background()) proposeInterval := 1024 * time.Hour // No need to periodically propose transactions list in unit tests - s.Nil(InitFromConfig(ctx, p, (&Config{ + s.Nil(InitFromConfig(ctx, p, &Config{ L1Endpoint: os.Getenv("L1_NODE_WS_ENDPOINT"), L2Endpoint: os.Getenv("L2_EXECUTION_ENGINE_HTTP_ENDPOINT"), TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), @@ -53,7 +54,7 @@ func (s *ProposerTestSuite) SetupTest() { TierFeePriceBump: common.Big2, MaxTierFeePriceBumps: 3, ExtraData: "test", - }))) + })) s.p = p s.cancel = cancel diff --git a/proposer/prover_selector/eth_fee_eoa_selector.go b/proposer/prover_selector/eth_fee_eoa_selector.go index 448952c95..d86a2204e 100644 --- a/proposer/prover_selector/eth_fee_eoa_selector.go +++ b/proposer/prover_selector/eth_fee_eoa_selector.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/go-resty/resty/v2" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/pkg/rpc" diff --git a/proposer/prover_selector/eth_fee_eoa_selector_test.go b/proposer/prover_selector/eth_fee_eoa_selector_test.go index aef8cc4bb..05f291aa6 100644 --- a/proposer/prover_selector/eth_fee_eoa_selector_test.go +++ b/proposer/prover_selector/eth_fee_eoa_selector_test.go @@ -10,8 +10,9 @@ 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/testutils" + "github.com/taikoxyz/taiko-client/internal/testutils" ) type ProverSelectorTestSuite struct { diff --git a/proposer/prover_selector/interface.go b/proposer/prover_selector/interface.go index 63bf2d8fc..06c2450e1 100644 --- a/proposer/prover_selector/interface.go +++ b/proposer/prover_selector/interface.go @@ -6,6 +6,7 @@ import ( "net/url" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/anchor_tx_validator/anchor_tx_validator.go b/prover/anchor_tx_validator/anchor_tx_validator.go index 912688229..b188ee267 100644 --- a/prover/anchor_tx_validator/anchor_tx_validator.go +++ b/prover/anchor_tx_validator/anchor_tx_validator.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/pkg/rpc" ) diff --git a/prover/anchor_tx_validator/anchor_tx_validator_test.go b/prover/anchor_tx_validator/anchor_tx_validator_test.go index 73ab2c6fa..d3ec2d2d7 100644 --- a/prover/anchor_tx_validator/anchor_tx_validator_test.go +++ b/prover/anchor_tx_validator/anchor_tx_validator_test.go @@ -9,7 +9,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" "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 AnchorTxValidatorTestSuite struct { diff --git a/prover/config.go b/prover/config.go index f3d8a4a28..a7fac7eb0 100644 --- a/prover/config.go +++ b/prover/config.go @@ -9,8 +9,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/taikoxyz/taiko-client/cmd/flags" "github.com/urfave/cli/v2" + + "github.com/taikoxyz/taiko-client/cmd/flags" ) // Config contains the configurations to initialize a Taiko prover. diff --git a/prover/config_test.go b/prover/config_test.go index 673164991..5ed2e833f 100644 --- a/prover/config_test.go +++ b/prover/config_test.go @@ -7,8 +7,9 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto" - "github.com/taikoxyz/taiko-client/cmd/flags" "github.com/urfave/cli/v2" + + "github.com/taikoxyz/taiko-client/cmd/flags" ) var ( diff --git a/prover/guardian_prover_sender/guardian_prover.go b/prover/guardian_prover_sender/guardian_prover.go index abcd3cf27..bfc2243cc 100644 --- a/prover/guardian_prover_sender/guardian_prover.go +++ b/prover/guardian_prover_sender/guardian_prover.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/pkg/rpc" "github.com/taikoxyz/taiko-client/prover/db" ) diff --git a/prover/proof_producer/dummy_producer.go b/prover/proof_producer/dummy_producer.go index 4a33d3a0c..26d056c36 100644 --- a/prover/proof_producer/dummy_producer.go +++ b/prover/proof_producer/dummy_producer.go @@ -6,6 +6,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/prover/proof_producer/dummy_producer_test.go b/prover/proof_producer/dummy_producer_test.go index 10069f89a..f3cdcc10d 100644 --- a/prover/proof_producer/dummy_producer_test.go +++ b/prover/proof_producer/dummy_producer_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/prover/proof_producer/guardian_producer.go b/prover/proof_producer/guardian_producer.go index 278a6f257..770d60f30 100644 --- a/prover/proof_producer/guardian_producer.go +++ b/prover/proof_producer/guardian_producer.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/proof_producer/guardian_producer_test.go b/prover/proof_producer/guardian_producer_test.go index e7d541fcb..72e19ebb1 100644 --- a/prover/proof_producer/guardian_producer_test.go +++ b/prover/proof_producer/guardian_producer_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/proof_producer/optimistic_producer.go b/prover/proof_producer/optimistic_producer.go index 186f2d2f6..7815af584 100644 --- a/prover/proof_producer/optimistic_producer.go +++ b/prover/proof_producer/optimistic_producer.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/proof_producer/optimistic_producer_test.go b/prover/proof_producer/optimistic_producer_test.go index 024358fd0..1b869b54c 100644 --- a/prover/proof_producer/optimistic_producer_test.go +++ b/prover/proof_producer/optimistic_producer_test.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/proof_producer/proof_producer.go b/prover/proof_producer/proof_producer.go index 914879d90..44102b84f 100644 --- a/prover/proof_producer/proof_producer.go +++ b/prover/proof_producer/proof_producer.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/prover/proof_producer/sgx_and_zkevm_rpcd_producer.go b/prover/proof_producer/sgx_and_zkevm_rpcd_producer.go index 589295cb6..53d5bcfe0 100644 --- a/prover/proof_producer/sgx_and_zkevm_rpcd_producer.go +++ b/prover/proof_producer/sgx_and_zkevm_rpcd_producer.go @@ -6,9 +6,10 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" + "golang.org/x/sync/errgroup" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "golang.org/x/sync/errgroup" ) // SGXAndZkevmRpcdProducer generates a SGX + PSE ZKEVM proof for the given block. diff --git a/prover/proof_producer/sgx_producer.go b/prover/proof_producer/sgx_producer.go index 1ae81b64c..a8c38c83f 100644 --- a/prover/proof_producer/sgx_producer.go +++ b/prover/proof_producer/sgx_producer.go @@ -15,9 +15,10 @@ 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/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-client/metrics" + "github.com/taikoxyz/taiko-client/internal/metrics" ) // SGXProofProducer generates a SGX proof for the given block. diff --git a/prover/proof_producer/sgx_producer_test.go b/prover/proof_producer/sgx_producer_test.go index 20a25ecf1..da7fc38f0 100644 --- a/prover/proof_producer/sgx_producer_test.go +++ b/prover/proof_producer/sgx_producer_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/proof_producer/zkevm_rpcd_producer.go b/prover/proof_producer/zkevm_rpcd_producer.go index 3ffbee032..9acf0c1fc 100644 --- a/prover/proof_producer/zkevm_rpcd_producer.go +++ b/prover/proof_producer/zkevm_rpcd_producer.go @@ -15,9 +15,10 @@ 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/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-client/metrics" + "github.com/taikoxyz/taiko-client/internal/metrics" ) var ( diff --git a/prover/proof_producer/zkevm_rpcd_producer_test.go b/prover/proof_producer/zkevm_rpcd_producer_test.go index fe22a2bd3..d8345908e 100644 --- a/prover/proof_producer/zkevm_rpcd_producer_test.go +++ b/prover/proof_producer/zkevm_rpcd_producer_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/prover/proof_submitter/interface.go b/prover/proof_submitter/interface.go index 1173194c5..5874b4748 100644 --- a/prover/proof_submitter/interface.go +++ b/prover/proof_submitter/interface.go @@ -5,6 +5,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings" proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" ) diff --git a/prover/proof_submitter/proof_contester.go b/prover/proof_submitter/proof_contester.go index 9be3f295c..a581125b8 100644 --- a/prover/proof_submitter/proof_contester.go +++ b/prover/proof_submitter/proof_contester.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/pkg/rpc" diff --git a/prover/proof_submitter/proof_contester_test.go b/prover/proof_submitter/proof_contester_test.go index 45cdaf4c3..a3a64f781 100644 --- a/prover/proof_submitter/proof_contester_test.go +++ b/prover/proof_submitter/proof_contester_test.go @@ -4,9 +4,10 @@ import ( "context" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-client/testutils" + "github.com/taikoxyz/taiko-client/internal/testutils" ) func (s *ProofSubmitterTestSuite) TestSubmitContestNoTransition() { diff --git a/prover/proof_submitter/proof_submitter.go b/prover/proof_submitter/proof_submitter.go index bc5cf3a73..be8b7b1d3 100644 --- a/prover/proof_submitter/proof_submitter.go +++ b/prover/proof_submitter/proof_submitter.go @@ -12,11 +12,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-client/metrics" + "github.com/taikoxyz/taiko-client/internal/metrics" "github.com/taikoxyz/taiko-client/pkg/rpc" - anchorTxValidator "github.com/taikoxyz/taiko-client/prover/anchor_tx_validator" + validator "github.com/taikoxyz/taiko-client/prover/anchor_tx_validator" proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" "github.com/taikoxyz/taiko-client/prover/proof_submitter/transaction" ) @@ -29,7 +30,7 @@ type ProofSubmitter struct { rpc *rpc.Client proofProducer proofProducer.ProofProducer resultCh chan *proofProducer.ProofWithHeader - anchorValidator *anchorTxValidator.AnchorTxValidator + anchorValidator *validator.AnchorTxValidator txBuilder *transaction.ProveBlockTxBuilder txSender *transaction.Sender proverAddress common.Address @@ -54,7 +55,7 @@ func New( txReplacementTipMultiplier uint64, proveBlockMaxTxGasTipCap *big.Int, ) (*ProofSubmitter, error) { - anchorValidator, err := anchorTxValidator.New(taikoL2Address, rpcClient.L2ChainID, rpcClient) + anchorValidator, err := validator.New(taikoL2Address, rpcClient.L2ChainID, rpcClient) if err != nil { return nil, err } diff --git a/prover/proof_submitter/proof_submitter_test.go b/prover/proof_submitter/proof_submitter_test.go index f7efcc811..e8a5a763e 100644 --- a/prover/proof_submitter/proof_submitter_test.go +++ b/prover/proof_submitter/proof_submitter_test.go @@ -11,14 +11,15 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "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" + "github.com/taikoxyz/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-client/proposer" - proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" - "github.com/taikoxyz/taiko-client/testutils" + producer "github.com/taikoxyz/taiko-client/prover/proof_producer" ) type ProofSubmitterTestSuite struct { @@ -27,7 +28,7 @@ type ProofSubmitterTestSuite struct { contester *ProofContester calldataSyncer *calldata.Syncer proposer *proposer.Proposer - proofCh chan *proofProducer.ProofWithHeader + proofCh chan *producer.ProofWithHeader } func (s *ProofSubmitterTestSuite) SetupTest() { @@ -36,11 +37,11 @@ func (s *ProofSubmitterTestSuite) SetupTest() { l1ProverPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROVER_PRIVATE_KEY"))) s.Nil(err) - s.proofCh = make(chan *proofProducer.ProofWithHeader, 1024) + s.proofCh = make(chan *producer.ProofWithHeader, 1024) s.submitter, err = New( s.RPCClient, - &proofProducer.OptimisticProofProducer{}, + &producer.OptimisticProofProducer{}, s.proofCh, common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), l1ProverPrivKey, @@ -124,11 +125,11 @@ func (s *ProofSubmitterTestSuite) TestProofSubmitterRequestProofDeadlineExceeded func (s *ProofSubmitterTestSuite) TestProofSubmitterSubmitProofMetadataNotFound() { s.Error( s.submitter.SubmitProof( - context.Background(), &proofProducer.ProofWithHeader{ + context.Background(), &producer.ProofWithHeader{ BlockID: common.Big256, Meta: &bindings.TaikoDataBlockMetadata{}, Header: &types.Header{}, - Opts: &proofProducer.ProofRequestOptions{}, + Opts: &producer.ProofRequestOptions{}, Proof: bytes.Repeat([]byte{0xff}, 100), }, ), diff --git a/prover/proof_submitter/transaction/builder.go b/prover/proof_submitter/transaction/builder.go index 20f93480d..1e7904a9c 100644 --- a/prover/proof_submitter/transaction/builder.go +++ b/prover/proof_submitter/transaction/builder.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/pkg/rpc" diff --git a/prover/proof_submitter/transaction/builder_test.go b/prover/proof_submitter/transaction/builder_test.go index 47d62a352..1caec2544 100644 --- a/prover/proof_submitter/transaction/builder_test.go +++ b/prover/proof_submitter/transaction/builder_test.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/prover/proof_submitter/transaction/sender.go b/prover/proof_submitter/transaction/sender.go index fa9501065..408960caa 100644 --- a/prover/proof_submitter/transaction/sender.go +++ b/prover/proof_submitter/transaction/sender.go @@ -12,10 +12,11 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/log" - "github.com/taikoxyz/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-client/metrics" "github.com/taikoxyz/taiko-client/pkg/rpc" - proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" + + "github.com/taikoxyz/taiko-client/bindings/encoding" + "github.com/taikoxyz/taiko-client/internal/metrics" + producer "github.com/taikoxyz/taiko-client/prover/proof_producer" ) var ( @@ -55,7 +56,7 @@ func NewSender( // the transaction should not be retried anymore, it will return an `ErrUnretryable` error. func (s *Sender) Send( ctx context.Context, - proofWithHeader *proofProducer.ProofWithHeader, + proofWithHeader *producer.ProofWithHeader, buildTx TxBuilder, ) error { var ( @@ -139,7 +140,7 @@ func (s *Sender) Send( // validateProof checks if the proof's corresponding L1 block is still in the canonical chain and if the // latest verified head is not ahead of this block proof. -func (s *Sender) validateProof(ctx context.Context, proofWithHeader *proofProducer.ProofWithHeader) (bool, error) { +func (s *Sender) validateProof(ctx context.Context, proofWithHeader *producer.ProofWithHeader) (bool, error) { // 1. Check if the corresponding L1 block is still in the canonical chain. l1Header, err := s.rpc.L1.HeaderByNumber(ctx, new(big.Int).SetUint64(proofWithHeader.Meta.L1Height+1)) if err != nil { diff --git a/prover/proof_submitter/transaction/sender_test.go b/prover/proof_submitter/transaction/sender_test.go index d14dc614c..d509089b7 100644 --- a/prover/proof_submitter/transaction/sender_test.go +++ b/prover/proof_submitter/transaction/sender_test.go @@ -12,9 +12,10 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-client/bindings" - proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" - "github.com/taikoxyz/taiko-client/testutils" + "github.com/taikoxyz/taiko-client/internal/testutils" + producer "github.com/taikoxyz/taiko-client/prover/proof_producer" ) var ( @@ -53,22 +54,22 @@ func (s *TransactionTestSuite) TestSendTxWithBackoff() { meta := &bindings.TaikoDataBlockMetadata{L1Height: l1HeadChild.Number.Uint64(), L1Hash: l1HeadChild.Hash()} s.NotNil(s.sender.Send( context.Background(), - &proofProducer.ProofWithHeader{ + &producer.ProofWithHeader{ Meta: meta, BlockID: common.Big1, Header: &types.Header{}, - Opts: &proofProducer.ProofRequestOptions{EventL1Hash: l1Head.Hash()}, + Opts: &producer.ProofRequestOptions{EventL1Hash: l1Head.Hash()}, }, func(nonce *big.Int) (*types.Transaction, error) { return nil, errors.New("L1_TEST") }, )) s.Nil(s.sender.Send( context.Background(), - &proofProducer.ProofWithHeader{ + &producer.ProofWithHeader{ Meta: meta, BlockID: common.Big1, Header: &types.Header{}, - Opts: &proofProducer.ProofRequestOptions{EventL1Hash: l1Head.Hash()}, + Opts: &producer.ProofRequestOptions{EventL1Hash: l1Head.Hash()}, }, func(nonce *big.Int) (*types.Transaction, error) { height, err := s.RPCClient.L1.BlockNumber(context.Background()) diff --git a/prover/prover.go b/prover/prover.go index 6e5f26e01..07b2e98b0 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -20,16 +20,17 @@ import ( "github.com/ethereum/go-ethereum/ethdb/leveldb" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/log" + "github.com/urfave/cli/v2" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" - "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" guardianproversender "github.com/taikoxyz/taiko-client/prover/guardian_prover_sender" proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" proofSubmitter "github.com/taikoxyz/taiko-client/prover/proof_submitter" "github.com/taikoxyz/taiko-client/prover/server" - "github.com/urfave/cli/v2" ) var ( diff --git a/prover/prover_test.go b/prover/prover_test.go index da58e702a..9e5c8e419 100644 --- a/prover/prover_test.go +++ b/prover/prover_test.go @@ -15,15 +15,16 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb/memorydb" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/driver" + "github.com/taikoxyz/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-client/pkg/jwt" "github.com/taikoxyz/taiko-client/pkg/rpc" "github.com/taikoxyz/taiko-client/proposer" guardianproversender "github.com/taikoxyz/taiko-client/prover/guardian_prover_sender" producer "github.com/taikoxyz/taiko-client/prover/proof_producer" - "github.com/taikoxyz/taiko-client/testutils" ) type ProverTestSuite struct { diff --git a/prover/server/api.go b/prover/server/api.go index 7daa04c48..9cc4968ee 100644 --- a/prover/server/api.go +++ b/prover/server/api.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" "github.com/labstack/echo/v4" + "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/pkg/rpc" ) diff --git a/prover/server/api_test.go b/prover/server/api_test.go index 7482fa40e..1d0b6b245 100644 --- a/prover/server/api_test.go +++ b/prover/server/api_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/server/server.go b/prover/server/server.go index ae07f84a4..54e4d250d 100644 --- a/prover/server/server.go +++ b/prover/server/server.go @@ -11,8 +11,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" - echo "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/pkg/rpc" ) diff --git a/scripts/common.sh b/scripts/common.sh index 1c42be75f..79a317cfd 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -3,7 +3,7 @@ RED='\033[1;31m' NC='\033[0m' # No Color -COMPOSE="docker compose -f docker/nodes/docker-compose.yml" +COMPOSE="docker compose -f internal/docker/nodes/docker-compose.yml" print_error() { local msg="$1"