Skip to content

Conversation

kevaundray
Copy link
Contributor

No description provided.

Comment on lines 101 to 103
let Some(precompile) = self.precompiles.get(address) else {
return Ok(None);
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We now check for this in self.precompiles.execute -- will revert this and just deref the fn pointer, then explicitly pass in the dyn trait

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this is quite an invasive change just to make the sha256 fn configurable

perhaps a better approach would be to have dedicated precompile fns that use different impls and then simply replace the entire precompile

@kevaundray
Copy link
Contributor Author

kevaundray commented Jul 23, 2025

this is quite an invasive change just to make the sha256 fn configurable

perhaps a better approach would be to have dedicated precompile fns that use different impls and then simply replace the entire precompile

This would be for all of the precompiles fwiw -- I just did sha256 first to show it working.

I was hoping to not need to replace the entire precompile because the main thing we care about switching out is the pure cryptography part and not the EVM related parts

@kevaundray
Copy link
Contributor Author

@mattsse we would essentially be adding all of these methods:

pub trait CryptoProvider: Send + Sync + 'static {

Copy link

codspeed-hq bot commented Jul 23, 2025

CodSpeed Performance Report

Merging #2772 will not alter performance

Comparing kevaundray:kw/crypto-trait-in-precompiles-struct (fd1b3f7) with main (a46aa4a)

Summary

✅ 171 untouched benchmarks

@kevaundray kevaundray marked this pull request as ready for review July 23, 2025 15:59
@rakita
Copy link
Member

rakita commented Jul 23, 2025

This is contained only within Precompile, so it does not change PrecompileProvider and how it is handled. And intention is to have an exchangeable crypto module for every precompile, so it is easy to use.

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

Good as a skeleton.

@rakita rakita merged commit e6a25a3 into bluealloy:main Jul 23, 2025
30 checks passed
@github-actions github-actions bot mentioned this pull request Jul 23, 2025
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