Skip to content

[Breaking API Change] Use list instead of set for filenames and contracts_names; change filename ordering#436

Merged
montyly merged 4 commits intodevfrom
ordering3
Jun 9, 2023
Merged

[Breaking API Change] Use list instead of set for filenames and contracts_names; change filename ordering#436
montyly merged 4 commits intodevfrom
ordering3

Conversation

@montyly
Copy link
Copy Markdown
Contributor

@montyly montyly commented May 16, 2023

Build on top of #432 + merge dev + fix pylint

One thing I am unsure is if crytic_compile.filenames should return a list or a set. This is a merge of all the filenames from the different compilation units, so it can contain duplicate. Solutions:

  • Return a Set
  • Return a List where the duplicate are removed
  • Return a List with duplicate

The set remove the order, however the order makes sense only at the compilation unit level, and not the CryticCompile level I think.

What do you all think?

@montyly
Copy link
Copy Markdown
Contributor Author

montyly commented May 16, 2023

(cc @samalws-tob for visibility)

@samalws-tob
Copy link
Copy Markdown
Contributor

The reasons we need CompilationUnit.filenames to be ordered are:

  • So that sourcemap numbers match file filenames indices
  • So that the output is deterministic

Both of these apply to CryticCompile as well, so I think CryticCompile.filenames should be a list.

It seems like, in any case involving echidna, only one CompilationUnit per CryticCompile will be used. So I would say don't worry about the ordering of filenames in the case of multiple compilation units; feel free to remove duplicates or move things around or anything like that. All that matters is that in single-compilation-unit builds, CryticCompile.filenames is ordered in the same way as CompilationUnit.filenames.

@montyly montyly added this pull request to the merge queue Jun 9, 2023
Merged via the queue into dev with commit d730f93 Jun 9, 2023
@0xalpharush 0xalpharush deleted the ordering3 branch January 22, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants