RelayMiner Reward Accumulation

tl;dr


Background on Optimistic Relay Accumulation

RelayMiner's accumulate relay rewards before the relay is forwarded to the backend.

This optimistic approach:

  • Counts the relay immediately

  • Enables in-process rate-limiting (no extra network calls)

  • Protects suppliers against over-servicing flood attacks

Managing 5xx Rewards

1

Before forwarding

Before a relay is forwarded to the backend, the relay miner accumulates the reward.

2

Backend returns 5xx

If the backend replies with a 5xx status, the relay miner immediately reverts the reward.

3

Backend returns 2xx/3xx

If the backend replies with a 2xx or 3xx status, the relay miner keeps the reward.

4

Result

This ensures that suppliers are not paid for failed relays, while rate-limiting remains effective against burst traffic.


Rate Limiting with Optimistic Accumulation

The following diagram shows the optimistic accumulation of rewards:

Backend ServiceRelay MinerApplicationBackend ServiceRelay MinerApplicationAccumulate reward (optimistic)Accumulate reward (optimistic)Rate limit reached → rejectRelayForward RelayRelayForward RelayRelay

Pessimistic Reversal of 5xx Rewards

The following diagram shows the pessimistic reversal of rewards for 5xx responses:

Relay Path

< 500

≥ 500

Receive relay request

Accumulate reward

+ rate-limit check

Forward to backend

HTTP status

Mark relay successful

Return response to client

Revert reward

Return 5xx to client


Reference GitHub Issue

This page was put together as a result of the discussion in pokt-network/poktroll#1315.

Was this helpful?