From 91250b336b75f4f371ec45f1307510303d9beb70 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 13 Dec 2024 15:22:55 +0100 Subject: [PATCH] [Relayminer, Bug] fix: sessiontree logger never initialized (#993) ## Summary Fixes a nil pointer panic in the relayminer; the logger member is never initialized. ## Issue - N/A ## Type of change Select one or more from the following: - [ ] New feature, functionality or library - [ ] Consensus breaking; add the `consensus-breaking` label if so. See #791 for details - [x] Bug fix - [ ] Code health or cleanup - [ ] Documentation - [ ] Other (specify) ## Testing - [ ] **Documentation**: `make docusaurus_start`; only needed if you make doc changes - [ ] **Unit Tests**: `make go_develop_and_test` - [ ] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [ ] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code - [ ] I create and reference any new tickets, if applicable - [ ] I have left TODOs throughout the codebase, if applicable --- pkg/relayer/session/sessiontree.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/relayer/session/sessiontree.go b/pkg/relayer/session/sessiontree.go index 566369968..df1bfde79 100644 --- a/pkg/relayer/session/sessiontree.go +++ b/pkg/relayer/session/sessiontree.go @@ -96,14 +96,20 @@ func NewSessionTree( // contain a non-hashed Relay that could be used to validate the proof on-chain. trie := smt.NewSparseMerkleSumTrie(treeStore, protocol.NewTrieHasher(), smt.WithValueHasher(nil)) + logger = logger.With( + "store_path", storePath, + "session_id", sessionHeader.SessionId, + "supplier_operator_address", supplierOperatorAddress, + ) + sessionTree := &sessionTree{ + logger: logger, sessionHeader: sessionHeader, storePath: storePath, treeStore: treeStore, sessionSMT: trie, sessionMu: &sync.Mutex{}, supplierOperatorAddress: supplierOperatorAddress, - logger: logger, } return sessionTree, nil @@ -270,7 +276,6 @@ func (st *sessionTree) Delete() error { } else { st.logger.With( "claim_root", fmt.Sprintf("%x", st.GetClaimRoot()), - "session_id", st.GetSessionHeader().SessionId, ).Info().Msg("KVStore is already stopped") }