matter-labs / era-test-node

In-memory node that can be used for integration testing and debugging.
https://matter-labs.github.io/era-test-node
Apache License 2.0
308 stars 75 forks source link

Storage Slot Validation not performed during validateTransaction #359

Open cpb8010 opened 2 hours ago

cpb8010 commented 2 hours ago

🐛 Bug Report for zkSync Era In-Memory Node

📝 Description

When attempting to access storage slots belonging to another address, era-test-node is less restrictive than eraVM. https://docs.zksync.io/build/developer-reference/account-abstraction/extending-4337#extending-the-set-of-slots-that-belong-to-a-user

🔄 Reproduction Steps

  1. During the Native Account Abstraction validation method, call a contract that performs a storage access
  2. Have that contract access storage not linked to the validating account's address
  3. era-test-node allows the validation

🤔 Expected Behavior

The documented behavior requires that storage slot access only come from storage slots with solidity like mappings to account addresses.

😯 Current Behavior

era-test-node doesn't look like it performs any validation

🖥️ Environment

📋 Additional Context

We're also looking at making eraVM less restrictive, but not as permissive as era-test-node here: https://github.com/matter-labs/zksync-era/pull/3166

📎 Log Output

Paste any relevant log output here.
MexicanAce commented 2 hours ago

This comes from ValidationTracer -and this isn't run in era_test_node: https://github.com/matter-labs/era-test-node/blob/ceee937055a5a373e27b0ff9bf2e42391de78c59/src/node/in_memory.rs#L1353

MexicanAce commented 2 hours ago

But also, implementing this tracer as-is would break console.log (just FYI to whomever fixes this)