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: Add incentivization PoC for RLNaaS in Lightpush #3166

Merged
merged 40 commits into from
Jan 22, 2025
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ae48b92
feat: add simple txid-based eligibility check with hard-coded params …
s-tikhomirov Oct 31, 2024
8ca8c3e
use new proc to generate eligibility status
s-tikhomirov Dec 11, 2024
f5674d0
minor fixes
s-tikhomirov Dec 11, 2024
d9e00ed
add comments to clarify eligibility definition
s-tikhomirov Dec 11, 2024
f5711e3
use Address.fromHex conversion from eth-web3
s-tikhomirov Dec 11, 2024
9d09b00
move isEligible to common
s-tikhomirov Dec 12, 2024
6181bff
refactor: avoid result and unnecesary branching
s-tikhomirov Dec 12, 2024
db60158
define const for simple transfer gas usage
s-tikhomirov Dec 12, 2024
1fc916c
avoid unnecessary parentheses
s-tikhomirov Dec 12, 2024
2a6de96
chore: run nph linter manually
s-tikhomirov Dec 13, 2024
55900dc
refactor, move all hard-coded constants to tests
s-tikhomirov Dec 13, 2024
21c641d
use Result type in eligibility tests
s-tikhomirov Dec 13, 2024
7921ef8
use standard method of error handling
s-tikhomirov Dec 13, 2024
77733b6
make try-block smaller
s-tikhomirov Dec 13, 2024
088f19f
add a try-block in case of connection failure to web3 provider
s-tikhomirov Dec 13, 2024
87b1dd3
make queries to web3 provider in parallel
s-tikhomirov Dec 13, 2024
8f65a11
move Web3 provider RPC URL into env variable
s-tikhomirov Dec 13, 2024
6c7c07c
remove unused import
s-tikhomirov Dec 13, 2024
7ae9e52
rename functions
s-tikhomirov Dec 17, 2024
c6fd8a3
use await in async proc
s-tikhomirov Dec 17, 2024
110d11e
add timeout to tx receipt query
s-tikhomirov Dec 20, 2024
753b3ff
parallelize queries for tx and txreceipt
s-tikhomirov Dec 20, 2024
b82949f
make test txids non public
s-tikhomirov Jan 3, 2025
deffd40
use assert in txid i13n test
s-tikhomirov Jan 3, 2025
d579450
use parentheses when calling verb-methods without arguments
s-tikhomirov Jan 3, 2025
7c02768
remove unused import
s-tikhomirov Jan 3, 2025
90445a7
use init for stack-allocated objects
s-tikhomirov Jan 3, 2025
e1154b1
add txReceipt error message to error
s-tikhomirov Jan 3, 2025
cc2f3cd
introduce eligibility manager
s-tikhomirov Jan 3, 2025
d8b6db6
[WIP] use Anvil for eligibility testing
s-tikhomirov Jan 8, 2025
3ca6aba
add eligibility test with contract deployment tx
s-tikhomirov Jan 13, 2025
d6a70d0
add eligibility test with contract call
s-tikhomirov Jan 14, 2025
347553f
add asyncSetup and asyncTeardown for eligibility tests
s-tikhomirov Jan 16, 2025
70b20b3
minor refactor
s-tikhomirov Jan 17, 2025
dadc7cb
refactor tests for onchain group manager with asyncSetup and asyncTea…
s-tikhomirov Jan 17, 2025
c1119d9
minor refactor
s-tikhomirov Jan 17, 2025
3755a07
remove unnecessary defer in asyncTeardown
s-tikhomirov Jan 20, 2025
19efc15
remove unnecessary call in test (moved to asyncTeardown)
s-tikhomirov Jan 20, 2025
438c01b
add comment justidying the use of discard
s-tikhomirov Jan 20, 2025
56ea04d
rename file txid_proof to eligibility_manager
s-tikhomirov Jan 22, 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
Prev Previous commit
Next Next commit
minor refactor
  • Loading branch information
s-tikhomirov committed Jan 22, 2025
commit 70b20b36386933b43027bc85026c553832cbf05b
20 changes: 7 additions & 13 deletions tests/waku_rln_relay/utils_onchain.nim
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,10 @@ proc sendEthTransfer*(

return txHash

proc createEthAccount*(
web3: Web3, amountEth: UInt256 = 1000.u256
): Future[(keys.PrivateKey, Address)] {.async.} =
let accounts = await web3.provider.eth_accounts()
web3.defaultAccount = accounts[0]

proc createEthAccount*(web3: Web3): (keys.PrivateKey, Address) =
let pk = keys.PrivateKey.random(rng[])
let acc = Address(toCanonicalAddress(pk.toPublicKey()))

discard
await sendEthTransfer(web3, accounts[0], acc, ethToWei(amountEth), some(0.u256))

return (pk, acc)

proc getAnvilPath*(): string =
Expand Down Expand Up @@ -230,15 +222,17 @@ proc setupOnchainGroupManager*(
let accounts = await web3.provider.eth_accounts()
web3.defaultAccount = accounts[0]

var pk = none(string)
let (privateKey, _) = await createEthAccount(web3, amountEth)
pk = some($privateKey)
let (privateKey, acc) = createEthAccount(web3)

discard await sendEthTransfer(
s-tikhomirov marked this conversation as resolved.
Show resolved Hide resolved
web3, web3.defaultAccount, acc, ethToWei(1000.u256), some(0.u256)
)

let manager = OnchainGroupManager(
ethClientUrl: ethClientAddress,
ethContractAddress: $contractAddress,
chainId: CHAIN_ID,
ethPrivateKey: pk,
ethPrivateKey: some($privateKey),
rlnInstance: rlnInstance,
onFatalErrorAction: proc(errStr: string) =
raiseAssert errStr
Expand Down