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
feat: Separate Tokenomics from Core Protocol to a Controller Contract #13791
Comments
With tokenomics you mean the proposer selection/prover selection/fee system right? (I think that goes well above what people would normally understand under tokenomics so just making sure). Yes I think we should do this, same with the verifier contracts this will otherwise get too messy if we want to make this more flexible/modular.
If it makes things significantly simpler I think it should be fine to call for each block. With how current gas costs are set up to make warm storage reads/writes very cheap compared to cold ones (even true for calls), the gas savings probably won't be that significant while the complexity of batching things could be high (and also costs gas).
There could still be a shared independent smart contract where funds could be stored that could be used by multiple Taiko instances (sure, costs some extra gas), it'll be up to the specific instance to use that or not, but could make sense depending on how the selection mechanism works. |
Brecht, appreciate your insights. Contemplating on this issue and Dani's PR, which isolates verifier logic into a separate contract, I still want to advocate for cost-optimization over composability. In the long run, any third party utilizing our code will inevitably modify it to minimize gas costs and eliminate inter-contract calls, nullifying the benefit of contract division. I propose leveraging inheritance. The core protocol could simply define empty virtual functions, allowing derived contracts to override these with bespoke logic. We should experiment to measure the difference in gas cost with these two options. |
I've conducted some testing on (this PR) and would like to share some of my observations:
Based on my testing, I am leaning towards maintaining the current design - keeping both the |
I would actually argue for the opposite, too much focus on gas costs at this point. It's very easy to optimize things once we're happy with the functionality and design (in this case: just replace the external contract call by an internal library call and you're done). Optimizing each step towards that final design is just wasted effort I feel. I agree that we don't want to be more flexible than needed and so don't want to add functions/APIs that we don't need at this point. |
So a bit more on why I think optimizing at this point is early: things will still change, pretty significantly as far as I currently know, and who knows what else will come up in the next months. And even the things we know that still have to change aren't fully figured out yet.
Implementing these and making sure they work: not so easy. |
I'm somewhat in the middle of this. I'd like to separate the logic from maintenance/upgradeability/readability point of view but what if we can have a good compromise ? As we tested with the verifier, separating this into 2 different deployable contracts would cost somewhere around 4-5k gas with the current design and data on-chain (which is kinda significant: 0.009 USD ATM / block).
This would also most probably imply, we need to upgrade the protocol anyways, so one advantage of separating the protocol vs. the proof verification into different deployed contracts most probably gone but the fee stays, so it's not a win-win. TBH, i like the way we outsourced the proof verification on this PR to different libraries. Maintainable, maybe we could even do an aggregated internal function (as we did already some commits ago - just removed due to gas optimization) but all in all i'm somewhere in the middle. |
Honestly I'm probably also somewhere in the middle! My main point is simply that for me it seems we should optimize for simplicity and ease of changing things. We're not planning on using the protocol on mainnet very soon so why worry so much about gas costs? Realistically we're gonna go through a couple of iterations before we get something we'll actually want to deploy on mainnet, so I don't see a reason we should try and optimize each iteration as much as possible and then throw it away anyway. |
Yes, this is why i say im on the middle too - not too focused on gas (tho we should be reasonable with them) but rather to have something which is not a nightmare to maintain during the upcoming iterations. :) To me main question is: which one is easier and more practical ? |
Currently, tokenomics is tightly integrated with the core protocol. I suggest decoupling the tokenomics code into a distinct contract. This division would:
This decoupling, however, might inflate gas costs.
Certain implementation precautions are necessary:
It may be beneficial to rename 'tokenomics' to a more representative term like controller. This contract could whitelist proposer/prover addresses without token or tokenomics involvement. For example, a company could create a simple controller contract for deploying a centralized, permissioned Taiko rollup without a token.
Considering the core protocol may not require a token, we might want to remove
taikoTokenBalances
and associated functions from the core protocol. The controller contract could then undertake token minting/burning operations if tokens are introduced.The text was updated successfully, but these errors were encountered: