Closed michaelkrasa closed 9 months ago
The issue is likely caused by the time difference between your check of the burn amount and the execution of your register extrinsic on-chain.
To prevent this, you should get the current block and burn amount, and either A) reduce your wallet balance to the burn cost and submit, (two wallets maybe) or B) check the registration interval and craft an extrinsic that is only valid until the end of the current interval, making sure to know the burn cost in that same interval.
The above is a modification of the code in burned_register_extrinsic() method in registration.py. There is absolutely minimal delay between getting the burn price and the registration itself.
More importantly, I'd understand it if that would occur between two intervals e.g. from 3.2 Tao to 6.4 Tao. The issue is, however, that the burn method is returning an incorrect amount for both the 6.4 interval and the 12.8 interval.
More context:
while True:
if not s.burned_register(w, 19, True, True, False):
print("Failed to register hotkey: ", h)
I hope I got my point across now.
As mentioned in private, this is because of the time delay between the call to burn
and the extrinsic submission.
Closing the issue.
Describe the bug
Subtensor recycle method returns value that is outdated for the current registration period. I've encountered this bug several times in the past but they were always just an anomaly. Hence why I started to ask for the price twice to avoid this -- check screenshot.
To Reproduce
Run burn() in a while loop with a threshold lower than real burn price and watch it go through.
Expected behavior
Recycle method should return correct amount for the current block / registration interval. So when burn() says it costs 3.2 Tao to register, it really does cost that. If the registration cost is 12, the if should return False.
Screenshots
Too many registrations in this case was for a period when the recycle price was double -- 6.4 Tao. In the next registration window it was yet again said to be 3.2, registration was made but true cost was 12.8 which is insane.
Even when double checking burn price, it was accepted even thought the true price of registration was already 2 registration periods ahead.
Environment
Ubuntu 22, Bittensor 6.6.1
Additional context
I'm assuming the code comes with no warranty but I wasted 16 Tao on this bug just today until I realized what was going on. Some partial refund from the foundation would be appreciated.