Refactor proposals #38
Reference in New Issue
Block a user
Delete Branch "refactor/proposal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@skddc can you help me to understand how the queryParams are used? I removed them for now (see the commit message) but I'm happy to readd them.
@bumi we need to look into hubot and how we should do the contributor look up there. I think if we have some kind of caching it would be better to have it in the kredits module
I'd remove the contributor ipfsHash from the proposal and only have the kredits id stored there. With that one the latest profile ipfs hash can be retrieved from the contract. This would also make sure that one always gets the latest profile hash of the contributor.
hope I did not forget some reason why the hash is stored there.
It is stored there, because you need to be able to access the profile at the time of the proposal. Otherwise someone can do nasty things or just plain accidental bad things.
They are used for linking a new proposal creation form, with any of the fields pre-set by the URL.
Nice!
I can't really test this in my browser at the moment, because it's using new Ethereum contracts, right? Just added a few comments for some minor things.
This looks a bit strange to me. Is there a benefit to not just importing the model and doing a
create()or something? (I'm not actually sure what's really happening here though.)Just a formatting thing: if it's only one function argument, we don't need the parentheses around it. So it looks a bit cleaner and reads just a tiny little bit easier.
I think the hash splitting and combining should not be done in here, but needs to in our kredits npm module, so we can use it from other programs as well.
The validations seem to be missing in the new serializer tests.
The problem with the
.create()is that we can not inject services because the model doesn't have a container. I'm unhappy with this as well and will try to figure out a better way.What we try right now is that we cleanup the kredits service and and extract all the common logic from the service in the npm module. That will be our next step.
hmmm. but all data is stored in the contract and that one holds the "truth".
the proposal IPFS hash is retrieved from the contract and through the contracts the contributor ipfs hash can be retrieved. (the latest one, but also thanks to blockchain the one at a specific time in the past - when the proposal was created).
To load data might be one more step: get the contributor by id from the contract and then access the contributor profile from IPFS.
I think at least we should also add the kredits contributor id to the proposal ipfs data to be able to get to the contributor in the contract from the ipfs proposal data.
Yes. I'll add it in
addContributorandaddProposaland usev4to do it. I think it's cleaner to validate before we save instead of while we serialize.Cool.
Sounds good.
yep, it uses the new contracts and the new truffle setup. That makes it way easier to develop and manage the contracts. Right now those are in: https://github.com/67P/truffle-kredits - but should replace the kredits-contract package.
Truffle has made great improvements in the last months and the ganache-cli is a great local network simulator and can easily be installed with npm.
There is setup information here:
https://github.com/67P/kredits-web#working-with-locally-deployed-contracts
Basically it is: