From a81e71ac41c830e9af1029a75f90d024ef4080bb Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Wed, 26 Aug 2026 15:14:54 +0800 Subject: [PATCH] integrate Autobahn with in-memory EVM-only executor --- Makefile | 9 +- docker/docker-compose.yml | 4 + .../scripts/step4_config_override.sh | 7 + integration_test/autobahn/autobahn_test.go | 152 +++++++++- sei-tendermint/config/autobahn.go | 8 + .../internal/p2p/evmonly_inmemory_app.go | 279 ++++++++++++++++++ .../internal/p2p/evmonly_inmemory_app_test.go | 96 ++++++ sei-tendermint/internal/rpc/core/blocks.go | 8 +- sei-tendermint/node/setup.go | 8 + 9 files changed, 563 insertions(+), 8 deletions(-) create mode 100644 sei-tendermint/internal/p2p/evmonly_inmemory_app.go create mode 100644 sei-tendermint/internal/p2p/evmonly_inmemory_app_test.go diff --git a/Makefile b/Makefile index 16b333e95c..9bc55d0b27 100644 --- a/Makefile +++ b/Makefile @@ -500,11 +500,16 @@ giga-integration-test: # Run Autobahn integration tests with an Autobahn-enabled cluster. autobahn-integration-test: @# The test drives cluster start/stop itself via TestMain — see - @# integration_test/autobahn/autobahn_test.go. GOWORK=off: ignore ambient - @# go.work; this target only needs stdlib + sei-tendermint. + @# integration_test/autobahn/autobahn_test.go. GOWORK=off ignores an + @# ambient go.work so dependency resolution matches the module. @GOWORK=off go test -tags autobahn_integration -v -count=1 -timeout 30m ./integration_test/autobahn/... .PHONY: autobahn-integration-test +# Run the minimal in-memory EVM-only executor behind a four-validator Autobahn cluster. +autobahn-evmonly-integration-test: + @AUTOBAHN_EVMONLY_IN_MEMORY=true GOWORK=off go test -tags autobahn_integration -v -count=1 -timeout 30m ./integration_test/autobahn/... +.PHONY: autobahn-evmonly-integration-test + # Run a mixed-mode cluster: node 0 uses GIGA_EXECUTOR with OCC, nodes 1-3 use standard V2. # (node-level GIGA_EXECUTOR/GIGA_OCC values are pinned in docker-compose.giga-mixed.yml) # Any determinism divergence between giga and V2 will cause the giga node to halt. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b0db261842..247bcb79c5 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -20,6 +20,7 @@ services: - GIGA_OCC - RECEIPT_BACKEND - AUTOBAHN + - AUTOBAHN_EVMONLY_IN_MEMORY - GIGA_STORAGE - GIGA_MIGRATE_FROM_MEMIAVL - GIGA_FLATKV_ONLY @@ -55,6 +56,7 @@ services: - GIGA_OCC - RECEIPT_BACKEND - AUTOBAHN + - AUTOBAHN_EVMONLY_IN_MEMORY - GIGA_STORAGE - GIGA_MIGRATE_FROM_MEMIAVL - GIGA_FLATKV_ONLY @@ -86,6 +88,7 @@ services: - GIGA_OCC - RECEIPT_BACKEND - AUTOBAHN + - AUTOBAHN_EVMONLY_IN_MEMORY - GIGA_STORAGE - GIGA_MIGRATE_FROM_MEMIAVL - GIGA_FLATKV_ONLY @@ -121,6 +124,7 @@ services: - GIGA_OCC - RECEIPT_BACKEND - AUTOBAHN + - AUTOBAHN_EVMONLY_IN_MEMORY - GIGA_STORAGE - GIGA_MIGRATE_FROM_MEMIAVL - GIGA_FLATKV_ONLY diff --git a/docker/localnode/scripts/step4_config_override.sh b/docker/localnode/scripts/step4_config_override.sh index b8a2ad7b96..bed39b96d6 100755 --- a/docker/localnode/scripts/step4_config_override.sh +++ b/docker/localnode/scripts/step4_config_override.sh @@ -6,6 +6,7 @@ NODE_ID=${ID:-0} GIGA_EXECUTOR=${GIGA_EXECUTOR:-true} GIGA_OCC=${GIGA_OCC:-true} AUTOBAHN=${AUTOBAHN:-false} +AUTOBAHN_EVMONLY_IN_MEMORY=${AUTOBAHN_EVMONLY_IN_MEMORY:-false} GIGA_STORAGE=${GIGA_STORAGE:-false} # GIGA_FLATKV_ONLY=true boots the cluster directly in the terminal v3 # steady state: all SC writes route to FlatKV and memiavl is not allocated. @@ -165,6 +166,12 @@ if [ "$AUTOBAHN" = "true" ]; then # Generate autobahn config using seid seid tendermint gen-autobahn-config $NODE_DIRS --output "$AUTOBAHN_CONFIG" + if [ "$AUTOBAHN_EVMONLY_IN_MEMORY" = "true" ]; then + AUTOBAHN_CONFIG_TMP="$AUTOBAHN_CONFIG.tmp" + jq '.evm_only_in_memory = true | del(.persistent_state_dir)' "$AUTOBAHN_CONFIG" > "$AUTOBAHN_CONFIG_TMP" + mv "$AUTOBAHN_CONFIG_TMP" "$AUTOBAHN_CONFIG" + echo "Enabled Autobahn EVM-only execution with in-memory consensus state for node $NODE_ID" + fi # Inject autobahn config file path into config.toml # Must be placed before any [section] header so TOML parser reads it as a top-level key. if grep -q "autobahn-config-file" ~/.sei/config/config.toml; then diff --git a/integration_test/autobahn/autobahn_test.go b/integration_test/autobahn/autobahn_test.go index 2857ebde36..24e3bb9311 100644 --- a/integration_test/autobahn/autobahn_test.go +++ b/integration_test/autobahn/autobahn_test.go @@ -5,6 +5,7 @@ // Requires a running autobahn Docker cluster. Run via: // // make autobahn-integration-test +// make autobahn-evmonly-integration-test // // Or directly (cluster must already be up): // @@ -13,9 +14,11 @@ package autobahn import ( "bufio" + "context" "encoding/json" "fmt" "io" + "math/big" "net/http" "os" "os/exec" @@ -24,8 +27,15 @@ import ( "testing" "time" + "github.com/ethereum/go-ethereum/common" + "golang.org/x/sync/errgroup" + + "github.com/sei-protocol/sei-chain/giga/evmonly/cmd/evmonly-loadtest/scenarios" + tmconfig "github.com/sei-protocol/sei-chain/sei-tendermint/config" tmjson "github.com/sei-protocol/sei-chain/sei-tendermint/libs/json" + tmhttp "github.com/sei-protocol/sei-chain/sei-tendermint/rpc/client/http" "github.com/sei-protocol/sei-chain/sei-tendermint/rpc/coretypes" + tmtypes "github.com/sei-protocol/sei-chain/sei-tendermint/types" "github.com/sei-protocol/sei-chain/testutil/evmtest" ) @@ -75,6 +85,10 @@ const ( // CI runners are slower than local; 1m was tight enough to flake. haltStableTimeout = 2 * time.Minute testRecipientEVM = "0x1000000000000000000000000000000000000001" + + evmOnlyInMemoryEnv = "AUTOBAHN_EVMONLY_IN_MEMORY" + evmOnlyLoadTxs = 4_000 + evmOnlyLoadTimeout = 3 * time.Minute ) var ( @@ -200,6 +214,21 @@ func assertAutobahnEnabled(t *testing.T) { } } +func evmOnlyInMemoryEnabled() bool { + return os.Getenv(evmOnlyInMemoryEnv) == "true" +} + +func assertEVMOnlyInMemoryEnabled(t *testing.T) { + t.Helper() + for _, name := range listRunningNodes(t) { + cmd := exec.Command("docker", "exec", name, "sh", "-c", + "grep -q 'Autobahn EVM-only in-memory execution enabled' build/generated/logs/seid-*.log") + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("EVM-only in-memory execution not enabled on %s: %v\n%s", name, err, out) + } + } +} + // dockerExec runs `docker exec sh -c