@@ -1048,6 +1048,15 @@ func (c *Bor) commitSpan(
10481048 return err
10491049 }
10501050
1051+ // check if chain id matches with heimdall span
1052+ if heimdallSpan .ChainID != c .chainConfig .ChainID .String () {
1053+ return fmt .Errorf (
1054+ "Chain id proposed span, %s, and bor chain id, %s, doesn't match" ,
1055+ heimdallSpan .ChainID ,
1056+ c .chainConfig .ChainID ,
1057+ )
1058+ }
1059+
10511060 // get validators bytes
10521061 var validators []MinimalVal
10531062 for _ , val := range heimdallSpan .ValidatorSet .Validators {
@@ -1167,11 +1176,22 @@ func (c *Bor) CommitStates(
11671176 if err := json .Unmarshal (response .Result , & eventRecord ); err != nil {
11681177 return err
11691178 }
1179+
1180+ // check if chain id matches with event record
1181+ if eventRecord .ChainID != "" && eventRecord .ChainID != c .chainConfig .ChainID .String () {
1182+ return fmt .Errorf (
1183+ "Chain id proposed state in span, %s, and bor chain id, %s, doesn't match" ,
1184+ eventRecord .ChainID ,
1185+ c .chainConfig .ChainID ,
1186+ )
1187+ }
1188+
11701189 log .Info ("→ committing new state" ,
11711190 "id" , eventRecord .ID ,
11721191 "contract" , eventRecord .Contract ,
11731192 "data" , hex .EncodeToString (eventRecord .Data ),
11741193 "txHash" , eventRecord .TxHash ,
1194+ "chainID" , eventRecord .ChainID ,
11751195 )
11761196
11771197 recordBytes , err := rlp .EncodeToBytes (eventRecord )
0 commit comments