burnsignal / burnSignal-Spec

This repo is the specification for the Burner Vote application
3 stars 2 forks source link

PoC Solidity Overview #16

Open deomaius opened 4 years ago

deomaius commented 4 years ago

Solidity recommendations & improvements

Download here

I've taken the time to have a quick look over the state of the PoC's smart contracts and have some perspectives on how to tidy up some of the unnecessary code present. It is important to note I have not tested the contracts for myself, these recommendations are from a speculative point-of-view. I think there is a need for more critical thinking towards the poll design. In the larger scale of things a lot of gas is spent deploying independent contracts for each event and after their time of utility has come. They become a dysfunctional contract that only adds more misused space to the network itself. So that's why I think the leveraging the SELFDESTRUCT opcode would be interesting and a great display of efficiency but also where the possibilities are endless with the utility of the refunded gas.

The great thing about this is that we don't actually need any in-house contract storage to validate data for a certain poll, as the transaction history will give us all we need to know.

I'm eager to hear some of your perspectives and feedback.

auryn-macmillan commented 4 years ago

The suggestions all look reasonable to me. What are your thoughts @Tomasvrba?

@samgos if you can turn this into a pull request in the contracts repo, that would be awesome! https://github.com/burnSignal/burnSignalContracts

Tomasvrba commented 4 years ago

The suggestions all look reasonable to me. What are your thoughts @Tomasvrba?

@samgos if you can turn this into a pull request in the contracts repo, that would be awesome! https://github.com/burnSignal/burnSignalContracts

Awesome, thanks fr looking at it @samgos I will go over it over the weekend.

Tomasvrba commented 4 years ago

Thanks @samgos for going through the contract. I'm sure it can be improved in many ways, I hacked it together in a day with pretty limited understanding of Solidity XD

Using SELFDESTRUCT sounds like a great idea, when I put the contract together, it was really a rough prototype, and not optimized in any way. It is definitely way more expensive than it could be.

Overall, I think all the suggestions make sense. You are right that more accountability with regards to burned contributions is something that is missing completely. What to do with the contributions is something that still needs to be decided and implemented properly.

I would although refrain from implementing any sort of "reputation" system (especially self-baked), this stuff is highly immature and there are other projects (BrightID, Colony), that can be leveraged for that purpose. The purpose of BurnSignal is to impartially accept "signals" and it is up to any client/frontend to decide how to interpret those.