Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Mar 26, 2024
1 parent e2852c8 commit 80c8f17
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 17 deletions.
5 changes: 1 addition & 4 deletions integration/obscurogateway/tengateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ func testMultipleAccountsSubscription(t *testing.T, httpURL, wsURL string, w wal
_, err = user0.HTTPClient.ChainID(context.Background())
require.NoError(t, err)

//_, err = user0.WSClient.BalanceAt(context.TODO(), user0.Wallets[0].Address(), nil)
//require.NoError(t, err)

user1, err := NewGatewayUser([]wallet.Wallet{datagenerator.RandomWallet(integration.TenChainID), datagenerator.RandomWallet(integration.TenChainID)}, httpURL, wsURL)
require.NoError(t, err)
testlog.Logger().Info("Created user with encryption token", "t", user1.tgClient.UserID())
Expand Down Expand Up @@ -875,7 +872,7 @@ func subscribeToEvents(addresses []gethcommon.Address, topics [][]gethcommon.Has
// Make a subscription
filterQuery := ethereum.FilterQuery{
Addresses: addresses,
FromBlock: big.NewInt(2), // todo (@ziga) - without those we get errors - fix that and make them configurable
FromBlock: big.NewInt(2),
// ToBlock: big.NewInt(10000),
Topics: topics,
}
Expand Down
3 changes: 1 addition & 2 deletions lib/gethfork/rpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package rpc
import (
"context"
"encoding/json"
"fmt"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -389,6 +388,7 @@ func (h *handler) startCallProc(fn func(*callProc)) {
ctx, cancel := context.WithCancel(h.rootCtx)
defer h.callWG.Done()
defer cancel()
// handle the case when normal rpc calls are made over a ws connection
if ctx.Value(GWTokenKey{}) == nil {
ctx = context.WithValue(ctx, GWTokenKey{}, hexutils.BytesToHex(h.UserID))
}
Expand Down Expand Up @@ -555,7 +555,6 @@ func (h *handler) handleSubscribe(cp *callProc, msg *jsonrpcMessage) *jsonrpcMes
// Parse subscription name arg too, but remove it before calling the callback.
argTypes := append([]reflect.Type{stringType}, callb.argTypes...)
args, err := parsePositionalArguments(msg.Params, argTypes)
fmt.Printf("Subscribe %s\n", string(msg.Params))
if err != nil {
return msg.errorResponse(&invalidParamsError{err.Error()})
}
Expand Down
2 changes: 0 additions & 2 deletions lib/gethfork/rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package rpc

import (
"context"
"fmt"
"io"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -157,7 +156,6 @@ func (s *Server) serveSingleRequest(ctx context.Context, codec ServerCodec) {
if err != nil {
if err != io.EOF {
resp := errorMessage(&invalidMessageError{"parse error"})
fmt.Printf(">> Parse error %s. requests: %v\n", err, reqs)
codec.writeJSON(ctx, resp, true)
}
return
Expand Down
2 changes: 1 addition & 1 deletion lib/gethfork/rpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (c *callback) call(ctx context.Context, method string, args []reflect.Value
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
log.Error("RPC method " + method + " crashed: " + fmt.Sprintf("%v\n%s", err, buf))
errRes = &internalServerError{errcodePanic, fmt.Sprintf("method handler crashed:%v\n%s ", err, buf)}
errRes = &internalServerError{errcodePanic, "method handler crashed"}
}
}()
// Run the callback.
Expand Down
2 changes: 1 addition & 1 deletion testnet/launcher/eth2network/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (n *Eth2Network) Start() error {
}

func (n *Eth2Network) IsReady() error {
timeout := 20 * time.Minute
timeout := 20 * time.Minute // this can be reduced when we no longer download the ethereum binaries
interval := 2 * time.Second
var dial *ethclient.Client
var err error
Expand Down
2 changes: 1 addition & 1 deletion tools/walletextension/container_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ host="0.0.0.0"
nodeHost="erpc.sepolia-testnet.ten.xyz"
nodePortHTTP=80
nodePortWS=81
logPath="sys_out"
logPath="wallet_extension_logs.txt"
databasePath=".obscuro/gateway_database.db"
image="obscuronet/obscuro_gateway_sepolia_testnet:latest"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export const WalletConnectionProvider = ({
setVersion(await fetchVersion());
} catch (error) {
showToast(
ToastType.DESTRUCTIVE,
"Error initializing wallet connection. Please refresh the page."
);
ToastType.DESTRUCTIVE,
error instanceof Error ? error.message : "Error initializing wallet connection. Please refresh the page."
);
} finally {
setLoading(false);
}
Expand Down
2 changes: 1 addition & 1 deletion tools/walletextension/main/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
nodeWebsocketPortUsage = "The port on which to connect to the Obscuro node via RPC over websockets. Default: 81."

logPathName = "logPath"
logPathDefault = "sys_out"
logPathDefault = "wallet_extension_logs.txt"
logPathUsage = "The path to use for the wallet extension's log file"

databasePathName = "databasePath"
Expand Down
2 changes: 1 addition & 1 deletion tools/walletextension/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func main() {
}
}

logLvl := gethlog.LvlDebug
logLvl := gethlog.LvlError
if config.VerboseFlag {
logLvl = gethlog.LvlDebug
}
Expand Down
1 change: 0 additions & 1 deletion tools/walletextension/rpcapi/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ func withCache[R any](cache cache.Cache, cfg *CacheCfg, cacheKey []byte, onCache
}

func audit(services *Services, msg string, params ...any) {
println(fmt.Sprintf(msg, params...))
if services.Config.VerboseFlag {
services.FileLogger.Info(fmt.Sprintf(msg, params...))
}
Expand Down

0 comments on commit 80c8f17

Please sign in to comment.