Skip to content

Commit a1d08ef

Browse files
committed
feat(sequencer): catchup from base
1 parent 42f7321 commit a1d08ef

37 files changed

+2941
-1494
lines changed

.github/workflows/benchmark.yml

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ permissions: {}
55
push:
66
branches:
77
- main
8+
pull_request:
9+
branches:
10+
- main
811
workflow_dispatch:
912

1013
jobs:
1114
evm-benchmark:
1215
name: EVM Contract Benchmark
1316
runs-on: ubuntu-latest
1417
timeout-minutes: 30
15-
permissions:
16-
contents: write
17-
issues: write
1818
steps:
1919
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2020
- name: Set up Go
@@ -29,30 +29,112 @@ jobs:
2929
run: |
3030
cd test/e2e && go test -tags evm -bench=. -benchmem -run='^$' \
3131
-timeout=10m --evm-binary=../../build/evm | tee output.txt
32-
- name: Store benchmark result
32+
- name: Run Block Executor benchmarks
33+
run: |
34+
go test -bench=BenchmarkProduceBlock -benchmem -run='^$' \
35+
./block/internal/executing/... > block_executor_output.txt
36+
- name: Upload benchmark results
37+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
38+
with:
39+
name: evm-benchmark-results
40+
path: |
41+
test/e2e/output.txt
42+
block_executor_output.txt
43+
44+
spamoor-benchmark:
45+
name: Spamoor Trace Benchmark
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 30
48+
steps:
49+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
50+
- name: Set up Go
51+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
52+
with:
53+
go-version-file: ./go.mod
54+
- name: Set up Docker Buildx
55+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
56+
- name: Build binaries
57+
run: make build-evm build-da
58+
- name: Run Spamoor smoke test
59+
run: |
60+
cd test/e2e && BENCH_JSON_OUTPUT=spamoor_bench.json go test -tags evm \
61+
-run='^TestSpamoorSmoke$' -v -timeout=15m --evm-binary=../../build/evm
62+
- name: Upload benchmark results
63+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
64+
with:
65+
name: spamoor-benchmark-results
66+
path: test/e2e/spamoor_bench.json
67+
68+
# single job to push all results to gh-pages sequentially, avoiding race conditions
69+
publish-benchmarks:
70+
name: Publish Benchmark Results
71+
needs: [evm-benchmark, spamoor-benchmark]
72+
runs-on: ubuntu-latest
73+
permissions:
74+
contents: write
75+
issues: write
76+
pull-requests: write
77+
steps:
78+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
79+
- name: Download EVM benchmark results
80+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
81+
with:
82+
name: evm-benchmark-results
83+
- name: Download Spamoor benchmark results
84+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
85+
with:
86+
name: spamoor-benchmark-results
87+
path: test/e2e/
88+
89+
# only update the benchmark baseline on push/dispatch, not on PRs
90+
- name: Store EVM Contract Roundtrip result
91+
if: always()
3392
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
3493
with:
3594
name: EVM Contract Roundtrip
3695
tool: 'go'
3796
output-file-path: test/e2e/output.txt
38-
auto-push: true
97+
auto-push: ${{ github.event_name != 'pull_request' }}
98+
save-data-file: ${{ github.event_name != 'pull_request' }}
3999
github-token: ${{ secrets.GITHUB_TOKEN }}
40100
alert-threshold: '150%'
41101
fail-on-alert: true
42102
comment-on-alert: true
43103

44-
- name: Run Block Executor benchmarks
45-
run: |
46-
go test -bench=BenchmarkProduceBlock -benchmem -run='^$' \
47-
./block/internal/executing/... > block_executor_output.txt
48-
- name: Store Block Executor benchmark result
104+
# delete local gh-pages so the next benchmark action step fetches fresh from remote
105+
- name: Reset local gh-pages branch
106+
if: always()
107+
run: git branch -D gh-pages || true
108+
109+
- name: Store Block Executor result
110+
if: always()
49111
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
50112
with:
51113
name: Block Executor Benchmark
52114
tool: 'go'
53115
output-file-path: block_executor_output.txt
54-
auto-push: true
116+
auto-push: ${{ github.event_name != 'pull_request' }}
117+
save-data-file: ${{ github.event_name != 'pull_request' }}
55118
github-token: ${{ secrets.GITHUB_TOKEN }}
56119
alert-threshold: '150%'
57120
fail-on-alert: true
58121
comment-on-alert: true
122+
123+
# delete local gh-pages so the next benchmark action step fetches fresh from remote
124+
- name: Reset local gh-pages branch
125+
if: always()
126+
run: git branch -D gh-pages || true
127+
128+
- name: Store Spamoor Trace result
129+
if: always()
130+
uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7
131+
with:
132+
name: Spamoor Trace Benchmarks
133+
tool: 'customSmallerIsBetter'
134+
output-file-path: test/e2e/spamoor_bench.json
135+
auto-push: ${{ github.event_name != 'pull_request' }}
136+
save-data-file: ${{ github.event_name != 'pull_request' }}
137+
github-token: ${{ secrets.GITHUB_TOKEN }}
138+
alert-threshold: '150%'
139+
fail-on-alert: false
140+
comment-on-alert: true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Added
1313

