Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Dec 18, 2024
1 parent 1562233 commit a6bbbaa
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions core/lib/contract_verifier/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use zksync_dal::Connection;
use zksync_node_test_utils::{create_l1_batch, create_l2_block};
use zksync_types::{
address_to_h256,
bytecode::BytecodeHash,
bytecode::{pad_evm_bytecode, BytecodeHash},
contract_verification_api::{CompilerVersions, SourceCodeData, VerificationIncomingRequest},
get_code_key, get_known_code_key,
l2::L2Tx,
Expand Down Expand Up @@ -114,28 +114,6 @@ impl TestContract {
}
}

/// Pads an EVM bytecode in the same ways it's done by system contracts.
fn pad_evm_bytecode(deployed_bytecode: &[u8]) -> Vec<u8> {
let mut padded = Vec::with_capacity(deployed_bytecode.len() + 32);
let len = U256::from(deployed_bytecode.len());
padded.extend_from_slice(&[0; 32]);
len.to_big_endian(&mut padded);
padded.extend_from_slice(deployed_bytecode);

// Pad to the 32-byte word boundary.
if padded.len() % 32 != 0 {
padded.extend(iter::repeat(0).take(32 - padded.len() % 32));
}
assert_eq!(padded.len() % 32, 0);

// Pad to contain the odd number of words.
if (padded.len() / 32) % 2 != 1 {
padded.extend_from_slice(&[0; 32]);
}
assert_eq!((padded.len() / 32) % 2, 1);
padded
}

async fn mock_deployment(
storage: &mut Connection<'_, Core>,
address: Address,
Expand Down

0 comments on commit a6bbbaa

Please sign in to comment.