<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Comput. Sci.</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.48550/ARXIV.2309.10781</article-id>
      <title-group>
        <article-title>Noninterference Analysis for Smart Contracts: Would you Bet on it?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Samia Guesmi</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>CarlaPiazza</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>SabinaRossi</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Università degli Studi di Camerino</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Università degli Studi di Udine</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Università Ca' Foscari di Venezia</string-name>
        </contrib>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>884</volume>
      <issue>2021</issue>
      <fpage>116</fpage>
      <lpage>135</lpage>
      <abstract>
        <p>In the context of Blockchains and Decentralized Finance the notion of Maximal Extractable Value (MEV) is attracting more and more attention. MEV is the maximum gain that users-including miners and validators-can obtain by interacting with a smart contract and with its dependencies. Such profits witness attacks that also exploit strategic transaction manipulations (e.g., reordering transactions in blocks) and distort the meaning of smart contracts. The use of the notion of noninterference for modeling and analysing MEV attacks has recently been proposed in the literature. Noninterference aims to capture unwanted information flows in multi-level systems. Various definitions of noninterference have been presented, and among these those based on unwinding conditions allow the possible flows to be specifically located in a system. In this paper we investigate the use of such unwinding conditions to analyze MEV. We exploit a simple case study-the Bet contract-to highlight the advantages and disadvantages of our proposal.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Smart Contracts</kwd>
        <kwd>MEV</kwd>
        <kwd>Noninterference</kwd>
        <kwd>Unwinding Conditions</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Decentralized Finance (DeFi) is revolutionizing the landscape of the global digital economy by
amalgamating decentralization and distribution principles with traditional financial services. This
integration operates within a decentralized framework, leveraging digital assets primarily through blockchain
technology1[
        <xref ref-type="bibr" rid="ref2 ref3">, 2, 3</xref>
        ]. Such pioneering methods engender an alternative financial system distinguished
