SChernykh / p2pool

Decentralized pool for Monero mining
GNU General Public License v3.0
1.03k stars 124 forks source link

autodiff gave very low-difficulty job #182

Closed bladedoyle closed 2 years ago

bladedoyle commented 2 years ago

I see in the logs that a very low difficulty job was given. Is this some bug in the autodiff code? Here is the information I have:

XMRig logs:

[2022-07-04 14:33:43.827]  miner    speed 10s/60s/15m 8050.2 8120.2 7997.2 H/s max 8257.1 H/s
[2022-07-04 14:33:44.037]  cpu      accepted (1524/0) diff 256385 (0 ms)
[2022-07-04 14:33:44.416]  net      new job from 23.124.76.211:3333 diff 252140 algo rx/0 height 2659999 (173 tx)
[2022-07-04 14:33:52.446]  net      new job from 23.124.76.211:3333 diff 252140 algo rx/0 height 2659999 (173 tx)
[2022-07-04 14:33:54.005]  net      new job from 23.124.76.211:3333 diff 252140 algo rx/0 height 2659999 (168 tx)
[2022-07-04 14:33:58.572]  net      new job from 23.124.76.211:3333 diff 252140 algo rx/0 height 2659999 (168 tx)
[2022-07-04 14:34:04.019]  net      new job from 23.124.76.211:3333 diff 252140 algo rx/0 height 2659999 (172 tx)
[2022-07-04 14:34:07.546]  cpu      accepted (1525/0) diff 252140 (1 ms)
[2022-07-04 14:34:14.413]  net      new job from 23.124.76.211:3333 diff 1000 algo rx/0 height 2659999 (172 tx)
[2022-07-04 14:34:14.598]  cpu      accepted (1526/0) diff 1000 (1 ms)
[2022-07-04 14:34:14.640]  cpu      accepted (1527/0) diff 1000 (0 ms)
...
...
[2022-07-04 14:34:25.402]  cpu      accepted (1597/0) diff 1000 (1 ms)
[2022-07-04 14:34:25.466]  cpu      accepted (1598/0) diff 1000 (1 ms)
[2022-07-04 14:34:25.484]  net      new job from 23.124.76.211:3333 diff 192005 algo rx/0 height 2660000 (45 tx)
[2022-07-04 14:34:33.817]  net      new job from 23.124.76.211:3333 diff 192005 algo rx/0 height 2660000 (47 tx)
[2022-07-04 14:34:38.787]  net      new job from 23.124.76.211:3333 diff 192005 algo rx/0 height 2660000 (47 tx)
[2022-07-04 14:34:39.153]  net      new job from 23.124.76.211:3333 diff 192005 algo rx/0 height 2660001 (1 tx)
[2022-07-04 14:34:40.152]  net      new job from 23.124.76.211:3333 diff 192005 algo rx/0 height 2660001 (1 tx)
[2022-07-04 14:34:43.874]  miner    speed 10s/60s/15m 8049.4 8117.7 8005.5 H/s max 8257.1 H/s
[2022-07-04 14:34:50.014]  net      new job from 23.124.76.211:3333 diff 192005 algo rx/0 height 2660001 (2 tx)
[2022-07-04 14:34:52.232]  cpu      accepted (1599/0) diff 192005 (1 ms)

P2Pool logs:

p2pool-p2pool      | 2022-07-04 14:34:04.0219 BlockTemplate final reward = 0.619559621973 XMR, weight = 300302, outputs = 70, 171 of 198 transactions included
p2pool-p2pool      | 2022-07-04 14:34:04.0223 StratumServer sent new job to 1/1 clients
p2pool-p2pool      | 2022-07-04 14:34:14.4074 SideChain add_block: height = 2545299, id = bf9a7ca71cd25a3c37b38026754323c96868d5408bb491eadc0305692aba8a13, mainchain height = 2659999, verified = 0
p2pool-p2pool      | 2022-07-04 14:34:14.4110 SideChain verified block at height = 2545299, depth = 0, id = bf9a7ca71cd25a3c37b38026754323c96868d5408bb491eadc0305692aba8a13, mainchain height = 2659999
p2pool-p2pool      | 2022-07-04 14:34:14.4121 SideChain new chain tip: next height = 2545300, next difficulty = 1389040180, main chain height = 2659999
p2pool-p2pool      | 2022-07-04 14:34:14.4122 BlockTemplate base  reward = 0.600000000000 XMR, 200 transactions, fees = 0.019795370000 XMR, weight = 356340
p2pool-p2pool      | 2022-07-04 14:34:14.4159 BlockTemplate final reward = 0.619559637973 XMR, weight = 300298, outputs = 70, 171 of 200 transactions included
p2pool-p2pool      | 2022-07-04 14:34:14.4161 StratumServer sent new job to 1/1 clients
p2pool-p2pool      | 2022-07-04 14:34:16.7347 SideChain add_block: height = 2545300, id = ba5435af34dbb339051a5eecc25dd980211739c905961c9b5088af48cb0e8205, mainchain height = 2659999, verified = 0
p2pool-p2pool      | 2022-07-04 14:34:16.7367 SideChain verified block at height = 2545300, depth = 0, id = ba5435af34dbb339051a5eecc25dd980211739c905961c9b5088af48cb0e8205, mainchain height = 2659999
p2pool-p2pool      | 2022-07-04 14:34:16.7375 SideChain new chain tip: next height = 2545301, next difficulty = 1388345261, main chain height = 2659999
p2pool-p2pool      | 2022-07-04 14:34:16.7376 BlockTemplate base  reward = 0.600000000000 XMR, 200 transactions, fees = 0.019795370000 XMR, weight = 356340
p2pool-p2pool      | 2022-07-04 14:34:16.7389 BlockTemplate final reward = 0.619559637973 XMR, weight = 300298, outputs = 70, 171 of 200 transactions included
p2pool-p2pool      | 2022-07-04 14:34:16.7391 StratumServer sent new job to 1/1 clients
p2pool-p2pool      | 2022-07-04 14:34:25.4736 P2Pool new miner data
p2pool-p2pool      | ---------------------------------------------------------------------------------------------------------------
p2pool-p2pool      | major_version           = 14
p2pool-p2pool      | height                  = 2660000
p2pool-p2pool      | prev_id                 = a6c5bc25d536f9d9cae7b9335abbf80b382cf21a9e2f5061dbf54ea4eaad9de8
p2pool-p2pool      | seed_hash               = 9cfa17830fb15f710e8ddc5d6ebcd340deb857fc33cf2d6950ff4613b034ff2d
p2pool-p2pool      | difficulty              = 320187164098
p2pool-p2pool      | median_weight           = 300000
p2pool-p2pool      | already_generated_coins = 18143197978043650606
p2pool-p2pool      | transactions            = 46
p2pool-p2pool      | ---------------------------------------------------------------------------------------------------------------
p2pool-p2pool      | 2022-07-04 14:34:25.4737 BlockTemplate base  reward = 0.600000000000 XMR, 44 transactions, fees = 0.001242230000 XMR, weight = 70178
p2pool-p2pool      | 2022-07-04 14:34:25.4739 P2Pool new main chain block: height = 2659999, id = a6c5bc25d536f9d9cae7b9335abbf80b382cf21a9e2f5061dbf54ea4eaad9de8, timestamp = 1656945148, reward = 0.618615510000 XMR
p2pool-p2pool      | 2022-07-04 14:34:25.4872 BlockTemplate final reward = 0.601242230000 XMR, weight = 72914, outputs = 70, 44 of 44 transactions included
p2pool-p2pool      | 2022-07-04 14:34:25.4874 StratumServer sent new job to 1/1 clients
p2pool-p2pool      | 2022-07-04 14:34:33.8108 SideChain add_block: height = 2545301, id = 9d902ec224bf724a0b2e7223158552a61da8973309c042f87827bf3c53005598, mainchain height = 2660000, verified = 0
SChernykh commented 2 years ago

https://github.com/SChernykh/p2pool/commit/340a3e85c864aa9f176910bdbe75fb29fe0c2ba5 should fix this, can you test it?

bladedoyle commented 2 years ago

Testing now. Its hard to prove a negative but will assume fixed if not seen for some time.

SChernykh commented 2 years ago

You should test for 65536 seconds (~18 hours 12 minutes) to be sure. If it doesn't happen after that, it's fixed.

bladedoyle commented 2 years ago

No issue in > 24 hours, seems resolved. Thanks much!

pokkst commented 1 year ago

This issue only started occurring me AFTER the latest update. I'm on 2.2.1, latest version of xmrig, monerod, etc. @SChernykh I am on Manjaro, and am mining with a Ryzen 7 3700x on the mini pool. I do not have a custom difficulty set anywhere. Here is xmrig log:

[2022-08-21 23:25:12.439]  net      new job from 127.0.0.1:3333 diff 4002K algo rx/0 height 2694906 (102 tx)
[2022-08-21 23:25:14.097]  net      new job from 127.0.0.1:3333 diff 4002K algo rx/0 height 2694906 (103 tx)
[2022-08-21 23:25:27.739]  net      new job from 127.0.0.1:3333 diff 2000K algo rx/0 height 2694906 (107 tx)
[2022-08-21 23:25:39.562] no results yet
[2022-08-21 23:25:44.758]  net      new job from 127.0.0.1:3333 diff 1000K algo rx/0 height 2694906 (110 tx)
[2022-08-21 23:25:47.378]  net      new job from 127.0.0.1:3333 diff 1000K algo rx/0 height 2694907 (5 tx)
[2022-08-21 23:25:48.912]  net      new job from 127.0.0.1:3333 diff 1000K algo rx/0 height 2694907 (5 tx)
[2022-08-21 23:25:55.216]  net      new job from 127.0.0.1:3333 diff 500054 algo rx/0 height 2694907 (5 tx)
[2022-08-21 23:26:03.417]  net      new job from 127.0.0.1:3333 diff 500054 algo rx/0 height 2694907 (8 tx)
[2022-08-21 23:26:06.644]  miner    speed 10s/60s/15m 8452.9 n/a n/a H/s max 8853.6 H/s
[2022-08-21 23:26:10.788]  net      new job from 127.0.0.1:3333 diff 250012 algo rx/0 height 2694907 (9 tx)
[2022-08-21 23:26:19.288]  net      new job from 127.0.0.1:3333 diff 250012 algo rx/0 height 2694907 (10 tx)
[2022-08-21 23:26:21.403]  net      new job from 127.0.0.1:3333 diff 250012 algo rx/0 height 2694907 (10 tx)
[2022-08-21 23:26:25.135]  net      new job from 127.0.0.1:3333 diff 125002 algo rx/0 height 2694907 (10 tx)
[2022-08-21 23:26:28.284]  cpu      accepted (1/0) diff 125002 (0 ms)
[2022-08-21 23:26:39.830]  net      new job from 127.0.0.1:3333 diff 125002 algo rx/0 height 2694907 (10 tx)
[2022-08-21 23:26:40.138]  cpu      accepted (2/0) diff 125002 (0 ms)
[2022-08-21 23:26:46.521]  net      new job from 127.0.0.1:3333 diff 125002 algo rx/0 height 2694907 (13 tx)
[2022-08-21 23:26:50.108]  net      new job from 127.0.0.1:3333 diff 125002 algo rx/0 height 2694907 (14 tx)
[2022-08-21 23:26:50.675]  net      new job from 127.0.0.1:3333 diff 125002 algo rx/0 height 2694907 (14 tx)
[2022-08-21 23:26:58.651]  net      new job from 127.0.0.1:3333 diff 125002 algo rx/0 height 2694907 (15 tx)

The "accepted" shares are not shown on p2pool, since the diff is too low.

SChernykh commented 1 year ago

This issue only started occurring me AFTER the latest update

What issue exactly? It's working as it's supposed to.

pokkst commented 1 year ago

How exactly is giving too low of a difficulty, resulting in shares that aren't actually valid by p2pool, mean it's "working as it's supposed to" when it's the same exact bug as the one reported above by bladedoyle?

Right now p2pool mini has ~12 MH/s, with this (before the latest update 2.2.1), my CPU would find a valid share (that would also be valid by p2pool) roughly every 4 hours. After 2.2.1, I'm finding shares probably every 30 seconds, because the difficulty is just all over the place and not actually what it's supposed to be.

But hey, I guess it's working as intended.

SChernykh commented 1 year ago

It's not the same bug, it's autodiff working. Use --no-autodiff in command line to turn it off.

pokkst commented 1 year ago

I see, I missed that in the 2.1 changelog. In my opinion it's very misleading and will be confusing for new p2pool users. I just assumed it was broken. It's back to normal now.

SChernykh commented 1 year ago

Quite the opposite. You are the first who was confused, and before 2.1 I had to explain the high p2pool difficulty almost daily. Autodiff is the default way of operation for almost all pools, so the way it worked before 2.1 was confusing for new users.

pokkst commented 1 year ago

Hmm, weird. So fewer people are confused now when they see a ton of "accepted" shares but nothing on p2pool?

Thanks for the help though. The difficulty is back to normal now on my instance. Back to p2pool mining. :]