Log/LogTrie processing panic #161
Closed
opened 2021-11-29 06:23:42 +00:00 by i-norden
·
1 comment
No Branch/Tag Specified
v1.11.6-statediff-v5
v1.10.26-statediff-4.2.2-alpha
jenkins_reborn
v1.10.25-statediff-v4
v1.10.25-statediff-v4-wip
cerc_refactor
release-v1.10.23-statediff-4.2.0-alpha
v1.10.23-statediff-v4
v1.10.23-statediff-v4-wip
v1.10.22-statediff-v4-wip
v1.10.22-statediff-v4
v1.10.21-statediff-v4
linter_updates_wip
release-v1.10-21-statediff-4.1.2-alpha
release-v1.10.21-statediff-4.1.2-alpha
v1.10.20-statediff-v4
v1.10.19-statediff-v4
statediff
v1.13.14
v1.11.6-statediff-v5.0.8
v1.10.23-statediff-4.2.0-alpha-cerc-unstable
v1.10.23-statediff-4.2.0-alpha-unstable
v1.10.25
v1.10.24
v1.10.23-statediff-4.2.0-alpha
v1.10.23-statediff-v4-unstable
v1.10.23
v1.10.22
v1.10.21-statediff-4.1.2-alpha
v1.10.21
v1.10.19-statediff-4.1.1-alpha
v1.10.20-statediff-4.1.0-alpha
v1.10.19-statediff-4.1.0-alpha
v1.10.20
v1.10.19-statediff-4.0.4-alpha
v1.10.19-statediff-4.0.3-alpha
v1.10.19-statediff-4.0.2-alpha
v1.10.19
v1.10.18-statediff-4.0.2-alpha
v1.10.18-statediff-3.2.2
v1.10.18-statediff-4.0.1-alpha
v1.10.18-statediff-3.2.1
v1.10.18
v1.10.17-statediff-4.0.1-alpha
v1.10.17-statediff-4.0.0-alpha
v1.10.17-statediff-3.2.1
v1.10.17-statediff-3.2.0
v1.10.17
v1.10.16-statediff-3.0.2
v3.0.2
v1.10.15-statediff-3.0.2
v1.10.16
v1.10.15-statediff-3.1.0
v1.10.15-statediff-3.0.1
v1.10.15-statediff-3.0.0
v1.10.11-statediff-3.0.0
v1.10.15-statediff-2.0.0
v1.10.15-statediff-0.0.29
v1.10.15
v1.10.11-statediff-0.1.0
v1.10.14-statediff-0.0.29
v1.10.14-statediff-0.0.28
v1.10.14
v1.10.13-statediff-0.0.29
v1.10.11-statediff-0.0.28a
v1.10.13-statediff-0.0.28
v1.10.12-statediff-0.0.28
v1.10.12-statediff-0.0.27
v1.10.11-statediff-0.0.27i
v1.10.11-statediff-0.0.27h
v1.10.11-statediff-0.0.27g
v1.10.11-statediff-0.0.27f
v1.10.11-statediff-0.0.27e
v1.10.13
v1.10.11-statediff-0.0.27d
v1.10.11-statediff-0.0.27c
v1.10.11-statediff-0.0.27b
v1.10.11-statediff-0.0.27a
v1.10.12
v1.10.11-statediff-0.0.27
v1.10.11
v1.10.10-statediff-0.0.27
v1.10.10
v1.10.9-statediff-0.0.27
v1.10.9
v1.10.8-statediff-0.0.27
v1.10.8-statediff-0.0.26
v1.10.8-statediff-0.0.25
v1.10.8
v1.10.7-statediff-0.0.25
v1.10.7
v1.10.6-statediff-0.0.25
v1.10.6
v1.10.5-statediff-0.0.25
v1.10.5
v1.10.4-statediff-0.0.25
v1.10.4-statediff-0.0.24
v1.10.3-statediff-0.0.24
v1.10.4-ir-0.0.1
v1.10.3-statediff-0.0.23
v1.10.4
v1.10.3-statediff-0.0.22
v1.10.3-statediff-0.0.21
v1.10.3
v1.10.2-statediff-0.0.21
v1.10.2-statediff-0.0.20
v1.10.2-statediff-0.0.19
v1.10.2-statediff-0.0.18
v1.10.2-statediff-0.0.17
v1.10.1-statediff-0.0.17
v1.10.2
v1.10.1-statediff-0.0.16
v1.10.1-statediff-0.0.15
v1.10.1
v1.10.0
v1.9.25-statediff-0.0.15
v1.9.25-statediff-0.0.14
v1.9.25-statediff-0.0.13
v1.9.25
v1.9.24-statediff-0.0.13
v1.9.24-statediff-0.0.12
v1.9.24-statediff-0.0.11
v1.9.23-statediff-0.0.11
v1.9.24
v1.9.23-statediff-0.0.10
v1.9.23-statediff-0.0.9
v1.9.11-statediff-0.0.9
v1.9.11-statediff-0.0.8
v1.9.23
v1.9.15-1559-0.0.1
v1.9.11-statediff-0.0.7
v1.9.10-optimism-0.0.2
v1.9.22
v1.9.21
v1.9.10-optimism-0.0.1
v1.9.11-statediff-0.0.6
v1.9.20
v1.9.11-statediff-0.0.5
v1.9.11-statediff-0.0.4
v1.9.11-statediff-0.0.3
v1.9.19
v1.9.18
v1.9.17
v1.9.16
v1.9.15
v1.9.11-statediff-0.0.2
v1.9.14
v1.9.13
v1.9.12
v1.10-alpha.2
v1.9.11
v1.9.10
v1.10-alpha.1
v1.9.9
v1.9.8
v1.9.7
v1.9.6
v1.9.5
v1.9.4
v1.9.3
v1.9.2
v1.10-alpha.0
v1.9.1
v1.9.0
v1.8.27
v1.8.26
v1.8.25
v1.8.24
v1.8.23
v1.8.22
v1.8.21
v1.8.20
v1.8.19
v1.8.18
v1.8.17
v1.8.16
v1.8.15
v1.8.14
v1.8.13
v1.8.12
v1.8.11
v1.8.10
v1.8.9
v1.8.8
v1.8.7
v1.8.6
v1.8.5
v1.8.4
v1.8.3
v1.8.2
v1.8.1
v1.8.0
v1.7.3
v1.7.2
v1.7.1
v1.7.0
v1.6.7
v1.6.6
v1.6.5
v1.6.4
v1.6.3
v1.6.2
v1.6.1
v1.6.0
v1.5.9
v1.5.8
v1.5.7
v1.5.6
v1.5.5
v1.5.4
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.19
v1.4.18
v1.4.17
v1.4.16
v1.4.15
v1.4.14
v1.4.13
v1.4.12
v1.4.11
v1.4.10
v1.4.9
v1.4.8
v1.4.7
v1.4.6
v1.4.5
v1.4.4
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.2.3
v1.2.2
1.2.1
v1.1.3
v1.0.5
v1.0.4
v1.1.2
v1.1.1
v1.0.3
v1.1.0
v1.0.2
v1.0.1.2
v1.0.1.1
v1.0.1
v1.0.0
v0.9.39
v0.9.38
v0.9.36
v0.9.34-1
v0.9.34
v0.9.32
v0.9.30
v0.9.28
v0.9.26
v0.9.25
v0.9.24
0.9.23
v0.9.23
v0.9.22
v0.9.21.1
v0.9.21
v0.9.20
v0.9.18
v0.9.17
0.9.16
v0.8.5-2
v0.8.5
v0.8.4
v0.8.4-1
v0.7.11
v0.7.10
vv0.7.10
v0.7.10-broken
PoC6
v0.6.8
v0.6.7
v0.6.6
v0.6.5-2
v0.6.5-1
v0.6.5
v0.6.4
v0.6.3
v0.6.0
0.5.19
0.5.18
0.5.17
0.5.16
0.5.15
0.5.14
0.5.13
poc5-rc12
poc5-rc11
2
poc5-rc10
poc5-rc9
poc5-rc8
poc5-rc7
poc5-rc6
poc5-rc4
poc5-rc3
poc5-rc2
poc5-rc1
0.3.1
0.3.0
0.2.2
poc1
Labels
Clear labels
bug
critical
duplicate
enhancement
epic
help wanted
in progress
invalid
low priority
question
rebase
v1
v5
wontfix
Copied from Github
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
An issue or PR manually copied from GitHub.
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cerc-io/go-ethereum#161
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
On mainnet data we sometimes run into blocks where the log/logTrie processing causes the below panic. Infrequent enough to have not caught in our unit tests/earlier trial runs, but often enough to be a major issue with the current production deployment.
The bug we are running into is due to this optimization in Ethereum’s modified merle Patricia trie where if a “leaf node” (partial path + RLP encoding of the value it stores) is less than or equal to 32 bytes in size (the size of a keccak256 hash) then its parent branch node will store it directly in one of its 16 hex slots rather than it existing as a distinct leaf node referenced by a hash in that hex slot. In this case there is a leaf value but it is not stored in a distinct leaf node and can't be associated with a leaf key.
This can also occur, and often does, in the storage trie where contract variables can be less than 32 bytes in length. It can’t occur in the state trie because an RLP encoded account is always greater than 32 bytes even when it is empty. Nor can it occur in the tx or rct tries as txs and rcts always encode to >32 bytes.
We aren’t properly accounting for this in the new LogTrie (which doesn’t exist in canonical Ethereum data structures). Somewhat rarely, contracts will emit event logs that don’t contain any topics or data, the log only contains a 20 byte address. If the partial path for the node in the trie is <= 12 bytes then the “leaf node” is <= 32 bytes and will be stored in its parent branch node. When this happens, the number of leaf nodes in the trie does not match the number of logs (hence the panic on out-of-bounds where we expected them to match), and it is not possible to associate the eth.log_cids entry with a leaf_cid/leaf_mh_key (the association becomes nonsensical).