Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b8cdd33
integrate reputation manager into Lightpush behind a feature flag
s-tikhomirov Feb 26, 2025
6449840
use PeerId properly for reputation tests
s-tikhomirov Feb 26, 2025
ef67d54
add optional reputation manager to Lightpush client initialization
s-tikhomirov Feb 27, 2025
7f7594a
refactor lightpush client
s-tikhomirov Feb 27, 2025
9c23579
add tests for Lightpush reputation
s-tikhomirov Feb 28, 2025
b2ef56f
better naming
s-tikhomirov Feb 28, 2025
436751b
add test for Lightpush peer selection with reputation
s-tikhomirov Feb 28, 2025
b50fd48
fix linter warning
s-tikhomirov Feb 28, 2025
d8ba7b7
replace compile reputation flag with config flag
s-tikhomirov Mar 5, 2025
350929c
set reputationEnabled to false by default in config
s-tikhomirov Mar 6, 2025
f60bd31
initialize ReputationManager inside new()
s-tikhomirov Mar 6, 2025
5edfdfa
Merge branch 'feat/incentivization-poc-lightpush-integration-reputati…
s-tikhomirov Mar 11, 2025
ebae717
fix incorrect merge in test file
s-tikhomirov Mar 11, 2025
0446dba
fix merge for lightpush client tests
s-tikhomirov Mar 11, 2025
236abfa
adjust reputation depending on lightpush response
s-tikhomirov Mar 11, 2025
0b1f189
minor refactor
s-tikhomirov Mar 11, 2025
df66fcd
adapt reputation tests to Lightpush v3 response type
s-tikhomirov Mar 11, 2025
b1d646c
feat: introduce reputation in PeerManager (#3322)
s-tikhomirov Mar 14, 2025
ebf11dc
Merge branch 'master' into feat/service-incentivization-poc
s-tikhomirov Apr 1, 2025
b26606c
add EligibilityStatusCode type
s-tikhomirov Apr 3, 2025
49b918b
encode and decode optional eligibilityProof in LightpushRequest
s-tikhomirov Apr 3, 2025
c4cb412
add eligibilityEnabled config flag
s-tikhomirov Apr 3, 2025
49c8f54
chore: fix lint, add todos
s-tikhomirov Apr 4, 2025
0e741ca
chore: remove unnecessary comment
s-tikhomirov Apr 14, 2025
0d00fb8
add JSON support for eligibility proof in Lightpush REST API
s-tikhomirov May 21, 2025
f773d5e
[WIP] pass eligibilityProof from REST API to protocol
s-tikhomirov May 23, 2025
3485691
Merge remote-tracking branch 'origin/master' into feat/service-incent…
s-tikhomirov May 23, 2025
ec363fd
minor fix
s-tikhomirov Jun 3, 2025
5d3af6d
[WIP] eligibility check with hard-coded parameters
s-tikhomirov Jun 5, 2025
1e1d89e
pass eligibilityEnabled as config parameter
s-tikhomirov Jun 22, 2025
3cd3e58
[WIP] initialize EligibilityManager properly
s-tikhomirov Jun 25, 2025
2a6e3c9
refactor: store expected amount and address in EligibilityManager
s-tikhomirov Jun 25, 2025
d20f64f
[WIP] pass eligibility proof to the service node (check still required)(
s-tikhomirov Jun 26, 2025
5e038f6
add eligibility check in Lightpush protocol
s-tikhomirov Jun 26, 2025
bdd2ed5
propagate reputation-enabled config from CLI, init ReputationManager
s-tikhomirov Jul 8, 2025
14698bd
handle empty pre-selected peers case due to bad reputation
s-tikhomirov Jul 9, 2025
4a0de2f
add NeutralReponse option that doesn't affect server's reputation
s-tikhomirov Jul 9, 2025
2c9e801
randomize peer selection from peerstore
s-tikhomirov Jul 9, 2025
e07438d
minor refactor for DRY
s-tikhomirov Jul 10, 2025
921e651
Merge branch 'master' into feat/service-incentivization-poc
s-tikhomirov Jul 10, 2025
e0edb71
fix merge issues
s-tikhomirov Jul 10, 2025
4e8de55
use new Lightpush status type in reputation tests
s-tikhomirov Jul 15, 2025
fcdf674
restore things mistakenly removed during merge
s-tikhomirov Jul 15, 2025
0edacb9
Merge branch 'master' of github.com:waku-org/nwaku into feat/service-…
s-tikhomirov Jul 15, 2025
9b8b5b3
add i13n PoC testing instructions
s-tikhomirov Jul 15, 2025
7fa3c4b
use config files for i13n-poc nodes
s-tikhomirov Jul 18, 2025
366d96d
use env var file; edit setup instuctions
s-tikhomirov Jul 25, 2025
e3bfdac
chore: minor edits in config files
s-tikhomirov Jul 28, 2025
b0488ff
fix: only mark txid as seen if response is successful
s-tikhomirov Jul 28, 2025
c29cae1
edit PoC instructions for clarity
s-tikhomirov Jul 28, 2025
bb7eac8
edit testing scenario instructions for clarity
s-tikhomirov Jul 28, 2025
ee6fa04
add spoilers for testing scenario
s-tikhomirov Jul 30, 2025
ac64a1b
replace default password in i13n PoC envvars
s-tikhomirov Aug 1, 2025
ef4ec24
minor edits in PoC readme
s-tikhomirov Aug 1, 2025
bc73b71
minor refactor, remove unnecessary log lines
s-tikhomirov Aug 1, 2025
23dd47d
add comment on INVALID_MESSAGE handling w.r.t reputation
s-tikhomirov Aug 1, 2025
1abe4f2
add reputation to REST API endpoints
s-tikhomirov Aug 7, 2025
abb0182
check reputation with REST API instead of logs
s-tikhomirov Aug 7, 2025
dbefff0
fix: remove extra ticks
s-tikhomirov Aug 7, 2025
743e889
fixes in i13n readme
s-tikhomirov Aug 7, 2025
2077220
use silent curl in examples for brevity
s-tikhomirov Aug 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
543 changes: 543 additions & 0 deletions README-I13N-POC.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ The nwaku repository implements Waku, and provides tools related to it.
- Examples of Waku usage.
- Various tests of above.

For more details see the [source code](waku/README.md)
For more details see the [source code](waku/README.md).

For information on Service Incentivization (i13n) PoC, see [README-I13N-POC.md](README-I13N-POC.md).

## How to Build & Run ( Linux, MacOS & WSL )

Expand Down
4 changes: 4 additions & 0 deletions i13n-poc-configs/envvars.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export ELIGIBILITY_ETH_CLIENT_ADDRESS="https://rpc.sepolia.linea.build/"
export RLN_RELAY_ETH_CLIENT_ADDRESS="https://rpc.sepolia.linea.build/"
export RLN_RELAY_CRED_PATH="../nwaku-compose/keystore/keystore.json"
export RLN_RELAY_CRED_PASSWORD="<INSERT_YOUR_RLN_RELAY_CRED_PASSWORD>"
8 changes: 8 additions & 0 deletions i13n-poc-configs/run_alice.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Load env vars
source ./i13n-poc-configs/envvars.env

# Run nwaku
./build/wakunode2 \
--config-file=./i13n-poc-configs/toml/alice.toml
12 changes: 12 additions & 0 deletions i13n-poc-configs/run_bob.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Load env vars
source ./i13n-poc-configs/envvars.env

# Run nwaku
./build/wakunode2 \
--config-file=./i13n-poc-configs/toml/bob.toml \
--rln-relay-eth-client-address=$RLN_RELAY_ETH_CLIENT_ADDRESS \
--rln-relay-cred-path=$RLN_RELAY_CRED_PATH \
--rln-relay-cred-password=$RLN_RELAY_CRED_PASSWORD \
--eligibility-eth-client-address=$ELIGIBILITY_ETH_CLIENT_ADDRESS
12 changes: 12 additions & 0 deletions i13n-poc-configs/run_charlie.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Load env vars
source ./i13n-poc-configs/envvars.env

# Run nwaku
./build/wakunode2 \
--config-file=./i13n-poc-configs/toml/charlie.toml \
--rln-relay-eth-client-address=$RLN_RELAY_ETH_CLIENT_ADDRESS \
--rln-relay-cred-path=$RLN_RELAY_CRED_PATH \
--rln-relay-cred-password=$RLN_RELAY_CRED_PASSWORD \
--eligibility-eth-client-address=$ELIGIBILITY_ETH_CLIENT_ADDRESS
9 changes: 9 additions & 0 deletions i13n-poc-configs/run_dave.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Load env vars
source ./i13n-poc-configs/envvars.env

# Run nwaku
./build/wakunode2 \
--config-file=./i13n-poc-configs/toml/dave.toml \
--rln-relay-eth-client-address=$RLN_RELAY_ETH_CLIENT_ADDRESS
41 changes: 41 additions & 0 deletions i13n-poc-configs/toml/alice.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Incentivization PoC: Alice

# Alice is a client node that wants to publish messages
# without being connected to Relay.

# Disable Lightpush
lightpush = false

# Use a pre-generated static node key for reproducibility
nodekey = "17950ef7510db19197ec0e3d34b41c0ed60bb7a0a619aa504eb6689c85ca9925"

# Connect to Charlie only on launch
# (Alice will connect to Bob via REST API later)
staticnode = [ "/ip4/127.0.0.1/tcp/60003/p2p/16Uiu2HAkyxHKziUQghTarGhBSFn8GcVapDgkJjMFTUVCCfEuyzSd" ]

# Connect to The Waku Network (TWN)
# (must come before we override relay and discovery to false)
preset = "twn"

# Disable Relay and RLN-Relay
relay = false
rln-relay = false

# Disable discovery methods to ensure node isolation
discv5-discovery = false
dns-discovery = false

# Reputation-related parameters
reputation-enabled = true

# Shift ports to avoid conflicts in local setups
ports-shift = 1

# Enable REST API including admin functions
rest = true
rest-admin = true
rest-address = "127.0.0.1"
rest-allow-origin = [ "127.0.0.1:*" ]

# Log level
log-level = "DEBUG"
43 changes: 43 additions & 0 deletions i13n-poc-configs/toml/bob.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Incentivization PoC: Bob

# Bob is a service node with Lightpush and Relay enabled
# that successfully fulfils Alice's eligible requests.
# Bob also checks for double-spend attempts -
# when Alice submits duplicate txid as proof of payment.

# Enable Lightpush
lightpush = true

# Use a pre-generated static node key for reproducibility
nodekey = "2bd3bbef1afa198fc614a254367de5ae285d799d7b1ba6d9d8543ba41038bbed"

# Connect to Dave
staticnode = [ "/ip4/127.0.0.1/tcp/60002/p2p/16Uiu2HAmSCUwvwDnXm7PyVbtKiQ5xzXb36wNw8YbGQxcBuxWTuU8" ]

# Enable Relay (required for eligibility module)
relay = true

# Connect to The Waku Network (TWN)
preset = "twn"

# Optional: Bob only connecting to Dave is OK for testing scenario
discv5-discovery = false
dns-discovery = false
nat = "upnp"

# Eligibility-related parameters
eligibility-enabled = true
eligibility-receiver-address = "0x6298cc1831B6E5eDEDA5cC73bc75a040108358Bb"
eligibility-payment-amount-wei = 1000000000

# RLN-related parameters
rln-relay-tree-path = "~/.waku/rln-tree-db"

# Enable REST API including admin functions
rest = true
rest-admin = true
rest-address = "127.0.0.1"
rest-allow-origin = [ "127.0.0.1:*" ]

# Log level
log-level = "DEBUG"
43 changes: 43 additions & 0 deletions i13n-poc-configs/toml/charlie.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Incentivization PoC: Charlie

# Charlie is an isolated node with Relay and Lightpush enabled.
# Charlie fails to fulfill Alice's request due to lack of peers.
# However, Charlie implements eligibility-related checks,
# and rejects Alice's ineligible requests before trying to fulfil them.

# Enable Lightpush
lightpush = true

# Use a pre-generated static node key for reproducibility
nodekey = "fbfa8c3e38e7594500e9718b8c800e2d1a3ef5bc65ce041adf788d276035230f"

# Enable Relay (required for eligibility module)
relay = true

# Connect to The Waku Network (TWN)
preset = "twn"

# Disable discovery methods to ensure node isolation
discv5-discovery = false
dns-discovery = false
nat = "upnp"

# Eligibility-related parameters
eligibility-enabled = true
eligibility-receiver-address = "0x6298cc1831B6E5eDEDA5cC73bc75a040108358Bb"
eligibility-payment-amount-wei = 1000000000

# Shift ports to avoid conflicts in local setups
ports-shift = 3

# RLN-related parameters
rln-relay-tree-path = "~/.waku/rln-tree-db-3"

# Enable REST API including admin functions
rest = true
rest-admin = true
rest-address = "127.0.0.1"
rest-allow-origin = [ "127.0.0.1:*" ]

# Log level
log-level = "DEBUG"
32 changes: 32 additions & 0 deletions i13n-poc-configs/toml/dave.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Incentivization PoC: Dave

# Dave is a Relay node that Bob uses to publishing Alice's message.
# Dave is unaware of any elibibiligy- or reputation-related features.

# Enable Lightpush
lightpush = true

# Use a pre-generated static node key for reproducibility
nodekey = "166aee32c415fe796378ca0336671f4ec1fa26648857a86a237e509aaaeb1980"

# Enable Relay (required for eligibility module)
relay = true

# Connect to The Waku Network (TWN)
preset = "twn"
nat = "upnp"

# Shift ports to avoid conflicts in local setups
ports-shift = 2

# RLN-related parameters
rln-relay-tree-path = "~/.waku/rln-tree-db-2"

# Enable REST API including admin functions
rest = true
rest-admin = true
rest-address = "127.0.0.1"
rest-allow-origin = [ "127.0.0.1:*" ]

# Log level
log-level = "DEBUG"
15 changes: 8 additions & 7 deletions tests/incentivization/test_poc_eligibility.nim
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ suite "Waku Incentivization PoC Eligibility Proofs":
var manager {.threadvar.}: EligibilityManager

asyncSetup:
manager = await EligibilityManager.init(EthClient)
# Setup manager with expected receiver and amount
manager = await EligibilityManager.init(EthClient, Address.fromHex(receiverExpected.toHex()), TxValueExpectedWei)

(
txHashWrongReceiverRightAmount, txHashRightReceiverWrongAmount,
Expand All @@ -147,7 +148,7 @@ suite "Waku Incentivization PoC Eligibility Proofs":
let eligibilityProof =
EligibilityProof(proofOfPayment: some(@(TxHashNonExisting.bytes())))
let isEligible = await manager.isEligibleTxId(
eligibilityProof, receiverExpected, TxValueExpectedWei
eligibilityProof
)
check:
isEligible.isErr()
Expand All @@ -158,7 +159,7 @@ suite "Waku Incentivization PoC Eligibility Proofs":
let eligibilityProof =
EligibilityProof(proofOfPayment: some(@(txHashContractCreation.bytes())))
let isEligible = await manager.isEligibleTxId(
eligibilityProof, receiverExpected, TxValueExpectedWei
eligibilityProof
)
check:
isEligible.isErr()
Expand All @@ -170,7 +171,7 @@ suite "Waku Incentivization PoC Eligibility Proofs":
let eligibilityProof =
EligibilityProof(proofOfPayment: some(@(txHashContractCall.bytes())))
let isEligible = await manager.isEligibleTxId(
eligibilityProof, receiverExpected, TxValueExpectedWei
eligibilityProof
)
check:
isEligible.isErr()
Expand All @@ -181,7 +182,7 @@ suite "Waku Incentivization PoC Eligibility Proofs":
let eligibilityProof =
EligibilityProof(proofOfPayment: some(@(txHashRightReceiverRightAmount.bytes())))
let isEligible = await manager.isEligibleTxId(
eligibilityProof, receiverExpected, TxValueExpectedWei
eligibilityProof
)

assert isEligible.isOk(), isEligible.error
Expand All @@ -193,11 +194,11 @@ suite "Waku Incentivization PoC Eligibility Proofs":
EligibilityProof(proofOfPayment: some(@(txHashRightReceiverRightAmount.bytes())))

let isEligibleOnce = await manager.isEligibleTxId(
eligibilityProof, receiverExpected, TxValueExpectedWei
eligibilityProof
)

let isEligibleTwice = await manager.isEligibleTxId(
eligibilityProof, receiverExpected, TxValueExpectedWei
eligibilityProof
)

assert isEligibleOnce.isOk()
Expand Down
Loading