-
Notifications
You must be signed in to change notification settings - Fork 352
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
Migrate account presets to camelCase #446
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @martriay! I left a small suggestion. Also, should we update the IAccount magic value in the constants
lib (and subsequently in the docs)?
func is_valid_signature( | ||
func isValidSignature( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to camelCase the return is_valid
here as well
@martriay The more I think about this the less I think it is a good idea. I started to align in the Argent repo then realized it posed a lot of questions: should I use camelCase for external function parameters as well? Output parameters? The answer is probably yes if you want to be consistent (weird to have both camel case and snake case in the same function definition), but then you are passing camel case variables to your snake case internal methods... and you are back to the same mixing mess. Not even mentioning the fact that While I can understand the logic of using camel case for ERC standard, the |
Hello @juniset thanks once again for giving this a thorough thought.
Yes. All external methods and its parameters would be camelCased as per the extensibility pattern. We've received many questions/complaints around us not following it and the confusion this generates. We agreed with them.
The extensibility pattern tries to provide easy to follow guidelines to design libraries and contracts. It does not reference EIPs or other networks, it's purely StarkNet. Although it recognizes the existence of EIP-based interfaces, it's not the goal to specify how to deal with them but to simplify the thought process so developers don't have to think whether they're interacting/interfacing with an ERC standard to name their functions, so it simply uses Part of the reason for this is that there's a lot of non-EIP but defacto standards such as access control interfaces, or you could even be implementing an interface that ends up being an EIP in the future. EIP-ness of an interface is not future proof. The goal therefore is to have a super simple mental model: if it's an external/public function of a contract, it needs to be camelCase. You don't need to worry about deciding/guessing whether it corresponds to an existing (or future!) EIP or not.
I recognize there's 2 exceptions here: system-defined account entrypoints ( There's one super important point to highlight here: ecosystem-wide consistency was not possible since the moment starkware decided to use snake_case for their stdlib (unlike Vyper), and users wanting to follow ERC interfaces. Unless one of them gets dropped, we can't have consistency. Once we accept inconsistency, the question is what rule/pattern are we going to use to decide when to use each casing. Here's is where we lean towards the simpler model: all external interfaces have to be camelCase (an easier superset of camelCasing ERC contracts only). Distinguishing between non/ERC contracts is a much harder thought process with no clear gain, since we'll have inconsistencies anyway. This decision only minimizes those inconsistencies.
Considering the points presented above, I believe the ecosystem is already diverging by itself. Some projects use cameCase for their externals, some projects use ERC contracts, etc. If we were to not implement camelCase on the Account, we would not be following the Extensibility pattern thus collaborating to the growing chaos. Casing mixing already exists and this change is our own take on how to minimize it, using some form of occams' razor: if in doubt, choose the simpler model. Re: discussion, there were discussions for this (here and here) and if anything they just showed lack of ecosystem-wide agreement, for which we need to reply with an opinionated decision otherwise we'll stall. Finally, considering that:
Is that we sadly cannot afford to reopen this discussion so close to releasing. |
This PR is superceded by #449 btw. |
There is ecosystem wide agreement on naming now - it's
This change didn't really have to be in the 0.10 support release, you decided so. I'm curious, did you consult any of the leading wallet providers (Argent, Braavos, Ledger, MetaMask, apologies if I'm missing any) about this breaking change? Finally, won't changing this break the StarkNet CLI? |
Milan your tone has been way too confrontational in all discussions so far, even when you were mistaken like in here. I'd like to gently ask you to change it if you're interested in positive discussion. This change was planned for this release as you can see the issue that this very PR aims to close, is part of the same release as Cairo 0.10. The comment you're linking is just saying we should close that issue in the same PR instead of a different one.
We did. Julien himself expressed his concerns but accepted the decision a while ago. Now he's been working on it and had second thoughts, but it was agreed.
Good point, we'll have to coordinate with them although probably they were going to include it anyway since they use our implementation and we didn't release one for 0.10 yet. |
And yes I decide what's on the roadmap because that's my job. But we've been super public about our roadmap and design, more than any other project in the space. And the rationale behind my decision is above: to bundle as many breaking changes together as possible, to minimize migration hurdles. We have to make decisions. Some of them good, some of them bad. We aim to maximize the former, minimze the latter. But it's not easy, especially when there's no ecosystem wide agreement and I understand you feel very strongly about your opinion, but it's not enough to legitimize it. We are forced to make a decision and I know of very few projects taking community input as we do, but this decision has been made and the rationale is above. Unless a very big reason appears (which has not), we cannot afford to change plans 1 or 2 days before releasing, I'm sorry. You're still on time to discuss what's happening on the next release, and the one after that. |
You are right. Even though I follow this repo quite closely, I don't remember seeing the project management UI and I missed that the Also note it's nothing personal, I'm simply trying to stand up for what I believe is right.
Yes, I do have a strong opinion as do you. So that applies both ways☝🏼
That's simply not true. Cairo stdlib is snake case, so there's precedence. Furthermore, I've presented a handful of well known projects above, all using snake case in their API. From my point of view, this change doesn't bring any benefit to the ecosystem. |
Thanks @martriay for the detailed response. And I'm sorry to have reopened the discussion, just realised some implications of it while working on its implementation :-) @milancermak I want to emphasise that Martin has been very transparent and communicative about this change, and we started the discussion a while ago. While I don't necessarily agree with it, I do recognise that it makes sense for the consistency of the OZ repo since their starting point is to write ERC compliant contract standards on StarkNet. And I did agree to it for the sake of consistency. But we need to communicate that change to the wider ecosystem because I might keep both versions ( |
I know and I appreciate you being on top of our development process, you made notable contributions in the past so I'm glad to know we can keep it civil.
Sure that's what I mean by lack of ecosystemic agreement but as I said before decisions have to be made and I'm in a position that forces me to do so. I know I'll bear the weight of bad decisions and this time I think this is the right way.
Yes, very understandable.
I think this is one of Milan's most accurate points. I started to reach out to projects so they update accordingly. I also sent an updated comment on the standard account interface discussion, and I'll open an issue on the shamans forum. Closing this now since it's been superceded by #449. Thanks again for your comments. |
Fixes #382