by its emphasis on decentralization, fostering innovation, promoting interoperability, and ensuring
transparency4][. Ethereum, renowned for its sophisticated smart contract functionality, stands as
the cornerstone technology supporting various DeFi services. Smart contracts serve as automated
enforcers of contractual terms, allowing for intricate interactions between parties without the need f
intermediaries5[].
      </p>
      <p>
        Despite the security assurances provided by blockchain technology, DeFi smart contracts possess
inherent vulnerabilities as highlighted in recent s6t]u.dWieitsh[ in the DeFi ecosystem, decentralized
exchanges (DEXs) play a central role by facilitating trustless transactions through smart contract
eliminating the need for centralized intermediaries. Automated Market Maker (AMM) protocols, a
prominent feature of DEXs, have garnered significant attention in the wake of increased interest in
blockchain technology. These protocols operate on a peer-to-pool basis, wherein liquidity providers
contribute assets to liquidity pools, enabling users to exchange assets at algorithmically determined
prices [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>In the realm of Blockchains and Decentralized Finance (DeFi), the concept of Maximal Extractable
Value (MEV) is gaining increasing attention. MEV represents the maximum potential gain that users,
including miners and validators, can achieve through interactions with a smart contract and its
associated dependencies7[]. This potential for profit attracts not only legitimate users but also malicious
actors who exploit strategic transaction manipulations, such as reordering transactions within block
to manipulate the outcomes of smart contracts. These actors often employ automated bots to engage
in frontrunning, exploiting transactional intricacies for potent8]i.alNgoatianbsle[ examples of MEV
exploitation include instances of decentralized exchange (DEX) arbitrage, where participants exploit
price diferences across decentralized exchange protoc9o].lsSu[ch attacks not only compromise the
integrity of smart contracts but also distort their intended functionality.</p>
      <p>
        Recent literature has proposed utilizing the concept of noninterference for modeling and analyzing
MEV attacks. Noninterference aims to identify and mitigate undesired information flows within
multilevel systems. Various definitions of noninterference have been introd1u0c,1e1d,[
        <xref ref-type="bibr" rid="ref12 ref13">12, 13</xref>
        ], with those
based on unwinding conditions particularly useful for pinpointing potential information flows within a
system [
        <xref ref-type="bibr" rid="ref14">14, 15, 16</xref>
        ]. Our study builds upon prior research, particularly drawing from the contributions
by Babel et al. in17[] and by Bartoletti et al.1i8n].[Specifically, Bartoletti et al.’s work introduces a
novel concept of secure composability for smart contracts, aiming to safeguard compound contracts
from economic harm caused by adversaries interfering with their dependencies.
      </p>
      <p>
        In this paper, our investigation centers on the application of unwinding conditions to analyze the
Maximal Extractable Value (MEV). Our approach involves a meticulous examination of a
straightforward case study—the Bet contract—with the aim of elucidating both the strengths and limitations of
our methodology. Specifically, we utilize a simple imperative concurrent language, as introduced in a
previous study1[
        <xref ref-type="bibr" rid="ref4">4, 16</xref>
        ] for security verification, to identify vulnerabilities within DeFi smart contracts
that are susceptible to MEV interferences. Through the presentation of the Bet contract case study, we
spotlight scenarios where particular conditions afect MEV noninterference, thereby emphasizing
potential sources of vulnerability within DeFi services. Diferently from the prop1o8]s,awleofex[ploit
the formalization of noninterference in terms of unwinding conditions. This allows us to abstract from
the environment, namely the specific implementations of smart contracts that interact with the one
under examination. This abstraction enables a more comprehensive evaluation of MEV vulnerabilities
within DeFi systems.
      </p>
      <p>Structure of the paper. The structure of the paper is as follows: In Se1c,twioenpresent the case study
of the Bet contract. Sect2ioinntroduces the concept of noninterference for an imperative concurrent
language and outlines the use of downgrading to capture the release of sensitive information. Section
3 details the modeling of the Bet contract within our imperative language, including the capture of
the noninterference property and the application of downgrading functionality to diferentiate secure
scenarios from potentially risky ones. Finally, Section 4 discusses related work and concludes the
paper.</p>
    </sec>
    <sec id="sec-2">
      <title>1. The Bet Contract Case Study</title>
      <p>
        In this section we briefly introduce the main functionalities of a betting service, as also detailed in
[
        <xref ref-type="bibr" rid="ref16">18</xref>
        ], which serves as a straightforward case study in this paper to demonstrate how to instantiate
noninterference expressed through unwinding conditions for detecting MEV attacks. Specifically, the
Bet contract we consider enables individuals to place bets on the exchange rate between a given token
and Ether. This contract is parameterized based on an oracle contract responsible for providing token
price information. Upon deployment, the owner initiates the bet contract with an initial pot of Ether;
for joining, a player is required to contribute an amount of Ether equal to the pot. Prior to the deadline,
the player can withdraw the pot if the oracle exchange rate is greater than the bet rate defined by
the Bet contract owner. Subsequently, after the deadline elapses, the pot is transferred to the owner’s
wallet.
      </p>
      <p>We explore two instances of the oracle contract, with the first being an Automated Market Maker
(AMM) inspired by the Uniswap protocol (shetet,ps://uniswap.org/). This AMM allows users to
both add liquidity for two tokens and execute swaps between the held tokens. Additionally, the contract
enables the querying of token pairs and exchange rates. In contrast, the second oracle contract, referred
to as the Exchange contract, difers from the AMM contract in terms of rate setting. In the AMM, the
rate is afected by the fluctuations in the total amount of tokens staked in the AMM wallet, equating to
the division of the total amount of one token by the total amount of the paired token. Conversely, in
the Exchange contract, the rate is solely determined by the owner and remains unafected by variations
in wallet values resulting from user interactions.1Fiilglursterates the primary functionalities of the
Bet contract and its potential interactions with either AMM or Exchange.</p>
      <p>
        As detailed in1[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], MEV attacks become feasible when the Bet contract employs AMM as its oracle.
In this scenario, an attacker can place a bet and subsequently interact with the AMM contract before
executing the function to claim the win. By doing so, the attacker alters the exchange rate, thereby
influencing the outcome of the bet. This vulnerability is not limited to regular users; its success rate
significantly increases when the attacker is a miner with the ability to dictate transaction order within
blocks. Conversely, if the Bet contract relies on the Exchange contract as its oracle, the attacker cann
modify the rate, even if interaction with the Exchange contract occurs.
      </p>
      <p>In the forthcoming sections, we will show that when we use noninterference for modeling this attack
the wallet of the bet contract is going to play the role of the low level variable over which we observe
a flow of information (denoted by a gre enin Figure1). Such flow of information comes from the
high level variable representing the exchange rate (denoted byina rFeigdure1), i.e., from a variable
whose value can be altered by other contracts. Our approach ofers the advantage of focusing solely
on the bet contract and identifying potentially dangerous instructions within it. Then, a thorough
analysis of the oracles becomes imperative to distinguish between the two scenarios.</p>
    </sec>
    <sec id="sec-3">
      <title>2. Noninterference and Downgrading over a Concurrent Imperative</title>
    </sec>
    <sec id="sec-4">
      <title>Language</title>
      <p>In [16] we considered an imperative concurrent language, inspired by the one introd1u9c]eadnidn [
proposed diferent notions of noninterference with the aim of ensuring that in multi-level systems,
where users are categorized as high (e.g., system administrators) and low (e.g., standard users) no
information flow occurs from the high level to the low one. A flow of information from high to low
could in fact represent the public disclosure of private data.</p>
      <p>Recognizing that completely preventing any potential flow might be overly restrictive in many
scenarios, we also proposed a downgrading mechanism16in]. [This mechanism enables explicit
allowance of delimited flows, providing a nuanced approach to managing information flow within the
system.</p>
      <p>In this section, we provide a brief overview of those papers. However, to maintain simplicity in
our presentation, we refrain from utilizing specific observational equivalences, like, e.g., bisimulation.
Instead, we solely focus on observing the values of low-level variables at the end of the execution.</p>
      <sec id="sec-4-1">
        <title>2.1. The Language</title>
        <p>Letℤ be the set of integer number=s, { true,false} be the set of boolean valu esb,e a set of low
level locations anℍd be a set of high level locations, w∩itℍh = ∅ . The setAexp of arithmetic
expressions is defined by the grammar:
 ∶∶=  |  |</p>
        <p>0 +  1 |  0 −  1 |  0 ∗  1
. We assume that arithmetic expressions are total. TBheexspeotf boolean
where ∈ ℤ and ∈  ∪ ℍ
expressions is defined by:
where 0,  1 ∈ Aexp.</p>
        <p>∶∶= true| false| ( 0 =  1) | ( 0 ≤  1) | ¬ |  0 ∧  1 |  0 ∨  1</p>
        <p>We say that an arithmetic expres si oisnconfidential , denoted by ∈ high, if there is a high level
location which occurs in it. Otherwise we sa y tishpautblic, denoted by ∈ low. Similarly, we say
that a boolean expressionis confidential , denoted by ∈
high, if there is a confidential arithmetic
expression which occurs in it. Otherwise we say tihsaptublic, denoted by ∈
low. This notion
of confidentiality, both for arithmetic and boolean expressions, is purely syntactic. Notice that a high
level expression can contain low level locations, i.e., its value can depend on the values of low level
locations. This reflects the idea that a high level user can read both high and low level data.</p>
        <p>The setProg of programs of our language is defined as:
 ∶∶=
skip |  ∶=  |</p>
        <p>0;  1
 ∶∶=  |</p>
        <p>0;  1 | if() { 0} else { 1} | while() {} | await() {} | co  1| … |  oc
where ∈ Aexp,  ∈  ∪ ℍ</p>
        <p>, and  ∈ Bexp. Notice that, as i1n9[], in the body of thaewait operator
only sequences of assignments are allowed.</p>
        <p>The operational semantics of our language is based on the nosttiaoten. oAf stat e is a function
which assigns to each location an integer∶, i .∪e.ℍ,
⟶ ℤ
. Given a state, we denote by [ /]
the state′ such that′( ) =</p>
        <p>and  ′( ) =  ( )
restriction ofto the low level locations and we w=rite for  =   .</p>
        <p>for al l ≠  . Moreover, we denote by the</p>
        <p>Given an arithmetic expressi o∈n Aexp and a stat e, the evaluation oifn , denoted by⟨,  ⟩ → 
with ∈ ℤ , is defined in the standard way. Similarl⟨y,,⟩ → 
with ∈</p>
        <sec id="sec-4-1-1">
          <title>Bexp and  ∈ { true,false},</title>
          <p>denotes the evaluation of a boolean expressiinona state. In both cases atomicity of the evaluation
operation is assumed.</p>
          <p />
          <p>Our operational semantics is expressed in terms of state transitions. A transition from a program
 and a state has the form⟨,  ⟩</p>
          <p>→ ⟨ ′,  ′⟩ where ′ is either a program or the special symebnodl
(denoting termination) a n∈d{ high, low} stating that the transition is either confidential or public.
The operation1∪ 2 returnlsow if both 1 and 2 arelow otherwise it returhnisgh. Letℙ = Prog∪{end}
and Σ be the set of all the possible states. The operational sema⟨n, t⟩ic∈s ℙof× Σ
is thelabelled
transition system (LTS) defined by structural induction onaccording to the rules depicted in T1aibnle
the Appendix. Intuitively, the semantics of the sequential composition imposes that a program of the
form  0;  1 behaves lik e 0 unti l 0 terminates and then it behaves li1k. eTo describe the semantics
of a program of the forwmhile() {}</p>
          <p>we have to distinguish two cases:iisftrue, then the program
is unravelled t;o while() {} ; otherwise it terminates. As far asatwhaeit operator is concerned,
if  is true thenawait() {}</p>
          <p>terminates executi ngin one indivisible action, i.e., it is not possible
to observe the state changes internal to the execu t,iwohniolef if is false thenawait() {}
loops
waiting for to become true. Finally, in a parallel composition of thceof or0m|… |  oc any of the
  can move, and the termination is reached only when a l l’sthhaeve terminated.</p>
          <p>We use the following notations. We w⟨r, i⟩te→ ⟨</p>
          <p>low
{low, high} and ⟨ 0,  0⟩ →</p>
          <p>⟨  ,   ⟩ with ≥ 0 for⟨ 0,  0⟩ → ⟨ 1,  1⟩ → ⋯ → ⟨ −1 ,  −1 ⟩ → ⟨  ,   ⟩.</p>
          <p>The notatio⟨n 0,  0⟩ ⇝ ⟨  ,   ⟩ stands for⟨ 0,  0⟩ → ⟨  ,   ⟩ for some ≥ 0 with all t hetransitions
high
⇝
labelled witlhow; similarly⟨ 0,  0⟩
⟨  ,   ⟩ stands for⟨ 0,  0⟩ →
 ⟨  ,   ⟩ for some ≥ 0 with
at least one of thetransitions labelled whitihgh. Finally, we writ⟨e, ⟩ ⇝ ⟨
′,  ′⟩ to denote
′,  ′⟩ to denote⟨, ⟩

→ ⟨ ′,  ′⟩ with ∈</p>
          <p>⇝ ⟨ ′,  ′⟩ with ∈ { low, high}.</p>
          <p>Notice that the operational semantics defined in T1aibslneon-deterministic, since in the case of
parallel composition there are many possible evolutions.</p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>2.2. Noninterference</title>
        <p>
          Intuitively, when we analyze a prog ratmhat involves both low and high-level variables, our
objective is to ensure that regardless of how the high-level variables are modified during execution by other
high-level components, which represent interactions with high-level users, the values of the low-level
variables remain unafected. Put simply, if actions performed by other components on the high-level
variables lead to changes in the low-level ones, it signifies an unwanted information flow, or
interference. In essence, we focus solely on the prograamnd aim to demonstrate its security in any possible
context or environment – meaning, irrespective of the actions taken by high-level users. This concept
is formalized in 1[
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], where ageneralized unwinding condition defines classes of programs that are
parametric with respect to:
• a binary relatio≐nwhich equates two states if they are indistinguishable for a low level observer;
• a binary reachability relatℛioonn ℙ × Σ which associates to each p⟨a,i⟩r
all the pair⟨s,  ⟩
which, in some sense, are reachable fr⟨o, m⟩ .
        </p>
        <p>low level observer;
• a binary relatio≑nwhich equates two pai⟨r,s⟩ and ⟨, ⟩ if they are indistinguishable for a
A pair⟨, ⟩ satisfies (an instance of) our unwinding framework (i.e., there are no flows of
informahigh
→</p>
        <p>⟨, ⟩
tion from high to low) if any high level ⟨s ,t ⟩ep
performed by a pair⟨ ,  ⟩
reachable
from ⟨, ⟩</p>
        <p>has no efect on the observation of a low level user. This is achieved by requiring that all
the elements in the s{e⟨ t,⟩ |  ≐  }
reaching an element of the {s⟨e, t⟩ | ⟨, ⟩
ℛ(⟨, ⟩) = {⟨ ,  ⟩ | ⟨, ⟩ℛ⟨ ,  ⟩}</p>
        <p>.
low level observer). We use the notaℛtio(⟨n, ⟩)</p>
        <p>to denote the set of pairs reachable ⟨fr,o⟩m , i.e.,
(whose states are low level equivalent) may perform a transition
≑ ⟨, ⟩}</p>
        <p>(whose elements are all indistinguishable for a
Definition 1. (Generalized Unwinding) Let≐ be a binary relation ovΣe,rℛ and≑ be two binary
relations oveℙr× Σ. We define the unwinding class  (≐, ℛ, ≑) by:
 (≐, ℛ, ≑) = {⟨, ⟩ ∈</p>
        <p>Prog × Σ ∣ ∀ ⟨ ,  ⟩ ∈ ℛ(⟨, ⟩)
def
if ⟨ ,  ⟩
high
→
⟨, ⟩</p>
        <p>then
∀  ∈ Σ such that≐  , ∃ ⟨, ⟩ ∶
⟨ , ⟩ → ⟨, ⟩
and⟨, ⟩
≑ ⟨, ⟩}</p>
        <p>We will now apply the concept of generalized unwinding in one of its simplest forms, which will
serve as a suficient foundation for our analysis in the subsequent section focusing on our case study.
high
⟶ ⟨, ⟩ ⇝ ⟨ end,  ′⟩
⟨,  ⟩
 =  
↑
↓
↑
↓
⟨, ⟩
⟶
⟨, ⟩ ⇝ ⟨
↑
↓
≈

↑
↓
↑
↓
↑
↓
 ′ =  ′
end,  ′⟩
they assign the same values to the low level variables, i.e., we c≐ontsoidbeer the relatio=n. The
relationℛ is the notion of reachability we rely on⇝,i.eis., defined by the operational semantics.
In [16], we introduced the concept of low-level bisimulation to define what the low-level user can
observe. Specifically, we utilized low-level bisimulation to instantiate the equivalence relation denoted
by ≑. Bisimulation is the appropriate notion to employ when it is assumed that the low-level user can
observe the values of low-level variables at any point during the execution. Also other more involved
forms of approximating equivalences such as the one presente2d0]inco[uld be used for our aims.
However, for the sake of simplicity in our current presentation, we make the assumption that the
lowlevel user can only observe the values of variables at the end of the execution. We are aware of the fact
that this is not a good choice when non-terminating programs are considered. Formally this means
that we instantia≑taes ≈ defined as follows.
⟨, ⟩ ⇝ ⟨</p>
        <p>end,  ′⟩, there exists a pa⟨iernd,  ′⟩ such that⟨, ⟩ ⇝ ⟨
Definition 2 (≈ ). Let⟨, ⟩
and⟨, ⟩
be two pairs. It holds th⟨,a⟩t≈
 ⟨, ⟩</p>
        <p>if and only if whenever
end,  ′⟩ with ′ =  ′, and
viceversa (i.e.,≈ is symmetric).</p>
        <p>Now that we have gathered all the necessary components, our objective is to demonstrate that a
program does not exhibit interference. In other words, for all possible, tsthaetpeasir⟨, ⟩
belongs
to (=</p>
        <p>, ⇝, ≈ ). Through our case study, we will illustrate that when this condition is not met, it may
lead to MEV interferences.</p>
        <p>As demonstrated in our previous wor1k6],[ when a program does not belong to an unwinding
class, it is possible to define a malicious environment wherein information flows from high to low.
This means that by analyzing the program in isolation, we can pinpoint potential hazardous scenarios.
In other words, when a program belongs to an unwinding class, no adverse consequences can arise,
regardless of the actions taken by the environment. One of the main advantages of the unwinding
approach is its ability to identify the specific points within the program that could potentially lead to
information flows. As illustrated in Fig2u,rseuch flows occur when high-level transitions are executed.</p>
        <p>In the context of MEV interference, this approach aids in identifying the specific dependencies of
the contract that require deeper analysis. When scrutinizing these dependencies reveals that no
adverse outcomes can occur, it is possible to leverage the concept of downgrading, thereby permitting
controlled information flows.</p>
        <p>Example 1. In order to provide some more intuition on the meaning of the unwinding condition, let
us consider the followning toy example.</p>
        <p>≡  ∶= 0; if( &gt; 0){ ∶=  }
Let be high level and be low level. Apparently, when we reach the if test the value of the high
level variable i0s, so the else branch is always taken and the value of the high level variable is not
revealed. However, this program does not satisfy our unwinding condition as one can observe taking
for instance which assigns valu0eto
and  that is[ /1]
. As a matter of fact, when the if test
is reached we have to consider the possibility that another program running in pa ralhlaesl with
modified the value of , thus allowing to take the if branch and reveal the value of the vtaoriable
the low level user.</p>
      </sec>
      <sec id="sec-4-3">
        <title>2.3. Downgrading</title>
        <p>
          As noted by numerous researchers, the concept of noninterference can be overly limiting in numerous
practical scenarios. Noninterference models the complete absence of information flow from high to
low levels. However, in reality, many programs do require some form of reledaoswenogrrading of
sensitive information (e.g., password checking, information purchase, and spreadsheet computation)
[
          <xref ref-type="bibr" rid="ref12 ref19">12, 21</xref>
          ].
        </p>
        <p>The intuitive concept of downgrading masks certain intricate issues at the implementation level.
For example, it raises questions like ”who can perform downgrading,” ”what elements can be
downgraded,” ”where downgrading can occur,” and so forth. In our previous1w6]o, rwke[introduced a
collection of high-level expressions and proposed a delimited notion of noninterference that permits
the downgrading of such expressions at any stage during the execution.</p>
        <p>In this paper, we opt to focus on a notion of downgrading that pertains to the precise point within
the execution where the downgrading occurs. This aligns with our approach of using unwinding
conditions to pinpoint specific points in the execution of a smart contract where potential MEV
interferences may arise. To achieve this, we introduce a function cdaowllnegdrade that maps any arithmetic
or boolean expression to itself, while altering its confidentialitylloewv. eClotnosequently, the
operational semantics of program instructions invodlovwinnggrade are declassified to the low level, and
they are not considered as dangerous in the unwinding test.</p>
        <p>Example 2. We consider again the progr amof Example1. If we know that revealing to the low
level user the value ofis not dangerous, and it is necessary (e.g., the system administrator needs to
send to the user a message), then we can modify the pro graasmfollows:
 ≡  ∶= 0;  ∶=
downgrade( ); if( &gt; 0){ ∶= }
If  is low level, the only point where we should check the unwinding condition, is the second
assignment instruction. However, since dtohwengrade operator is used, when the assignment is executed a
low level transition is performed and the unwinding condition is satisfied.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>3. Back to the Bet Contract</title>
      <p>We are now ready to model the Bet contract case study within our imperative language. In our model,
the Bet contract is defined as the parallel composition of its functionalities, namely:</p>
      <p>Bet_Contract ≡ co Constructor | Bet | Win | Close oc .</p>
      <p>Since our language provides only basic instructions and lacks object-oriented features, we exploit the
await operator to enforce the desired order of execution. For instance, the Constructor should
execute first. Additionally, in our code, we denote variables using strings that begin with capital letters,
while constants are enclosed in quotation marks.</p>
      <p>The Constructor program is responsible for deploying the Bet_Contract. Let us assume a
program named Owner initializes the variables InitialPot, Rate, Token, Oracle, and Deadline. Additionally,
the variable OracleGetToken contains the returned value of the GetToken program, which is a part of
the oracle contract, and it is used to check that the oracle contract allows the exchange between Eth
and Token. Another program, Zero, assigns zero values to the variables InitialPot, Rate, Token,
Oracle, and Deadline. The Constructor program awaits the initialization of the variables InitialPot, Rate,
Token, Oracle, and Deadline. Subsequently, it verifies that the oracle program can exchange Ether and
Token. If this is the case, it updates the variables BetOwner, BetOwnerWalBletWEtahlelre.,tWe
highlight the variabBleetWalleitn green as it is the variable we aim to safeguard from MEV attacks,
meaning it will be designated as low-level.</p>
      <p>Zero</p>
      <p>The Bet program continuously runs until the deadline set by the Bet_Contract owner in the
variable Deadline is expired. It waits for the Player to be ‘NULL’ and for PotBet to be non zero. The
condition for Player to be ’NULL’ ensures that another user is not already placing a bet. Additionally,
PotBet must be non-zero, indicating that the Player program has initialized the variables PotBet and
SenderBet. If the PotBet is valid, the program updates the variables Player, PlayerWalletEther, and
BetWalle.t
1: Program Bet
2: while (Deadline&gt; BlockNum) do
3: await (Player = ‘NULL’ ∧ PotBet ≠0d)o
4: skip
5: if (PotBet= BetWalle)tthen
6: Player∶= SenderBet;
7: PlayerWalletEth∶e=r PlayerWalletEth−erPotBet;
8: BetWalle∶t= BetWalle+t PotBet
9: else
10:
11:</p>
      <p>PotBet∶= 0;</p>
      <p>SenderBet∶= 0</p>
      <p>Similar to the Bet program, the Win program runs continuously until the deadline expires. It awaits
the current player, whose name is stored in the variable Player, to claim victory. This indicates that
when the player wishes to claim, they will use another program to modify the value of the variable
SenderWin. Upon this action, the Win program compares the variables BetRAamtemaRnadteEthe.rIf
the latter is greater than the former, the player receives the entire vBaeltuWe aolflte.htTehe variable
AmmRateEtheris highlighted in red because its value is determined and modified within the oracle
program (AMM or Exchange in our example). We lack control over its value, making it a potential
source of MEV attacks.</p>
      <p>1: Program Win
2: while (Deadline&gt; BlockNum) do
3: await ( SenderWin = Playerd)o
4: skip
5: if (BetRate&lt; AmmRateEthe)rthen
6: PlayerWalletEth∶e=r PlayerWalletEth+erBetWalle;t
7: BetWalle∶t= 0
8:
9:
1: Program Constructor
2: await ( InitialPot ≠0 ∧ BetRate ≠0 ∧ Deadline ≠0 ∧ Oracle ≠0 ∧ Tokedno≠0)
3: GetToken
4: if (Token≠ ‘Ether’∧ OracleGetToke=n (‘Ether’ , Token)) then
5: BetOwner∶= SenderConstruct;or
6: BetOwnerWalletEth∶e=rBetOwnerWalletEth−eIrnitialPo; t
7: BetWalle∶t= BetWalle+t InitialPot
8: else
9:
else</p>
      <p>SenderWin∶= ‘NULL’
It’s worth noting that we explicitly designate the vBaertiWaballeleats low-level anAdmmRateEther
as high-level, while no specific designation is made for the other variables. In this scenario, we can
consider them as low-level by default, which is equivalent to solely focusing on potential MEV attacks
stemming from the variablAemmRateEthe.r</p>
      <p>At this point, we have all the necessary ingredients to assess whether the program Bet_Contract
meets our unwinding condition. Assuming that the only high-level varAimabmlReaitseEthe,rwe
observe that the sole high-level transition is triggered by line 5 of the Win program. When this transition
occurs we reach a state which leads to the end of the program with the low levBeeltvWarailalbelte
equal to0. However, if we modify only the high level variaAbmlmeRateEtherprior to the execution
of line 5, the program ends wiBtehtWallebteing non-zero. This discrepancy is suficient to infer that
Bet_Contract fails to satisfy the unwinding condition, indicating interference from high to low and
highlighting a potential source of MEV attacks.</p>
      <p>This small example provides insight into the functionality of unwinding conditions, demonstrating
their ability to analyze the program of interest independently of the blockchain environment in which it
will ultimately operate. Additionally, unwinding conditions ofer the benefit of identifying the precise
instructions and variables within the code that could potentially be exploited as attack vectors.</p>
      <p>However, we cannot draw a conclusion on the reliability of the Bet_Contract solely based on this
analysis. It is imperative to delve deeper into the oracle programs to assess whether the potential
attacks are indeed feasible. If these attacks are not deemed “realistic”, we can then utilize the
downgrading mechanism and consider the Bet_Contract as “secure”.</p>
      <p>Let us now examine the scenario where the oracle program is the AMM contract. Specifically, we
will analyze its core functionalities, particularly operations that significantly impact the token’s rate
An Automated Market Maker (AMM) is a decentralized finance (DeFi) algorithmic trading protocol
that enables the automatic exchange of cryptographic tokens through the use of liquidity pools.
Unlike traditional order book-based exchanges, AMMs provide liquidity through these pools, with prices
determined algorithmically based on the token ratios within the pool. Automated Market Makers
(AMMs) employ mathematical formulas to determine token prices within liquidity pools. The two
predominant AMM formulas are the Constant Product Market Maker (CPMM) and the Constant Sum
Market Maker (CSMM). In our case study, we use an AMM instance based on CPMM, which is
expressed by the formula=  ∗  , where represents the amount of token T1 in the AMM, and
represents the amount of token T2 in the AMM. This implies that the ratio of token quantities directly
influences the price of one token relative to another. Furthermore, the formula ensures that, while the
values for toke ns and  may fluctuate, the value fo r remains constant during trades or liquidity
deposits.</p>
      <p>The program GetRate returns the exchange rate between the two tokens T1 and T2, ensuring the
constant product of their quantities as defined earlier. This program computes and provides the value
of the variablAemmRateEthe,rwhich is used in the Win program within the Bet_Contract.
Similarly, in the code, variables designated in red are considered high-level. SpeAcmificmaRllayt, eT1 and
AmmRateT2 must be high-level because they correspond to the varAimabmlReateEtherused in the
Win program. Furthermore, the variabAlmesmWalletT1andAmmWalletT2also need to be high-level,
their significance will become clear upon examining the Swap program.</p>
      <p>1: Program GetRate
2: while true do
3: await ( T ≠‘NULL’) do
4: skip
5: if (T = ‘T1’) then
6: AmmRateT1 ∶= AAmmmmWWaalllleettTT12;
7: T ∶= ‘NULL’
8: else if (T = ‘T2’) then
9: AmmRateT2 ∶= AAmmmmWWaalllleettTT21;
10: T ∶= ‘NULL’
11: else
12:</p>
      <p>T ∶= ‘NULL’</p>
      <p>The Swap program enables token exchange based on the constant prKo.dTuhcte swapping
operation is governed by the values of AmountToSwap and TokenToSwap specified by the sender. If
the sender chooses to exchange AmountToSwap of token T1 for token T2, the program initially
computes the corresponding amount required for AmountToSwap in T2. Subsequently, it verifies
whetherAmmWalletT2holds adequate tokens to satisfy this amount. If it does, the program increases
AmmWalletT1by the specified AmountToSwap and decreaseAsmmWalletT2accordingly to maintain</p>
      <p>ZeroAMM</p>
      <p>As far as the levels of the variables are concerned,AsminmcReateT1 and AmmRateT2 have to be
high level, in order to ensure that the program Swap satisfies the unwinding condition, thYe variable
has to be high too (see line 7). This in turn impliesAtmhmaWtalletT1andAmmWalletT2have to be
high (see lines 8,9, 16, 17). Finally, this requires to the vaKriatoblbee high (see line 5).</p>
      <p>We already observed that line 5 of the Win program causes a flow of information witnessing a
possible MEV attack. Now that we possess a deeper understanding of the AMM contract, we can
demonstrate the interference resulting from the interaction with the AMM contract, utilizing the LT
notation outlined in Sect2i.o1n.Specifically, we will show how two executions of the same program
starting with the same low level variable values can end with diferent values for the low level variable
BetWalle.tLet us consider the program:</p>
      <sec id="sec-5-1">
        <title>Bet+Amm ≡ co Bet_Contract | Amm_Contract oc</title>
        <p>In particular, let us assume that we have reached the execution of:</p>
        <p>co (co Bet | Win | Close oc) | Amm_Contract oc
Moreover, the Player has been set to ‘BOB’and he has already added his PotBeBtetoWtahllee.tIn
this context, we designate the T1 token held within the AMM contract to represent Ethereum’s
native cryptocurrency, Ether. Thus, we denote AmmWalletT1 as AmmWalletEther and AmmRateT1 as
AmmRateEther. We focus on a st atien which the variables have the following values:
AmmWalletEthe=r 600; AmmWalletT2= 600; AmmRateEther= 1</p>
        <p>AmountToSwap= 300; TokenToSwap=T2</p>
        <p>BetWalle=t 10; BetRate= 2; SenderWin= ‘BOB’
If the execution sequence begins with the code of the Swap program, followed by GetRate, which
are part of the Amm_Contract, and concludes with the selection of Win, the resulting outcome is as
Conversely, if Win is executed prior to Swap, and then Swap follows, the outcome difers:
These two executions result in a distinct value for the low levelBveatrWiaabll e,tindicating a
potential MEV attack. In fact, in the second execution the BvaetrWiabalelehtas not been modified and
reaches the end with val1u0e. Notice that we are not delving into the specific identities of the player
and the user initiating the Swap. Nor we are assuming their ability to influence the scheduling order.
We are simply observing two diferent low-level behaviors. Further analysis is required to ascertain
the potential transformation of the first execution into a MEV attack. Naturally, if the player of the
Bet contract also interacts with the AMM and possesses the authority to dictate transaction order
a miner, they can ensure a favorable outcome, thereby enabling the occurrence of a MEV attack, as
highlighted in18[].</p>
        <p>Let us now examine the scenario where we leverage the Exchange contract instead of relying on the
AMM contract. In this case only the owner has the authority to modify the rate. Below, we model the
pivotal functionality of the Exchange contract, wherein the rate is altered.</p>
        <p>1: Program SetRate
2: while true do
3: await (NewRate ≠0 ∧ SenderSetRate = ExchangeOwndeor)
4: skip
5: ExchangeRate∶= NewRate;
6: NewRate∶= 0;
7: SenderSetRat∶e= ‘NULL’</p>
        <p>Let us modify the Win program at line 5 by replacing the varAimabmlReateEtherwith the variable
ExchangeRat.eOur analysis on the Bet contract is not afected. We still observe that the unwinding
condition is not satisfied witnessing a possible MEV attack. However, in this very simple example
one can assume that when the player in the Bet contract is diferent from the owner of the Exchange
contract, the player cannot be sure to win the bet. So, we can exploit the downgrading mechanism and
modify the Win program as follows.</p>
        <p>Player∶= ‘NULL’</p>
        <p>In this specific scenario, the noninterference property remains unscathed when utilizing the
Exchange contract as a price oracle, given that the adversary lacks the ability to manipulate the exchang
rate. With the Exchange contract, only the owner holds the authority to adjust the exchange rate, re
dering any attempts by adversaries to influence the exchange contract inefective in altering the rate.
However, it is essential to recognize that within this framework, there exists a potential information
lfow through interactions with the Exchange contract, particularly when the owner of the Exchange
contract coincides with the owner or player of the Bet contract. This introduces the possibility of
interference. However, interference does not arise when the player in the Bet contract difers from the
owner of the Exchange contract. To diferentiate this secure scenario from the potentially risky one
described earlier, we rely on the Downgrading functionality embedded in our language.</p>
        <p>The code implementation for this example encompasses smart contracts for Bet, AMM, and
Eexchange functionalities. Furthermore, we’ve developed a USDC ERC20 token to enable a hands-on
exchange experience with our custom token. The complete implementation in solidity can be found
on GitHub via the following licnokd:e repositor.y</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>4. Conclusion</title>
      <p>In this paper, we explore the application of unwinding conditions to analyze Maximal Extractable
Value (MEV) within the context of the Bet contract. Our investigation utilizes a simple imperative
concurrent language to model the Bet contract, shedding light on scenarios where specific conditions
impact MEV noninterference. This underscores potential vulnerabilities within decentralized finance
(DeFi) services. This is a first step, while an in depth analysis of the relationships between unwinding
conditions and MEV is left as future work.</p>
      <p>Comparing our approach with the contribution of Bartoletti1e8t] (asle.eianl[so AppendixB), our
focus lies in formalizing noninterference through unwinding conditions. By employing unwinding
conditions, we abstract from the environment, enabling us to disregard the specific implementations
of possible smart contracts interacting with the one under examination, 1u8n]l.ikCeleinar[ly this
is an advantage from the computational point of view, since it allows us to analyse smaller system.
Moreover, this approach facilitates the identification of critical points within the program that may
lead to information flows, thereby enhancing the security analysis of smart contracts. On the other
side, a second stage analysis of the dependencies is necessary in order to discard unrealistic sources of
attacks.</p>
      <p>Furthermore, the Bet contract case study presented in this paper illustrates the practical
application of our methodology in identifying and mitigating MEV attacks. Overall, our work contributes
to the comprehension and mitigation of MEV vulnerabilities in smart contracts within the realm of
decentralized finance. As future work we also plan to apply our framework.</p>
      <p>As future work we also plan to define our framework on fragments of languages for smart contracts,
such as solidity, in order to avoid possible discrepancies introduced relying on an intermediate
language. This is a dificult task due to the richness of languages for smart contracts. However, object
oriented features would avoid us the use of programming tricks, such as the use of the away operator,
for avoiding unwanted interleaving behaviors.</p>
    </sec>
    <sec id="sec-7">
      <title>Acknowledgments</title>
      <p>This work has been partially supported by the Project PRIN 2020 “Nirvana - Noninterference and
Reversibility Analysis in Private Blockchains”, and by the project SERICS (PE00000014) under the MUR
National Recovery and Resilience Plan funded by the European Union - NextGenerationEU.</p>
      <p>Wesley, 2000.
[16] A. Bossi, C. Piazza, S. Rossi, Compositional information flow security for concurrent programs,
2023, pp. 2499–2516. doi:10.1109/SP46215.2023.10179346.</p>
      <p>A. Operational Semantics</p>
      <p>⟨skip, ⟩ l→ow ⟨end, ⟩
⟨ 0, ⟩ → ⟨ 0′,  ′⟩
⟨ 0;  1, ⟩ → ⟨ 0′;  1,  ′⟩</p>
      <p>0′ ≢ end
⟨if() { 0} else { 1}, ⟩ → ⟨ 0, ⟩
⟨, ⟩→ true
⟨, ⟩→ true
⟨while() {}, ⟩</p>
      <p>→ ⟨; while() {}, ⟩
⟨, ⟩→ true ⟨, ⟩
⟨await() {}, ⟩
 →1∪ 2 ⟨end,  ′⟩</p>
      <p>⇝2 ⟨end,  ′⟩  ∈  1
⟨  , ⟩ → ⟨ ′,  ′⟩
 ∈ 
 ∈ 
⟨, ⟩ →</p>
      <p>⟨ ∶= , ⟩
→ ⟨end, [ /]⟩</p>
      <p>∈ 
⟨ 0, ⟩ → ⟨end,  ′⟩</p>
      <p>⟨ 0;  1, ⟩ → ⟨ 1,  ′⟩
⟨, ⟩→ false
⟨if() { 0} else { 1}, ⟩ → ⟨ 1, ⟩
⟨, ⟩→</p>
      <p>false
⟨while() {}, ⟩

→ ⟨end, ⟩</p>
      <p>∈ 
⟨, ⟩→</p>
      <p>false
⟨await() {}, ⟩
→ ⟨await() {}, ⟩
 ∈ 
 ∈ 
⟨co  1| … |  | … |  oc, ⟩ → ⟨co  1| … | ′| … |  oc,  ′⟩
⟨co end| … |end| … |end oc, ⟩ l→ow ⟨end, ⟩</p>
    </sec>
    <sec id="sec-8">
      <title>B. MEV and Local MEV in [18]</title>
      <p>
        In [
        <xref ref-type="bibr" rid="ref16">18</xref>
        ], the author delineates two notions of MEV. The first, termed global MEV, relies on the entire
blockchain stateto determine the value of MEV extracted from a conΔt.rTahcitscriterion introduced
by Babel et al. in17[], referred to a s-composability, asserts that contrΔacatrse composable in
a blockchain stateif addingΔ to does not aford the adversary a “significantly higher” Maximal
Extractable Value (MEV). Formally, denoting by(M)EtVhe maximal value adversaries can extract
from  , and with|Δ representing the blockchain staetxetended with contraΔct,sthe composability
criterion of Babel et al. is expressed as:
Δ is  -composable in if MEV (|Δ) ≤ (1 + ) MEV ()
(1)
where parameterizes the “not significantly higher” condition above. However, this approach has
limitations as elucidated 1i8n].[ For instance, utilizing the MEV of the entire state S as a baseline for
comparison complicates the interpretation of the concrete security guarantee of ε-composability.
The second notion of MEV, introduced by Bartoletti et al., is Local MEV, termed MEV non-interference.
This concept measures the maximal economic loss that adversaries can induce on a given set of
contracts, unlike global MEV, which applies solely to the entire blockchain state. By adapting the
definition of non-interference property to the DeFi setting, they stipulate that the MEV extractable
from Δ (the public output) should remain unafected by the dependencieΔs (otfhe private inputs).
Formally, MEV non-interference holds when the MEV extractable from the contract aΔc(ic.oe.u,nts in
†∆) using any contract in S | ∆ is exactly the same MEV that can be extracted using only the contracts
in ∆. They introduce the following definition:
Definition 3. (MEV non-interference). A st aties MEV non-interfering wiΔth,when
      </p>
      <p>MEV(|Δ, †Δ) = MEV†Δ(|Δ, †Δ).
(2)</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>[1] ethereum.org: what-is-defi?h</article-title>
          ,ttps://ethereum.org/en/defi/#what-is-,
          <source>d2e0f2i4. Accessed: jan 13</source>
          ,
          <year>2024</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>L.</given-names>
            <surname>Gudgeon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Werner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Perez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W. J.</given-names>
            <surname>Knottenbelt</surname>
          </string-name>
          ,
          <article-title>Defi protocols for loanable funds: Interest rates, liquidity and market eficiency</article-title>
          ,
          <source>in: AFT '20: 2nd ACM Conference on Advances in Financial Technologies, ACM</source>
          ,
          <year>2020</year>
          , pp.
          <fpage>92</fpage>
          -
          <lpage>112</lpage>
          .
          <year>do1i</year>
          :
          <fpage>0</fpage>
          .1145/3419614.3423254.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Werner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Perez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Gudgeon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Klages-Mundt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Harz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W. J.</given-names>
            <surname>Knottenbelt</surname>
          </string-name>
          , Sok:
          <article-title>Decentralized ifnance (defi)</article-title>
          ,
          <source>in: Proceedings of the 4th ACM Conference on Advances in Financial Technologies, AFT</source>
          <year>2022</year>
          , ACM,
          <year>2022</year>
          , pp.
          <fpage>30</fpage>
          -
          <lpage>46</lpage>
          . doi:
          <volume>10</volume>
          .1145/3558535.3559780.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J.</given-names>
            <surname>Xu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Paruch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Cousaert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Feng</surname>
          </string-name>
          , Sok:
          <article-title>Decentralized exchanges (DEX) with automated market maker (AMM) protocols</article-title>
          ,
          <source>ACM Comput. Surv</source>
          .
          <volume>55</volume>
          (
          <year>2023</year>
          )
          <volume>238</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>238</lpage>
          :
          <fpage>50</fpage>
          . d1o0i:.
          <volume>1145</volume>
          /3570639.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S.</given-names>
            <surname>Kitzler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Victor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Saggese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Haslhofer</surname>
          </string-name>
          ,
          <article-title>A systematic investigation of defi compositions in ethereum, in: Financial Cryptography and Data Security</article-title>
          . FC 2022 International Workshops - CoDecFin, DeFi, Voting,
          <string-name>
            <surname>WTSC</surname>
          </string-name>
          , volume
          <volume>13412</volume>
          oLfecture Notes in Computer Science, Springer,
          <year>2022</year>
          , pp.
          <fpage>272</fpage>
          -
          <lpage>279</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>031</fpage>
          -32415-4\_
          <fpage>18</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>L.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Xiong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Ernstberger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Chaliasos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Qin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Wattenhofer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Song</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Gervais</surname>
          </string-name>
          , Sok:
          <article-title>Decentralized finance (defi) attacks</article-title>
          ,
          <source>in: 44th IEEE Symposium on Security and Privacy</source>
          ,
          <string-name>
            <surname>SP</surname>
          </string-name>
          <year>2023</year>
          , IEEE,
          <year>2023</year>
          , pp.
          <fpage>2444</fpage>
          -
          <lpage>2461</lpage>
          .
          <year>doi1</year>
          :
          <fpage>0</fpage>
          .1109/SP46215.
          <year>2023</year>
          .
          <volume>10179435</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>P.</given-names>
            <surname>Daian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Goldfeder</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Kell</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Bentov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Breidenbach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Juels</surname>
          </string-name>
          ,
          <source>Flash boys 2</source>
          .
          <article-title>0: Frontrunning in decentralized exchanges, miner extractable value, and consensus instability</article-title>
          ,
          <source>in: 2020 IEEE Symposium on Security and Privacy</source>
          ,
          <string-name>
            <surname>SP</surname>
          </string-name>
          <year>2020</year>
          , IEEE,
          <year>2020</year>
          , pp.
          <fpage>910</fpage>
          -
          <lpage>927</lpage>
          .
          <year>do1i0</year>
          :.1109/ SP40000.
          <year>2020</year>
          .
          <volume>00040</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>D.</given-names>
            <surname>Bernhardt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Taub</surname>
          </string-name>
          ,
          <article-title>Front-running dynamics</article-title>
          ,
          <source>J. Econ. Theory</source>
          <volume>138</volume>
          (
          <year>2008</year>
          )
          <fpage>288</fpage>
          -
          <lpage>2961</lpage>
          .
          <year>0d</year>
          .oi: 1016/J.JET.
          <year>2007</year>
          .
          <volume>05</volume>
          .005.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>K.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Guan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <article-title>Towards understanding and characterizing the arbitrage bot scam in the wild</article-title>
          ,
          <source>Proc. ACM Meas. Anal. Comput. Syst</source>
          .
          <volume>7</volume>
          (
          <year>2023</year>
          )
          <volume>52</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>52</lpage>
          :
          <fpage>29</fpage>
          .
          <year>d1o0i</year>
          .:
          <volume>1145</volume>
          /3626783.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J. A.</given-names>
            <surname>Goguen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Meseguer</surname>
          </string-name>
          ,
          <article-title>Security policies and security models</article-title>
          ,
          <source>in: 1982 IEEE Symposium on Security and Privacy</source>
          ,
          <year>1982</year>
          , IEEE Computer Society,
          <year>1982</year>
          , pp.
          <fpage>11</fpage>
          -
          <lpage>20</lpage>
          .
          <year>1d0o</year>
          .
          <source>i:1109/SP</source>
          .
          <year>1982</year>
          .
          <volume>10014</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>R.</given-names>
            <surname>Focardi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rossi</surname>
          </string-name>
          ,
          <article-title>Information flow security in dynamic contexts</article-title>
          ,
          <source>J. Comput. Secur</source>
          .
          <volume>14</volume>
          (
          <year>2006</year>
          )
          <fpage>65</fpage>
          -
          <lpage>110</lpage>
          . doi:
          <volume>10</volume>
          .3233/JCS-2006-14103.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>S.</given-names>
            <surname>Crafa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rossi</surname>
          </string-name>
          ,
          <article-title>Controlling information release in the pi-calculus, Inf</article-title>
          . Comput.
          <volume>205</volume>
          (
          <year>2007</year>
          )
          <fpage>1235</fpage>
          -
          <lpage>1273</lpage>
          . doi:
          <volume>10</volume>
          .1016/J.IC.
          <year>2007</year>
          .
          <volume>01</volume>
          .001.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>J.</given-names>
            <surname>Hillston</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Marin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Piazza</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rossi</surname>
          </string-name>
          ,
          <article-title>Persistent stochastic non-interference</article-title>
          ,
          <source>Fundam. Informaticae</source>
          <volume>181</volume>
          (
          <year>2021</year>
          )
          <fpage>1</fpage>
          -
          <lpage>35</lpage>
          .
          <year>doi1</year>
          :
          <fpage>0</fpage>
          .3233/FI-2021-
          <year>2049</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>A.</given-names>
            <surname>Bossi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Piazza</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rossi</surname>
          </string-name>
          ,
          <article-title>Unwinding conditions for security in imperative languages</article-title>
          ,
          <source>in: Logic Based Program Synthesis and Transformation, 14th International Symposium, LOPSTR</source>
          <year>2004</year>
          , volume
          <volume>3573</volume>
          ofLecture Notes in Computer Science, Springer,
          <year>2004</year>
          , pp.
          <fpage>85</fpage>
          -
          <lpage>100</lpage>
          .
          <year>doi1</year>
          :
          <fpage>0</fpage>
          .1007/ 11506676\_6.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>K.</given-names>
            <surname>Babel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Daian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kelkar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Juels</surname>
          </string-name>
          ,
          <article-title>Clockwork finance: Automated analysis of economic security in smart contracts</article-title>
          ,
          <source>in: 44th IEEE Symposium on Security and Privacy</source>
          ,
          <string-name>
            <surname>SP</surname>
          </string-name>
          <year>2023</year>
          , IEEE,
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>M.</given-names>
            <surname>Bartoletti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Marchesin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Zunino</surname>
          </string-name>
          ,
          <article-title>Defi composability as MEV non-interference</article-title>
          , CoRR
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>G. R.</given-names>
            <surname>Andrews</surname>
          </string-name>
          , Foundations of Multithreaded, Parallel, and
          <string-name>
            <given-names>Distributed</given-names>
            <surname>Programming</surname>
          </string-name>
          , Addison-
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>A.</given-names>
            <surname>Marin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Piazza</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rossi</surname>
          </string-name>
          ,
          <article-title>Proportional lumpability</article-title>
          , in: É. André, M. Stoelinga (Eds.),
          <source>Formal Modeling and Analysis of Timed Systems - 17th International Conference, FORMATS</source>
          <year>2019</year>
          , Amsterdam, The Netherlands,
          <source>August 27-29</source>
          ,
          <year>2019</year>
          , Proceedings, volume 1175L0ecotufre Notes in Computer Science, Springer,
          <year>2019</year>
          , pp.
          <fpage>265</fpage>
          -
          <lpage>281</lpage>
          .
          <year>doi1</year>
          :
          <fpage>0</fpage>
          .1007/978-3-
          <fpage>030</fpage>
          -29662-9\_
          <fpage>16</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>A.</given-names>
            <surname>Marin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Piazza</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Rossi</surname>
          </string-name>
          ,
          <string-name>
            <surname>D</surname>
          </string-name>
          _PSNI :
          <article-title>Delimited persistent stochastic non-interference, Theor.</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>