Skip to content

Commit 39fbbe5

Browse files
committed
fix: use UnmarshalBinary for typed transaction decoding in proxy
The proxy server used rlp.DecodeBytes to decode captured transactions, which only handles legacy transactions. Typed transactions (EIP-2718, e.g. EIP-1559 type 2) have a type prefix byte before the RLP payload that causes rlp.DecodeBytes to fail with 'typed transaction too short'. Switch to Transaction.UnmarshalBinary() which handles both legacy and typed transaction formats. Also fix load-test worker config to include required fields for calldata (max_size) and precompile (target) transaction types.
1 parent 35db44b commit 39fbbe5

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

runner/clients/common/proxy/proxy.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/ethereum/go-ethereum/common"
2323
ethTypes "github.com/ethereum/go-ethereum/core/types"
2424
"github.com/ethereum/go-ethereum/log"
25-
"github.com/ethereum/go-ethereum/rlp"
2625
)
2726

2827
type ProxyServer struct {
@@ -196,11 +195,13 @@ func (p *ProxyServer) OverrideRequest(method string, rawParams json.RawMessage)
196195
return false, nil, fmt.Errorf("failed to decode hex: %w", err)
197196
}
198197

199-
err = rlp.DecodeBytes(rawTxBytes, &tx)
198+
// Use UnmarshalBinary to support both legacy and typed (EIP-2718) transactions.
199+
// The previous rlp.DecodeBytes only handled legacy transactions.
200+
err = tx.UnmarshalBinary(rawTxBytes)
200201

201202
if err != nil {
202-
p.log.Error("failed to decode RLP", "err", err)
203-
return false, nil, fmt.Errorf("failed to decode RLP: %w", err)
203+
p.log.Error("failed to decode transaction", "err", err)
204+
return false, nil, fmt.Errorf("failed to decode transaction: %w", err)
204205
}
205206

206207
p.pendingTxs = append(p.pendingTxs, &tx)

runner/payload/loadtest/load_test_worker.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ type loadTestConfig struct {
3939
}
4040

4141
type loadTestTransactionDef struct {
42-
Type string `yaml:"type"`
43-
Weight uint64 `yaml:"weight"`
42+
Type string `yaml:"type"`
43+
Weight uint64 `yaml:"weight"`
44+
MaxSize uint64 `yaml:"max_size,omitempty"`
45+
Target string `yaml:"target,omitempty"`
4446
}
4547

4648
type loadTestPayloadWorker struct {
@@ -159,8 +161,8 @@ func (w *loadTestPayloadWorker) writeConfig() (string, error) {
159161
FundingAmount: "10000000000000000000",
160162
Transactions: []loadTestTransactionDef{
161163
{Type: "transfer", Weight: 70},
162-
{Type: "calldata", Weight: 20},
163-
{Type: "precompile", Weight: 10},
164+
{Type: "calldata", Weight: 20, MaxSize: 256},
165+
{Type: "precompile", Weight: 10, Target: "sha256"},
164166
},
165167
}
166168

0 commit comments

Comments
 (0)