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: add ed25519/secp256k1 precompiles #102

Merged
merged 7 commits into from
Oct 26, 2024

Conversation

OliverNChalk
Copy link
Contributor

@OliverNChalk OliverNChalk commented Oct 17, 2024

Without this patch ed25519/secp256k1 fail with:

[ERROR litesvm] Program account KeccakSecp256k11111111111111111111111111111 is not executable.

@Aursen Aursen requested review from kevinheavey and Aursen October 18, 2024 01:23
svm/src/lib.rs Outdated Show resolved Hide resolved
@OliverNChalk
Copy link
Contributor Author

Have implemented both suggestions

account.set_lamports(1);
account.set_executable(true);

svm.set_account(ed25519_program::ID, account.clone().into())
Copy link
Collaborator

@kevinheavey kevinheavey Oct 20, 2024

Choose a reason for hiding this comment

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

I looked at bank.rs and it checks each precompile against the feature_set before adding it:

        for precompile in get_precompiles() {
            let should_add_precompile = precompile
                .feature
                .as_ref()
                .map(|feature_id| self.feature_set.is_active(feature_id))
                .unwrap_or(false);
            if should_add_precompile {
                self.add_precompile(&precompile.program_id);
            }
        }

Can we do the same please? We already have a feature_set field on LiteSVM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented in 4ea8b29

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strange, seems the bank code has a logic error/poor wording. These precompiles have feature_id: None which means always enabled. But the code doesn't enable them. My guess is they're loaded elsewhere so it just works... cool.

a0e53b5

@Aursen
Copy link
Collaborator

Aursen commented Oct 25, 2024

Hi can you add an entry in the Changelog?

@OliverNChalk
Copy link
Contributor Author

done

@Aursen
Copy link
Collaborator

Aursen commented Oct 26, 2024

Waiting for a last check of @kevinheavey and after sounds good to me

@kevinheavey kevinheavey merged commit 609734c into LiteSVM:master Oct 26, 2024
2 checks passed
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.

3 participants