HerodotusDev / integrity

Apache License 2.0
62 stars 18 forks source link

fact_registry_FactRegistry.contract_class.json too large for deployment when LAYOUT_TYPES is set to "starknet" #145

Open swift-hl opened 2 weeks ago

swift-hl commented 2 weeks ago

I encountered an issue while deploying a contract to the StarkNet testnet. When I set LAYOUT_TYPES to "starknet", the deployment fails during the execution of the following command:

starkli declare ./target/dev/fact_registry_FactRegistry.contract_class.json

After investigating, it seems the functions eval_composition_polynomial_inner and eval_oods_polynomial_inner are too large, which likely causes the contract size to exceed the limits for deployment.

Would it be possible to optimize these functions?

Okm165 commented 2 weeks ago

Hey @swift-hl your observations are correct we resolve this issue by splitting the verifier to multi-contract logic. Checkout this https://github.com/HerodotusDev/integrity/tree/autogenerated_split branch we implemented this already. It will be merged into main after refactor and probably dynamic layout split addition.

Okm165 commented 2 weeks ago

As u noticed, the Cairo1 implementation of simple logic in auto-generated is main cause of the size of the contract class json. In the past I already introduced some Cairo1 specific impl tricks to reduce the size by 4x, if we find some more tricks to do so I will optimize the auto-generated further, but now we moved to splitting it.

swift-hl commented 1 week ago

I optimized the size of the contract class JSON in this PR 'https://github.com/HerodotusDev/integrity/pull/149'.