feat: adds tip004 pow changes - #174
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new proposal document, TIP-Proc-MT-0004_MinoTari_PoW_Difficulty_changes.md, which outlines proposed changes to the MinoTari Proof-of-Work (PoW) difficulty adjustment mechanism. Specifically, it proposes an exponential backoff mechanism for consecutive blocks mined by the same PoW algorithm to prevent a single algorithm from dominating and causing disproportionate reorgs. The review feedback suggests fixing a broken relative link in the TIP metadata table, resolving an undefined markdown link reference [OEP], and removing an empty list item.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
I would support this change, despite it requiring a hard fork. It would reduce the ability of an attacker to 'rock the boat' and depress one algorithm's difficulty either to attempt a reorg or to gain an advantage with a timed burst of mining on the depressed algorithm.
|
If the goal is to stop reorgs on a network with as little nethash as Tari currently has, a more gradual increase like you suggested wouldn't sufficiently mitigate the threat of reorgs. It needs to be be a stiff penalty for consecutive blocks. I think the exponential increase is the right move. |
Kelketek
left a comment
There was a problem hiding this comment.
@SWvheerden Small comment on the header, but otherwise this looks good to me. Exponential backoff as a mitigation to making any lane dominant seems straightfoward to implement and likely to resolve immediate issues.
stringhandler
left a comment
There was a problem hiding this comment.
I don't think this will solve the problem.
Some faults off the top of my mind:
- If you are behind on C29 blocks, multiple C29 blocks are hard to mine in succession.
- If you interleave 2 algorithms, there is no penalty.
If anything you should adjust the target time for the other 3 algorithms when a C29 block has not been mined. This strategy is complicated and also flawed.
You would have to find a sequence in the chain's history where this proposal would have actually made a difference.
From my experience with P2pool, trying to artificially limit POW does not have the desire effect, and often has the reverse of what you are trying to achieve.
|
I will address you comments here quick: 2: This will only work with RxT/RxM as they hardware is the same, but also not 100% as you need to closely match the PoW of the network for that algo. Tari's PoW is calculated as Sha * C29 * RxT * RxM. Which you further boil down to: This can be seen the (Sha3 % increase) > (C29 % increase) + (Rxt % increase) + (RxM % increase) |
08cf7b4 to
8ee8843
Compare
|
I'm not going to die on this hill, but this still seems dumb to me. Anyway here is what claude thinks:
Why the exponential backoff won't workAccumulated difficulty per unit time equals hashrate, regardless of the target. LWMA sets So doubling Sha3x's target makes each block worth 2x and take 2x as long. Over any window longer than a few blocks, is unchanged. Selfish mining costs hashrate x time; the proposal moves neither. "Neutral: does not change the geometric-mean comparison logic" is the tell. Also:
The fix belongs in the accounting, not the scheduling. The comparison is sensitive to an algorithm's growth rate of accumulated difficulty. Normalize each block's work by that algorithm's recent average difficulty before summing, so a block is worth ~ Minor: |
| | Last Modified | 2026-05-17 | | ||
| | Authors | SW van Heerden | | ||
| | Status | Accepted | | ||
| | Type | Process | |
| ## Proposed Change | ||
|
|
||
| Tari currently calculates target difficulty using LWMA (Linearly | ||
| Weighted Moving Average) over the last 90 blocks. The LWMA uses: |
There was a problem hiding this comment.
@SWvheerden Could you make sure to add the change to the LWMA as discussed in the forum thread and approved by the council? I think we landed on 45, but Kinkajou should remember if neither of us does.
There was a problem hiding this comment.
I was treating that as a separate move, but we can do it here as well.
| - Makes selfish mining exponentially more expensive for any single | ||
| algorithm attempting to dominate. | ||
| - Encourages natural interleaving of algorithms. | ||
| - |
| | TIP | [A-TIP-RFC-MT-0004](#/RFC/MinoTari/TIP-RFC-MT-0004_MinoTari_PoW_Difficulty_changes.md) | | ||
| |-----------------|---------------------------------------------------------------------------| | ||
| | Title | MinoTari PoW difficulty changes | | ||
| | Last Modified | 2026-05-17 | |
There was a problem hiding this comment.
Please bump this upon addressing notes
|
@SWvheerden Looks good to me! 👍 Matches my understanding of the approved changes. |
Yes, you're right about this. The Kryptex bot could very well just move hashrate between the two lanes and attempt to gain a profitability advantage that way. This is much more difficult to execute in practice though and still prevents offline reorgs/selfish mining attacks.
This is concerning. Do you have any data to back this up? We're already sitting on a 3min blocktime average fairly regularly depending on the window - and this is one of the main things I'd like to fix with this change.
I agree with you here. This was the focus of my initial suggestions, but changing the difficulty algorithm entirely is a much larger fix and it was my view that this was a much less contentious way to go about solving the immediate issue of daily reorgs and 20min+ blocktimes. We discussed scheduling another, permanent improvement, for 6months out.
I beg you, and everyone here, please go use my sim https://github.com/m4r1m0/tari-diff-sim/tree/main You can attach your own historical block data. You can craft fictitious block data and slap it in there. I spent 3 days extra moving my python over to JS so people would audit and test my work/run their own simulations. I don't want to be the guy responsible for making the network worse, that's why I relied on simulations and data to support my assertions and published the code and methodology for others to audit rather than just taking the AI at it's word. |
I appreciate the work there. However, I might be missing it, but there doesn't seem to be a simulation of the problem stated in this PR. So I would expect a simulation to have that. Selfish mining would make the most sense to simulate (apologies if you have this and I missed it). Assuming a bad actor, with 2x the hashrate, and the exponential increase in target time will this proposed change:
I suspect that, even with the doubled target time, the difficulty difference does not change. In that case you would see:
In which case this solution makes the problem worse. The selfish mining scenario is not an unlikely scenario. We have already seen it with qubic's attacks on monero. |
In theory, I think there is something here, as the amount of work done over a large period is still the same. But as your target time increases, you give more chance for the other algo's to increase their work percentage-wise to catch up.
This is true, nothing we can do about this, its a free swap between this. But at the same time it wont really work for RxT pools as their hash rate is lower than RxM. It will only work for RxM.
A lot of the quick blocks are with pools jumping on and off Tari, this will penalise them as well, which is good.
I dont agree. It will slow down the emission if its too quick. The slow emmision on the other algo's are due to pool hash rates, which the 45 block window will help.
I dont agree, LWMA does hash estimations per block, you can set the target time per block.
I dont see the problem? Your difficulty always depends on the previous block. If you reorg, you need to look at the latest tip and recalculate your template anyway?
I am guessing you forgot all the work we did when sha3x kept causing 10-block reorgs? |
In other words, it is easier to mine on the previous tip to get a block reward than it is to accept the current block if it's the same algorithm as you. Rational mining pools should ignore any blocks that are of the algorithm they are mining.
Regardless of whether I remember or not, this event is not in this TIP. Claude, who wrote this message, cannot remember this event.
So your logic is that if you hurt the honest miners as well as the bad miners then it's good. Ok, that does not solve the problem that honest miners will lose profitability. Enjoy the lower hash rate as miners move away. Again, I did not write these comments. I asked Claude to review it. You can reproduce them with the prompt I supplied. Admittedly, I started with a negative prompt, but you can also reproduce it by asking if there "are any problems with this TIP". Chatgpt had it's own problems. E.g. |
This is incorrect,
I dont think I agree, honest miners are not getting the blocks because pools are jumping on and getting all the blocks cheaply, then leaving as soon as the difficulty jumps, this leaves honest miners trying to mine to get the difficulty down again after having lost all those blocks. If a pool jumps onto an algo, there is nothing you can do, their hash rate is far greater than the rest. They will take the blocks for that algo. This stops them from taking all the blocks and forces other algos get some blocks, while also stopping them from reorging out the network. This is primarily a security thing. |
|
Ok seems like you have this all thought out. I hope it works |
|
@stringhandler |
|
In the last 20 blocks as I write this (height 314697), the following block patterns appear:
This proposal would make these gaps even worse. I don't have access to reorg data in this period (block 314678+) so I don't know if blocks are being added and then removed. My prediction is that this proposal just makes the chain slower and doesn't solve anything you are trying to solve. 25% of the blocks in the chain had the same algo as their parent. So potentially you are looking at a 25% slower block time. |
|
Updated my diff sim https://github.com/m4r1m0/tari-diff-sim It looks like the new proposed changes may actually make the issue worse. |
|
I updated my sim again to include a comparison against Zawy's WTEMA: https://github.com/m4r1m0/tari-diff-sim/tree/wtema-proposal The readme is very verbose, too much so, because I just had my agent dump all its context in there. I figured this would be useful for auditing. |
Description
adds a proposed changed to change how the difficulty is calculated