oxen-io / oxen-core

Oxen core repository, containing oxend and oxen cli wallets
https://oxen.io
Other
317 stars 120 forks source link

Rewards claim fix #1695

Closed Doy-lee closed 3 months ago

Doy-lee commented 3 months ago

Goes ontop of https://github.com/oxen-io/oxen-core/pull/1694

This gets the rewards claim working on localdev

2024-07-24 16:47:39.016037 Sleeping now, awaiting pulse quorum to generate blocks, blockchain height is 411
2024-07-24 16:48:09.049308 Waking up after sleeping for 30s, blockchain height is 413
  127.104.111.181:1100 => {'jsonrpc': '2.0', 'id': '0', 'method': 'bls_rewards_request', 'params': {'address': 'f39Fd6e51aad88F6F4ce6aB8827279cffFb92266'}}
2024-07-24 16:48:09.155890 {'id': '0', 'jsonrpc': '2.0', 'result': {'address': 'f39fd6e51aad88f6f4ce6ab8827279cfffb92266', 'amount': 1767942398, 'height': 412, 'msg_to_sign': '626464393764316536623833303463663737653037323763646330643561636362336138613339323766633062383466613965643166653936643866303036646633396664366535316161643838663666346365366162383832373237396366666662393232363630303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303639363061386665', 'non_signer_indices': [], 'signature': '1144e090cae58b0b989a337da1c16e7ebe28914417f7f97671709f6823ac12670f43c366bb9617599d7c45a01ca8b1fad4dbb5de4aa062cfb0fb6e962570b92d26c7f5778ab187c018fb8e96d6bca925fd239f26521b3839dfb1e05884bb91d701013af95d4743097dd6032a5377f91164b5dbdfe3a443896ae0cb517ffeffa2', 'status': 'OK'}}
2024-07-24 16:48:09.163003 Contract rewards before updating has ['available', 'claimed'] respectively:  [0, 0]  for  f39Fd6e51aad88F6F4ce6aB8827279cffFb92266
2024-07-24 16:48:09.202763 Foundation pool balance: 40000000000000000
2024-07-24 16:48:09.207632 Rewards contract balance: 121767942498
2024-07-24 16:48:09.339393 Contract rewards update executed, has ['available', 'claimed'] now respectively:  [1767942398, 0]  for  f39Fd6e51aad88F6F4ce6aB8827279cffFb92266
2024-07-24 16:48:09.345096 Balance for '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' before claim 59999878232057502
2024-07-24 16:48:09.373062 Contract rewards after claim is now ['available', 'claimed'] respectively:  [1767942398, 1767942398]  for  0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
2024-07-24 16:48:09.377876 Balance for '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' after claim 59999879999999900
2024-07-24 16:48:09.377916 Done.
2024-07-24 16:48:09.377926 Local Devnet SN network setup complete!
2024-07-24 16:48:09.377936 Communicate with daemon on ip: 127.104.111.181 port: 1105

For localdev anecdotally looks like it took around 104ms to service the request which is a bit slow .. but there's more to the RPC request than just the allServiceNodeIDs call.

[2024-07-24 16:48:09] [+1m23.332s] [ethyl:debug|src/provider.cpp:203] making rpc request with body {"id":1,"jsonrpc":"2.0","method":"eth_call","params":[{"data":"0xabf2c503","to":"0x5FC8d32690cc91D4c39d9d3abcBD16989F875707"},"latest"]}
[2024-07-24 16:48:09] [+1m23.334s] [ethyl:debug|src/provider.cpp:140] get_json_result
[2024-07-24 16:48:09] [+1m23.334s] [ethyl:debug|src/provider.cpp:148] parsing json rpc result, r.text = "{"jsonrpc":"2.0","id":1,"result":"... omitted ..."}"
[2024-07-24 16:48:09] [+1m23.334s] [ethyl:debug|src/provider.cpp:150] parsing json rpc result succeeded
[2024-07-24 16:48:09] [+1m23.334s] [ethyl:debug|src/provider.cpp:153] returning parsed json result
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   00 {1, 019ab9ee5d2c3a7e0768645ac6176631ed2ded6adfcbb19394676680b35a925a269cd5f4ecb2964eca4fb5dea7a5b248b5f9d1f4c018619bf5c81d19d45f97a4}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   01 {2, 266075dd7ddc16f53a0469a95107a9cb112e908f7a3d116b6855b2366a79dbbd23d62922aab97eeeb635e997a2868989a4c93178ac126e6389a74f89cc79fba2}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   02 {3, 166e8b71bd9d5984b07096b4825d148c1543ddd6f318af5843954f289aeb9283165bd96d953a72d2ca10f3b5cc7c6bb9ebb2465c53877abb34e4df566c70f206}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   03 {4, 0395d16eb805722680368fd3936e34015162888ede0efa7c50ae057eefa471102b701969dea346ec40d57a1a53a4a4de940b642a809aada421c3d591dedd74a7}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   04 {5, 1ca16e9c1bd01c29fced50ed75e6822c1ad9ec79dbb52bf2cd3a14d7fd89bd6506d961088630911d4e77bf509b6d3d9b7ccdc888d0ad33af7d0cb6b854f31e22}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   05 {6, 2cb36ee23614f6c3ed37b34c4e0ce9917a5f03c075915b1f4c3db9a48b5586db23a405c7d596a32a2c62e34ee22db13b6e692d2512882ae4ce968452cf4e3ae3}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   06 {7, 18c46767ee3aae119d04cb83c21be2a232dbf7602277e52e5af571c003135aa102b05b2b0e09a7ab0d8c5f2033febf369c2ca6af034bb1b21ee87f588111dcf8}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   07 {8, 2e8502636e50d2751eb4dade9a74c8de84ff2200e3ed16f0c0581c03d894599f1714796ed926237409e3711e1bb65dbd9d5fe65469c5bf9e911b3eef3ec1ccee}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   08 {9, 0dfc908e976487c10f398c0a16607d59db6c392a2a751c2b481662e31588c196168e7e206ce902069fcaed5aceac2a8791e70130d64f287fd7615af3c90f228c}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   09 {10, 2a201883be2a736e8dbc72f20e56783982bb41c5e226967f7a3d520a54c5fdc818f22b3a53f6543993952491a49bdd5a828e560ebc7323805a89b757741d7292}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   10 {11, 17a3f1af2aa0591642c9e2ad95a87f816dafa320da2494c30c9a63184713ea160fcbce161e97b79ab6b1477751c1f5846cb973ab84abf8acb0f628b9cb36a330}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   11 {12, 151e9350ac549e8cbd10fde7207df54db21cbf838587463ba127264d516ac36f0cdc59a379bb2907628ba056b0cf44118f73313a8ed5e991a00378546dadb7f0}
[2024-07-24 16:48:09] [+1m23.334s] [l2_tracker:info|l2_tracker/rewards_contract.cpp:391]   12 {13, 2a01c27a882e6865c26e333f13a1b614eb703b4f79b5b626131e5bd1bd544e7c2431ac5e8535a3854f926a20fba2e55b61cd1b628508d60eb0fa9a28d4e80a4e}
[2024-07-24 16:48:09] [+1m23.334s] [daemon.rpc:debug|rpc/http_server.cpp:388] HTTP RPC /json_rpc [] OK (785 bytes) in 104.009ms
jagerman commented 3 months ago

LGTM.