Turing Consulting (turingconsulting)

Turing Consulting

Securing and optimizing the blockchain: gas optimization, security audits, tokenomics and tech DD

9 Followers

Recent casts

Throwing errors in assembly is a simple way to further improve your gas costs. The following snippet shows two contracts performing the same data validation, one using solidity and another one using inline assembly, where the latter is more optimal than the former 👇

  • 1 reply
  • 0 recasts
  • 0 reactions

Storage buckets allow you to point to explicit storage slots of your choosing, not relying on the compiler to perform such task. A great pattern if you want to avoid painful situations where a contract's storage might get corrupted during an upgrade👇

  • 1 reply
  • 0 recasts
  • 0 reactions

Top casts

We’ve seen many projects wasting tons of gas checking for enum values. In our last audit, we found a situation where an enum storage ID had to be validated prior to an execution. Do you see why it is extremely inefficient? Let’s check how this code can be improved and optimised👇

  • 1 reply
  • 2 recasts
  • 2 reactions

We can see how we can perform the same checks just by validating if the queried storage ID is less than 2. This can lead to significant gas improvements even if not performed with assembly, as stated in the following snapshot comparing the differences:

  • 1 reply
  • 0 recasts
  • 1 reaction

DM us for REAL gas optimisations that will make your code be extremely improved!🙌🏻

  • 0 replies
  • 0 recasts
  • 1 reaction

As we can see, the previous snippet will check if the storageId parameter is different from the valid Storage IDs and revert in case none of them is valid. However, this can be performed in a more efficient way if we consider the fact that enums are actually uint8 types👀

  • 1 reply
  • 0 recasts
  • 1 reaction

Onchain profile

Ethereum addresses

    Solana addresses