cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Attack.OutputsReordering

Description

This module exposes an attack consisting in reordering the outputs of a transaction, in an attempt to uncover vulnerabilities in smart contracts relying on the outputs order.

Synopsis

Outputs reordering params

data OutputsReorderingParams Source #

Parameters of the outputs reordering attack

Constructors

Swap Int Int

Swaps two elements in the list

Move Int Int

Moves one element from a given index to a given index in the list

Shuffle

Shuffle the list (generate all permutations, except the identity)

ManualReordering (forall a. [a] -> [[a]])

Do whatever you want with the outputs, manually, including removing some of them, or fully changing the list.

Outputs reordering label

data OutputsReorderingLabel Source #

A label added to a TxSkel on which a tweak reordering some outputs has been applied.

Outputs reordering attack

outputsReorderingAttack :: Members '[Tweak, NonDet] effs => OutputsReorderingParams -> Sem effs () Source #

Reorders the outputs following a given policy (parameters) to try and uncover vulnerabilities for smart contracts depending on the outputs order. This can also be used to uncover some cases of double satisfaction. This removes the permutations that turn out to be identical to the initial outputs list.