This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add cli params * Simplify the config structure This allows to create commands that do not use chain configuration * Parse all files and isolate contract definitions * Performance tracking * Simplifications * Flattening works * An implementation that is not an approximation * Remove comments * Refactorings * Running on base 9/16 files are parsed correctly * Optimistic projects are flattening files from discovery without problems * Recursive imports * Resolve imports recursively * Take libraries into consideration Right now the support is only for libraries that are imported and later declared as 'using'. We don't currently support libraries that are imported and later used as 'Address.myLibraryFunction()'. This requires us to traverse the AST and find accesses that reach into libraries. * demo * Rename ParsingContext to ContractFlattener * This has to work * Comment out * Move this around * Stupid solution to a hard problem, not full * visited path is now just a function variable * Stale todo * Simple solution to infinite recursion * Checkpoint * Make this more readable * now we can detect libraries used inside the body of a contract * We don't support flattening when the file-tree has top level function declarations for now * Extract ParsedFileManager * Delete-delete-delete * lint and format * ContractFlattener is now a function * parseFiles is not a static function * pushSource is now just formatting * looks pretty * Remove code used for debugging * Flatten cases * Now the import path is just the remapped path * resolveRemappings are now just a function * Fix lint and format * ParsedFilesManager is now nicer * Clean out the runFlatten.ts * Tests for getASTIdentifiers * Tests for flattening * tests for ParsedFilesManager * Import torture test * Reverse the direction of flattening and source code hash is unique id * Add handling of missing AST node types Fixes dydx * Add messages to all asserts * rename libraries used to referenced contracts * Move saving into sub functions * Logging * Timing * Normalize imports and test it, fix import bug * Saving from discovery * Remove "unflattening" from source saving * Linting fix * Fix all tests * Fix types * Self-review * throughput formatting * renames and privates * Type imports * .join() * format * changeset
- Loading branch information
1 parent
bdf2a54
commit 419e72b
Showing
33 changed files
with
1,845 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# @l2beat/discovery | ||
|
||
## 0.43.0 | ||
|
||
### Minor Changes | ||
|
||
- Flattener | ||
|
||
## 0.42.2 | ||
|
||
### Patch Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Logger } from '@l2beat/backend-tools' | ||
|
||
import { DiscoveryCliConfig } from '../config/types' | ||
import { runFlatten } from '../flatten/runFlatten' | ||
|
||
export async function flattenCommand( | ||
config: DiscoveryCliConfig, | ||
logger: Logger, | ||
): Promise<void> { | ||
if (!config.flatten) { | ||
return | ||
} | ||
|
||
const { path, rootContractName } = config.flatten | ||
logger.info('Starting') | ||
|
||
await runFlatten(path, rootContractName, logger) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.