Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Mar 8, 2024
1 parent 1c43e86 commit 9faa105
Show file tree
Hide file tree
Showing 36 changed files with 84 additions and 32 deletions.
11 changes: 6 additions & 5 deletions integration/networktest/env/network_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package env
import (
"fmt"

"github.com/ten-protocol/go-ten/tools/walletextension"
"github.com/ten-protocol/go-ten/tools/walletextension/common"

gethlog "github.com/ethereum/go-ethereum/log"
"github.com/ten-protocol/go-ten/go/enclave/genesis"
"github.com/ten-protocol/go-ten/integration"
"github.com/ten-protocol/go-ten/integration/common/testlog"
"github.com/ten-protocol/go-ten/integration/networktest"
gatewaycfg "github.com/ten-protocol/go-ten/tools/walletextension/config"
"github.com/ten-protocol/go-ten/tools/walletextension/container"
)

const (
Expand Down Expand Up @@ -68,7 +69,7 @@ type TestnetEnvOption func(env *testnetEnv)
type testnetEnv struct {
testnetConnector *testnetConnector
localTenGateway bool
tenGatewayContainer *container.WalletExtensionContainer
tenGatewayContainer *walletextension.WalletExtensionContainer
logger gethlog.Logger
}

Expand Down Expand Up @@ -99,7 +100,7 @@ func (t *testnetEnv) startTenGateway() {
validatorHTTP := validator[len("http://"):]
// replace the last character with a 1 (expect it to be zero), this is good enough for these tests
validatorWS := validatorHTTP[:len(validatorHTTP)-1] + "1"
cfg := gatewaycfg.Config{
cfg := common.Config{
WalletExtensionHost: "127.0.0.1",
WalletExtensionPortHTTP: _gwHTTPPort,
WalletExtensionPortWS: _gwWSPort,
Expand All @@ -110,7 +111,7 @@ func (t *testnetEnv) startTenGateway() {
DBType: "sqlite",
TenChainID: integration.TenChainID,
}
tenGWContainer := container.NewWalletExtensionContainerFromConfig(cfg, t.logger)
tenGWContainer := walletextension.NewWalletExtensionContainerFromConfig(cfg, t.logger)
go func() {
fmt.Println("Starting Ten Gateway, HTTP Port:", _gwHTTPPort, "WS Port:", _gwWSPort)
err := tenGWContainer.Start()
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
5 changes: 4 additions & 1 deletion lib/gethfork/node/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ You must always call Close on Node, even if the node was not started.
All file-system resources used by a node instance are located in a directory called the
data directory. The location of each resource can be overridden through additional node
configuration. The data directory is optional. If it is not set and the location of a
resource is otherwise unspecified, package node will create the resource in memory.
resource is otherwise unspecified, //nolint
package node
will create the resource in memory.
To access to the devp2p network, Node configures and starts p2p.Server. Each host on the
devp2p network has a unique identifier, the node key. The Node instance persists this key
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/extract_params_handler.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/jwt_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/jwt_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

// Lifecycle encompasses the behavior of services that can be started and stopped
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/rpc_server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// nolint
package node

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/node/rpcstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package node

import (
Expand Down
7 changes: 4 additions & 3 deletions lib/gethfork/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down Expand Up @@ -76,7 +77,7 @@ type BatchElem struct {

// Client represents a connection to an RPC server.
type Client struct {
UserId string
UserID string
idgen func() ID // for subscriptions
isHTTP bool // connection type: http, ws or ipc
services *serviceRegistry
Expand Down Expand Up @@ -120,7 +121,7 @@ func (c *Client) newClientConn(conn ServerCodec) *clientConn {
ctx := context.Background()
ctx = context.WithValue(ctx, clientContextKey{}, c)
ctx = context.WithValue(ctx, peerInfoContextKey{}, conn.peerInfo())
handler := newHandler(ctx, conn, c.idgen, c.services, c.batchItemLimit, c.batchResponseMaxSize, c.UserId)
handler := newHandler(ctx, conn, c.idgen, c.services, c.batchItemLimit, c.batchResponseMaxSize, c.UserID)
return &clientConn{conn, handler}
}

Expand Down Expand Up @@ -243,7 +244,7 @@ func newClient(initctx context.Context, cfg *clientConfig, connect reconnectFunc
func initClient(conn ServerCodec, services *serviceRegistry, cfg *clientConfig) *Client {
_, isHTTP := conn.(*httpConn)
c := &Client{
UserId: cfg.UserId,
UserID: cfg.UserID,
isHTTP: isHTTP,
services: services,
idgen: cfg.idgen,
Expand Down
3 changes: 2 additions & 1 deletion lib/gethfork/rpc/client_opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand All @@ -28,7 +29,7 @@ type ClientOption interface {
}

type clientConfig struct {
UserId string
UserID string
// HTTP settings
httpClient *http.Client
httpHeaders http.Header
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/context_headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import "fmt"
Expand Down
7 changes: 4 additions & 3 deletions lib/gethfork/rpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down Expand Up @@ -65,7 +66,7 @@ type handler struct {

subLock sync.Mutex
serverSubs map[ID]*Subscription
UserId string
UserID string
}

type callProc struct {
Expand All @@ -88,7 +89,7 @@ func newHandler(connCtx context.Context, conn jsonWriter, idgen func() ID, reg *
log: log.Root(),
batchRequestLimit: batchRequestLimit,
batchResponseMaxSize: batchResponseMaxSize,
UserId: userId,
UserID: userId,
}
if conn.remoteAddr() != "" {
h.log = h.log.New("conn", conn.remoteAddr())
Expand Down Expand Up @@ -555,7 +556,7 @@ func (h *handler) handleSubscribe(cp *callProc, msg *jsonrpcMessage) *jsonrpcMes
args = args[1:]

// Install notifier in context so the subscription handler can find it.
n := &Notifier{h: h, namespace: namespace, UserId: h.UserId}
n := &Notifier{h: h, namespace: namespace, UserID: h.UserID}
cp.notifiers = append(cp.notifiers, n)
ctx := context.WithValue(cp.ctx, notifierKey{}, n)

Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/inproc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/ipc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/ipc_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//go:build js
// +build js

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/ipc_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/ipc_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//go:build windows
// +build windows

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
3 changes: 2 additions & 1 deletion lib/gethfork/rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down Expand Up @@ -105,7 +106,7 @@ func (s *Server) ServeCodec(codec ServerCodec, options CodecOption, userId strin
idgen: s.idgen,
batchItemLimit: s.batchItemLimit,
batchResponseLimit: s.batchResponseLimit,
UserId: userId,
UserID: userId,
}
c := initClient(codec, &s.services, cfg)
<-codec.closed()
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/stdio.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
3 changes: 2 additions & 1 deletion lib/gethfork/rpc/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down Expand Up @@ -101,7 +102,7 @@ func NotifierFromContext(ctx context.Context) (*Notifier, bool) {
// Server callbacks use the notifier to send notifications.
type Notifier struct {
h *handler
UserId string
UserID string
namespace string

mu sync.Mutex
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
1 change: 1 addition & 0 deletions lib/gethfork/rpc/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// nolint
package rpc

import (
Expand Down
4 changes: 2 additions & 2 deletions tools/walletextension/rpcapi/filter_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ func (api *FilterAPI) Logs(ctx context.Context, crit filters.FilterCriteria) (*r
return nil, fmt.Errorf("invalid subscription")
}

uid, err := wecommon.GetUserIDbyte(not.UserId)
uid, err := wecommon.GetUserIDbyte(not.UserID)
if err != nil {
return nil, fmt.Errorf("invald token: %s, %w", not.UserId, err)
return nil, fmt.Errorf("invald token: %s, %w", not.UserID, err)
}

user, err := getUser(uid, api.we.Storage)
Expand Down
Loading

0 comments on commit 9faa105

Please sign in to comment.