this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve strict verification

+9 -9
+9 -9
cmd/relay/relay/verify.go
··· 127 127 if evt.TooBig { 128 128 return fmt.Errorf("deprecated tooBig commit flag set") 129 129 } 130 + // if previous repo stat is unknown, and prevData is nil, assume that this is first commit for the account 131 + // TODO: should still validate records existing in blocks, etc 132 + if prevRepo == nil && evt.PrevData == nil { 133 + r.Logger.Info("not verifying prevData or MST inversion for first commit from account") 134 + return nil 135 + } 136 + 130 137 if evt.PrevData == nil { 131 138 return fmt.Errorf("missing prevData field") 132 139 } ··· 142 149 } 143 150 } 144 151 145 - // this parse is redundant with earlier parse; once lenient mode is removed we should do only a single pass 146 - origRepo, _, err := repo.LoadRepoFromCAR(ctx, bytes.NewReader(evt.Blocks)) 147 - if err != nil { 148 - return err 149 - } 150 - 151 - // TODO: break out this function in to smaller chunks 152 - _ = origRepo 152 + // TODO: break out this function in to smaller chunks. For example, missing PrevData 153 153 if _, err := repo.VerifyCommitMessage(ctx, evt); err != nil { 154 154 logger.Warn("failed to invert commit MST", "err", err) 155 155 } ··· 158 158 if evt.Rebase { 159 159 return fmt.Errorf("deprecated rebase commit flag set") 160 160 } 161 - _, err = syntax.ParseDatetime(evt.Time) 161 + _, err := syntax.ParseDatetime(evt.Time) 162 162 if err != nil { 163 163 return fmt.Errorf("commit timestamp syntax: %w", err) 164 164 }