libplanet icon indicating copy to clipboard operation
libplanet copied to clipboard

Expose `BlockLocator`

Open dahlia opened this issue 3 years ago • 5 comments

It will be great if we can remove this and make Libplanet internals used in Libplanet.Net public.

Originally posted by @limebell in https://github.com/planetarium/libplanet/pull/1760#discussion_r792261018

Currently Libplanet allows Libplanet.Net to see its internals in order to keep BlockLocator internal. However, it would be better if it is exposed as a public class instead.

dahlia avatar Jan 26 '22 02:01 dahlia

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 01:04 stale[bot]

This issue is extreamly easy.

The goal of this issue is not to focus on understanding the structure of libplanet, but rather to follow the process of contributing to libplanet. We are looking forward to familiarizing you with the changelog or lint.

riemannulus avatar Jun 03 '22 05:06 riemannulus

Is the objective of this issue simply making the class BlockLocator public, or removing the lines:

[assembly: InternalsVisibleTo("Libplanet.Net")]
[assembly: InternalsVisibleTo("Libplanet.Net.Tests")]

?

I'm asking because if it's the former it would be really simple, but in case of the latter, the members of the class BlockChain Swap(other, render, stateCompleters), TipChanged, Store, Append(block, evaluateActions, renderBlocks), FindNextHashes(locator, stop, count), Fork(point, inheritRenderers, GetBlockLocator(threshold), IterateBlockHashes(offset, limit) must also be made public, and the code must be swapped around due to the fact that public members should precede the internal members. I wasn't so sure if this is what you would have wanted.

tkiapril avatar Jul 12 '22 01:07 tkiapril

The goal of this issue is not to focus on understanding the structure of libplanet, but rather to follow the process of contributing to libplanet.

Baby steps. 🙂

As the original https://github.com/planetarium/libplanet/pull/1760#discussion_r792261018 suggest, the goal is eventually to decouple Libpanet and Libplanet.Net, but doing so in one go would be rather hard as you've mentioned.

For now, I think just making partially mentioned entities public and moving around some chunks to pass code analysis would be fine. 😗

greymistcube avatar Jul 12 '22 02:07 greymistcube