Skip to content

Commit

Permalink
fix: request accountID updated to use address
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Dec 20, 2024
1 parent e5c5b52 commit fa32683
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions disperser/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
"github.com/Layr-Labs/eigenda/encoding"
"github.com/Layr-Labs/eigenda/encoding/rs"
"github.com/Layr-Labs/eigensdk-go/logging"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
grpcprom "github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus"
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
Expand Down Expand Up @@ -140,21 +138,22 @@ func (s *DispersalServer) DisperseBlobAuthenticated(stream pb.Disperser_Disperse

// Get the ethereum address associated with the public key. This is just for convenience so we can put addresses instead of public keys in the allowlist.
// Decode public key
publicKeyBytes, err := hexutil.Decode(blob.RequestHeader.AccountID)
if err != nil {
s.metrics.HandleInvalidArgRpcRequest("DisperseBlobAuthenticated")
s.metrics.HandleInvalidArgRequest("DisperseBlobAuthenticated")
return api.NewErrorInvalidArg(fmt.Sprintf("failed to decode account ID (%v): %v", blob.RequestHeader.AccountID, err))
}

pubKey, err := crypto.UnmarshalPubkey(publicKeyBytes)
if err != nil {
s.metrics.HandleInvalidArgRpcRequest("DisperseBlobAuthenticated")
s.metrics.HandleInvalidArgRequest("DisperseBlobAuthenticated")
return api.NewErrorInvalidArg(fmt.Sprintf("failed to decode public key (%v): %v", hexutil.Encode(publicKeyBytes), err))
}

authenticatedAddress := crypto.PubkeyToAddress(*pubKey).String()
// publicKeyBytes, err := hexutil.Decode(blob.RequestHeader.AccountID)
// if err != nil {
// s.metrics.HandleInvalidArgRpcRequest("DisperseBlobAuthenticated")
// s.metrics.HandleInvalidArgRequest("DisperseBlobAuthenticated")
// return api.NewErrorInvalidArg(fmt.Sprintf("failed to decode account ID (%v): %v", blob.RequestHeader.AccountID, err))
// }

// pubKey, err := crypto.UnmarshalPubkey(publicKeyBytes)
// if err != nil {
// s.metrics.HandleInvalidArgRpcRequest("DisperseBlobAuthenticated")
// s.metrics.HandleInvalidArgRequest("DisperseBlobAuthenticated")
// return api.NewErrorInvalidArg(fmt.Sprintf("failed to decode public key (%v): %v", hexutil.Encode(publicKeyBytes), err))
// }

// authenticatedAddress := crypto.PubkeyToAddress(*pubKey).String()
authenticatedAddress := blob.RequestHeader.AccountID

// Send back challenge to client
challengeBytes := make([]byte, 32)
Expand Down

0 comments on commit fa32683

Please sign in to comment.