-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Feature Request] Potentially the chain could be stalled due to too many listings #438
Comments
By automated bot I assume you mean an external program that is run by us. This would be even more dangerous, expensive and less reliable. If we are not already, we should limit the amount of operations that we do per block. This will help us make sure that we don't go over a critical threshold. |
While we have weight system in place, using on_initialized hook could take up all the weight. Even if we set a limit on the total number of open listings and ensure they can be processed in time, the allocated time for the on_initialize phase would still be limited. Unfortunately, I do not yet have a concrete number for this limit, but it is likely to be quite low. This could lead to an issue where someone could spam the marketplace by sending tons of listings, preventing anyone else from listing anything. I understand that the external bot is not an ideal solution in terms of security and cost, however it is a pattern that has been used in the crypto space. The maintenance extrinsic can only do simple and restricted tasks, so the worst case scenario would be if the bot fails to call this maintenance extrinsic occasionally, it could be easily picked up and retried, even manually. Alternatively, if you were to lose your private key for the bot, then the maximum you would lose is a small amount of gas fee sent to it. After all, if we continue with the existing on-chain approach, then if something were to go wrong there would be no more blocks finalized and a fork &and restart might not be avoidable - which I believe is far more dangerous and costly. |
According to you link there is nothing wrong about Let me respond to some of your comments: 2) Not ideal in terms of security and cost 3) maintenance extrinsic can only do simple and restricted tasks Three more things:
|
Appreciate your prompt reply, very well said. I just verified that I used a different link than what I intended , but you can understand why the issue of on_initialize is a concern. Everybody want to reduce the gas cost for users, the listing number limit could be very low, so the total cost of spamming the entire area could be much lower than expected. Spamming with many other transactions will not prevent this market from functioning, but reaching the listing limit could. Therefore, from the marketplace product standpoint, I would be grateful if the listing number limit could be avoided.
this is not the case though, as we have weight limit in 1 block, so we have an limit on how many listings we can loop for in one block, The reason I am in favor of an external bot is that you can adjust the timing, chunk size, pivot etc flexibly, split the big batch into smaller chunks per block, and avoid setting a limit on open listings. I acknowledge the reasons that you rule out external bot. Then in this case, I think it is still worth considering solving this. Any hint could be helpful. In the mean time, I can spend sometime to find out how many open listings will actually brick the chain. |
observation:
This pallet uses an on_initialize hook to close ended listings, in a loop, which is dangerous and costly, as we can have a number of listings, and I think it is already noted in the code comment.
proposal:
move this function out of hook, use an automated bot to send extrinsic to maintain the status of the listings, and always check listing end block in related extrinsic.
The text was updated successfully, but these errors were encountered: