Commit d386df5
authored
fix: make evm_execution more robust (#2942)
<!--
Please read and fill out this form before submitting your PR.
Please make sure you have reviewed our contributors guide before
submitting your
first PR.
NOTE: PR titles should follow semantic commits:
https://www.conventionalcommits.org/en/v1.0.0/
-->
## Overview
<!--
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue.
Ex: Closes #<issue number>
-->
### Summary
Prevents fork explosions where multiple EL blocks are created for the
same app block height by adding three layers of protection:
1. **Idempotency check** - Before building, checks if EL already has a
block at the requested height with matching timestamp and reuses it
2. **Fixed safe/finalized semantics** - `setFinal(isFinal=false)` no
longer incorrectly advances safe block; safe now lags head by
`SafeBlockLag` (2 blocks)
### Changes
- Added `executeMu sync.Mutex` to serialize `ExecuteTxs` and
`ResumePayload` calls
- Added idempotency check at start of `ExecuteTxs` using height +
timestamp matching
- Fixed forkchoice args to use tracked
`currentSafeBlockHash`/`currentFinalizedBlockHash` instead of
`prevBlockHash`
- Added `SafeBlockLag` constant (2 blocks) for automatic safe block
advancement
- Added new APIs: `SetSafe()`, `SetSafeByHeight()`, `SetFinalized()`,
`ResumePayload()`
- Refactored common RPC logic into `doForkchoiceUpdate()1 parent d4a2da9 commit d386df5
File tree
22 files changed
+1065
-275
lines changed- apps/evm/cmd
- execution/evm
- test
- types/pb/execution/evm/v1
- proto
- evnode/v1
- execution/evm/v1
- scripts
- types/pb/evnode/v1
22 files changed
+1065
-275
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
56 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
| |||
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
248 | | - | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
0 commit comments