Skip to content

fix(examples): use real keccak256 for StorageWritten event topic - #3876

Open
cuiweixie wants to merge 5 commits into
bluealloy:mainfrom
cuiweixie:fix/example-storage-written-event-topic
Open

fix(examples): use real keccak256 for StorageWritten event topic#3876
cuiweixie wants to merge 5 commits into
bluealloy:mainfrom
cuiweixie:fix/example-storage-written-event-topic

Conversation

@cuiweixie

Copy link
Copy Markdown
Contributor

Summary

  • Replace the placeholder topic0 bytes in the custom precompile journal example with keccak256(b"StorageWritten(address,uint256)").
  • Add a regression assertion that the emitted log's first topic matches that signature hash.

Test plan

  • cargo nextest run -p example-custom-precompile-journal --lib
  • cargo clippy --workspace --all-targets --all-features

The custom precompile journal example used a placeholder byte array for topic0 while documenting keccak256("StorageWritten(address,uint256)"). Emit the real signature hash and assert it in the log regression test.
@codspeed-hq

codspeed-hq Bot commented Aug 23, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.12%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 217 untouched benchmarks
⏩ 9 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation ecrecover precompile 392.1 µs 404.8 µs -3.12%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing cuiweixie:fix/example-storage-written-event-topic (8611359) with main (8ca4052)

Open in CodSpeed

Footnotes

  1. 9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Format the keccak256 import in the custom precompile example. Also switch Stack::push_slice_ to slice.as_chunks::<32>() so clippy on rustc 1.98 (-Dwarnings) passes.
Stable 1.98 clippy denies chunks_exact_to_as_chunks under -Dwarnings. Update the remaining call sites in interpreter and precompile so CI clippy passes.
Last chunks_exact_to_as_chunks hit under cargo clippy --all-targets.
@cuiweixie
cuiweixie force-pushed the fix/example-storage-written-event-topic branch from def9253 to 072f1bb Compare August 27, 2026 23:36
Resolve as_chunks conflicts in BLS MSM precompiles by keeping main's style.
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.

1 participant