@@ -151,8 +151,6 @@ func (s *Replayer) replayBlock(ctx context.Context, height uint64) error {
151151 var prevState types.State
152152 if height == s .genesis .InitialHeight {
153153 // For the first block, use genesis state.
154- // The header.AppHash contains the previous state's app hash (i.e., the genesis app hash).
155- // This is what ExecuteTxs needs as input.
156154 prevState = types.State {
157155 ChainID : s .genesis .ChainID ,
158156 InitialHeight : s .genesis .InitialHeight ,
@@ -161,15 +159,12 @@ func (s *Replayer) replayBlock(ctx context.Context, height uint64) error {
161159 AppHash : header .AppHash , // Genesis app hash (input to first block execution)
162160 }
163161 } else {
164- // Get previous state from store.
165162 // GetStateAtHeight(height-1) returns the state AFTER block height-1 was executed,
166163 // which contains the correct AppHash to use as input for executing block at 'height'.
167164 prevState , err = s .store .GetStateAtHeight (ctx , height - 1 )
168165 if err != nil {
169166 return fmt .Errorf ("failed to get previous state: %w" , err )
170167 }
171- // Note: prevState.AppHash is already correct - it's the result of executing block height-1,
172- // which is what we need as input for executing block at 'height'.
173168 }
174169
175170 // Prepare transactions
@@ -217,8 +212,7 @@ func (s *Replayer) replayBlock(ctx context.Context, height uint64) error {
217212 Str ("app_hash" , hex .EncodeToString (newAppHash )).
218213 Msg ("replayBlock: app hash verified against stored state" )
219214 } else {
220- // State doesn't exist yet - this is expected during replay.
221- // We trust the execution result since we're replaying validated blocks.
215+ // State doesn't exist yet, we trust the execution result since we're replaying validated blocks.
222216 s .logger .Debug ().
223217 Uint64 ("height" , height ).
224218 Str ("app_hash" , hex .EncodeToString (newAppHash )).
0 commit comments