Skip to content

Commit

Permalink
fix: handle 0x prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Jul 8, 2024
1 parent f8e0ac6 commit 8bde6c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions p2p/pkg/rpc/provider/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func (s *Service) RegisterStake(
}
opts.Value = amount

stake.BlsPublicKey = strings.TrimPrefix(stake.BlsPublicKey, "0x")
blsPubkeyBytes, err := hex.DecodeString(stake.BlsPublicKey)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "decoding bls public key: %v", err)
Expand Down
1 change: 1 addition & 0 deletions p2p/pkg/rpc/provider/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func TestStakeHandling(t *testing.T) {
if stake.Amount != tc.amount {
t.Fatalf("expected amount to be %v, got %v", tc.amount, stake.Amount)
}
tc.blsPublicKey = strings.TrimPrefix(tc.blsPublicKey, "0x")
if stake.BlsPublicKey != tc.blsPublicKey {
t.Fatalf("expected bls_public_key to be %v, got %v", tc.blsPublicKey, stake.BlsPublicKey)
}
Expand Down

0 comments on commit 8bde6c8

Please sign in to comment.