From 42dfeaa396ff6a9f80d8f93559103e1a0e9715b5 Mon Sep 17 00:00:00 2001 From: Franco Barpp Gomes Date: Mon, 1 Apr 2024 08:30:29 -0300 Subject: [PATCH] refactor: Remove unnecessary type assertions (#55) --- operator/rpc_client.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/operator/rpc_client.go b/operator/rpc_client.go index dcbfc592..7ae8da44 100644 --- a/operator/rpc_client.go +++ b/operator/rpc_client.go @@ -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")