-
Notifications
You must be signed in to change notification settings - Fork 60
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
Streamline token chaincode params initialization #743
Comments
Hi @arner , thanks for reporting this issue. |
As far as I understand, we currently don't have that. Even though we require Init, and don't have a function for updates, we can't stop a quorum of endorsers from crafting a rwset offline, signing it and getting it committed. In my view, if that possibility is there, any hurdle in the chaincode is just cosmetic. In my proposal there is already a conscious decision by the endorsers to do the update, because they each have to manually update the parameters in their chaincode before someone invokes the update transaction (similar to the current way but easier). Contrary to, for instance, approving a transfer, which is done automatically by the chaincode and has no human oversight. If we want to enforce access control on who initiates the invoke, maybe an option could be key-level endorsement: that can be set to be stricter than the normal endorsement policy. Whether to use it and how to configure it would be different per use case though. |
so, the endorsement policy is the trust assumption that covers also against a subset of malicious endorsers that come together and try to update the namespace without an actual request from a user. So, it must set properly to avoid also this. In this sense, we don't have the issue you point to. I agree anyway that the process is not the simplest. Unfortunately, it would not be efficient to retrieve for each request the state from the ledger. We must cache it in some way. So, to summarize, I find it risky to allow anyone to submit new public parameters. The honest endorsers would have no way to check if they must accept these params or not. But what if we say that the issuer can update the public params? Would this be fine? We can ask the token-sdk to check such a signature. Wdyt? |
Agree. It means that (currently/by default) the rules are the same to update any key on the ledger. So a subset of malicious endorsers could arbitrarily reassign ownership of tokens, or change the issuer in the public parameters. I guess this is ok because both are pretty catastrophic, so we'd ensure a strong policy anyway.
This is fine. For the caching, the main thing I propose is to change the function behind initOnce (
I don't mean that the invoke would allow the user to submit the parameters as argument of the invoke. That would indeed be a bad idea. It would have a few steps:
Do you mean the client application? When would it check it? If it only sees it after the new params have been committed, it could get a bit messy with differing points of view (what does it do if it rejects the new params?). Issuer as authority makes sense, but maybe it's better to enforce it at the ledger level? Then we get back to either relying on the normal endorser quorum (which often includes the issuer organization as mandatory anyway) or key-based endorsement (I don't really like the added complexity - maybe someone might need it for specific cases but then they can just write the code for it ;) ). |
Let me make sure I understand. The proposal is: The administrator of each chaincode, update locally the public parameters and maybe a flag telling the chaincode that as soon as an Init command is received, it must be accepted and the flag reset. |
Yeah, except that I even don't think the flag and hash are necessary, they know to which params they update the file, right? Do we need an explicit vote or is the changing of the file your vote? However, now that you put it that way, we may not want the moment that the switch happens to be so free to choose for anyone... |
Current approach
The Fabric chaincode needs the fabric
--init-required
functionality: when deploying, before any other transaction, one party has to call the init function which then stores the public params on the ledger.This is not the most ergonomic feature, because:
From the Fabric docs:
The flow of the init function is as follows:
And when doing a transaction:
As far as I can tell this means that if an endorser changes their public params file and restarts the chaincode, transactions will fail because they're the only one reading it from the file.
Proposal
--init-required
. It doesn't change the trust assumptions because init has the same endorsement policy as normal functions.If you agree with the proposal I can make a PR.
The text was updated successfully, but these errors were encountered: