Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: CI #58

Merged
merged 13 commits into from
Dec 25, 2024
1 change: 1 addition & 0 deletions .github/workflows/test-e2e-multi_pp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
e2e-group:
- "fork12-pessimistic"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build-cdk-image:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ stop: ## Stops all services

.PHONY: test-unit
test-unit:
trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=coverage.out -coverpkg ./... -timeout 200s ./...
trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=coverage.out -coverpkg ./... -timeout 15m ./...

.PHONY: test-seq_sender
test-seq_sender:
Expand Down
20 changes: 10 additions & 10 deletions bridgesync/bridgesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

const (
bridgeSyncL1 = "L1"
bridgeSyncL2 = "L2"
l1BridgeSyncer = "L1BridgeSyncer"
l2BridgeSyncer = "L2BridgeSyncer"
downloadBufferSize = 1000
)

Expand Down Expand Up @@ -55,7 +55,7 @@ func NewL1(
rd,
ethClient,
initialBlock,
bridgeSyncL1,
l1BridgeSyncer,
waitForNewBlocksPeriod,
retryAfterErrorPeriod,
maxRetryAttemptsAfterError,
Expand Down Expand Up @@ -89,7 +89,7 @@ func NewL2(
rd,
ethClient,
initialBlock,
bridgeSyncL2,
l2BridgeSyncer,
waitForNewBlocksPeriod,
retryAfterErrorPeriod,
maxRetryAttemptsAfterError,
Expand All @@ -107,14 +107,14 @@ func newBridgeSync(
rd ReorgDetector,
ethClient EthClienter,
initialBlock uint64,
layerID string,
syncerID string,
waitForNewBlocksPeriod time.Duration,
retryAfterErrorPeriod time.Duration,
maxRetryAttemptsAfterError int,
originNetwork uint32,
syncFullClaims bool,
) (*BridgeSync, error) {
logger := log.WithFields("bridge-syncer", layerID)
logger := log.WithFields("module", syncerID)
processor, err := newProcessor(dbPath, logger)
if err != nil {
return nil, err
Expand Down Expand Up @@ -143,7 +143,7 @@ func newBridgeSync(
return nil, err
}
downloader, err := sync.NewEVMDownloader(
layerID,
syncerID,
ethClient,
syncBlockChunkSize,
blockFinalityType,
Expand All @@ -156,13 +156,13 @@ func newBridgeSync(
return nil, err
}

driver, err := sync.NewEVMDriver(rd, processor, downloader, layerID, downloadBufferSize, rh)
driver, err := sync.NewEVMDriver(rd, processor, downloader, syncerID, downloadBufferSize, rh)
if err != nil {
return nil, err
}

logger.Infof(
"BridgeSyncer [%s] created:\n"+
"%s created:\n"+
" dbPath: %s\n"+
" initialBlock: %d\n"+
" bridgeAddr: %s\n"+
Expand All @@ -172,7 +172,7 @@ func newBridgeSync(
" syncBlockChunkSize: %d\n"+
" blockFinalityType: %s\n"+
" waitForNewBlocksPeriod: %s",
layerID,
syncerID,
dbPath,
initialBlock,
bridge.String(),
Expand Down
3 changes: 2 additions & 1 deletion crates/cdk/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn build_versions() -> std::io::Result<()> {
// Get the corresponding lines from the contents of the starlark file
let versions = content
.lines()
.skip(30)
.skip(32)
.take(15)
.collect::<Vec<&str>>()
.join("\n");
Expand All @@ -81,6 +81,7 @@ fn build_versions() -> std::io::Result<()> {
// Remove all comments to the end of the line using a regexp
let re = Regex::new(r"\s#\s.*\n").unwrap();
let versions = re.replace_all(&versions, "");

// Replace the trailing comma on the last line
let versions = versions.replace(", }", " }");

Expand Down
8 changes: 7 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,37 @@ generate-mocks-agglayer: ## Generates mocks for agglayer, using mockery tool
.PHONY: test-e2e-fork9-validium
test-e2e-fork9-validium: stop
./run-e2e.sh fork9 cdk-validium
export BATS_TEST_TIMEOUT=1800
bats bats/fep/

.PHONY: test-e2e-fork11-rollup
test-e2e-fork11-rollup: stop
./run-e2e.sh fork11 rollup
export BATS_TEST_TIMEOUT=1800
bats bats/fep/

.PHONY: test-e2e-fork12-validium
test-e2e-fork12-validium: stop
./run-e2e.sh fork12 cdk-validium
export BATS_TEST_TIMEOUT=1800
bats bats/fep/

.PHONY: test-e2e-fork12-rollup
test-e2e-fork12-rollup: stop
./run-e2e.sh fork12 rollup
export BATS_TEST_TIMEOUT=1800
bats bats/fep/

.PHONY: test-e2e-fork12-pessimistic
test-e2e-fork12-pessimistic: stop
./run-e2e.sh fork12 pessimistic
export BATS_TEST_TIMEOUT=1800
bats bats/pp/bridge-e2e.bats bats/pp/e2e-pp.bats

.PHONY: test-e2e-fork12-multi-pessimistic
test-e2e-fork12-multi-pessimistic: stop
./run-e2e-multi_pp.sh
./run-e2e-multi_pp.sh
export BATS_TEST_TIMEOUT=1800
bats bats/pp-multi

.PHONY: stop
Expand Down
25 changes: 13 additions & 12 deletions test/helpers/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import (
const (
rollupID = uint32(1)
syncBlockChunkSize = 10
retries = 3
periodRetry = time.Millisecond * 100
)

type AggoracleWithEVMChain struct {
Expand Down Expand Up @@ -108,35 +106,39 @@ func L1Setup(t *testing.T) *L1Environment {
require.NoError(t, err)
go rdL1.Start(ctx) //nolint:errcheck

const (
l1InfoTreeSyncerRetries = 3
l1InfoTreeSyncerRetryFreq = time.Millisecond * 100
)

// L1 info tree sync
dbPathL1InfoTreeSync := path.Join(t.TempDir(), "L1InfoTreeSync.sqlite")
l1InfoTreeSync, err := l1infotreesync.New(
ctx, dbPathL1InfoTreeSync,
gerL1Addr, common.Address{},
syncBlockChunkSize, etherman.LatestBlock,
rdL1, l1Client.Client(),
time.Millisecond, 0, periodRetry,
retries, l1infotreesync.FlagAllowWrongContractsAddrs,
time.Millisecond, 0, l1InfoTreeSyncerRetryFreq,
l1InfoTreeSyncerRetries, l1infotreesync.FlagAllowWrongContractsAddrs,
)
require.NoError(t, err)

go l1InfoTreeSync.Start(ctx)

const (
syncBlockChunks = 10
waitForNewBlocksPeriod = 10 * time.Millisecond
originNetwork = 1
initialBlock = 0
retryPeriod = 0
retriesCount = 0
retryPeriod = 50 * time.Millisecond
retriesCount = 10
)

// Bridge sync
testClient := TestClient{ClientRenamed: l1Client.Client()}
dbPathBridgeSyncL1 := path.Join(t.TempDir(), "BridgeSyncL1.sqlite")
bridgeL1Sync, err := bridgesync.NewL1(
ctx, dbPathBridgeSyncL1, bridgeL1Addr,
syncBlockChunks, etherman.LatestBlock, rdL1, testClient,
syncBlockChunkSize, etherman.LatestBlock, rdL1, testClient,
initialBlock, waitForNewBlocksPeriod, retryPeriod,
retriesCount, originNetwork, false)
require.NoError(t, err)
Expand Down Expand Up @@ -186,16 +188,15 @@ func L2Setup(t *testing.T) *L2Environment {
testClient := TestClient{ClientRenamed: l2Client.Client()}

const (
syncBlockChunks = 10
waitForNewBlocksPeriod = 10 * time.Millisecond
originNetwork = 1
initialBlock = 0
retryPeriod = 0
retriesCount = 0
retryPeriod = 50 * time.Millisecond
retriesCount = 10
)

bridgeL2Sync, err := bridgesync.NewL2(
ctx, dbPathL2BridgeSync, bridgeL2Addr, syncBlockChunks,
ctx, dbPathL2BridgeSync, bridgeL2Addr, syncBlockChunkSize,
etherman.LatestBlock, rdL2, testClient,
initialBlock, waitForNewBlocksPeriod, retryPeriod,
retriesCount, originNetwork, false)
Expand Down
Loading