14+
- Add disaster recovery for sequencer
15+
- Catch up possible DA-only blocks when restarting. [#3057](https://github.com/evstack/ev-node/pull/3057)
16+
- Verify DA and P2P state on restart (prevent double-signing). [#3061](https://github.com/evstack/ev-node/pull/3061)
1417
- Node pruning support. [#2984](https://github.com/evstack/ev-node/pull/2984)
1518
- Two different sort of pruning implemented:
1619
_Classic pruning_ (`all`): prunes given `HEAD-n` blocks from the databases, including store metadatas.
@@ -21,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2124
### Changes
2225

2326
- Store pending blocks separately from executed blocks key. [#3073](https://github.com/evstack/ev-node/pull/3073)
27+
- Fixes issues with force inclusion verification on sync nodes. [#3057](https://github.com/evstack/ev-node/pull/3057)
28+
- Add flag to `local-da` to produce empty DA blocks (closer to the real system). [#3057](https://github.com/evstack/ev-node/pull/3057)
2429

2530
## v1.0.0-rc.4
2631

apps/evm/go.mod

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ replace (
99
)
1010

1111
require (
12-
github.com/ethereum/go-ethereum v1.16.8
12+
github.com/ethereum/go-ethereum v1.17.0
1313
github.com/evstack/ev-node v1.0.0-rc.4
1414
github.com/evstack/ev-node/core v1.0.0-rc.1
1515
github.com/evstack/ev-node/execution/evm v1.0.0-rc.3
@@ -39,7 +39,6 @@ require (
3939
github.com/cespare/xxhash/v2 v2.3.0 // indirect
4040
github.com/consensys/gnark-crypto v0.18.2 // indirect
4141
github.com/crate-crypto/go-eth-kzg v1.4.0 // indirect
42-
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
4342
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
4443
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
4544
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
@@ -50,7 +49,6 @@ require (
5049
github.com/dustin/go-humanize v1.0.1 // indirect
5150
github.com/emicklei/dot v1.6.2 // indirect
5251
github.com/ethereum/c-kzg-4844/v2 v2.1.5 // indirect
53-
github.com/ethereum/go-verkle v0.2.2 // indirect
5452
github.com/fatih/color v1.18.0 // indirect
5553
github.com/ferranbt/fastssz v0.1.4 // indirect
5654
github.com/filecoin-project/go-clock v0.1.0 // indirect
@@ -113,7 +111,6 @@ require (
113111
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
114112
github.com/mattn/go-colorable v0.1.14 // indirect
115113
github.com/mattn/go-isatty v0.0.20 // indirect
116-
github.com/mattn/go-runewidth v0.0.15 // indirect
117114
github.com/miekg/dns v1.1.72 // indirect
118115
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
119116
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
@@ -131,7 +128,6 @@ require (
131128
github.com/multiformats/go-multistream v0.6.1 // indirect
132129
github.com/multiformats/go-varint v0.1.0 // indirect
133130
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
134-
github.com/olekukonko/tablewriter v0.0.5 // indirect
135131
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
136132
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
137133
github.com/pion/datachannel v1.5.10 // indirect
@@ -164,7 +160,6 @@ require (
164160
github.com/quic-go/qpack v0.6.0 // indirect
165161
github.com/quic-go/quic-go v0.59.0 // indirect
166162
github.com/quic-go/webtransport-go v0.10.0 // indirect
167-
github.com/rivo/uniseg v0.2.0 // indirect
168163
github.com/sagikazarmark/locafero v0.11.0 // indirect
169164
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
170165
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect

apps/evm/go.sum

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo
350350
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
351351
github.com/crate-crypto/go-eth-kzg v1.4.0 h1:WzDGjHk4gFg6YzV0rJOAsTK4z3Qkz5jd4RE3DAvPFkg=
352352
github.com/crate-crypto/go-eth-kzg v1.4.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI=
353-
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg=
354-
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM=
355353
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
356354
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
357355
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -407,10 +405,8 @@ github.com/ethereum/c-kzg-4844/v2 v2.1.5 h1:aVtoLK5xwJ6c5RiqO8g8ptJ5KU+2Hdquf6G3
407405
github.com/ethereum/c-kzg-4844/v2 v2.1.5/go.mod h1:u59hRTTah4Co6i9fDWtiCjTrblJv0UwsqZKCc0GfgUs=
408406
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab h1:rvv6MJhy07IMfEKuARQ9TKojGqLVNxQajaXEp/BoqSk=
409407
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab/go.mod h1:IuLm4IsPipXKF7CW5Lzf68PIbZ5yl7FFd74l/E0o9A8=
410-
github.com/ethereum/go-ethereum v1.16.8 h1:LLLfkZWijhR5m6yrAXbdlTeXoqontH+Ga2f9igY7law=
411-
github.com/ethereum/go-ethereum v1.16.8/go.mod h1:Fs6QebQbavneQTYcA39PEKv2+zIjX7rPUZ14DER46wk=
412-
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
413-
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
408+
github.com/ethereum/go-ethereum v1.17.0 h1:2D+1Fe23CwZ5tQoAS5DfwKFNI1HGcTwi65/kRlAVxes=
409+
github.com/ethereum/go-ethereum v1.17.0/go.mod h1:2W3msvdosS/MCWytpqTcqgFiRYbTH59FxDJzqah120o=
414410
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
415411
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
416412
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
@@ -623,6 +619,10 @@ github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA
623619
github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
624620
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
625621
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
622+
github.com/grafana/pyroscope-go v1.2.7 h1:VWBBlqxjyR0Cwk2W6UrE8CdcdD80GOFNutj0Kb1T8ac=
623+
github.com/grafana/pyroscope-go v1.2.7/go.mod h1:o/bpSLiJYYP6HQtvcoVKiE9s5RiNgjYTj1DhiddP2Pc=
624+
github.com/grafana/pyroscope-go/godeltaprof v0.1.9 h1:c1Us8i6eSmkW+Ez05d3co8kasnuOY813tbMN8i/a3Og=
625+
github.com/grafana/pyroscope-go/godeltaprof v0.1.9/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU=
626626
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
627627
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
628628
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
@@ -792,9 +792,6 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
792792
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
793793
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
794794
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
795-
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
796-
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
797-
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
798795
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
799796
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
800797
github.com/miekg/dns v1.1.72 h1:vhmr+TF2A3tuoGNkLDFK9zi36F2LS+hKTRW0Uf8kbzI=
@@ -849,8 +846,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
849846
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
850847
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
851848
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
852-
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
853-
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
854849
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
855850
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
856851
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
@@ -959,8 +954,6 @@ github.com/quic-go/webtransport-go v0.10.0 h1:LqXXPOXuETY5Xe8ITdGisBzTYmUOy5eSj+
959954
github.com/quic-go/webtransport-go v0.10.0/go.mod h1:LeGIXr5BQKE3UsynwVBeQrU1TPrbh73MGoC6jd+V7ow=
960955
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
961956
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
962-
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
963-
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
964957
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
965958
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
966959
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=

apps/evm/server/force_inclusion_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func (m *mockDA) HasForcedInclusionNamespace() bool {
7474
return true
7575
}
7676

77+
func (m *mockDA) GetLatestDAHeight(_ context.Context) (uint64, error) {
78+
return 0, nil
79+
}
80+
7781
func TestForceInclusionServer_handleSendRawTransaction_Success(t *testing.T) {
7882
testHeight := uint64(100)
7983

block/internal/da/client.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,23 @@ func (c *client) Retrieve(ctx context.Context, height uint64, namespace []byte)
299299
}
300300
}
301301

302+
// GetLatestDAHeight returns the latest height available on the DA layer by
303+
// querying the network head.
304+
func (c *client) GetLatestDAHeight(ctx context.Context) (uint64, error) {
305+
headCtx, cancel := context.WithTimeout(ctx, c.defaultTimeout)
306+
defer cancel()
307+
308+
header, err := c.headerAPI.NetworkHead(headCtx)
309+
if err != nil {
310+
return 0, fmt.Errorf("failed to get DA network head: %w", err)
311+
}
312+
if header == nil {
313+
return 0, fmt.Errorf("DA network head returned nil header")
314+
}
315+
316+
return header.Height, nil
317+
}
318+
302319
// RetrieveForcedInclusion retrieves blobs from the forced inclusion namespace at the specified height.
303320
func (c *client) RetrieveForcedInclusion(ctx context.Context, height uint64) datypes.ResultRetrieve {
304321
if !c.hasForcedNamespace {

block/internal/da/forced_inclusion_retriever.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ func (r *forcedInclusionRetriever) RetrieveForcedIncludedTxs(ctx context.Context
163163

164164
if result.Code == datypes.StatusNotFound {
165165
r.logger.Debug().Uint64("height", h).Msg("no forced inclusion blobs at height")
166+
syncFetchedBlocks[h] = &BlockData{
167+
Timestamp: result.Timestamp,
168+
}
166169
continue
167170
}
168171

@@ -229,6 +232,7 @@ func (r *forcedInclusionRetriever) RetrieveForcedIncludedTxs(ctx context.Context
229232
Msg("Failed to retrieve DA epoch.. retrying next iteration")
230233

231234
return &ForcedInclusionEvent{
235+
Timestamp: event.Timestamp,
232236
StartDaHeight: daHeight,
233237
EndDaHeight: daHeight,
234238
Txs: [][]byte{},

block/internal/da/interface.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type Client interface {
1717
// Get retrieves blobs by their IDs. Used for visualization and fetching specific blobs.
1818
Get(ctx context.Context, ids []datypes.ID, namespace []byte) ([]datypes.Blob, error)
1919

20+
// GetLatestDAHeight returns the latest height available on the DA layer.
21+
GetLatestDAHeight(ctx context.Context) (uint64, error)
22+
2023
// Namespace accessors.
2124
GetHeaderNamespace() []byte
2225
GetDataNamespace() []byte

block/internal/da/tracing.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,20 @@ func (t *tracedClient) Validate(ctx context.Context, ids []datypes.ID, proofs []
123123
return res, nil
124124
}
125125

126+
func (t *tracedClient) GetLatestDAHeight(ctx context.Context) (uint64, error) {
127+
ctx, span := t.tracer.Start(ctx, "DA.GetLatestDAHeight")
128+
defer span.End()
129+
130+
height, err := t.inner.GetLatestDAHeight(ctx)
131+
if err != nil {
132+
span.RecordError(err)
133+
span.SetStatus(codes.Error, err.Error())
134+
return 0, err
135+
}
136+
span.SetAttributes(attribute.Int64("da.latest_height", int64(height)))
137+
return height, nil
138+
}
139+
126140
func (t *tracedClient) GetHeaderNamespace() []byte { return t.inner.GetHeaderNamespace() }
127141
func (t *tracedClient) GetDataNamespace() []byte { return t.inner.GetDataNamespace() }
128142
func (t *tracedClient) GetForcedInclusionNamespace() []byte {

block/internal/da/tracing_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ func (m *mockFullClient) Validate(ctx context.Context, ids []datypes.ID, proofs
5454
}
5555
return nil, nil
5656
}
57-
func (m *mockFullClient) GetHeaderNamespace() []byte { return []byte{0x01} }
58-
func (m *mockFullClient) GetDataNamespace() []byte { return []byte{0x02} }
59-
func (m *mockFullClient) GetForcedInclusionNamespace() []byte { return []byte{0x03} }
60-
func (m *mockFullClient) HasForcedInclusionNamespace() bool { return true }
57+
func (m *mockFullClient) GetLatestDAHeight(_ context.Context) (uint64, error) { return 0, nil }
58+
func (m *mockFullClient) GetHeaderNamespace() []byte { return []byte{0x01} }
59+
func (m *mockFullClient) GetDataNamespace() []byte { return []byte{0x02} }
60+
func (m *mockFullClient) GetForcedInclusionNamespace() []byte { return []byte{0x03} }
61+
func (m *mockFullClient) HasForcedInclusionNamespace() bool { return true }
6162

6263
// setup a tracer provider + span recorder
6364
func setupDATrace(t *testing.T, inner FullClient) (FullClient, *tracetest.SpanRecorder) {

0 commit comments

Comments
 (0)