-
Notifications
You must be signed in to change notification settings - Fork 400
Description
Problem Description
The Poseidon hash function is a zero-knowledge (ZK) ecosystem-friendly cryptographic hash. Currently in our contracts, we can directly create Poseidon instances, but each message processing requires re-instantiating the Poseidon instance. This process involves loading substantial constant data, resulting in unnecessarily high gas costs.
Key Issues
-
Current Limitation: Is it possible to instantiate the Poseidon instance during contract initialization (loading all constant data once) and share it across subsequent contract calls? (This approach appears unfeasible with current architecture)
-
Proposed Solution: If the above approach is not viable, we should implement native Poseidon hash support in the CosmWasm framework. This would allow the Poseidon instance data to be pre-loaded in the chain's runtime environment, eliminating redundant loading and reducing gas costs.
Technical Context
- Poseidon hash is particularly important for ZK-related applications and privacy-preserving smart contracts
- The constant data loading during each instantiation creates significant overhead
- Native runtime support could provide both performance benefits and cost reductions
Desired Outcome
More efficient Poseidon hash implementation in CosmWasm contracts with reduced gas consumption for ZK-related operations.