arik-so / arik-so/ldk-parser

Assess anchoring requirements for returned values inside elided types

Open
#28 6 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Swift
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

When calling a method that requires passing a pointer to the instance, one usually assumes that the response value needs the caller's memory to outlast it.

However, if the returned object owns its own memory, that may not be necessary. Again however, if the returned object is an elided type, like a tuple or a Vec or a primitive wrapper, memory ownership check needs to be recursive. Example: `ChannelManager:listChannels`, which returns a `Vec_ChannelDetailsZ`, but the ChannelDetails are likely all owned, so the Vec may be freed.

Proposed solution: add an optional `parentalAnchor` parameter to `getValue()`, where, it checks if any of its objects don't own their memory, and then anchors the parent in them.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at getValue() and trace the ChannelManager:listChannels example, including the Vec_ChannelDetailsZ return and nested ownership checks. Review how returned values are currently anchored, then run the relevant tests while checking cases where nested objects own or do not own their memory. Done means recursive ownership behavior is covered consistently, including whether the parent needs anchoring.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.