Skip to content

Commit a00a13f

Browse files
committed
fix: shuttermint block processing
When handling blocks, we didnt' call the BeforeSaveHook, leading to some outgoing messages to be dropped. For clarity, we now also sync the shuttermint state cache with the db at each block (even though this is not strictly necessary).
1 parent 9967cb7 commit a00a13f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

rolling-shutter/keyper/smobserver/smdriver.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ func (smdrv *ShuttermintDriver) handleBlock(
165165
block *coretypes.ResultBlockResults,
166166
lastCommittedHeight int64,
167167
) error {
168+
err := smdrv.shuttermintState.Load(ctx, queries)
169+
if err != nil {
170+
return err
171+
}
168172
oldMeta, err := queries.TMGetSyncMeta(ctx)
169173
if err != nil {
170174
return err
@@ -217,7 +221,11 @@ func (smdrv *ShuttermintDriver) handleBlock(
217221
return err
218222
}
219223

220-
return nil
224+
err = smdrv.shuttermintState.BeforeSaveHook(ctx, queries)
225+
if err != nil {
226+
return err
227+
}
228+
return smdrv.shuttermintState.Save(ctx, queries)
221229
}
222230

223231
func (smdrv *ShuttermintDriver) innerHandleTransactions(

rolling-shutter/keyper/smobserver/smstate.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ func (st *ShuttermintState) sendPolyEvals(ctx context.Context, queries *database
218218
currentEon = eval.Eon
219219
}
220220

221-
fmt.Printf("SEND POLY EVALS: eon=%d receiver=%s\n", eval.Eon, eval.ReceiverAddress)
221+
log.Info().
222+
Int64("eon", eval.Eon).
223+
Str("receiverAddress", eval.ReceiverAddress).
224+
Msg("sending poly eval")
222225
receiver, err := shdb.DecodeAddress(eval.ReceiverAddress)
223226
if err != nil {
224227
return err

0 commit comments

Comments
 (0)