func (ch *Child) handleTree(ctx types.Context, blockHeight int64, blockHeader cmtproto.Header) (storageRoot []byte, err error) {
    if ch.finalizingBlockHeight == blockHeight {
        finalizedTree, newNodes, treeRootHash, err := ch.Merkle().FinalizeWorkingTree(nil)
        // ... saving trees and nodes ...
        
        // BUG: treeRootHash is never assigned to storageRoot
        // Should be: storageRoot = treeRootHash
    }
    return storageRoot, nil  // Always returns nil
}
func (ch *Child) endBlockHandler(ctx types.Context, args nodetypes.EndBlockArgs) error {
    storageRoot, err := ch.handleTree(ctx, blockHeight, args.Block.Header)
    if storageRoot != nil {  // This condition never evaluates to true
        // Output handling never executes
        err = ch.handleOutput(...)
    }
}
func (ch *Child) handleTree(ctx types.Context, blockHeight int64, blockHeader cmtproto.Header) (storageRoot []byte, err error) {
    if ch.finalizingBlockHeight == blockHeight {
        finalizedTree, newNodes, treeRootHash, err := ch.Merkle().FinalizeWorkingTree(nil)
        if err != nil {
            return nil, errors.Wrap(err, "failed to finalize working tree")
        }
        
        // Fix: Assign tree root hash
        storageRoot = treeRootHash
        
        // ... rest of the function ...
    }
    return storageRoot, nil
}
