Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

New Cairo Gen #869

Merged
merged 197 commits into from
Mar 1, 2023
Merged

New Cairo Gen #869

merged 197 commits into from
Mar 1, 2023

Conversation

rodrigo-pino
Copy link
Contributor

@rodrigo-pino rodrigo-pino commented Jan 23, 2023

Big update to cairoUtilFuncGen that make generated functions part of the AST and their code is stored inside this nodes

Fix #855
Fix #843

Before this PR:

Cairo generated functions raw string were stored in mappings outside of the solc-typed ast. Dummy functions definitions where created with empty bodies and function calls to this function definitions. When removing unnecessary function definitions the raw strings remained because there are outside of the AST.

After this PR:

  1. Raw strings functions are part of the AST, so when deleting one, generated raw code is deleted accordingly.

  2. Imports are treated as function definitions as well, so they get pruned when no one is using it.

To accomplish (1) and (2) there are now two new Cairo-AST nodes: CairoGeneratedFunctionDefintion and CairoImportFunctionDefinition.

Also on this PR:

All raw string cairo functions signatures gets parsed instead of being written by hand.

Refactorization in all util function generations (some more than others) to make them all have all the same external interface.

Warplib function signatures (name and implicits) are parsed from the generated code.

cicr99 and others added 30 commits January 5, 2023 11:19
 Conflicts:
	src/cairoUtilFuncGen/abi/abiDecode.ts
	src/cairoUtilFuncGen/abi/abiEncode.ts
	src/cairoUtilFuncGen/abi/indexEncode.ts
	src/cairoUtilFuncGen/calldata/calldataToStorage.ts
	src/cairoUtilFuncGen/memory/arrayConcat.ts
	src/cairoUtilFuncGen/memory/memoryWrite.ts
	src/cairoUtilFuncGen/storage/storageWrite.ts
@cicr99 cicr99 merged commit 1e51366 into develop Mar 1, 2023
@cicr99 cicr99 deleted the new-cairo-gen branch March 1, 2023 07:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cairo util generated functions code is outside the nodes that define them. Cairo Generated Function Pruner
5 participants