Smart Contract Developer Interview: How to Handle Logging and Gas Fees on Layer 2
How do I handle smart contract logging questions in developer interviews, especially for Layer 2 chains?
I got stuck when asked how to improve logging in Solidity without raising gas fees. Basic event logs don’t give enough detail for debugging, but adding more events makes transactions expensive.
Is there a way to log only the most important data and figure out the rest off-chain? The interviewer brought up The Graph and custom subgraphs—should I use those, or just log more granular data directly?
Are there best practices or tricks for cheaper, more efficient logging on Layer 2 compared to Layer 1? Any advice or real examples would help me prep for my next smart contract interview.