mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-15 13:51:12 +00:00
@@ -11,9 +11,8 @@ where
|
||||
{
|
||||
let offset = context.builder().build_int_add(
|
||||
offset,
|
||||
context.field_const(
|
||||
(revive_common::BYTE_LENGTH_X32 + revive_common::BYTE_LENGTH_FIELD) as u64,
|
||||
),
|
||||
context
|
||||
.word_const((revive_common::BYTE_LENGTH_X32 + revive_common::BYTE_LENGTH_WORD) as u64),
|
||||
"datacopy_contract_hash_offset",
|
||||
)?;
|
||||
|
||||
@@ -33,8 +32,8 @@ where
|
||||
{
|
||||
revive_llvm_context::polkavm_evm_memory::store_byte(
|
||||
context,
|
||||
context.field_const(offset),
|
||||
context.field_const(value),
|
||||
context.word_const(offset),
|
||||
context.word_const(value),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
@@ -53,21 +52,21 @@ where
|
||||
for (index, chunk) in source
|
||||
.chars()
|
||||
.collect::<Vec<char>>()
|
||||
.chunks(revive_common::BYTE_LENGTH_FIELD * 2)
|
||||
.chunks(revive_common::BYTE_LENGTH_WORD * 2)
|
||||
.enumerate()
|
||||
{
|
||||
let mut value_string = chunk.iter().collect::<String>();
|
||||
value_string.push_str(
|
||||
"0".repeat((revive_common::BYTE_LENGTH_FIELD * 2) - chunk.len())
|
||||
"0".repeat((revive_common::BYTE_LENGTH_WORD * 2) - chunk.len())
|
||||
.as_str(),
|
||||
);
|
||||
|
||||
let datacopy_destination = context.builder().build_int_add(
|
||||
destination,
|
||||
context.field_const(offset as u64),
|
||||
context.word_const(offset as u64),
|
||||
format!("datacopy_destination_index_{index}").as_str(),
|
||||
)?;
|
||||
let datacopy_value = context.field_const_str_hex(value_string.as_str());
|
||||
let datacopy_value = context.word_const_str_hex(value_string.as_str());
|
||||
revive_llvm_context::polkavm_evm_memory::store(
|
||||
context,
|
||||
datacopy_destination,
|
||||
|
||||
@@ -49,7 +49,7 @@ where
|
||||
let condition = context.builder().build_int_compare(
|
||||
inkwell::IntPredicate::NE,
|
||||
condition.into_int_value(),
|
||||
context.field_const(0),
|
||||
context.word_const(0),
|
||||
format!("conditional_{block_key}_condition_compared").as_str(),
|
||||
)?;
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ impl Instruction {
|
||||
..
|
||||
} => {
|
||||
let mut key_extended =
|
||||
"0".repeat(revive_common::BYTE_LENGTH_FIELD * 2 - value.len());
|
||||
"0".repeat(revive_common::BYTE_LENGTH_WORD * 2 - value.len());
|
||||
key_extended.push_str(value.as_str());
|
||||
|
||||
*value = mapping.get(key_extended.as_str()).cloned().ok_or_else(|| {
|
||||
|
||||
@@ -11,7 +11,7 @@ where
|
||||
D: revive_llvm_context::PolkaVMDependency + Clone,
|
||||
{
|
||||
let result = context
|
||||
.field_type()
|
||||
.word_type()
|
||||
.const_int_from_string(
|
||||
value.to_ascii_uppercase().as_str(),
|
||||
inkwell::types::StringRadix::Hexadecimal,
|
||||
@@ -30,7 +30,7 @@ where
|
||||
D: revive_llvm_context::PolkaVMDependency + Clone,
|
||||
{
|
||||
let result = context
|
||||
.field_type()
|
||||
.word_type()
|
||||
.const_int_from_string(value.as_str(), inkwell::types::StringRadix::Decimal)
|
||||
.expect("Always valid");
|
||||
Ok(result.as_basic_value_enum())
|
||||
|
||||
@@ -88,7 +88,7 @@ impl Assembly {
|
||||
hash_data_mapping: &BTreeMap<String, String>,
|
||||
) -> anyhow::Result<BTreeMap<String, String>> {
|
||||
let mut index_path_mapping = BTreeMap::new();
|
||||
let index = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2);
|
||||
let index = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2);
|
||||
index_path_mapping.insert(index, full_path.to_owned());
|
||||
|
||||
let dependencies = match self.data.as_mut() {
|
||||
@@ -100,7 +100,7 @@ impl Assembly {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2 - index.len());
|
||||
let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2 - index.len());
|
||||
index_extended.push_str(index.as_str());
|
||||
|
||||
*data = match data {
|
||||
@@ -136,7 +136,7 @@ impl Assembly {
|
||||
hash_data_mapping: &BTreeMap<String, String>,
|
||||
) -> anyhow::Result<BTreeMap<String, String>> {
|
||||
let mut index_path_mapping = BTreeMap::new();
|
||||
let index = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2);
|
||||
let index = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2);
|
||||
index_path_mapping.insert(index, full_path.to_owned());
|
||||
|
||||
let dependencies = match self
|
||||
@@ -150,7 +150,7 @@ impl Assembly {
|
||||
None => return Ok(index_path_mapping),
|
||||
};
|
||||
for (index, data) in dependencies.iter_mut() {
|
||||
let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_FIELD * 2 - index.len());
|
||||
let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2 - index.len());
|
||||
index_extended.push_str(index.as_str());
|
||||
|
||||
*data = match data {
|
||||
|
||||
Reference in New Issue
Block a user