Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann committed Sep 27, 2024
1 parent ed7d269 commit 58e9316
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
5 changes: 3 additions & 2 deletions clients/feeder/feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"path/filepath"
"strings"
"testing"
"time"

"github.com/NethermindEth/juno/core/felt"
Expand Down Expand Up @@ -91,7 +92,7 @@ func NopBackoff(d time.Duration) time.Duration {
}

// NewTestClient returns a client and a function to close a test server.
func NewTestClient(t utils.BenchmarkTesting, network *utils.Network) *Client {
func NewTestClient(t testing.TB, network *utils.Network) *Client {
srv := newTestServer(t, network)
t.Cleanup(srv.Close)
ua := "Juno/v0.0.1-test Starknet Implementation"
Expand All @@ -116,7 +117,7 @@ func NewTestClient(t utils.BenchmarkTesting, network *utils.Network) *Client {
return c
}

func newTestServer(t utils.BenchmarkTesting, network *utils.Network) *httptest.Server {
func newTestServer(t testing.TB, network *utils.Network) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
queryMap, err := url.ParseQuery(r.URL.RawQuery)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions core/class.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ func computeHintedClassHash(abi, program json.RawMessage) (*felt.Felt, error) {
// Combine both ABI and Program JSON strings
var hintedClassHashJSON strings.Builder
hintedClassHashJSON.Grow(len(formattedABI) + len(formattedSpacesProgramStr))
hintedClassHashJSON.WriteString("{\"abi\": ")
hintedClassHashJSON.WriteString(`{"abi": `)
hintedClassHashJSON.WriteString(formattedABI)
hintedClassHashJSON.WriteString(", \"program\": ")
hintedClassHashJSON.WriteString(`, "program": `)
hintedClassHashJSON.WriteString(formattedSpacesProgramStr)
hintedClassHashJSON.WriteString("}")

Expand Down
2 changes: 1 addition & 1 deletion core/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (p *Program) Format() error {

func (p *Program) ReorderHints() error {
// Extract keys and convert them to integers
intKeys := make([]int, p.Hints.Len())
intKeys := []int{}

for pair := p.Hints.Oldest(); pair != nil; pair = pair.Next() {
key := pair.Key
Expand Down
8 changes: 0 additions & 8 deletions utils/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ import (
"github.com/stretchr/testify/require"
)

type BenchmarkTesting interface {
Errorf(format string, args ...interface{})
FailNow()
Logf(format string, args ...interface{})
Fatalf(format string, args ...interface{})
Cleanup(func())
}

func HexToFelt(t testing.TB, hex string) *felt.Felt {
t.Helper()
f, err := new(felt.Felt).SetString(hex)
Expand Down

0 comments on commit 58e9316

Please sign in to comment.