Replies: 10 comments 10 replies
-
I would be a strong proponent of building a compatible network module using a p2p library (like libp2p). The advantages to this are many, but the primary benefits are:
|
Beta Was this translation helpful? Give feedback.
-
I agree with splitting out the networking stack into its own crate, but
strongly disagree with using libp2p in particular (it has some pretty
terrible design flaws and has rather anemic support in other languages
besides Go), and somewhat disagree with using a 3rd party p2p library in
general. The reasons for the latter are that (1) Stacks has somewhat
bespoke requirements for block propagation and peer selection due to the
fact that peers rely on the state of both Bitcoin's and Stacks' chain state
to make peering and routing decisions, and (2) there just aren't that many
well-designed alternatives today. Happy to discuss more in a call.
…On Tue, Jun 20, 2023, 12:00 PM Aaron Blankstein ***@***.***> wrote:
I would be a strong proponent of building a compatible network module
using a p2p library (like libp2p).
The advantages to this are many, but the primary benefits are:
1. *Freeing blockchain maintainer throughput*. Our networking stack
works, but bugs in the stack are very difficult for contributors to
diagnose and fix (and harder to test). It's also the part of the stack with
the least shared knowledge among active contributors. It's certainly the
part of the codebase I have the most trouble contributing to, and my guess
is others agree. Employing a library for this allows maintainers to focus
energy on other components which *are* necessarily more custom: the
consensus data store, block selection, fork selection, the clarity VM, and
special contracts.
2. *Standardization of the stack*. Using a networking library should
lead to a stack that is more modular and extensible: a networking library
will provide better documentation than our networking stack does, and it
has a non-permeable interface. Our networking stack's boundaries between
"networking code", "consensus code", and "clarity" are all quite fuzzy.
Making this boundary sharp will make contributing to all of these
components easier and safer. Finally, a more standard networking stack will
make implementation in other languages much easier: implementing a simple
stacks p2p client in TS or python should be easy if the interfaces with a
portable library like libp2p are clear.
—
Reply to this email directly, view it on GitHub
<#3761 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADQJK34Q2CZK4PVSI7DXHDXMHCKVANCNFSM6AAAAAAZNF64RA>
.
You are receiving this because you are subscribed to this thread.Message
ID:
<stacks-network/stacks-blockchain/repo-discussions/3761/comments/6232486@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
On a scale of 1 to 10, where 10 is "drop everything and do this right now,"
where do you place the importance of figuring this out? Can it wait a
couple weeks until I'm back?
…On Tue, Jun 20, 2023, 6:42 PM Igor Sylvester ***@***.***> wrote:
Thanks for your thoughts! Could the first step towards this work be to
define a clear network stack API and pull it into a new repository? Is
stacks-net a good name?
—
Reply to this email directly, view it on GitHub
<#3761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADQJKYS7HAAHL2YS3KUSZTXMIRL5ANCNFSM6AAAAAAZNF64RA>
.
You are receiving this because you commented.Message ID:
<stacks-network/stacks-blockchain/repo-discussions/3761/comments/6235788@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Streamr Network could be an option for Stacks networking. The SDK is currently in TypeScript however the Streamr Nodes have HTTP/MQTT/WS interfaces for any language. It's based on WebRTC so peers can connect through difficult NATs, it has very low and predictable latency, it's decentralized, permissionless and so on. Happy to answer any questions about the protocol. No tokens are needed. |
Beta Was this translation helpful? Give feedback.
-
This discussion makes me sad. We're talking about replacing a very large
subsystem (that 1-2 engineers are intimately familiar with) with a
different very large subsystem that none of us are nearly as familiar with,
but has known design deficiencies that the current system fixes.
Furthermore, the impetus for this is an issue for which there is no PoC or
smoking gun evidence that implicates the p2p network in the first place
(and, neither is there any discussion about what the fix for that issue
would be).
It's like going to the doctor's office with a runny nose, and the doctor
immediately saying "YOU NEED A LIVER TRANSPLANT!" without any sort of
testing or consultation. And then other doctors walking through the hallway
overhear this, poke their heads in, and say "NO YOU NEED A LUNG TRANSPLANT"
or "YOU HAVE CANCER." If I were the patient, I would be running, not
walking, to the nearest exit.
What we ought to be doing is figuring out the root cause of the issue at
hand, and having a discussion about how we can regularly test block
propagation in large-scale deployments of the blockchain so we can catch
these bugs earlier.
…On Fri, Jun 30, 2023, 8:30 AM Matthew ***@***.***> wrote:
Streamr Network <https://streamr.network/network> could be an option for
Stacks networking.
The SDK is currently in TypeScript however the Streamr Nodes have
HTTP/MQTT/WS interfaces for any language.
The main advantage over LibP2P is scalability beside low and predictable
latency of the message transport. Happy to answer any questions about the
protocol. No tokens are needed.
—
Reply to this email directly, view it on GitHub
<#3761 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADQJK5MKTBYKIEERSYPNHTXN3BIHANCNFSM6AAAAAAZNF64RA>
.
You are receiving this because you were mentioned.Message ID:
<stacks-network/stacks-blockchain/repo-discussions/3761/comments/6325524@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
I think this is a discussion of specialization @obycode
(Sorry for not replying in the thread; that's not really an option for me
right now)
The p2p network is a core competency of a blockchain that should not be
outsourced. Business requirements like block size, block latency, and block
production all have a profound impact on how the system needs to store and
propagate blocks and transactions. For example:
* blockchains with large-ish blocks should use TCP instead of UDP for
transmitting data, lest the system accidentally reinvent a shitty TCP on
top of UDP to deal with congestion collapse and multi-framed messages
* blockchains that support block production from regular users should
permit node operation behind NATs in order to support users running nodes
at home. This has a large impact on peer discovery and next-hop message
forwarding -- for example, a peer needs to maintain stateful connections to
NAT'ed peers in order to keep the translation table entries alive (and thus
keep the NAT'ed peers connected)
* blockchains with open-membership block production should employ a routing
strategy that maximizes the number of nodes who can be reached by the next
hop
* blockchains with low latency requirements ought to employ a "happy path"
propagation strategy on top of message flooding that minimizes the time it
takes for block producers to receive the message. For example, block
producers could self-organize into a minimum spanning tree for optimistic
fast replication and fall back to flooding on timeouts.
* blockchains that run across the public untrusted internet should employ a
peer discovery strategy that resists node eclipsing, including via BPG
prefix hijacking.
I can think of more, but you get the idea: the common theme of all of
these design points is that they impact the inner design and implementation
of the p2p subsystem.
…On Fri, Jun 30, 2023, 9:11 AM Brice Dobry ***@***.***> wrote:
I think this is a discussion of specialization. A better metaphor is that
Alice is a baker with the goal of making the world's best bread, but she
also builds her own delivery vehicles. These vehicles seem to be having
some issues, and she's not quite sure what's wrong, so Bob suggests buying
a delivery truck from Acme Truck Co. to replace her custom built delivery
vehicles so that she can focus on the bread.
So the question that needs to be answered is, is the p2p networking code a
vital component of making our bread, or is it something that can be
outsourced so that our focus can be on other things.
I don't have a clear answer to that, but I just wanted to explain better
where I think this discussion is coming from.
—
Reply to this email directly, view it on GitHub
<#3761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADQJK6QZJF2HJWE4UPA44LXN3GBRANCNFSM6AAAAAAZNF64RA>
.
You are receiving this because you were mentioned.Message ID:
<stacks-network/stacks-blockchain/repo-discussions/3761/comments/6325846@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
s/BPG/BGP
…On Fri, Jun 30, 2023, 9:33 AM Jude Nelson ***@***.***> wrote:
> I think this is a discussion of specialization @obycode
(Sorry for not replying in the thread; that's not really an option for me
right now)
The p2p network is a core competency of a blockchain that should not be
outsourced. Business requirements like block size, block latency, and block
production all have a profound impact on how the system needs to store and
propagate blocks and transactions. For example:
* blockchains with large-ish blocks should use TCP instead of UDP for
transmitting data, lest the system accidentally reinvent a shitty TCP on
top of UDP to deal with congestion collapse and multi-framed messages
* blockchains that support block production from regular users should
permit node operation behind NATs in order to support users running nodes
at home. This has a large impact on peer discovery and next-hop message
forwarding -- for example, a peer needs to maintain stateful connections to
NAT'ed peers in order to keep the translation table entries alive (and thus
keep the NAT'ed peers connected)
* blockchains with open-membership block production should employ a
routing strategy that maximizes the number of nodes who can be reached by
the next hop
* blockchains with low latency requirements ought to employ a "happy path"
propagation strategy on top of message flooding that minimizes the time it
takes for block producers to receive the message. For example, block
producers could self-organize into a minimum spanning tree for optimistic
fast replication and fall back to flooding on timeouts.
* blockchains that run across the public untrusted internet should employ
a peer discovery strategy that resists node eclipsing, including via BPG
prefix hijacking.
I can think of more, but you get the idea: the common theme of all of
these design points is that they impact the inner design and implementation
of the p2p subsystem.
On Fri, Jun 30, 2023, 9:11 AM Brice Dobry ***@***.***>
wrote:
> I think this is a discussion of specialization. A better metaphor is that
> Alice is a baker with the goal of making the world's best bread, but she
> also builds her own delivery vehicles. These vehicles seem to be having
> some issues, and she's not quite sure what's wrong, so Bob suggests buying
> a delivery truck from Acme Truck Co. to replace her custom built delivery
> vehicles so that she can focus on the bread.
>
> So the question that needs to be answered is, is the p2p networking code
> a vital component of making our bread, or is it something that can be
> outsourced so that our focus can be on other things.
>
> I don't have a clear answer to that, but I just wanted to explain better
> where I think this discussion is coming from.
>
> —
> Reply to this email directly, view it on GitHub
> <#3761 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AADQJK6QZJF2HJWE4UPA44LXN3GBRANCNFSM6AAAAAAZNF64RA>
> .
> You are receiving this because you were mentioned.Message ID:
> <stacks-network/stacks-blockchain/repo-discussions/3761/comments/6325846@
> github.com>
>
|
Beta Was this translation helpful? Give feedback.
-
would Ethereum's network stack have similar requirements to those you
describe? @igorsyl
No, they are pretty different. And not even solely due to business
requirements; Ethereum's p2p system is just _sloppy_ in places. For
example, up until 2018 it was trivial to eclipse Ethereum nodes [1]. As
another example, Ethereum's RLP wire format makes it hard to build a
parallelizable codec.
Furthermore, Solana and Ethereum 2.0 are PoS networks, which place a
different set of p2p constraints on their respective networks. For
example, they prioritize all-to-all connectivity for block producers by
staked weight, and they don't need to care about forks. We need to
prioritize all-to-all connectivity for _everyone_ (since anyone can mine,
even from behind a NAT), and we do care about forks (so we need the p2p
network to help identify nodes on forks that are of interest to us). There
are more subtleties, but I'm on mobile and don't have time to list them
here.
Point is, trying to drop-in replace our p2p stack with someone else's is
probably not going to happen. It would be painful in many
hard-to-anticipate ways, including dealing with mismatch between our
chain's business needs and theirs.
[1] https://eprint.iacr.org/2018/236.pdf
[2]
…On Fri, Jun 30, 2023, 1:40 PM Igor Sylvester ***@***.***> wrote:
These are all important considerations and optimizations. However, would
Ethereum's network stack have similar requirements to those you describe?
What is the delta in network stack requirements between Ethereum and
Stacks? Could we use the network stacks from
https://github.com/paradigmxyz/reth?
—
Reply to this email directly, view it on GitHub
<#3761 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADQJKZQJP34UEWUFJQEIT3XN4FRPANCNFSM6AAAAAAZNF64RA>
.
You are receiving this because you were mentioned.Message ID:
<stacks-network/stacks-blockchain/repo-discussions/3761/comments/6328128@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
@jcnelson this whole discussion is starting to feel a lot like NIH. We should be very skeptical that we can build, for instance, a correct and performant HTTP parser, server etc better than projects like hyper, warp etc. Likewise, I understand your stance on Finally, if there are implicit rules or constraints on the codebase ("thou shalt not pull in any dependency with |
Beta Was this translation helpful? Give feedback.
-
Can we estimate the effort to replace the current p2p implementation? I feel supportive of Jude's concerns that it is not that easy as it might seem. |
Beta Was this translation helpful? Give feedback.
-
Given issues with the peer network such as #3753. Should we consider revamping the net stack to use another production-ready and robust p2p library such as:
https://docs.rs/libp2p/latest/libp2p/
https://github.com/libp2p/rust-libp2p
cc @obycode @Acaccia @jbencin
Beta Was this translation helpful? Give feedback.
All reactions