-
Notifications
You must be signed in to change notification settings - Fork 24
CHIP-0050 & CHIP-0051: Action Layer and Slots + Reward Distributor #165
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
base: main
Are you sure you want to change the base?
Conversation
|
So putting my fantasy hat on with a low understanding to dream of things for the pool/farm reward mechanism... is these concepts something that could be used for farming on pools (or solos) when it comes to claiming and distributing rewards with fewer transactions, as well as flexibility in how much of the initial reward portions are committed to the pool and/or farmer? Fantasy 1: would this allow a fancy puzzle for farmers to commit 100% (or varying amounts) of the pool/farm reward portions to a pool rather than the 87.5% / 12.5% split today? If transaction fees in the farmer portion become the largest portion of the reward, some users will want that shared with the whole pool. So if there was an "official protocol" instead of a centralized pool making blocks for them or trusting people won't cheat a regular pool which often requires them to build up credit owed before payout, that might be neat. Fantasy 2: would this allow stacking of multiple pool rewards and a pool can inject their (by block, by day, by fixed amount) oracle data for payouts when claiming those rewards, turning it into a single transaction? rather than claiming rewards and multiple distribution transactions after? If the fantasy thinking is possible, would it just take a change to consensus in the upcoming hard fork to open the door to these ideas and more with flexibility going forward while we're doing the hard fork? |
|
CHIPs 50 and 51 are now drafts. (Both CHIPs can be handled in this PR.) Please leave your reviews here, and feel free to discuss in the #chips channel of our Discord. |
|
Left a comment PR on the reference repository: Yakuhito/slot-machine#13 |
Replied. The slot puzzle no longer assumes a singleton amount of 1 and is roughly ~25% smaller. |
|
After thinking about your ideas @OverActiveBladderSystem here's my comments:
To change the split, you'd probably want to change consensus to allow custom or even configurable percentages. I think the same mechanism used to switch pools could work. I'm not an expert on that topic, so not the best person to ask 😅
This would, more likely, require a custom pooling singleton (and that to be supported at the consensus level - not sure if it is). I'm pro-official-protocol-pools, but I don't think these puzzles can necessarily help here.
The distributors work on a per-second basis. The difficult 'balance' here is that pools will likely frequently update the list of active farmers and their shares of the rewards, which might also cause a lot of on-chain transactions. This contrasts the ideal case of the rewards distributor, where updates from the manager are not that frequent. The NFT reward distributor doesn't have this problem because users update it themselves when they stake/unstake an NFT, but you unfortunately can't trust farmers to update their own space. Is there an aspect of the current farming rewards distribution mechanism you'd like to see improved?
Generally no, as the CHIPs cover Chialisp puzzles that can run on the current version of the blockchain. I think a hard fork would be needed for the split idea, for example. Probably best to ask over Discord, where people with better knowledge in that area can answer. |
|
CHIP call slides (call in 8h13m from now) |
|
As suggested in the call, please find the benchmarks produced by the tests from chia-wallet-sdk below. Each action call aims to build a 'realistic' spend bundle. You can compare the values against the ones provided in the Chia Documentation, although I found the docs to be (sometimes severely) under-reporting some costs. EDIT: With the addition of three new reward distributor modes and the release of the Rue rewrite, raw test results became a bit too long to be included in this thread. Please see this comparison, which uses the costs reported in the 'Average' benchmark column. For full data, don't hesitate to fork my current working branch of chia-wallet-sdk and run the tests yourself. |
|
The recording of our Zoom call for these CHIPs is now available: |
|
I think, there is a small code optimization possible in Alternatively, instead of carrying in WITHDRAWAL_SHARE_BPS carry in WITHDRAWAL_SHARE_BPS divided by 10000 and update the above line of code accordingly. Similar optimizations can be applied to |
Are you definitely sure the |
Based on the cost table https://chialisp.com/costs/ it seems that it is slightly cheaper. However, I did not perform any tests. IMO, more importantly, / produces rounding error while * does not. Whether this rounding error can be exploited or not, I do not know. The second proposed optimization. At this point a curried in parameter is divided by a constant 10000, both are known at compile time, so why not just curry in the quotient. If only integers can be curried in, this optimization cannot be applied. |
The static cost difference between Chialisp has no floats to my knowledge, which is why the puzzles use BPS and divide by 10000 on the go. The order of operations was specifically chosen to preserve as much precision as possible in the calculations. Rounding is always done in the dApp's favor (to the user's disadvantage) to prevent potential exploits. |
|
CHIPs 50 and 51 have a working implementation, and all comments so far have been addressed. These CHIPs are now in |
|
Puzzles will be updated to use better precision for rewards: blog.fireacademy.io/p/too-discrete-to-handle-how-low-cat |
|
Hi Yakuhito, just wanted to share some notes and feedback on your CHIP-51. First and foremost, thanks for building this! Even in its first form this a great thing to have in the CHIA ecosystem. I've been testing with your https://rewards.fireacademy.io/distributor/datalayer-minions I have 106 minions staked. After claiming, I received 75 DIG coins, each of amount 0.016, and there are more to claim. Claiming a second time... It appears the rewards batch per NFT. In the single-NFT case this is good, as I receive one reward coin per claim. In the multi-nft case, it'd be nicer if I received one coin overall. At present, following a claim, I need to do a sweep operation in my wallet in order to keep the rewards manageable.
Next, thinking about staking mechanisms that are common in other blockchains (e.g. ETH and Solana), there are a few very common patterns that I would love to see CHIA support so that we have feature parity. Maybe those are better as future CHIPS, but to lay out the wishlist I would look for CHIA's staking mechanisms to facilitate:
I imagine many of these would be large efforts deserving separate CHIPs, but since you've thought through the Chialisp on this, perhaps some of these items are viable to bring into scope for this CHIP. |
|
Hey, all! As I mentioned in a DM I sent @judeallred shortly after his comment, I held off responding to the last comment until the new version of the reward distributor was tested and ready to be discussed. I'll address the points below, then send another (independent) comment detailing the update. Please feel free to ask for clarifications/post new questions that may arise.
For the first question: yes! The reward distributor was initially designed for DIG, and the NFT mechanism was added as an extension. DIG mirrors would only have one entry ('ticket'), while, in the first version of the NFT reward distributor, each NFT acted as its own, independent entry. I severely underestimated the number of people holding 10+ NFTs of a given collection. With the new version, multiple NFTs (or CATs, more on that later) can be consolidated into the same entry - there will be one 'ticket' per user, not per NFT. This means you'll be able to get your payout in one coin only, with no real disadvantages other than slightly more complex staking/unstaking code. For the second question: limits were set so spend bundles do not reach the maximum cost allowed for mempool items (5.5 billion - half a block). Now that payouts are done in a single coin for all your NFTs, you won't come near that limit - so you'll get all your rewards in one claim. A lot of users have asked for this, and I'm glad the new version of the reward distributor will have a much better experience. The only operation where you'll still have to do 'batches' is staking and unstaking - unfortunately, moving NFTs around is really expensive, so I don't think you'll be able to stake (or even transfer) 103 NFTs in a single block. Still, I think work on the drivers/frontend could improve the experience on that front (e.g., upload 5 offers one after the other, and the site automatically tries to stake one batch per block until the queue is empty).
For the purpose of this CHIP, only one reward token is allowed per reward distributor. While it's possible to have more than one token, it would require a big architectural change. If the demand is there, a future reward distributor version could be built to allow this along with a new CHIP. A lot of distributors may work with just one reward token, and assuming one reward token only allowed me to make a lot of optimizations in the current code. It may make sense to still have them run with the current standard, and then anyone who wants to take sponsorships in another token could use the other standard (which would be more costly given the increased complexity). Much like it makes sense to separate asset-asset partial offers from multi-asset ones, I think this distinction is important here as well.
To quote AI, "You're absolutely right!" - the new version of the reward distributor has a mode where you can stake CATs to earn rewards. The main use case I see for this type is allowing projects to incentivize TibetSwap liquidity, but I'm sure the community will come up with entirely new ways to use this primitive.
Really appreciate the examples you're providing! All the modes included in this new CHIP will allow the users to unstake assets at any time. That said, at the Chialisp level, there is an easy way to add these kinds of timed locks via custom locking/unlocking puzzles. In short, you'd only have to write the locking/unlocking puzzles for a distributor that locked tokens according to the rules you mentioned above - you could then reuse most of the code of the current distributors (slot consolidations, payouts, accounting, etc.).
DAOs on Chia are another beast (see CHIP-0024), and definitely a major undertaking. I think reward distributors could remain mostly independent and make this scenario possible by having the DAO mechanism designed around them. It seems it would only require custom locking/unlocking puzzles. Each action already produces announcements - right now, users use those to secure the bundle, but dApps may as well use them to assert certain operation were done on the distributor.
These are actually very interesting! The fact that the entries become fungible (sTokens instead of users each having a 'ticket' to reclaim staked assets) means the reward distributor is not ideal for them, but you could use something extremely similar, as the reward 'accumulation' mechanism (which I wrote about here) is the same. Honestly, this sounds like a really exciting project from a technology point of view.
Once again, thank you very much for the interesting ideas! Your comment heavily influenced the decision to generalize locking/unlocking into puzzles to keep reward distributor flexible so that future extensions will require minimal work (specifically timed locks). While some features are addressed by the new version (slot consolidation/CAT reward distributors), the line between this CHIP and future ones needs to be drawn somewhere. The reward distributor in particular is a very complex dApp where every new feature needs careful design, optimization, testing, and reviews - while all the cases you mentioned are very interesting, I think we should be very wary with scope creep, as any new feature would require a lot of effort. That said, I think this next deployment will show the capabilities of the general system on Chia, and I hope it will inspire everyone to keep building on top of this CHIP. |
|
Hey, all! We're excited to announce the 2nd generation of reward distributors, with some awesome new features:
Tests are now passing for the new version! As there is a lot of new code, we're aiming to go through another security review before proceeding to an alpha/pilot of the new reward distributor in collaboration with multiple ecosystem projects. If you're interested in being part of the new alpha test, please reach out! We're extremely excited about the reward distributor, and expect it to impact a big part of the current and future Chia ecosystem. |
|
As @Yakuhito mentioned, CHIP-51 has undergone a major update. Please review both CHIPs 50 and 51 at your convenience. These CHIPs will remain in |
No description provided.