This commit is contained in:
Felipe Andrade 2023-06-01 13:36:13 -07:00
parent 33881542a9
commit eb0fc1a837
3 changed files with 10 additions and 4 deletions

@ -7,9 +7,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rpc"
"github.com/google/uuid"
"io"
"math"
"math/rand"
@ -20,6 +17,10 @@ import (
"sync"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rpc"
"github.com/google/uuid"
sw "github.com/ethereum-optimism/optimism/proxyd/pkg/avg-sliding-window"
"github.com/ethereum/go-ethereum/log"
@ -415,7 +416,7 @@ func (b *Backend) doForward(ctx context.Context, rpcReqs []*RPCReq, isBatch bool
originalRequests := rpcReqs
translatedReqs := make(map[string]*RPCReq, len(rpcReqs))
derivedRequests := make([]*RPCReq, 0, 0)
derivedRequests := make([]*RPCReq, 0)
// translate consensus_getReceipts to receipts target
// right now we only support non-batched
if !isBatch {

@ -802,6 +802,7 @@ func TestConsensus(t *testing.T) {
var resJsonMap map[string]interface{}
err = json.Unmarshal(resRaw, &resJsonMap)
require.NoError(t, err)
require.Equal(t, "debug_getRawReceipts", resJsonMap["result"].(map[string]interface{})["method"].(string))
require.Equal(t, "debug_getRawReceipts", resJsonMap["result"].(map[string]interface{})["result"].(map[string]interface{})["_"])
@ -824,6 +825,7 @@ func TestConsensus(t *testing.T) {
var resJsonMap map[string]interface{}
err = json.Unmarshal(resRaw, &resJsonMap)
require.NoError(t, err)
require.Equal(t, "debug_getRawReceipts", resJsonMap["result"].(map[string]interface{})["method"].(string))
require.Equal(t, "debug_getRawReceipts", resJsonMap["result"].(map[string]interface{})["result"].(map[string]interface{})["_"])

@ -90,6 +90,9 @@ func (mh *MockedHandler) Handler(w http.ResponseWriter, req *http.Request) {
if selectedResponse != "" {
var rpcRes proxyd.RPCRes
err = json.Unmarshal([]byte(selectedResponse), &rpcRes)
if err != nil {
panic(err)
}
idJson, _ := json.Marshal(r["id"])
rpcRes.ID = idJson
res, _ := json.Marshal(rpcRes)