informalsystems / informalsystems/emerald

fix(sync): Value sync is slow when consensus is very far ahead

Open
#86 3 comments 0 reactions 0 assignees View on GitHub
enhancement sync
Dominant language
Rust
Stars
25
Forks
9
PR merge metrics
No merged PRs in 30d

Description

When a node is far behind the network (10k+) heights, it has problems catching up. The protocol works but the performance is not great.

Malachite core sync is significantly faster than Emerald sync. This indicates that the bottleneck should resolved on the app side. Potential candidates for investigation:

- [ ] When peers request a range of blocks - the node that provides them fetches one block at a time from Reth. There is an option to fetch a batch of nodes from reth, however the interaction between consensus and the shim layer looks roughly as follows:

```pseudo
for each block_num in req.block_range do

value = shim.fetch_value(block_num)
if value.valid do
respones.append(value)
done
done
}
```
and the shim layer then calls into Reth:

```pseud

func fetch_value(block_numder){

payload = execution_client.get_block (block_number)

if payload.status.is_ok() {
return valueFrompayloe
}

}
```

Reth has an option to fetch a range of blocks, if we had this , we could download all the blocks and then validate them one by one. For this we would need to alter malachite core, to ask the app for a whole range.

- [ ] Once a node receives a batch of values, it validates each one of them, one by one in Reth. (this is potentially not optimizable).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.