Skip to content

Commit

Permalink
Fix feeder public_key decoding (#1874)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirugan authored May 21, 2024
1 parent 315cfd7 commit c64bac4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions clients/feeder/feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,12 @@ func (c *Client) PublicKey(ctx context.Context) (*felt.Felt, error) {
}
defer body.Close()

b, err := io.ReadAll(body)
if err != nil {
var publicKey string // public key hex string
if err = json.NewDecoder(body).Decode(&publicKey); err != nil {
return nil, err
}
publicKey := new(felt.Felt).SetBytes(b)

return publicKey, nil
return new(felt.Felt).SetString(publicKey)
}

func (c *Client) Signature(ctx context.Context, blockID string) (*starknet.Signature, error) {
Expand Down
2 changes: 1 addition & 1 deletion clients/feeder/feeder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func TestPublicKey(t *testing.T) {

actualPublicKey, err := client.PublicKey(context.Background())
assert.NoError(t, err)
assert.Equal(t, "0x507b38d81561baa02f718dae46c371ba9f72fc5f0e9535ca94559dfb776115b", actualPublicKey.String())
assert.Equal(t, "0x52934be54ce926b1e715f15dc2542849a97ecfdf829cd0b7384c64eeeb2264e", actualPublicKey.String())
}

func TestSignature(t *testing.T) {
Expand Down

0 comments on commit c64bac4

Please sign in to comment.