Skip to content

Commit

Permalink
refactor: Remove unnecessary type assertions (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyodar authored Apr 1, 2024
1 parent 169448f commit 42dfeaa
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions operator/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,16 @@ func (c *AggregatorRpcClient) tryResendFromDeque() {
var err error
var reply bool

switch message.(type) {
switch message := message.(type) {
case *messages.SignedCheckpointTaskResponse:
signedCheckpointTaskResponse := message.(*messages.SignedCheckpointTaskResponse)
// TODO(edwin): handle error
err = c.rpcClient.Call("Aggregator.ProcessSignedCheckpointTaskResponse", signedCheckpointTaskResponse, &reply)
err = c.rpcClient.Call("Aggregator.ProcessSignedCheckpointTaskResponse", message, &reply)

case *messages.SignedStateRootUpdateMessage:
signedStateRootUpdateMessage := message.(*messages.SignedStateRootUpdateMessage)
err = c.rpcClient.Call("Aggregator.ProcessSignedStateRootUpdateMessage", signedStateRootUpdateMessage, &reply)
err = c.rpcClient.Call("Aggregator.ProcessSignedStateRootUpdateMessage", message, &reply)

case *messages.SignedOperatorSetUpdateMessage:
signedOperatorSetUpdateMessage := message.(*messages.SignedOperatorSetUpdateMessage)
err = c.rpcClient.Call("Aggregator.ProcessSignedOperatorSetUpdateMessage", signedOperatorSetUpdateMessage, &reply)
err = c.rpcClient.Call("Aggregator.ProcessSignedOperatorSetUpdateMessage", message, &reply)

default:
panic("unreachable")
Expand Down

0 comments on commit 42dfeaa

Please sign in to comment.