mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-15 04:31:08 +00:00
Emerge Yul recompiler (#1)
Provide a modified (and incomplete) version of ZKSync zksolc that can compile the most basic contracts
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
//!
|
||||
//! Translates the external code operations.
|
||||
//!
|
||||
|
||||
use crate::eravm::context::Context;
|
||||
use crate::eravm::Dependency;
|
||||
|
||||
///
|
||||
/// Translates the `extcodesize` instruction.
|
||||
///
|
||||
pub fn size<'ctx, D>(
|
||||
context: &mut Context<'ctx, D>,
|
||||
address: inkwell::values::IntValue<'ctx>,
|
||||
) -> anyhow::Result<inkwell::values::BasicValueEnum<'ctx>>
|
||||
where
|
||||
D: Dependency + Clone,
|
||||
{
|
||||
crate::eravm::evm::call::request(
|
||||
context,
|
||||
context.field_const(zkevm_opcode_defs::ADDRESS_ACCOUNT_CODE_STORAGE.into()),
|
||||
"getCodeSize(uint256)",
|
||||
vec![address],
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// Translates the `extcodehash` instruction.
|
||||
///
|
||||
pub fn hash<'ctx, D>(
|
||||
context: &mut Context<'ctx, D>,
|
||||
address: inkwell::values::IntValue<'ctx>,
|
||||
) -> anyhow::Result<inkwell::values::BasicValueEnum<'ctx>>
|
||||
where
|
||||
D: Dependency + Clone,
|
||||
{
|
||||
crate::eravm::evm::call::request(
|
||||
context,
|
||||
context.field_const(zkevm_opcode_defs::ADDRESS_ACCOUNT_CODE_STORAGE.into()),
|
||||
"getCodeHash(uint256)",
|
||||
vec![address],
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user