Skip to content

Commit 5f750be

Browse files
committed
chore: hardcode last height for ethereum height, (cancel unnecessary calls to ethereum)
Signed-off-by: Jeremy Letang <me@jeremyletang.com>
1 parent 992b55a commit 5f750be

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

core/datasource/external/ethverifier/verifier_snapshot.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,16 @@ func (s *Verifier) LoadState(ctx context.Context, payload *types.Payload) ([]typ
156156
s.restorePendingCallEvents(ctx, pl.EthContractCallEvent)
157157
return nil, nil
158158
case *types.PayloadEthOracleLastBlock:
159-
s.restoreLastEthBlock(ctx, pl.EthOracleLastBlock)
159+
lastEthBlock := pl.EthOracleLastBlock
160+
if vgcontext.InProgressUpgradeFrom(ctx, "v0.74.9") {
161+
// use a recent time instead here to skip unneeded blocks
162+
lastEthBlock = &types.EthBlock{
163+
Height: 19384217,
164+
Time: 1709825615,
165+
}
166+
}
167+
168+
s.restoreLastEthBlock(ctx, lastEthBlock)
160169
return nil, nil
161170
case *types.PayloadEthVerifierMisc:
162171
s.restoreMisc(ctx, pl.Misc)
@@ -167,7 +176,8 @@ func (s *Verifier) LoadState(ctx context.Context, payload *types.Payload) ([]typ
167176
}
168177

169178
func (s *Verifier) OnStateLoaded(ctx context.Context) error {
170-
if vgcontext.InProgressUpgradeFrom(ctx, "v0.74.7") {
179+
// ensure patch block is set to lastBlock
180+
if vgcontext.InProgressUpgradeFrom(ctx, "v0.74.9") {
171181
s.patchBlock = s.lastBlock
172182
}
173183

core/datasource/external/ethverifier/verifier_snapshot_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func TestEthereumVerifierPatchBlock(t *testing.T) {
192192
assert.NoError(t, checkResult)
193193

194194
// now we want to restore as if we are doing an upgrade
195-
ctx := vgcontext.WithSnapshotInfo(context.Background(), "v0.74.7", true)
195+
ctx := vgcontext.WithSnapshotInfo(context.Background(), "v0.74.9", true)
196196

197197
lb, _, err := eov.GetState(lastEthBlockKey)
198198
require.Nil(t, err)

0 commit comments

Comments
 (0)