Skip to content

Commit 64a262f

Browse files
committed
Renaming: "transaction reordering" -> "transaction displacement"
1 parent 62c1a88 commit 64a262f

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

manticore/ethereum/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
DetectUninitializedStorage,
1818
DetectRaceCondition,
1919
DetectManipulableBalance,
20-
DetectTransactionReordering,
20+
DetectTransactionDisplacement,
2121
)
2222
from .account import EVMAccount, EVMContract
2323
from .solidity import SolidityMetadata

manticore/ethereum/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
DetectRaceCondition,
1414
DetectorClassification,
1515
DetectManipulableBalance,
16-
DetectTransactionReordering,
16+
DetectTransactionDisplacement,
1717
)
1818
from ..core.plugin import Profiler
1919
from .manticore import ManticoreEVM
@@ -56,7 +56,7 @@ def get_detectors_classes():
5656
DetectExternalCallAndLeak,
5757
DetectEnvInstruction,
5858
DetectManipulableBalance,
59-
DetectTransactionReordering,
59+
DetectTransactionDisplacement,
6060
# The RaceCondition detector has been disabled for now as it seems to collide with IntegerOverflow detector
6161
# DetectRaceCondition
6262
]

manticore/ethereum/detectors.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -884,15 +884,15 @@ def did_evm_execute_instruction_callback(self, state, instruction, arguments, re
884884
REPLAYING = "replaying"
885885

886886

887-
class DetectTransactionReordering(Detector):
887+
class DetectTransactionDisplacement(Detector):
888888
"""
889889
Detects cases where:
890890
* transaction Y returns successfully
891891
* for some transaction X from a different account, when X precedes Y, Y reverts
892892
"""
893893

894-
ARGUMENT = "transaction-reordering"
895-
HELP = "Susceptible to transaction reordering attacks"
894+
ARGUMENT = "transaction-displacement"
895+
HELP = "Susceptible to transaction displacement attacks"
896896
IMPACT = DetectorClassification.MEDIUM
897897
CONFIDENCE = DetectorClassification.HIGH
898898

@@ -920,16 +920,15 @@ def will_run_callback(self, states: Iterable[State]):
920920
consts = config.get_group("evm")
921921
if consts.sha3 is consts.sha3.symbolicate:
922922
logger.warn(
923-
"Unsound symbolication can cause the transaction reordering attack"
923+
"Unsound symbolication can cause the transaction displacement attack"
924924
+ " detector to produce false positives"
925925
)
926926
context[WARNED] = True
927927

928928
if not context.get(TROUBLEMAKER):
929929
# sam.moelius: Use same initial balance as in ManticoreEVM.multi_tx_analysis.
930930
troublemaker = self.manticore.create_account(
931-
balance=10000000000000000000,
932-
name="troublemaker",
931+
balance=10000000000000000000, name="troublemaker",
933932
)
934933
context[TROUBLEMAKER] = troublemaker.address
935934
self.debug("troublemaker = %s", hex(troublemaker.address))
@@ -987,7 +986,7 @@ def did_close_transaction_callback(self, state: State, tx: Transaction):
987986
state,
988987
tx.address,
989988
0,
990-
f"{tx.result} following transaction reordering",
989+
f"{tx.result} caused by transaction displacement",
991990
False,
992991
)
993992

tests/ethereum/test_general.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
State,
2222
DetectExternalCallAndLeak,
2323
DetectIntegerOverflow,
24-
DetectTransactionReordering,
24+
DetectTransactionDisplacement,
2525
Detector,
2626
NoAliveStates,
2727
ABI,
@@ -46,7 +46,7 @@ def disposable_mevm(*args, **kwargs):
4646
try:
4747
yield mevm
4848
finally:
49-
shutil.rmtree(mevm.workspace)
49+
pass # shutil.rmtree(mevm.workspace)
5050

5151

5252
class EthDetectorsIntegrationTest(unittest.TestCase):
@@ -63,39 +63,39 @@ def test_int_ovf(self):
6363
self.assertIn("Unsigned integer overflow at MUL instruction", all_findings)
6464

6565

66-
class EthDetectorsTransactionReordering(unittest.TestCase):
67-
def test_transaction_reordering_basic(self):
66+
class EthDetectorsTransactionDisplacement(unittest.TestCase):
67+
def test_transaction_displacement_basic(self):
6868
# log.set_verbosity(5)
6969
consts = config.get_group("evm")
7070
consts.sha3 = consts.sha3.concretize
7171
mevm = ManticoreEVM()
72-
mevm.register_detector(DetectTransactionReordering())
72+
mevm.register_detector(DetectTransactionDisplacement())
7373
filename = os.path.join(THIS_DIR, "contracts/basic.sol")
7474
mevm.multi_tx_analysis(filename, tx_limit=1)
7575
mevm.finalize()
7676
self.assertEqual(len(mevm.global_findings), 1)
7777
all_findings = "".join([x[2] for x in mevm.global_findings])
78-
self.assertIn("REVERT following transaction reordering", all_findings)
78+
self.assertIn("REVERT caused by transaction displacement", all_findings)
7979

80-
def test_transaction_reordering_sqrt(self):
80+
def test_transaction_displacement_sqrt(self):
8181
# log.set_verbosity(5)
8282
consts = config.get_group("evm")
8383
consts.sha3 = consts.sha3.concretize
8484
mevm = ManticoreEVM()
85-
mevm.register_detector(DetectTransactionReordering())
85+
mevm.register_detector(DetectTransactionDisplacement())
8686
filename = os.path.join(THIS_DIR, "contracts/sqrt.sol")
8787
mevm.multi_tx_analysis(filename, tx_limit=1)
8888
mevm.finalize()
8989
self.assertEqual(len(mevm.global_findings), 1)
9090
all_findings = "".join([x[2] for x in mevm.global_findings])
91-
self.assertIn("REVERT following transaction reordering", all_findings)
91+
self.assertIn("REVERT caused by transaction displacement", all_findings)
9292

93-
def test_transaction_reordering_sqrt_better(self):
93+
def test_transaction_displacement_sqrt_better(self):
9494
# log.set_verbosity(5)
9595
consts = config.get_group("evm")
9696
consts.sha3 = consts.sha3.concretize
9797
mevm = ManticoreEVM()
98-
mevm.register_detector(DetectTransactionReordering())
98+
mevm.register_detector(DetectTransactionDisplacement())
9999
filename = os.path.join(THIS_DIR, "contracts/sqrt_better.sol")
100100
mevm.multi_tx_analysis(filename, tx_limit=2)
101101
mevm.finalize()

0 commit comments

Comments
 (0)