Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Benchmarks
permissions: {}
"on":
push:
branches:
- main
workflow_dispatch:

jobs:
evm-benchmark:
name: EVM Contract Benchmark
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
issues: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: ./go.mod
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Build binaries
run: make build-evm build-da
- name: Run EVM benchmarks
run: |
cd test/e2e && go test -tags evm -bench=. -benchmem -run='^$' \
-timeout=10m --evm-binary=../../build/evm | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
with:
name: EVM Contract Roundtrip
tool: 'go'
output-file-path: test/e2e/output.txt
auto-push: true
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '150%'
fail-on-alert: true
comment-on-alert: true
2 changes: 1 addition & 1 deletion execution/evm/test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/ipfs/go-datastore v0.9.0
github.com/rs/zerolog v1.34.0
github.com/stretchr/testify v1.11.1
go.uber.org/zap v1.27.1
)

require (
Expand Down Expand Up @@ -179,7 +180,6 @@ require (
go.opentelemetry.io/otel/trace v1.40.0 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.1 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.48.0 // indirect
Expand Down
19 changes: 15 additions & 4 deletions execution/evm/test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/celestiaorg/tastora/framework/types"
"github.com/golang-jwt/jwt/v5"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"go.uber.org/zap/zaptest"
)

// Test-scoped Docker client/network mapping to avoid conflicts between tests
Expand All @@ -39,7 +41,7 @@ func randomString(n int) string {
}

// getTestScopedDockerSetup returns a Docker client and network ID that are scoped to the specific test.
func getTestScopedDockerSetup(t *testing.T) (types.TastoraDockerClient, string) {
func getTestScopedDockerSetup(t testing.TB) (types.TastoraDockerClient, string) {
t.Helper()

testKey := t.Name()
Expand All @@ -59,13 +61,22 @@ func getTestScopedDockerSetup(t *testing.T) (types.TastoraDockerClient, string)
}

// SetupTestRethNode creates a single Reth node for testing purposes.
func SetupTestRethNode(t *testing.T) *reth.Node {
func SetupTestRethNode(t testing.TB) *reth.Node {
t.Helper()
ctx := context.Background()

dockerCli, dockerNetID := getTestScopedDockerSetup(t)

n, err := reth.NewNodeBuilderWithTestName(t, fmt.Sprintf("%s-%s", t.Name(), randomString(6))).
testName := fmt.Sprintf("%s-%s", t.Name(), randomString(6))
logger := zap.NewNop()
if testing.Verbose() {
logger = zaptest.NewLogger(t)
}
n, err := new(reth.NodeBuilder).
WithTestName(testName).
WithLogger(logger).
WithImage(reth.DefaultImage()).
WithBin("ev-reth").
Comment on lines +75 to +79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of this is required, the default behaviour we get from NewNodeBuilderWithTestName should be fine, if we want to set a logger we can just chain the logger after directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround as NewNodeBuilderWithTestName does not accept the TB param

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened celestiaorg/tastora#178 to follow up

WithDockerClient(dockerCli).
WithDockerNetworkID(dockerNetID).
WithGenesis([]byte(reth.DefaultEvolveGenesisJSON())).
Expand All @@ -88,7 +99,7 @@ func SetupTestRethNode(t *testing.T) *reth.Node {
}

// waitForRethContainer waits for the Reth container to be ready by polling the provided endpoints with JWT authentication.
func waitForRethContainer(t *testing.T, jwtSecret, ethURL, engineURL string) error {
func waitForRethContainer(t testing.TB, jwtSecret, ethURL, engineURL string) error {
t.Helper()
client := &http.Client{Timeout: 100 * time.Millisecond}
timer := time.NewTimer(30 * time.Second)
Expand Down
2 changes: 1 addition & 1 deletion execution/evm/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// Transaction Helpers

// GetRandomTransaction creates and signs a random Ethereum legacy transaction using the provided private key, recipient, chain ID, gas limit, and nonce.
func GetRandomTransaction(t *testing.T, privateKeyHex, toAddressHex, chainID string, gasLimit uint64, lastNonce *uint64) *types.Transaction {
func GetRandomTransaction(t testing.TB, privateKeyHex, toAddressHex, chainID string, gasLimit uint64, lastNonce *uint64) *types.Transaction {
t.Helper()
privateKey, err := crypto.HexToECDSA(privateKeyHex)
require.NoError(t, err)
Expand Down
Loading
Loading