Skip to content
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

feat: incentivization POC: add double-spend check for txid-based eligibility #3264

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

s-tikhomirov
Copy link
Contributor

@s-tikhomirov s-tikhomirov commented Jan 29, 2025

Description

This is a continuation of the work started in #3166 with associated deliverable waku-org/pm#245.

The overall task is to implement a proof-of-concept service incentivization mechanism, where clients submit txids alongside their requests, and servers check eligibility of those txids as proofs of payment.

This PR adds a check against double-spending. A client is prevented from submitting the same txid twice. The server keeps track of txids it has seen, and checks every txid against that set. If the txid is in the set, the eligibility check fails.

Note the assumption: a transaction once deemed ineligible will never become eligible in the future, even (for example) in a scenario where a transaction underpaid, and later the server decreased its prices. Such scenarios look too complicated for a PoC. For now, we assume that a server declares a transaction eligible or ineligible when it is first submitted as proof of payment. No matter the result of the initial check, the same txid will be ineligible on all future submissions.

Changes

  • implement double-cpend check for eligibility PoC

Copy link

github-actions bot commented Jan 29, 2025

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3264

Built from c142994

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for it! 💯
Very insightful one :D

waku/incentivization/eligibility_manager.nim Outdated Show resolved Hide resolved
tests/incentivization/test_poc.nim Outdated Show resolved Hide resolved
waku/incentivization/eligibility_manager.nim Outdated Show resolved Hide resolved
tests/incentivization/test_poc.nim Outdated Show resolved Hide resolved
@s-tikhomirov s-tikhomirov force-pushed the feat/incentivization-poc-double-spend-check branch 2 times, most recently from 713e3f1 to 9ed1be7 Compare January 30, 2025 15:46
@s-tikhomirov s-tikhomirov force-pushed the feat/incentivization-poc-double-spend-check branch from 9ed1be7 to cd6d4d4 Compare January 31, 2025 16:23
@s-tikhomirov s-tikhomirov force-pushed the feat/incentivization-poc-double-spend-check branch from cd6d4d4 to a5113c3 Compare January 31, 2025 17:52
@s-tikhomirov s-tikhomirov merged commit c142994 into master Jan 31, 2025
2 checks passed
@s-tikhomirov s-tikhomirov deleted the feat/incentivization-poc-double-spend-check branch January 31, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants