Skip to content

Commit

Permalink
fix: Nil session tree logger
Browse files Browse the repository at this point in the history
  • Loading branch information
red-0ne committed Dec 12, 2024
1 parent 5d8c6dc commit 8f541cd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/poktroll/application/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/relayer/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (rs *relayerSessionsManager) ensureSessionTree(
// If the sessionTree does not exist, create and assign it to the
// sessionTreeWithSessionId map for the given supplier operator address.
if !ok {
sessionTree, err = NewSessionTree(sessionHeader, &supplierOperatorAccAddress, rs.storesDirectory)
sessionTree, err = NewSessionTree(sessionHeader, &supplierOperatorAccAddress, rs.storesDirectory, rs.logger)
if err != nil {
return nil, err
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/relayer/session/sessiontree.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func NewSessionTree(
sessionHeader *sessiontypes.SessionHeader,
supplierOperatorAddress *cosmostypes.AccAddress,
storesDirectory string,
logger polylog.Logger,
) (relayer.SessionTree, error) {
// Join the storePrefix and the session.sessionId and supplier's operator address to
// create a unique storePath.
Expand Down Expand Up @@ -102,6 +103,7 @@ func NewSessionTree(
sessionSMT: trie,
sessionMu: &sync.Mutex{},
supplierOperatorAddress: supplierOperatorAddress,
logger: logger,
}

return sessionTree, nil
Expand Down
5 changes: 4 additions & 1 deletion testutil/testtree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/pokt-network/poktroll/pkg/crypto"
"github.com/pokt-network/poktroll/pkg/polylog"
"github.com/pokt-network/poktroll/pkg/relayer"
"github.com/pokt-network/poktroll/pkg/relayer/session"
"github.com/pokt-network/poktroll/testutil/testrelayer"
Expand All @@ -31,7 +32,7 @@ func NewFilledSessionTree(
t.Helper()

// Initialize an empty session tree with the given session header.
sessionTree := NewEmptySessionTree(t, sessionTreeHeader, supplierOperatorAddr)
sessionTree := NewEmptySessionTree(t, sessionTreeHeader, supplierOperatorAddr, ctx)

// Add numRelays of relays to the session tree.
FillSessionTree(
Expand All @@ -52,6 +53,7 @@ func NewEmptySessionTree(
t *testing.T,
sessionTreeHeader *sessiontypes.SessionHeader,
supplierOperatorAddr string,
ctx context.Context,
) relayer.SessionTree {
t.Helper()

Expand All @@ -71,6 +73,7 @@ func NewEmptySessionTree(
sessionTreeHeader,
&accAddress,
testSessionTreeStoreDir,
polylog.Ctx(ctx),
)
require.NoError(t, err)

Expand Down

0 comments on commit 8f541cd

Please sign in to comment.