Under The Hood: Solana Code Review By A Blockchain Developer

Drake Mallard
4 min readJul 18, 2018

--

Introduction

This article was written by one of Under The Hood’s blockchain code review partners, Zia Haq. Zia is a seasoned software developer and researcher, with vast experience in finance, big data, cryptography and block chain development. It provides some insight into the Solana’s public code repository from the perspective of an experienced blockchain developer.

If you want more ICO code/tech reviews by experienced blockchain developers..Join our ‘Under The Hood’ Telegram Channel.

Enjoy.

Solana is another addition to an already steamed race of high throughput blockchain projects. It is coming up with a novel concept of using proof of history to scale the blockchain and aiming to process 710,000 transactions per second, it will be a long road to achieve this target. Here we will take a look at their code to see if they are on track and are set to achieve the goal.

Looking at their GitHub Repository the activity looks to have started earlier this years and has picked up the pace in last couple of months, there are 15 contributors to the repository committing the code frequently, that number suggest its big team of coders behind the project. A plus one to being with.

Let’s delve into the repository.

Let’s go into the core implementation of the project and pick up the Bank module. Which is handling the transactions. The code is well documented and we see a structure in the code. There are some unit tests as well but I would like to have seen some more tests as its not providing full coverage of the module. Nevertheless its good start and I hope to see more tests covering more scenarios.

Looking at the debit and credit functions, it’s pretty standard code and should do the job it suppose to do.

I noticed in apply credits function they are saying it may be safe to apply credits in parallel. I don’t like this statement, which leaves the consumer of this module in limbo to decide on the safety. They should clearly mention that its safe or not safe to utilize this module’s functionality in parallel.

(And don’t forget to join our ‘Under The Hood’ Telegram Channel.)

If I see the overall code of the module then it has not implemented any structure like Mutex (A mutual exclusive primitive to protect the shared data) that should safeguard against the side effects occurring due to parallel processing of transactions. To understand better, as an example an account with balance of 50 USD can execute two 40 USD debit transactions coming in parallel which is not right as second transaction should fail as there is not enough balance.

Next we move onto Entry module, in here they are building fundamentals to implement Proof of history. Good nicely structured code and in the direction of what they have outlined in their whitepaper, no major issues here though again would like to have seen some more unit tests. Hopefully they will be adding them as the project progresses.

Now look at the FullNode module which is hosting all the micro services e.g. Bank and Entry described above.

Again nice and cleanly written structured code. However one major issue which they hope will address in future. This is the module covering all the service so we need proper integration tests to test the overall functionally of the system I see these tests missing.

Conclusion:

Good, solid code that suggests they have a solid team behind it. Although they have used Rust language for implementation but the code is not rusty at all.

There are some issues as I pointed here but they still have a long way to go until the launch to iron out these issues.

If you want more ICO code/tech reviews by experienced blockchain developers..Join our ‘Under The Hood’ Telegram Channel.

Want to see the Lightstreams code ripped apart by two blockchain developers that accessed their private github? Checkout this article: https://medium.com/@drake.icoradar/under-the-hood-lightstreams-tech-review-by-two-blockchain-developers-bbd30ab60fbc

Disclaimer:

- The review is for educational purpose and not an investment advice. The comments made in this article are opinion of the writer.

- This review covers one area of the project and should not be taken as a view on the whole project.

- The review was done by auditing what is available publicly on 14 July, 2018. As code changes frequently so it’s highly likely you will see different/updated code in the repository by the time you are reading this article.

--

--