-
Notifications
You must be signed in to change notification settings - Fork 127
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
Implement all precompiled contracts #122
Comments
But |
For BN128 the fastest ways are in order:
|
After reviewing on precompiles.
// PrecompiledContractsHomestead contains the default set of pre-compiled Ethereum
// contracts used in the Frontier and Homestead releases.
var PrecompiledContractsHomestead = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{1}): &ecrecover{},
common.BytesToAddress([]byte{2}): &sha256hash{},
common.BytesToAddress([]byte{3}): &ripemd160hash{},
common.BytesToAddress([]byte{4}): &dataCopy{},
}
// PrecompiledContractsByzantium contains the default set of pre-compiled Ethereum
// contracts used in the Byzantium release.
var PrecompiledContractsByzantium = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{1}): &ecrecover{},
common.BytesToAddress([]byte{2}): &sha256hash{},
common.BytesToAddress([]byte{3}): &ripemd160hash{},
common.BytesToAddress([]byte{4}): &dataCopy{},
common.BytesToAddress([]byte{5}): &bigModExp{},
common.BytesToAddress([]byte{6}): &bn256Add{},
common.BytesToAddress([]byte{7}): &bn256ScalarMul{},
common.BytesToAddress([]byte{8}): &bn256Pairing{},
} So 0x0000...0001 for ecrecover for example
For reference here are some discussions, including BN128 C++ implementation concerns:
|
If we are limited in time on BN128 i will vote on |
After looking into BN128 with @cheatfate the current situation is somewhat strange: We don't know if we should use BN128 or BN256 (Note that the data will be stored in a 256-bit integer regardless) Facts:
Also BN128 is not supported in Milagro while BN256 is https://github.com/milagro-crypto/amcl/blob/master/version3/curves.txt#L26 |
|
Useful repo, a fuzzer for Ethereum BN256 implementations: https://github.com/guidovranken/bn256-fuzzing |
Geth uses Cloudflare implementation according to EIP 1108 Still no test vectors though. |
To the extent it might help prioritize things, the |
We need implementations and dispatching logic for the following precompiles
Introduced in Homestead:
Introduced in Byzantium:
Reference implementations:
https://github.com/ethereum/py-evm/tree/master/eth/precompiles
The text was updated successfully, but these errors were encountered: