@@ -104,6 +104,9 @@ import (
104104 evmrpcconfig "github.com/sei-protocol/sei-chain/evmrpc/config"
105105 gigaexecutor "github.com/sei-protocol/sei-chain/giga/executor"
106106 gigaconfig "github.com/sei-protocol/sei-chain/giga/executor/config"
107+
108+ gigaprecompiles "github.com/sei-protocol/sei-chain/giga/executor/precompiles"
109+ gigautils "github.com/sei-protocol/sei-chain/giga/executor/utils"
107110 "github.com/sei-protocol/sei-chain/precompiles"
108111 putils "github.com/sei-protocol/sei-chain/precompiles/utils"
109112 "github.com/sei-protocol/sei-chain/sei-db/state_db/ss"
@@ -1311,13 +1314,37 @@ func (app *App) DeliverTxWithResult(ctx sdk.Context, tx []byte, typedTx sdk.Tx)
13111314func (app * App ) ProcessBlockSynchronous (ctx sdk.Context , txs [][]byte , typedTxs []sdk.Tx , absoluteTxIndices []int ) []* abci.ExecTxResult {
13121315 defer metrics .BlockProcessLatency (time .Now (), metrics .SYNCHRONOUS )
13131316
1314- txResults := []* abci.ExecTxResult {}
1317+ txResults := make ( []* abci.ExecTxResult , len ( txs ))
13151318 for i , tx := range txs {
13161319 ctx = ctx .WithTxIndex (absoluteTxIndices [i ])
1317- res := app .DeliverTxWithResult (ctx , tx , typedTxs [i ])
1318- txResults = append (txResults , res )
1320+ evmMsg := app .GetEVMMsg (typedTxs [i ])
1321+ // If not an EVM tx, fall back to v2 processing
1322+ if evmMsg == nil {
1323+ result := app .DeliverTxWithResult (ctx , tx , typedTxs [i ])
1324+ txResults [i ] = result
1325+ continue
1326+ }
1327+
1328+ // Execute EVM transaction through giga executor
1329+ result , execErr := app .executeEVMTxWithGigaExecutor (ctx , i , evmMsg )
1330+ if execErr != nil {
1331+ // Check if this is a fail-fast error (Cosmos precompile interop detected)
1332+ if gigautils .ShouldExecutionAbort (execErr ) {
1333+ res := app .DeliverTxWithResult (ctx , tx , typedTxs [i ])
1334+ txResults [i ] = res
1335+ continue
1336+ }
1337+ txResults [i ] = & abci.ExecTxResult {
1338+ Code : 1 ,
1339+ Log : fmt .Sprintf ("[BUG] giga executor error: %v" , execErr ),
1340+ }
1341+ continue
1342+ }
1343+
1344+ txResults [i ] = result
13191345 metrics .IncrTxProcessTypeCounter (metrics .SYNCHRONOUS )
13201346 }
1347+
13211348 return txResults
13221349}
13231350
@@ -1363,12 +1390,13 @@ func (app *App) PartitionPrioritizedTxs(_ sdk.Context, txs [][]byte, typedTxs []
13631390
13641391// ExecuteTxsConcurrently calls the appropriate function for processing transacitons
13651392func (app * App ) ExecuteTxsConcurrently (ctx sdk.Context , txs [][]byte , typedTxs []sdk.Tx , absoluteTxIndices []int ) ([]* abci.ExecTxResult , sdk.Context ) {
1366- // TODO after OCC release, remove this check and call ProcessTXsWithOCC directly
1367- if ctx .IsOCCEnabled () {
1368- return app .ProcessTXsWithOCC (ctx , txs , typedTxs , absoluteTxIndices )
1393+ // Giga only supports synchronous execution for now
1394+ if app .EvmKeeper .GigaExecutorEnabled || ! ctx .IsOCCEnabled () {
1395+ results := app .ProcessBlockSynchronous (ctx , txs , typedTxs , absoluteTxIndices )
1396+ return results , ctx
13691397 }
1370- results := app . ProcessBlockSynchronous ( ctx , txs , typedTxs , absoluteTxIndices )
1371- return results , ctx
1398+
1399+ return app . ProcessTXsWithOCC ( ctx , txs , typedTxs , absoluteTxIndices )
13721400}
13731401
13741402func (app * App ) GetDeliverTxEntry (ctx sdk.Context , txIndex int , absoluateIndex int , bz []byte , tx sdk.Tx ) (res * sdk.DeliverTxEntry ) {
@@ -1462,12 +1490,9 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ
14621490 }
14631491 }()
14641492
1465- // Route to Giga Executor when enabled - bypasses Cosmos SDK transaction processing
1466- if app .EvmKeeper .GigaExecutorEnabled {
1467- if app .EvmKeeper .GigaOCCEnabled {
1468- return app .ProcessBlockWithGigaExecutorOCC (ctx , txs , req , lastCommit , simulate )
1469- }
1470- return app .ProcessBlockWithGigaExecutor (ctx , txs , req , lastCommit , simulate )
1493+ // TODO: for now Giga OCC calls ProcessBlockWithGigaExecutorOCC, WIP
1494+ if app .EvmKeeper .GigaExecutorEnabled && app .EvmKeeper .GigaOCCEnabled {
1495+ return app .ProcessBlockWithGigaExecutorOCC (ctx , txs , req , lastCommit , simulate )
14711496 }
14721497
14731498 ctx = ctx .WithIsOCCEnabled (app .OccEnabled ())
@@ -1530,6 +1555,7 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ
15301555// ProcessBlockWithGigaExecutor executes block transactions using the Giga executor,
15311556// bypassing the standard Cosmos SDK transaction processing flow.
15321557// This is an experimental path for improved EVM throughput.
1558+ // NOTE: This is not currently used in the codebase, but might be in the future.
15331559func (app * App ) ProcessBlockWithGigaExecutor (ctx sdk.Context , txs [][]byte , req BlockProcessRequest , lastCommit abci.CommitInfo , simulate bool ) (events []abci.Event , txResults []* abci.ExecTxResult , endBlockResp abci.ResponseEndBlock , err error ) {
15341560 // Panic recovery like original ProcessBlock
15351561 defer func () {
@@ -1580,12 +1606,9 @@ func (app *App) ProcessBlockWithGigaExecutor(ctx sdk.Context, txs [][]byte, req
15801606 // Check if this is an EVM transaction
15811607 evmMsg := app .GetEVMMsg (decodedTx )
15821608 if evmMsg == nil {
1583- // Non-EVM transaction - for now, fall back to standard processing
1584- // TODO: Handle or reject non-EVM txs in giga mode
1585- txResults [i ] = & abci.ExecTxResult {
1586- Code : 1 ,
1587- Log : "non-EVM transactions not supported in giga executor mode" ,
1588- }
1609+ res := app .DeliverTxWithResult (ctx , txBytes , decodedTx )
1610+ // Non-EVM transaction - fall back to standard processing
1611+ txResults [i ] = res
15891612 continue
15901613 }
15911614
@@ -1594,9 +1617,15 @@ func (app *App) ProcessBlockWithGigaExecutor(ctx sdk.Context, txs [][]byte, req
15941617 // Execute EVM transaction through giga executor
15951618 result , execErr := app .executeEVMTxWithGigaExecutor (ctx , i , evmMsg )
15961619 if execErr != nil {
1620+ // Check if this is a fail-fast error (Cosmos precompile interop detected)
1621+ if gigautils .ShouldExecutionAbort (execErr ) {
1622+ res := app .DeliverTxWithResult (ctx , txBytes , decodedTx )
1623+ txResults [i ] = res
1624+ continue
1625+ }
15971626 txResults [i ] = & abci.ExecTxResult {
15981627 Code : 1 ,
1599- Log : fmt .Sprintf ("giga executor error: %v" , execErr ),
1628+ Log : fmt .Sprintf ("[BUG] giga executor error: %v" , execErr ),
16001629 }
16011630 continue
16021631 }
@@ -1676,8 +1705,8 @@ func (app *App) executeEVMTxWithGigaExecutor(ctx sdk.Context, txIndex int, msg *
16761705 sstore := app .EvmKeeper .GetParams (ctx ).SeiSstoreSetGasEip2200
16771706 cfg := evmtypes .DefaultChainConfig ().EthereumConfigWithSstore (app .EvmKeeper .ChainID (ctx ), & sstore )
16781707
1679- // Create Giga executor VM (wraps evmone)
1680- gigaExecutor := gigaexecutor .NewEvmoneExecutor (* blockCtx , stateDB , cfg , vm.Config {}, app . EvmKeeper . CustomPrecompiles ( ctx ) )
1708+ // Create Giga executor VM
1709+ gigaExecutor := gigaexecutor .NewGethExecutor (* blockCtx , stateDB , cfg , vm.Config {}, gigaprecompiles . AllCustomPrecompilesFailFast )
16811710
16821711 // Execute the transaction through giga VM
16831712 execResult , execErr := gigaExecutor .ExecuteTransaction (ethTx , sender , app .EvmKeeper .GetBaseFee (ctx ), & gp )
@@ -1688,6 +1717,12 @@ func (app *App) executeEVMTxWithGigaExecutor(ctx sdk.Context, txIndex int, msg *
16881717 }, nil
16891718 }
16901719
1720+ // Check if the execution hit a fail-fast precompile (Cosmos interop detected)
1721+ // Return the error to the caller so it can handle accordingly (e.g., fallback to standard execution)
1722+ if execResult .Err != nil && gigautils .ShouldExecutionAbort (execResult .Err ) {
1723+ return nil , execResult .Err
1724+ }
1725+
16911726 // Finalize state changes
16921727 _ , ferr := stateDB .Finalize ()
16931728 if ferr != nil {
@@ -1905,6 +1940,12 @@ func (app *App) gigaDeliverTx(ctx sdk.Context, req abci.RequestDeliverTxV2, tx s
19051940
19061941 result , err := app .executeEVMTxWithGigaExecutor (ctx , ctx .TxIndex (), evmMsg )
19071942 if err != nil {
1943+ // Check if this is a fail-fast error (Cosmos precompile interop detected)
1944+ if gigautils .ShouldExecutionAbort (err ) {
1945+ // Transaction requires Cosmos interop - not supported in giga mode
1946+ // TODO: implement fallback to standard execution path
1947+ return abci.ResponseDeliverTx {Code : 1 , Log : fmt .Sprintf ("giga executor: cosmos interop not supported: %v" , err )}
1948+ }
19081949 return abci.ResponseDeliverTx {Code : 1 , Log : fmt .Sprintf ("giga executor error: %v" , err )}
19091950 }
19101951
0 commit comments