@@ -4774,7 +4774,10 @@ impl CoreStore {
47744774 return Ok ( Vec :: new ( ) ) ;
47754775 } ;
47764776 let Some ( transaction_manifest_locator) = anchor. transaction_manifest else {
4777- return Ok ( Vec :: new ( ) ) ;
4777+ if anchor. root_generation == 0 {
4778+ return Ok ( Vec :: new ( ) ) ;
4779+ }
4780+ bail ! ( "CoreStore non-genesis root anchor is missing transaction manifest" ) ;
47784781 } ;
47794782 validate_manifest_locator ( & transaction_manifest_locator) ?;
47804783 let transaction_manifest = self
@@ -7946,6 +7949,12 @@ fn validate_root_anchor_record(anchor: &CoreRootAnchorRecord) -> Result<()> {
79467949 if anchor. publisher_epoch == 0 || anchor. partition_owner_fence == 0 {
79477950 bail ! ( "CoreStore root anchor publisher epoch and owner fence must be nonzero" ) ;
79487951 }
7952+ if anchor. root_generation > 0 && anchor. transaction_manifest . is_none ( ) {
7953+ bail ! ( "CoreStore non-genesis root anchor must include a transaction manifest" ) ;
7954+ }
7955+ if anchor. root_generation == 0 && anchor. transaction_manifest . is_some ( ) {
7956+ bail ! ( "CoreStore genesis root anchor must not include a transaction manifest" ) ;
7957+ }
79497958 if let Some ( locator) = & anchor. transaction_manifest {
79507959 validate_manifest_locator ( locator) ?;
79517960 }
@@ -11559,6 +11568,19 @@ mod tests {
1155911568 "same root generation with different bytes must fail create-new CAS"
1156011569 ) ;
1156111570
11571+ let mut missing_manifest = genesis. clone ( ) ;
11572+ missing_manifest. root_generation = 1 ;
11573+ missing_manifest. previous_root_hash = hash_root_anchor_record ( & genesis) . unwrap ( ) ;
11574+ assert ! (
11575+ store
11576+ . write_root_register_anchor( & missing_manifest)
11577+ . await
11578+ . unwrap_err( )
11579+ . to_string( )
11580+ . contains( "transaction manifest" ) ,
11581+ "non-genesis roots must not be published without transaction evidence"
11582+ ) ;
11583+
1156211584 let mut skipped = genesis. clone ( ) ;
1156311585 skipped. root_generation = 2 ;
1156411586 skipped. previous_root_hash = hash_root_anchor_record ( & genesis) . unwrap ( ) ;
0 commit comments