Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make it #[no_std] compatible #280

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

th7nder
Copy link

@th7nder th7nder commented Oct 11, 2024

This PR makes it #[no_std] compatible.
It was tested in a substrate pallet extrinsic and called in polkadot.js.org explorer:

        pub fn test_neptune(origin: OriginFor<T>) -> DispatchResult {
            let _caller = ensure_signed(origin)?;

            let constants: PoseidonConstants<Fr, U8> = PoseidonConstants::new();
            let mut preimage = [Fr::ZERO; 8];
            preimage[0] = <Fr as Field>::ONE;

            let mut h = Poseidon::<Fr, U8>::new_with_preimage(&preimage, &constants);
            let _aa = h.hash();

            Ok(())
        }

I used libm to make the ceil() and friends available in no_std environments, not sure whether this is the right call for every env.

@th7nder th7nder changed the title make it #[no_std] comptabile feat: make it #[no_std] compatible Oct 11, 2024
Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back to your queue for one linting fix, otherwise this LGTM. You can also set up the PR to allow maintainer modifications to your branch and we'll shepherd that through.

src/error.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants