Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean unused variables in rpc iterator. Assing timestamp and block nu… #793

Merged
merged 4 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 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.Result, err = json.Marshal("0x1")
emptyReqA.Response, err = json.Marshal("0x1")
if err != nil {
t.Errorf("unexpected error while marshalling result; %v", err)
}

emptyReqB.Response.Result, err = json.Marshal("0x0")
emptyReqB.Response, err = json.Marshal("0x0")
if err != nil {
t.Errorf("unexpected error while marshalling result; %v", err)
}
Expand Down Expand Up @@ -93,6 +93,8 @@ 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 @@ -101,18 +103,14 @@ var emptyReqA = &rpc.RequestAndResults{
Namespace: "eth",
MethodBase: "getBalance",
},
Response: &rpc.Response{
Version: "2.0",
ID: json.RawMessage{1},
BlockID: 10,
Timestamp: 10,
},
StateDB: &rpc.StateDBData{
ReturnState: &rpc.ReturnState{
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 @@ -121,13 +119,7 @@ var emptyReqB = &rpc.RequestAndResults{
Namespace: "eth",
MethodBase: "getBalance",
},
Response: &rpc.Response{
Version: "2.0",
ID: json.RawMessage{1},
BlockID: 11,
Timestamp: 11,
},
StateDB: &rpc.StateDBData{
ReturnState: &rpc.ReturnState{
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.StateDB = rpc.Execute(uint64(state.Block), state.Data, ctx.Archive, p.cfg)
state.Data.ReturnState = rpc.Execute(uint64(state.Block), state.Data, ctx.Archive, p.cfg)
return nil
}

Expand Down
Loading