ava-labs / subnet-evm

Launch your own EVM as an Avalanche Subnet
https://docs.avax.network/subnets/create-a-fuji-subnet
GNU Lesser General Public License v3.0
237 stars 213 forks source link

resolve race in closing sync segments channel #1201

Closed darioush closed 1 month ago

darioush commented 1 month ago

Why this should be merged

Fixes https://github.com/ava-labs/subnet-evm/issues/1200

How this works

Closes the sync channel after the last storage trie has finished (or if there is no storage tries). This avoids writing to a closed channel when a storage trie splits into segments: https://github.com/ava-labs/subnet-evm/blob/master/sync/statesync/trie_segments.go#L311-L313

but in the existing behavior the storageTrieProducer could have previously closed the channel.

How this was tested

CI

How is this documented

N/A