onflow / cadence

Cadence, the resource-oriented smart contract programming language 🏃‍♂️
https://developers.flow.com/cadence
Apache License 2.0
532 stars 139 forks source link

Move the `crypto` contract outside of cadence #3135

Open tarakby opened 7 months ago

tarakby commented 7 months ago

Issue to be solved

The crypto contract offers crypto tools that are fully developed in the cadence language and don't have to be built-in in the language. It makes more sense to take the crypto contract outside of the Cadence repo and add it as an independent standard library core-contract.

This issue is a follow-up on the discussion in https://github.com/onflow/cadence/issues/1447#issuecomment-1863220320

Suggested Solution

Moving the Crypto contract out of Cadence will require:

No additional work in the contract itself is required, we had already previously refactored it to be deployable like any other contract

j1010001 commented 6 months ago

Given the effort required to complete this (moving this as a separate contract, updating all contracts to import this) it is unlikely we can complete it in C1.0. It might need to stay where it is.

j1010001 commented 6 months ago

We might be able to do this in a non-breaking way, if we can make "import crypto" statement to work - then this would not be a breaking change.

bluesign commented 6 months ago

I feel like if something breaking will be done here, better to moving native types ( HashAlgorithm.etc ) inside crypto in a native way. Crypto being pure Cadence has no value for the future. If we later have add something that is not in pure Cadence ( which seems pretty likely in the crypto context ) at least we can prevent polluting global namespace.