Skip to content

Commit e690e88

Browse files
committed
add flag to overwrite base fee to 0 during benchmark
1 parent 9ccd5ca commit e690e88

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

app/app.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,11 @@ func (app *App) executeEVMTxWithGigaExecutor(ctx sdk.Context, msg *evmtypes.MsgE
17591759
}, nil
17601760
}
17611761

1762+
// Overwrite BaseFee to zero if ZERO_BASE_FEE is enabled (for benchmarking)
1763+
if app.benchmarkManager != nil && app.benchmarkManager.ZeroBaseFee {
1764+
blockCtx.BaseFee = utils.Big0
1765+
}
1766+
17621767
// Get chain config
17631768
sstore := app.GigaEvmKeeper.GetParams(ctx).SeiSstoreSetGasEip2200
17641769
cfg := evmtypes.DefaultChainConfig().EthereumConfigWithSstore(app.GigaEvmKeeper.ChainID(ctx), &sstore)

app/benchmark/benchmark.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ type Manager struct {
3737
Generator *Generator
3838
Logger *Logger
3939
proposalCh <-chan *abci.ResponsePrepareProposal
40+
41+
// ZeroBaseFee overrides blockCtx.BaseFee to zero during tx execution.
42+
ZeroBaseFee bool
4043
}
4144

4245
// NewManager creates a new benchmark manager from configuration.
@@ -46,8 +49,9 @@ func NewManager(ctx context.Context, txConfig client.TxConfig, chainID string, e
4649
panic("benchmark not allowed on live chains")
4750
}
4851

49-
// Load config from environment variable or use default
52+
// Load config from environment variables or use defaults
5053
configPath := os.Getenv("BENCHMARK_CONFIG")
54+
zeroBaseFee := os.Getenv("ZERO_BASE_FEE") == "true"
5155

5256
cfg, err := LoadConfig(configPath, evmChainID, chainID)
5357
if err != nil {
@@ -67,12 +71,14 @@ func NewManager(ctx context.Context, txConfig client.TxConfig, chainID string, e
6771
logger.Info("Benchmark manager initialized",
6872
"configPath", configPath,
6973
"scenarios", len(cfg.Scenarios),
74+
"zeroBaseFee", zeroBaseFee,
7075
)
7176

7277
return &Manager{
73-
Generator: gen,
74-
Logger: benchLogger,
75-
proposalCh: proposalCh,
78+
Generator: gen,
79+
Logger: benchLogger,
80+
proposalCh: proposalCh,
81+
ZeroBaseFee: zeroBaseFee,
7682
}, nil
7783
}
7884

scripts/benchmark.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ GIGA_EXECUTOR=${GIGA_EXECUTOR:-false}
88
GIGA_OCC=${GIGA_OCC:-false}
99
BENCHMARK_TXS_PER_BATCH=${BENCHMARK_TXS_PER_BATCH:-1000}
1010
DISABLE_INDEXER=${DISABLE_INDEXER:-true}
11+
# Zero base fee - if true, overwrite blockCtx.BaseFee to zero for benchmarking
12+
ZERO_BASE_FEE=${ZERO_BASE_FEE:-false}
1113
# Debug mode - if true, prints all log output without filtering
1214
DEBUG=${DEBUG:-false}
1315
# Benchmark scenario config (path to JSON file, see scripts/scenarios/)
@@ -38,6 +40,7 @@ echo " GIGA_OCC: $GIGA_OCC"
3840
echo " DB_BACKEND: $DB_BACKEND"
3941
echo " BENCHMARK_TXS_PER_BATCH: $BENCHMARK_TXS_PER_BATCH"
4042
echo " DISABLE_INDEXER: $DISABLE_INDEXER"
43+
echo " ZERO_BASE_FEE: $ZERO_BASE_FEE"
4144
echo " DEBUG: $DEBUG"
4245
echo " BENCHMARK_CONFIG: ${BENCHMARK_CONFIG:-(default: EVMTransfer)}"
4346
echo ""
@@ -222,8 +225,8 @@ echo "============================================================"
222225
echo ""
223226
if [ "$DEBUG" = true ]; then
224227
# Debug mode: print all output
225-
BENCHMARK_CONFIG=$BENCHMARK_CONFIG BENCHMARK_TXS_PER_BATCH=$BENCHMARK_TXS_PER_BATCH ~/go/bin/seid start --chain-id sei-chain
228+
BENCHMARK_CONFIG=$BENCHMARK_CONFIG BENCHMARK_TXS_PER_BATCH=$BENCHMARK_TXS_PER_BATCH ZERO_BASE_FEE=$ZERO_BASE_FEE ~/go/bin/seid start --chain-id sei-chain
226229
else
227230
# Normal mode: filter to benchmark-related output only
228-
BENCHMARK_CONFIG=$BENCHMARK_CONFIG BENCHMARK_TXS_PER_BATCH=$BENCHMARK_TXS_PER_BATCH ~/go/bin/seid start --chain-id sei-chain 2>&1 | grep -E "(benchmark|Benchmark|deployed|transitioning)"
231+
BENCHMARK_CONFIG=$BENCHMARK_CONFIG BENCHMARK_TXS_PER_BATCH=$BENCHMARK_TXS_PER_BATCH ZERO_BASE_FEE=$ZERO_BASE_FEE ~/go/bin/seid start --chain-id sei-chain 2>&1 | grep -E "(benchmark|Benchmark|deployed|transitioning)"
229232
fi

0 commit comments

Comments
 (0)