Skip to content

Commit

Permalink
Revert "Rpc-Iterator clean up (#793)" (#802)
Browse files Browse the repository at this point in the history
This reverts commit 54f147c.
  • Loading branch information
cabrador authored Nov 8, 2023
1 parent 54f147c commit 88c11fa
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 160 deletions.
24 changes: 16 additions & 8 deletions cmd/aida-rpc/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ func TestRPC_TransactionsAreExecutedForCorrectRange(t *testing.T) {
archive := state.NewMockNonCommittableStateDB(ctrl)

var err error
emptyReqA.Response, err = json.Marshal("0x1")
emptyReqA.Response.Result, err = json.Marshal("0x1")
if err != nil {
t.Errorf("unexpected error while marshalling result; %v", err)
}

emptyReqB.Response, err = json.Marshal("0x0")
emptyReqB.Response.Result, err = json.Marshal("0x0")
if err != nil {
t.Errorf("unexpected error while marshalling result; %v", err)
}
Expand Down Expand Up @@ -93,8 +93,6 @@ func TestRPC_TransactionsAreExecutedForCorrectRange(t *testing.T) {
}

var emptyReqA = &rpc.RequestAndResults{
Block: 10,
Timestamp: 10,
Query: &rpc.Body{
Version: "2.0",
ID: json.RawMessage{1},
Expand All @@ -103,14 +101,18 @@ var emptyReqA = &rpc.RequestAndResults{
Namespace: "eth",
MethodBase: "getBalance",
},
ReturnState: &rpc.ReturnState{
Response: &rpc.Response{
Version: "2.0",
ID: json.RawMessage{1},
BlockID: 10,
Timestamp: 10,
},
StateDB: &rpc.StateDBData{
Result: new(big.Int).SetInt64(1),
},
}

var emptyReqB = &rpc.RequestAndResults{
Block: 11,
Timestamp: 11,
Query: &rpc.Body{
Version: "2.0",
ID: json.RawMessage{1},
Expand All @@ -119,7 +121,13 @@ var emptyReqB = &rpc.RequestAndResults{
Namespace: "eth",
MethodBase: "getBalance",
},
ReturnState: &rpc.ReturnState{
Response: &rpc.Response{
Version: "2.0",
ID: json.RawMessage{1},
BlockID: 11,
Timestamp: 11,
},
StateDB: &rpc.StateDBData{
Result: new(big.Int).SetInt64(0),
},
}
2 changes: 1 addition & 1 deletion cmd/aida-rpc/run_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type rpcProcessor struct {
}

func (p rpcProcessor) Process(state executor.State[*rpc.RequestAndResults], ctx *executor.Context) error {
state.Data.ReturnState = rpc.Execute(uint64(state.Block), state.Data, ctx.Archive, p.cfg)
state.Data.StateDB = rpc.Execute(uint64(state.Block), state.Data, ctx.Archive, p.cfg)
return nil
}

Expand Down
Loading

0 comments on commit 88c11fa

Please sign in to comment.