diff --git a/sonic/empty.patch b/sonic/empty.patch new file mode 100644 index 00000000..e69de29b diff --git a/sonic/sonic.Dockerfile b/sonic/sonic.Dockerfile index f4859b3c..65620362 100644 --- a/sonic/sonic.Dockerfile +++ b/sonic/sonic.Dockerfile @@ -2,11 +2,22 @@ FROM golang:1.22 as builder ARG VERSION ARG REPO +ARG PATCH RUN apt-get update && apt-get install -y git musl-dev make RUN cd /go && git clone ${REPO:-https://github.com/0xsoniclabs/sonic.git} sonic && cd sonic && git fetch --tags && git checkout -b ${VERSION} tags/${VERSION} +COPY ${PATCH:-empty.patch} /tmp/my-patch.patch + +RUN if [ -n "$PATCH" ]; then \ + echo "Using patch file: $PATCH"; \ + git apply --verbose /tmp/my-patch.patch || \ + (echo "Patch failed to apply!" && exit 1); \ + else \ + echo "No patch file provided. Skipping."; \ + fi + WORKDIR /go/sonic ARG GOPROXY diff --git a/sonic/sonic.patch b/sonic/sonic.patch new file mode 100644 index 00000000..05826508 --- /dev/null +++ b/sonic/sonic.patch @@ -0,0 +1,68 @@ +diff --git a/ethapi/api.go b/ethapi/api.go +index 5e921033..7557719c 100644 +--- a/ethapi/api.go ++++ b/ethapi/api.go +@@ -2284,17 +2284,18 @@ func (api *PublicDebugAPI) traceBlock(ctx context.Context, block *evmcore.EvmBlo + } + res, err := api.traceTx(ctx, tx, msg, txctx, block.Header(), statedb, config, nil) + if err != nil { +- return nil, err ++ results[i] = &txTraceResult{TxHash: tx.Hash(), Error: err.Error()} ++ resultsLength += len(err.Error()) ++ } else { ++ results[i] = &txTraceResult{TxHash: tx.Hash(), Result: res} ++ resultsLength += len(res) + } ++ statedb.Finalise() + + // limit the response size. +- resultsLength += len(res) + if api.maxResponseSize > 0 && resultsLength > api.maxResponseSize { + return nil, ErrMaxResponseSize + } +- +- results[i] = &txTraceResult{TxHash: tx.Hash(), Result: res} +- statedb.Finalise() + } + return results, nil + } +@@ -2344,6 +2345,16 @@ func stateAtTransaction(ctx context.Context, block *evmcore.EvmBlock, txIndex in + statedb.Release() + return nil, nil, err + } ++ ++ // For now, Sonic only supports Blob transactions without blob data. ++ if msg.BlobHashes != nil { ++ if len(msg.BlobHashes) > 0 { ++ continue // blob data is not supported - this tx will be skipped ++ } ++ // PreCheck requires non-nil blobHashes not to be empty ++ msg.BlobHashes = nil ++ } ++ + statedb.SetTxContext(tx.Hash(), idx) + if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil { + statedb.Release() +diff --git a/evmcore/state_processor.go b/evmcore/state_processor.go +index 202ebe56..023b5ac5 100644 +--- a/evmcore/state_processor.go ++++ b/evmcore/state_processor.go +@@ -113,6 +113,16 @@ func ApplyTransactionWithEVM(msg *core.Message, config *params.ChainConfig, gp * + txContext := NewEVMTxContext(msg) + evm.Reset(txContext, statedb) + ++ // For now, Sonic only supports Blob transactions without blob data. ++ if msg.BlobHashes != nil { ++ if len(msg.BlobHashes) > 0 { ++ statedb.Finalise() ++ return nil, fmt.Errorf("blob data is not supported") ++ } ++ // PreCheck requires non-nil blobHashes not to be empty ++ msg.BlobHashes = nil ++ } ++ + // Apply the transaction to the current state (included in the env). + result, err := core.ApplyMessage(evm, msg, gp) + if err != nil { +-- +2.43.0