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

secp256k1 precompiles #123

Closed
wants to merge 7 commits into from
Closed

secp256k1 precompiles #123

wants to merge 7 commits into from

Conversation

zeroXbrock
Copy link
Member

@zeroXbrock zeroXbrock commented Dec 8, 2023

📝 Summary

  • add randomUint precompile
  • add secp256k1 precompiles
    • secp256k1Sign
    • secp256k1RecoverPubkey
    • secp256k1VerifySignature

TODO:

  • add tests

📚 References


  • I have seen and agree to CONTRIBUTING.md

@@ -42,14 +47,18 @@ var (
fetchBidsAddr = common.HexToAddress("0x0000000000000000000000000000000042030001")
fillMevShareBundleAddr = common.HexToAddress("0x0000000000000000000000000000000043200001")
newBidAddr = common.HexToAddress("0x0000000000000000000000000000000042030000")
randomUintAddr = common.HexToAddress("0x00000000000000000000000000000000F00bA777")
Copy link
Contributor

Choose a reason for hiding this comment

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

should the hex addresses follow the same scheme as the others?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see a loose pattern in how the addresses are chosen, but it doesn't seem totally consistent.
For example, from

fetchBidsAddr                = common.HexToAddress("0x0000000000000000000000000000000042030001")

we might infer that 0x00..42 implies MEV-Share bid-related precompiles. But then we see

fillMevShareBundleAddr       = common.HexToAddress("0x0000000000000000000000000000000043200001")

So then we might infer that 0x00..42 is strictly bids and 0x00..43 is just bundle-related. But then we see

simulateBundleAddr           = common.HexToAddress("0x0000000000000000000000000000000042100000")

So then my guess is that the scheme is "start with 0x000000000000000000000000000000004 and have some zeros in the middle?"... Is there an actual pattern I should be following?
I thought this address was fun :p but happy to change it -- just wondering how best to avoid conflicts w/ other precompile PRs.

@ferranbt ferranbt mentioned this pull request Dec 13, 2023
1 task
@dmarzzz
Copy link
Member

dmarzzz commented Dec 13, 2023

@zeroXbrock didnt realize my PR does the same #127 , Im curious why we need recover as a precompile if solidity already exposes ecrecover? also we dont include the curve name on signEthTransaction so Im not sure we need to for signing an arbitrary message either if its in ethereums native curve, only for non-native curves

@dmarzzz
Copy link
Member

dmarzzz commented Jan 7, 2024

closing because stale

@dmarzzz dmarzzz closed this Jan 7, 2024
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