Skip to content

feat(structlog): add cold access detection and memory expansion utilities#84

Merged
mattevans merged 8 commits intorelease/mem-expansion-and-precompilesfrom
feat/mem-expansion
Feb 17, 2026
Merged

feat(structlog): add cold access detection and memory expansion utilities#84
mattevans merged 8 commits intorelease/mem-expansion-and-precompilesfrom
feat/mem-expansion

Conversation

@mattevans
Copy link
Member

feat(structlog): expose IsPrecompile helper for external use
feat(execution): extend StructLog with MemorySize, CallTransfersValue, ExtCodeCopySize
test(structlog): add comprehensive tests for cold access and memory expansion

…ties

feat(structlog): expose IsPrecompile helper for external use
feat(execution): extend StructLog with MemorySize, CallTransfersValue, ExtCodeCopySize
test(structlog): add comprehensive tests for cold access and memory expansion
@mattevans mattevans self-assigned this Feb 16, 2026
@mattevans mattevans requested a review from Savid as a code owner February 16, 2026 03:54
Introduce memory and cold-access counters to enable gas cost
breakdown into memory expansion and state-access categories.

- Extend CallFrameRow and OpcodeStats with memory-words sums
 (before/after) and squared sums plus cold-access counts.
- Update aggregator to accumulate the new fields per opcode
 and roll them up to frame summaries.
- Add memWordsBefore, memWordsAfter, coldAccessCount params
 to ProcessStructlog and wire them in transaction processing.
- Extend ClickHouse columns and batch insert logic to persist
 the new metrics.
- Remove local precompile list and delegate to structlog pkg.
…stant

test(memory_test): add comprehensive unit tests for resolveLastInFrame
style(memory): remove outdated comment about RETURN/REVERT stack layout
test: add boundary precision tests for cold access classification
test: add unit tests for memory parsing and word computation
test: add aggregator tests for resource gas accumulation and nested frames
test: add column tests for new resource gas fields
…e to empty account

The classifier now removes the 25 000 gas charged for creating a new
account before deciding how many cold accesses occurred. This prevents
false positives when the large new-account cost would otherwise be
mis-classified as extra cold accesses.

docs: clarify CALL value-transfer and stipend comments
test: add cases covering CALL to empty accounts with value transfer
…on logic

- Add detailed inline comments explaining CALL and EXTCODECOPY gas
 composition, normalization steps, and range-based classification rules.
- Clarify why 200/2600/5200 thresholds are safe (gaps >2000 gas).
- Document precompile warm-up via EIP-2929 and fallback stack reads.
- No functional change; improves future maintainability.
…pped

feat(aggregator): add exact memory expansion gas tracking per opcode
refactor: replace hard-coded thresholds with warmAccessCost constant
@mattevans mattevans merged commit 7092035 into release/mem-expansion-and-precompiles Feb 17, 2026
3 checks passed
@mattevans mattevans deleted the feat/mem-expansion branch February 17, 2026 02:06
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.

3 participants