hiero-ledger / hiero-ledger/hiero-consensus-node

Check if we can implement a stack for context metadata

Open
#8,457 0 comments 0 reactions 0 assignees View on GitHub
Base Logging Platform
Dominant language
Java
Stars
406
Forks
226
Avg merge
3d 4h
Merged PRs (30d)
210

Description

As @cody-littley mentioned correctly in #8423 we can currently miss some context metadata in some specific cases:

> What if somebody does something like this?
>
```
try (var x = context.add("foo", 123)) {
System.out.println(getContextMap().get("foo")); // prints 123
try (var y = context.add("foo", 321)) {
System.out.println(getContextMap().get("foo")); // prints 321
}
System.out.println(getContextMap().get("foo")); // prints null
}
```
> We probably either need to create a stack of values for the context if such a thing is supported, or prevent nested contexts from overwriting the same value.

We should check if it makes sense to find a solution for that point.

Contributor guide

Open the contributing guide

Research direction

Start by reading issue #8423 and locating the Java implementation behind context.add and getContextMap. Reproduce the nested-context example to understand the current behavior, then determine whether nested values should be restored or prevented from overwriting; done requires an agreed approach and corresponding tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.