Skip to content

Instantly share code, notes, and snippets.

@emo-eth
Created December 9, 2022 20:23
Show Gist options
  • Save emo-eth/ee2a167109006d63f089ad01dd03a410 to your computer and use it in GitHub Desktop.
Save emo-eth/ee2a167109006d63f089ad01dd03a410 to your computer and use it in GitHub Desktop.
script to detect duplicate fn definitions in seaport IR out
from collections import defaultdict
from pprint import pprint
defs = []
with open("Seaport.sol") as f:
lines = f.readlines()
for line in lines:
line = line.strip()
if line.startswith("function fun_"):
defs.append(line.split("(")[0].split(" ")[1].strip())
common = defaultdict(list)
for d in defs:
no_fun = [x for x in d.split("_") if x][1]
just_name = no_fun.split("_")[0]
common[just_name].append(d)
multi = {}
for k, v in common.items():
if len(v) > 1:
multi[k] = v
pprint(multi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment