Oliviajune
I would like to know what are the possible solutions to multiple permutations in smart contracts?
Reply 0 0
admin
Hello Olivia

Many concurrency bugs like Event Ordering arise in the smart contract due to multiple permutations. Contracts can be seen as objects with a mutable state and a set of interfaces for users to access such state. These interfaces can be invoked by many users simultaneously; the order in which these invocations (transactions) will be executed is determined entirely by the miners. Moreover, contracts can access off-chain services for various purposes. The replies from these services can be asynchronous, leading to a nondeterministic ordering on the blockchain. The technical barrier to finding reordering bugs is that the path and the state space of the analysis blows up combinatorically. One effective state-of-the-art technique for such analysis is based on dynamic symbolic execution (DSE), implemented by many existing analyses for contracts.

There are many open source tools like libocr which consists of a Go library and a set of Solidity smart contracts that implement the Chainlink Offchain Reporting Protocol, a Byzantine fault tolerant protocol that allows a set of oracles to generate offchain an aggregate report of the oracles' observations of some underlying data source. This report is then transmitted to an onchain contract in a single transaction.

Moreover Libocr has permutations helper package, which generates possible number of permutations for easy testing and analysis of smart contracts.
Reply 0 0
Reply