Skip to content

fix: add a test utility function to generate memory input opcodes#3280

Merged
rakita merged 4 commits intobluealloy:mainfrom
silathdiir:add-memory-input-test-utility
Feb 23, 2026
Merged

fix: add a test utility function to generate memory input opcodes#3280
rakita merged 4 commits intobluealloy:mainfrom
silathdiir:add-memory-input-test-utility

Conversation

@silathdiir
Copy link
Contributor

close #3277

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 6, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing silathdiir:add-memory-input-test-utility (3fe27fb) with main (a31fa98)

Summary

✅ 173 untouched benchmarks

use std::str::FromStr;

/// Constructs bytecode for inserting input into memory
pub fn build_memory_input_opcodes(hex_input: &str) -> Result<Vec<u8>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this to be string, &[u8] is fine. Additionally it should have a offset

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 35ea2a2


opcodes.extend_from_slice(chunk);

opcodes.push(opcode::MSTORE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSTORE uses two items, where one is offset https://www.evm.codes/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 35ea2a2

#[cfg(test)]
pub mod test {
use crate::opcode;
use alloy_primitives::{hex, Bytes};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use primitives::Bytes no need to introduce alloy_primitives or anyhow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed alloy-primitives dev-dependency in commit 35ea2a2, since fixed the argument to bytes.

@silathdiir silathdiir requested a review from rakita January 9, 2026 16:29
Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, test related

@rakita rakita merged commit c1c61e7 into bluealloy:main Feb 23, 2026
31 checks passed
@github-actions github-actions bot mentioned this pull request Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make a bytecode test utility that would make bytecode that insert input directly to memory

2 participants