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

Add unittest for multi-fork support #25

Merged
merged 11 commits into from
Aug 1, 2024
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ stop: ## Stops all services
.PHONY: test
test:
trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=../coverage.out -coverpkg ./... -timeout 200s ./...

.PHONY: test-seq_sender
test-seq_sender:
trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=../coverage.out -timeout 200s ./sequencesender/...
joanestebanr marked this conversation as resolved.
Show resolved Hide resolved


.PHONY: install-linter
install-linter: ## Installs the linter
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.54.2
Expand Down
8 changes: 4 additions & 4 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ func newTxBuilder(cfg config.Config, ethman *etherman.Client) (txbuilder.TxBuild
switch contracts.VersionType(cfg.Common.ContractVersions) {
case contracts.VersionBanana:
if cfg.Common.IsValidiumMode {
txBuilder = txbuilder.NewTxBuilderBananaValidium(ethman.Contracts.Banana.Rollup, ethman.Contracts.Banana.GlobalExitRoot, da, *auth, auth.From, cfg.SequenceSender.MaxBatchesForL1)
txBuilder = txbuilder.NewTxBuilderBananaValidium(ethman.Contracts.Banana.Rollup, ethman.Contracts.Banana.GlobalExitRoot, da, *auth, cfg.SequenceSender.MaxBatchesForL1)
} else {
txBuilder = txbuilder.NewTxBuilderBananaZKEVM(ethman.Contracts.Banana.Rollup, ethman.Contracts.Banana.GlobalExitRoot, *auth, auth.From, cfg.SequenceSender.MaxTxSizeForL1)
txBuilder = txbuilder.NewTxBuilderBananaZKEVM(ethman.Contracts.Banana.Rollup, ethman.Contracts.Banana.GlobalExitRoot, *auth, cfg.SequenceSender.MaxTxSizeForL1)
}
case contracts.VersionElderberry:
if cfg.Common.IsValidiumMode {
txBuilder = txbuilder.NewTxBuilderElderberryValidium(ethman.Contracts.Elderberry.Rollup, da, *auth, auth.From, cfg.SequenceSender.MaxBatchesForL1)
txBuilder = txbuilder.NewTxBuilderElderberryValidium(ethman.Contracts.Elderberry.Rollup, da, *auth, cfg.SequenceSender.MaxBatchesForL1)
} else {
txBuilder = txbuilder.NewTxBuilderElderberryZKEVM(ethman.Contracts.Elderberry.Rollup, *auth, auth.From, cfg.SequenceSender.MaxTxSizeForL1)
txBuilder = txbuilder.NewTxBuilderElderberryZKEVM(ethman.Contracts.Elderberry.Rollup, *auth, cfg.SequenceSender.MaxTxSizeForL1)
}
default:
err = fmt.Errorf("unknown contract version: %s", cfg.Common.ContractVersions)
Expand Down
12 changes: 7 additions & 5 deletions dataavailability/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ type DABackender interface {

// SequenceSender is used to send provided sequence of batches
type SequenceSender interface {
SequenceSenderElderberry
SequenceSenderBanana
}

type SequenceSenderElderberry interface {
// PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
// as expected by the contract
PostSequence(ctx context.Context, sequence etherman.SequenceBanana) ([]byte, error)
// PostSequenceElderberry sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
// as expected by the contract
PostSequenceElderberry(ctx context.Context, batchesData [][]byte) ([]byte, error)
}

type SequenceSenderElderberry interface {
type SequenceSenderBanana interface {
// PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
// as expected by the contract
PostSequenceElderberry(ctx context.Context, batchesData [][]byte) ([]byte, error)
PostSequence(ctx context.Context, sequence etherman.SequenceBanana) ([]byte, error)
joanestebanr marked this conversation as resolved.
Show resolved Hide resolved
}

// SequenceRetriever is used to retrieve batch data
Expand Down
96 changes: 96 additions & 0 deletions dataavailability/mocks_da/batch_data_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading