Open DaniPopes opened 1 month ago
Hi, willing to work on this. Can you share some pointers please?
Sure, in revm-precompile lib.rs, instead of conditionally adding precompiles with cfg, they should always be added but with a fallback implementation that panics at runtime.
For example in cancun https://github.com/bluealloy/revm/blob/30c6362bd4676911fa8f3306b4d8311cee340931/crates/precompile/src/lib.rs#L140-L158
the extend should always be enabled, and kzg_point_evaluation::POINT_EVALUATION
should be cfg'd internally, with a panic if the feature is not enabled
Would not panic on those. Seems like bad behaviour
Renamed the issue, we should return the error on this.
We should modify PrecompileResult
to contain additional field that would return panic like error. https://github.com/bluealloy/revm/blob/30c6362bd4676911fa8f3306b4d8311cee340931/crates/primitives/src/precompile.rs#L9C29-L9C67
Would add something like:
enum PrecompileResult {
Ok {
gas_used: u64,
output: Bytes,
},
Error {
error_type: PrecompileError,
},
FatalError {
msg: String,
}
}
Fatal error would stop execution, while Ok and Error would work as previously with Result<>
.
Implemented for kzg here: https://github.com/bluealloy/revm/pull/1589 blst pending and require some code refactoring
The precompile address should be specified regardless, but with an implementation that panics at run time so that certain bugs are caught early.