-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RLN Fees distribution to operators with root voting #101
Comments
Just to state the obvious, this assumes that we collect fees otherwise it can't work long term.
Do you think it would be economically viable to register 2/3 of ALL possible memberships and control the vote to get all the fees?
Waku Sync could be used to get the correct Merkle root without using Relay at all. I'm not sure we can prevent that. 🤔
What happen when no majority? Do fees just accumulate?
To me it feels unnecessary, is the lack of reward not penalty enough? It would allow superepoch to not have votes and for rewards to accumulate. It would be good to have a mechanism that can allow skipping superepoch when the fees are not high enough but maybe it makes the system too gameable? Maybe instead of voting, let people gamble on the correct merkle root? Stake/Vote -> Bet, Reward -> odds of wining. |
This is one of the issues that "1. Node registration" should address. In Ethereum this was solved by requiring a minimum amount of operators to stake first. Without this minimum amount of operators
Perhaps with a rate limit. Its okay to get some messages via waku sync (eg if you are offline for some time) but it shouldn't be possible to purely rely on waku sync. Another option (largely vague) is to mix service incentivization here. Meaning store sync will only work if you pay a small fee (see service incentivization).
No majority can happen in two scenarios: i) nodes strongly disagreeing in the root or ii) a bunch of nodes not voting. For ii) we can heavily penalize that since that hinders consensus. For i) tbh to be defined.
I would say penalizing here mitigates the ii) from the previous point. |
Looks good to me. Very exciting. Yes, there are some unknown and risks. Let's do the work so we can confirm viability (or not) of such a protocol. One potential issue is ephemeral messages. They should probably be discarded from the Merkle tree as it is not possible to use store/store sync to double check none were missed Few thoughts regarding gaming this by relying on store sync:
|
I like the overall approach as it resembles very closely of the pattern that is being used in previous project that i worked on. Few observations.
Wondering if pro-rating of rewards would be requried as node operators can join the network at any point in time.
Since in relay network message ordering is not gauranteed, how would this merkle tree look like as the root would keep changing based on order of insertion. Instead of a merkle tree, could we instead use sync state datastructure which is used by RBSR (as it is resilient to ordering)
this essentially means total votes to be considered for counting and majority would change per |
We could not use the hash of the actual message for sync and instead use a different hash that is not used by the consensus mechanism. |
Good catch. Yep, they should be discarded from the Merkle tree.
Will check, interesting.
Haven't thought much about it, but most likely yes. I'm afraid though this calculations may consume too much gas. Ideally billing periods should go together with the
I was thinking about ordering the leafs according to some criteria. Eg by timestamp and by hash (alphabetically). In that case the order would be deterministic and the root as well. You may receive an out of order message that you can insert in between wherever is its place. Does the datastructure you are referring to contain some kind of representation of all the content (eg like merkle root)?
Yep. New operators can be added (+) or operators can be slashed (-) or leave (-). Slightly related, Ethereum has a queue mechanism so that even if you have lots of capital to deploy (spawn new operators) you can't do it instantly. You have to wait an entry (and exit) queue. Its a protection. |
That's basically what Prolly trees are. |
I have been giving it more thought on fee distribution to operators and the approach we are thinking of above. Dropping some more thoughts here, not sure if we need to have solution to start with or some of these should be thought at a later stage but writing them anyway. Waku's aim is to build a p2p network where users and operators can operate in adversarial conditions (different than other p2p networks like ETH where currently they are currently designed for ideal conditions i.e node always online, not censorship resistent etc). This means that the conditions are not ideal either for users or node operators(i.e network maybe always available but nodes may not be due to various reasons which means it may not be able to function at 100% all the time). By designing a reward system for operators who validate and relay all the messages that pass through the network, we are expecting all operators to be available 100% of the time relaying messages. Should we consider an approach where operators are rewarded based on percentage of messages they were able to relay? I am not saying we should reward even if someone relays only 1% of messages, but rather than expecting 100% relaying should we look at some approach where incentives are given in other manner. Again this goes against my point above, because by incentivizing in this model we may be pushing operators towards utilizing a more centralized infra. Alternatively how about a mechanism which randomly verifies if an operator is validating and relaying messages? Maybe similar to a mechanism which filecoin network uses for Proof-of-SpaceTime. In Proof-of-SpaceTime, random checks are done for parts of data that are expected to be stored at frequent intervals which prove that data is still being stored rather than checking for all the data that is stored all the time. |
Thanks for the issue write-up! I think your "open problems" summarise what our next research focus should be. In particular, a potential no-go would be if we can't find an elegant solution for:
A node wouldn't even need to use Sync to be able to track the Merkle root without actually contributing - you could simply run as a relay "sink" (with a few in connections and no out) without actually relaying messages or providing other services. I like the direction that @chaitanyaprem suggests - random checks to verify that a node is actually contributing to the network. It may help here to consider Sync as an integral part of the routing fabric of the network. In other words, we may expect operators participating in the fee rewards to run the trifecta of RLN + Relay + Sync - at the very least they would have to respond to Sync requests (as it may be difficult to "prove" that a node is actually relaying and not just storing messages).
Presumably, if we consider Sync an essential element here, we could expect of nodes to know about all messages. Perhaps a random check to show that expected messages are stored combined with a Merkle proof? |
Note that eth is designed for very adversarial environments and nodes are not expected to be online. The incentives make them stay online, but the network can handle eg 50% nodes offline. Some non-finality period will start and penalties will kick out nodes that are not attesting.
Good point. I would say its not 100% whats required, since you can be 90% up and get what you are missing via store sync (eg restart for an update). But I get the point.
I'm open for this, but not sure how it can be technically done. How can you prove that you have relayed "some" messages? I think hopr has something related to this, proof of relay.
The random checks idea is interesting, will explore.
Aren't we protected with gossipsub scoring from this?
Sounds interesting. Any idea on which challenge to randomly run? imho the hard thing here is that if the challenge implies "being right on something" that's tricky, since we don't have consensus, hence its not possible to verify it correct. |
right, doesn't that mean validators are expected to be always online i.e 100%?
proof of relay was interesting read, Thanks! Instead, since gossipsub already has very detailed scoring mechanism that penalizes nodes for non-effective participation when they are online, i was wondering if we can somehow leverage that. Will think more on this problem though, this is just an initial thought. Maybe this somehow can also be added to the node's reputation apart from service protocol specific reputation? wdyt @s-tikhomirov |
From what I understand, HOPR is similar to Lightning in that it uses onion routing and hashlocks to make payment conditional on delivery of data. AFAIU, this scheme is suitable for a point-to-point communication, where first a path is established, and then the message is onion-encrypted using public keys of nodes along the path. Our use case, in contrast, has a broadcast communication pattern, therefore I'm not sure proof-of-relay is well-suited here. I'd be happy to be proven wrong of course. I've also been preparing a more detailed reply to this discussion, will post it as a separate message. |
No design in my head, but if we can reach some consensus on the message hash root for a superepoch (using your proposal), I guess a node could potentially be challenged to prove that they're storing random messages in this superepoch with a Merkle proof to the (consensus) root.
True. I misstated a problem we had with Relay "leeches" earlier - nodes that are not publicly reachable and only make a few outgoing Relay connections (the number of which they control). They observe gossipsub rules on these connections, but essentially provide nothing to the network since they only consume connections. In other words, they don't enrich overall connectivity by being discoverable and allowing incoming connections. Hence my entertaining the idea of combining this with at least some verification that the nodes provide a public service that contributes to the routing infrastructure (i.e. Sync in this case). This ties into another difficulty: the overall aim of a resilient relay infrastructure is to disperse the infrastructure as much as possible and increase the number of node operators. Everyone participating in a reward sharing scheme, however, is in essence incentivised to keep the topology as constrained as possible (fewer nodes = more reward). It is possible, as explained above, to be a perfectly good gossipsub node, but artificially limit the connectivity in the network to keep new operators from joining. |
I see. This addendum can fix the "lazy operator" issue, and moreover it prevents people from relying and not storing the messages. But this overlaps relay and store protocols. I mean, this proposal aimed to incentivize relay, not store. So not sure if we are mixing things? Or well, maybe relay and store can go together? As a side note, another problem is how to act upon the challenge. NodeA challenges NodeB. Is the challenge result stored onchain? (probably not since that will consume to much resources). Or this information affects gossipsub scoring? |
I think there is more nuance here. As a node, I prefer to have a larger node set as that increases the size of the pie of rewards. However, I want these nodes to be poorly connected, not to be able to vote for the "correct" merkle root and claim rewards. Some ideas and comments:
|
@mart1n-xyz Thanks for the comments!
afaik that's not the case. More node operators in thenetwork imply less rewards for each one. Rewards come from users registering RLN memberships which are a different actor than node operators.
It can be actually thought as the same tree, but going But not sure that the complexity is justified. What's the intention behind? To allow late joiners to participate? This could be fixed with a smaller superepoch size, so that if you miss some part of it, it's not a lot (eg few minutes). And well, store sync also allows late joiners to sync up. I may have to reconsider the superepoch size, because that's how frequently nodes reach consensus on the root. Right now the epoch is 10 minutes, so a superepoch will be for sure greater than that. And that may be too high.
Indeed. This is very important to for "1. Node registration" and maybe can be reused for other stuff. |
Indeed. Well, I would say it overlaps Relay and Sync, which seems to reflect the model in which routing can in fact take place via either relay or sync. To me it seems Sync may be a required component in any case for nodes to have a reasonable chance to reach consensus on the Merkle root. That said, I would lean towards a Relay-only solution, but I'm not sure how solvable the lazy node and anti-connectivity problems are if we don't consider Relay and Sync as an integrated routing protocol. Or, at least, this is a possible solution that may give us more angles from which to approach the problem. |
@alrevuelta Thanks for explaining. Makes sense, merkle trees are not my forte :)
To allow nodes launching within an superepoch to get partial rewards if they are not able to derive the merkle root for the complete set of messages but can prove a subset. |
I started writing down my thoughts on this issue, and while the result may sound a bit theoretical, I hope it will be helpful. FundamentalsIn the big picture, what are we aiming to achieve? We want the network to function effectively. We need to incentivize nodes to act in the best interest of the network. At the same time, we want rewards to be distributed fairly. MetricsIt's important to clearly define the terms we're using. I find it helpful to think in terms of metrics. Ideal Global MetricImagine we could measure anything in the Waku network. What global metric would we aim for? What do we mean by "functioning effectively"? In simple terms, a functioning network means messages are propagated quickly and reliably. This implies several independent metrics:
For example, consider using "infection" terminology: nodes that receive a new message are "infected." There could be a trade-off between:
Which option is preferable? Question: What global metric should we optimize? Local BehaviorThe network consists of independent nodes whose behavior we want to incentivize. We need to determine what local behaviors contribute to optimizing our global metric. Informally, for a node to maximize message propagation, it should:
This behavior needs a formal definition, as informal rules can be exploited. For example, if we define ideal behavior as "forward messages to as many peers as possible," forwarding to already "infected" peers may not help overall propagation. Question: What local behavior optimizes the global metric? Local MetricWe should define a local metric as a proxy for the desired local behavior. This metric must be measurable and ideally provable. The best metric would ensure that the only way for a node to score well is by honestly performing the desired behavior. Question: What local metric best reflects the ideal local behavior? Measuring the Local MetricFinally, we need to figure out how to measure the chosen local metric. If nodes are motivated to increase their score, self-reporting could be unreliable. However, some metrics are only known to the nodes involved (e.g., how many messages they actually relayed). Question: How do we reliably measure the local metric in practice? Root Voting Proposal in the Context of This FrameworkBased on the framework above, the proposal under discussion seems to be as follows:
Key assumptions:
We need to examine each assumption to determine how often they hold true. Assumptions rarely hold in every case, so the question is whether they hold often enough for our purposes. Other ConsiderationsA few additional points worth exploring: Incentives for (De)centralizationHow important is it to incentivize decentralization? Maximizing performance metrics might favor large, centralized nodes in data centers over smaller, home-run nodes. Do we want to encourage not only performance but also decentralization? Time Signal and Superepoch BoundariesThe proposal assumes that each message belongs to a single superepoch. Without full consensus, issues could arise if a message is issued exactly at the boundary between epochs, leading to disagreement on which epoch it belongs to and, consequently, on the correct root hash. Disagreement on the Root HashWhat happens if no candidate root hash secures a supermajority? What should be the protocol in such cases? Thoughts on ConsensusThis section may be somewhat abstract, but I think it's important to mention. I’m still unclear on the relationship between Waku and consensus. On the one hand, Waku is part of the blockchain ecosystem, where consensus is crucial for ensuring correctness across transactions. In financial systems, users want to ensure no double-spending occurs, requiring a global awareness of all transactions. This leads to the creation of consensus algorithms like PoW or PoS, with strong guarantees. In contrast, consensus may not be as critical in a messaging network like Waku, where users generally care only about messages sent to them. While synchronization protocols are important, they may not need the same level of finality guarantees as blockchains. However, by introducing financial incentives, we invite potential exploitation. In blockchains, consensus algorithms prevent cheating around rewards to a large extent (although even then things like selfish mining do exist), but Waku lacks such a robust consensus mechanism. Specifically, the root-hash-based proposal assumes a globally agreed-upon correct root hash without a full consensus mechanism to enforce it. My concern is that attackers may find ways to game the system by exploiting differences between Waku and consensus-based protocols. ConclusionThis all boils down to two key points:
|
@s-tikhomirov Thanks for the comments. To clarify, imho the waku protocol has different behaviors to incentivize, but not all of them are archived via this root voting suggestion. I see two layers of incentives:
I would say this is too low level for the "high-level crypto incentives". This kind of belongs to the gossipsub domain and not exactly, but already dealt with gossipsub scoring.
1 yes. 2 yes, assuming 2/3 are honest. 3 not really, but thinking about a challenge proposed in other comments (eg lazy node using store sync building tree and discarding the messages). 4 maybe not, but there are other ways to ensure messages are relayed. 5 yes, but there is more than that.
It depends on where you set the threshold. If I reward anyone that solves 2+2 and give 5 seconds I'm not favoring anyone, since that's a commodity. Anyone can solve that no matter their resources. The result from supercomputer is worth the same as the one from a RaspPi.
Edge cases should be dealt with deterministically in the implementation but I would say that's not a problem. RLN binds messages to an epoch. And superepochs are just
It's one of the open problems. Will update it once I have more. The challenge here is solving it simply. An option could be to allow a second round, where nodes are expected to use store sync under the hood to try to reach consensus. Not simple though.
I see consensus as important because of two things:
I see this root proposal as more generic than that. The low-level metrics you are referring to can be (and some already are) placed in gossipsub scoring. This proposal just tries to map that scoring to something onchain that we can use to reward operators. I see the root voting as some kind of high-level-summary.
No plan to have a fully-fledged consensus. For that, we have smart contracts with an underlying blockchain infrastructure providing that. imho we need some kind of consensus for messages as a prerequisite for incentives, that ideally can be simple. |
Thanks for the reply @alrevuelta !
Sure, but IMO the interesting question is how to ensure that the inverse statement holds. In other words: one should not be able to claim rewards without doing OK at the lower level (i.e., without actually relaying messages).
By the way, where does the 2/3 number come from? I know it is a common security assumption of BFT and PoS protocols, but as long as we have neither of those, do we have to use 2/3 too? Perhaps we could set the limit to, say, 90%, and that would discourage some splitting attacks? (Again, subject to further investigation if we decide to go along this route.)
Not disagreeing with you here, but in my view the key question is "can we afford consensus", not "would it be nice to have it". Of course it would be nice, but to implement consensus properly, blockchain protocol designers are spending lots of R&D effort + considerable resource commitment is required from protocol participants (hashing in PoW, locked-up capital in PoS). My feeling is that such things would be an overkill for a message relay network. We can, however, look for a clever way to piggy-back on existing consensus like we do with the RLN contract already.
I now realize that this part wasn't clear to me. Do we assume, among other things, that gossipsub score reflects the node's network participation, and that attackers won't fake their scores (perhaps using multiple colluding nodes that rank each other highly without relaying the messages)?
By fully-fledged consensus I mean consensus for messages with strong security guarantees (what alse can the consensus be for)? I agree though that we should leverage existing blockchain infrastructure as much as possible. |
Totally agree. This is the line of work behind "lazy operator". Largely undefined by now.
Open to discussing it. Took it from PoS like systems but ofc tunable.
I would say this question will be answered as the outcome of these discussions. I'm pushing towards having it, since I think its important, but we may have to accept that it is overkill for waku.
Open to ideas here. Can you be more specific? Not sure I see any consensus in RLN. I mean everyone that paid X and called
Note that gossipsub reputation is local to each node, based on what it sees from interacting with other nodes. Meaning that node_a can have different reputation values in different nodes. Not sure how an attacker can fake it score, because the score is something a node sets based on what it sees (performance). |
No concrete ideas yet, just a general thought that blockchain consensus i.e. smart contract provides us with a source of truth (just like the RLN contract is the source of truth about who has the right to relay messages).
Sure, I understand that. But I'm not sure I understand how gossipsub scores are used in this proposal. Do we only allow nodes with score higher than X (as reported by... whom?) to vote on the root hash? |
I mean, if your node forwards invalid messages (according to our gossipsub validation) or eg you don't send messages to any peers (just receive them) this will lower your score to a point where no nodes would want to connect to you. If this happens, no peers = no messages = no valid merkle root.
Anyone can vote on the root hash as long as you have posted some collateral. The right to vote is not connected to gossipsub scoring. |
Thanks everyone for the feedback. As part of the conversations, the following challenges were spotted:
Proposing a solution for each. Dealing with lazy nodesProblem:
Solution:
The whole proposal for distributing RLN fees works under the assumtion that knowing the root implies participating in relay, which is the behaviour we want to incentivize. There are two variants of lazy nodes:
To solve this problem we introduce a limit on the messages that store-sync serves. It shall serve messages up to On the other hand, we introduce a challenge. Its result is included in the gossipsub scoring. More particularly, in the The This challenge is done periodically by every peer with its connected peers, verifying that they know the content of a message given its hash for this The challenge:
Since it's in the best interest of every node to keep the network clean of lazy peers, all nodes will report each other and lazy peers will end up without peers to connect to. The cost of this solution is:
Lack of supermajorityProblem:
Solution:
The initial proposal didn't take into account the posibility of nodes not reaching consensus during a voting round.
With an example.
While no single root gets more that Note that as an implementation decission, when no consensus is reached in the first round, nodes can be more proactive
This should reduce the probabilities of a network partition and the node missing messages. Some reasons why the network may not reach consensus:
Consensus windowProblem:
Solution:
The initial proposal wanted to introduce the concept of In order to reach consensus more often, the Other Open Questions
|
Thank you for this thorough analysis and systematically addressing concerns! I have two parts to my response below. One part is to ask some clarifications on your proposed solutions to the open problems, the second is to summarise some further open questions that I think we should consider. I'll try to be as structured as possible. 😅 First, a couple of questions on your proposed solutions:
Is this necessarily a bad thing from network behaviour POV? If a node uses only store sync it would still help distribute messages and could in theory participate in services such as filter/store. From the node's POV this would seem a bit silly as RLN Relay would be a cheaper way of tracking the root than relying on store sync.
Store Sync is designed to improve "real-time" message routing reliability over a time window longer than what gossipsub caches can provide. Since real-time delivery has some jitter, we do already introduce a short delay before messages form part of the sync range. For this proposed mechanism to work, though, I assume we would have to delay with at least one
IIUC this means that every participating node would have to commit a root for every I'll add my more general questions in a next comment. |
I structure this under three meta questions that's less about technical feasibility than about what our long-term vision of Waku should be. Certainly open for discussion here, as Waku's definition and role as infrastructure in the p2p world is up to all of us. These questions are mostly just summaries of what has been discussed before, but I thought it important to gather my thoughts a bit more systematically. I apologise for the length. 😄 Happy to discuss in person or clarify any points. TL;DR
1. Do we really want strong consensus in Waku?I guess this question covers two points: whether we need on-chain consensus and whether we can afford it. Thus far we've considered the low-latency and ephemeral quality of messaging in Waku as one of our strongest draws - Waku is useful for the type of decentralised signalling use cases that are kept off-chain precisely because it tends to be incompatible with the restrictions of on-chain consensus. Consensus is expensive, at least in terms of complexity and overhead, and the long-term benefits of consensus to Waku as infrastructure not entirely clear to me. Some possible benefits that consensus may bring (other than RLN fee distribution) and a brief thought about each:
2. Do we really need RLN fee distribution?I think after these analyses we may be in a better position to ask and answer the meta questions again:
3. What are we really incentivising?This model assumes that we want to only incentivise node participation in RLN Relay. Perhaps we also want to incentivise selfless participation in RLN Relay - that is, we should encourage nodes to become richly connected for the network to become as diverse and dispersed as possible. It seems to me that nodes will be incentivised to keep the topology as centralised and small as possible. They could limit their connections to absolute minimum to still track the root, refuse new nodes, etc. - there seems to be no mechanism that would prevent this IIUC? GossipSub's tit-for-tat mechanism does a great job of encouraging nodes to be useful while benefitting off the network themselves. A reward distribution would incentivise nodes to try and break this mechanism. |
Similar to @jm-clius comments:
|
@jm-clius Thanks! Answers to the first comment: Clarifications to the proposal.
I thought about that while writing the proposal. Good point, maybe it's okay that store-sync nodes can vote for the root. And would simplify the solution because it simplifies the threat model, since these nodes are allowed. No need also to have this
It indeed reduces the real-time value of store-sync. But re: previous point maybe we don't need to add this artificial delay if we are ok with pure store-sync nodes voting for the root. So no real-time limitations then.
Yes. I don't have the gas estimate. It won't be crazy high, but the commit-reveal-claim involves at least 3? (I would say rather cheap) transactions. Regarding the numbers, I would approach it from a different angle. Instead of starting with eg $8000 splitting the cost top-down to what the operator will get, I would do it bottom-up. Meaning starting with the expected gas cost, expected infra cost, expected tx per month, add a % and come up with the expected membership cost to make it sustainable. Will it be prohibitive? Don't have the answer but indeed I need to provide an estimation on the cost of gas for this. |
@jm-clius Answers to the comment: Technical feasibility.
You have done a well summary on what consensus can bring, i) rln fee distribution aka incentives for nodes, ii) the ability to prove a wide variety of things (distribution and provision). I would say we do need it, because of what it unlocks. However, the cost of it may outweigh the benefits and make it non-viable.
I see this question very coupled with the "do we need consensus?".
And re:
Agree on this but how to know what's "good" without consensus? And how to have consensus without some incentives? So IMHO consensus unlocks incentives and vice-versa. And then this unlocks service incentivization because you can prove everything and know whats "good". By now, RLN fee distribution is the best candidate, since its the only entry point of $ into the system.
Not sure I agree with this statement.
Any node (registered operator or not) can introduce a message into the network. And you don't know who is that. If you keep yourself connected to a few nodes, you increase the probability of missing a message, and hence not getting the valid root that will get you rewarded. I would say what we are incentivizing here is that you i) follow the root and ii) know whats underneath the root (leafs + content) with the challenge. By doing so, we ensure that nodes are up to date, get rewarded for that, and reach consensus unlocking proving anything. Whether Waku can afford this extra complexity and cost, still not sure myself. |
A relatively minor idea regarding this:
We can implement the challenge-response protocol in such a way that doesn't involve transferring the whole message, for example like this (
The second step only requires transfering one hash instead of one message. |
TLDR: Proposal on how to distribute RLN membership fees to the node operators that submit the correct Merkle root
of the messages sent during a
superepoch
.Problem statement
Waku has chosen Rate Limiting Nullifiers to rate-limit users, ensuring they do a fair usage of the network resources.
In order to do so, it requires users to pay for the so-called RLN membership, which entitles the holder to send a given
amount of messages per unit of time while its active.
However at the time of writting, the collected fees from RLN memberships don't have a designated purpose.
In order to ensure the sustainability of the network and reward node operators for their work, one option would be
to distribute them among node operators.
We define node operators as entities that participate in the network, running nodes and relaying traffic. They are
the ones that make the network work. A node operator is also a registered entity known by the waku protocol,
see more information below.
This issue proposes how to distribute the generated rewards by RLN memberships to node operadors. It does so by
rewarding the node operators that vote on the correct Merkle root for each
superepoch
. The root agreed by a 2/3supermajority is considered the corerct one, and the nodes that voted on that get a reward.
This reward is a fraction of the fees that were generated from membership registration during that
superepoch
.Since gossipsub scoring punishes lazy peers and incentivices peers to behave properly, we assume that knowing the valid
Merkle root implies having participated in relay protocol, which is the behaviour we want to incentivice.
Proposal
This proposal introduces the following concepts:
superepoch
that matches the RLN membership renovation cycle.superepoch
.superepoch
each operator can submit their local Merkle root of the Merkle tree containing all messages,using a commit-reveal mechanisim to prevent lazy nodes from copying honest ones.
superepoch
, and every node is given/n
the rewards from the subscription fees of that
superepoch
, wheren
is the amount of nodes that matched the majority.Below, each point is ellaborated.
1. Node registration
Since anyone would be able to submit a vote on the Merkle root, we need some kind of pseudo-identity to sybil-protect the voting.
Otherwise the same entity knowing a valid Merkle root, defined as the one that represent a Merkle tree constructed by all messages within a
superepoch
could vote multiple times, getting more rewards than it should.
A suggested mechanisim is to require a
STAKE_AMOUNT
for node operators, which provides an economic sybil-protection.When an operator stakes this amount, it becomes eligible to participate in the voting and hence, eligible for rewards.
When the operator no longer wants to participate, it will be returned.
The stake can be slashed if they dont vote in
SUPEREPOCHS_PENALTY
consecutivesuperepochs
.Its yet to be defined if there would be other slashing conditions.
2. Superepoch
A
superepoch
is the time window used for voting. During eachsuperepoch
nodes construct a Merkle tree with all seen messagesand once finished, the Merkle root is calculated.
The
superepoch
matches the "billing period", see comment.In other words, if 10 users paid an RLN membership for a given
superepoch
then all this generated fees are distributesamong the nodes operators that participated in this
superepoch
.3. Messages Merkle Tree
For each
superepoch
node operators construct a Merkle tree with all the messages they have:Otherwise its score would be penalized.
A protection shall be added to discard "lazy nodes", meaning that they don't participate in relay but manage to get a valid Merkle root.
4. Commit-reveal
Since all onchain activity is public and anyone can see it, we propose a commit-reveal mechanisim to prevent lazy nodes
from sniffing the blockchain and copying the Merkle root of honest nodes.
Once the
superepoch
finishes, a window ofCOMMIT_WINDOW_SLOTS
opens, during which all registered nodes cansubmit their vote on which
root
they consider to be valid for thatsuperepoch
. What the node operators commits to (aka commitment)is a secret, in this case the
root
. The commitment ishash(root + salt)
. That would be public but since getting the preimageof that hash is not possible, an attacker won't be able to reveal in the next phase.
Once the
COMMIT_WINDOW_SLOTS
is due, no more votes are accepted for that superepoch and aREVEAL_WINDOW_SLOTS
window is opened.During this window node operators can reveal their secret. If the provided
root
during the reveal phase matcheshash(root + salt)
, then theirvote would be accepted.
Finally, once
REVEAL_WINDOW_SLOTS
is due eligible node operators can claim their share of the reward. See next section.5. Claim
After
REVEAL_WINDOW_SLOTS
the commit-reveal phase is done and votes are counted. An example:node0..4
(5) voted on rootroot1
.node5..24
(20) voted on rootroot2
.node25
(1) voted on rootroot3
.note26..30
(4) did not vote.As explained before, node operators are registered beforehand in the contract a priori so the total amount of votes are known.
The previous votes can be written as
[num_votes, root_n]
or[5, root1], [20, root2], [1, root3], [4, NaN]
.With the votes, a simple 2/3 consensus of a supermajority of 66% is used to decide which root to accept.
The weights would be:
root1
5/30 = 16%
root2
20/30 = 66%
root3
1/30 = 3%
This means that
root2
is accepted onchain as the Merkle root of all the messages seen during thesuperepoch
.Nodes that voted for that root are eligible for rewards.
The amount to be distributed is calculated as the amount of memberships
*
price paid for each membership for eachsuperepoch
.If 100 active memberships were active and each one paid 10 tokens/superepoch, then the amount to spit is:
100 * 10 = 1000 tokens
.Membership fees would be split among the nodes that voted the agreed root, aka
root2
meaning,1000/20 = 50
tokens fornode5..24
.Note that a node operator that does not vote during
SUPEREPOCHS_PENALTY
can be slashed by anyone, as this information is accesible onchainby anyone. The whistleblower will get
WHISTEBLOWER_REWARD
which is<=STAKE_REQUIREMENT
and the node will no longer be part of theactive node operators.
In order to make it gas efficient, each node operators rewards can be claimed at any time.
For each
superepoch
the claimable amount keep accumulating, so that the operator can claim their rewards of multiplesuperepochs
at once.Consensus
An interesting side effect of this proposal is that it introduces an onchain consensus of the messages sent for each
superepoch
.This would allow light clients (eg filter) to verify that a given message was indeed sent through the network, since the onchain root
can be used.
Open problems
This proposal has some open problems:
They should not be eligible for rewards.
STAKE_AMOUNT
for multiple node operators.This will allow it to vote multiple times but its only doing the work of one node.
The text was updated successfully, but these errors were encountered: