Instead of just having special native code for each precompiled contract, a client could have special gas metering for those (as it is their main purpose) but keep the logic as EVM instructions.
Would this be possible?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityInstead of just having special native code for each precompiled contract, a client could have special gas metering for those (as it is their main purpose) but keep the logic as EVM instructions.
Would this be possible?
There's no reason they can't be implemented in the EVM, but that completely defeats the purpose. The reason precompiles are precompiles instead of just Solidity libraries that people deploy is because, since they're programmed in the client's language and compiled, they're orders of magnitude more efficient than writing them in EVM bytecode.