Skip to content
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion qbft/messages_encoding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 45 additions & 1 deletion qbft/spectest/generate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ func main() {
if err != nil {
panic(errors.Wrapf(err, "failed to get post state for test: %s", test.TestName()).Error())
}
writeJsonStateComparison(test.TestName(), reflect.TypeOf(test).String(), post)

// Remove private keys from the post state for state comparison
postWithoutKeys := removePrivateKeysFromTest(post)

writeJsonStateComparison(test.TestName(), reflect.TypeOf(test).String(), postWithoutKeys)
}
}

Expand Down Expand Up @@ -129,3 +133,43 @@ func writeJson(name string, data []byte) {
panic(err.Error())
}
}

// removePrivateKeysFromTest creates a copy of a test object without the PrivateKeys field
// for state comparison JSON generation
func removePrivateKeysFromTest(test interface{}) interface{} {
// Use reflection to create a copy without PrivateKeys
v := reflect.ValueOf(test)
if v.Kind() == reflect.Ptr {
// Handle nil pointers
if v.IsNil() {
return nil
}
v = v.Elem()
}

// Handle basic types - return as is
if v.Kind() != reflect.Struct {
return test
}

// Create a new instance of the same type
newTest := reflect.New(v.Type()).Elem()

// Copy all fields except PrivateKeys
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
fieldName := v.Type().Field(i).Name

// Skip the PrivateKeys field
if fieldName == "PrivateKeys" {
continue
}

// Copy the field if it's settable
if newTest.Field(i).CanSet() {
newTest.Field(i).Set(field)
}
}

return newTest.Interface()
}
Original file line number Diff line number Diff line change
Expand Up @@ -588,5 +588,20 @@
],
"OutputMessages": null,
"ExpectedError": "",
"omitempty": null
"omitempty": null,
"PrivateKeys": {
"ValidatorSK": "3515c7d08e5affd729e9579f7588d30f2342ee6f6a9334acf006345262162c6f",
"Shares": {
"1": "5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9",
"2": "48e4c0a38e90f9352d1d09489446443ebd17b1904f4f0002fe894c2c3f62457a",
"3": "65dc7c179f68347cf12f86e1c51e54e8aeeed579d4c715082bb8a0382c1a8153",
"4": "42409cb09fa945fa6a168cf8b0861045d6e562f211a70c4a1cdbcf0417898763"
},
"OperatorKeys": {
"1": "N:25348731840291078005825590325564487387577949984138751827574266177664799802680584081605774102312469830768088407225969049641628198941986718537192182035329752347438705924160238003123375008393636927002319273399963028135027120220608768798379686730122718844961148800683771492121773580137199597743450807936811529760891741387670792248144880659056035035137940232060428168762246489933916254065670890253117832600308471512165153060802815978636310598359088308975108508385218674502080634810394418240783986685733591058597222710267089535157571913548182632316336050742209572764848934897777374280786266604855970036470136926952122328657,E:65537",
"2": "N:19380692323952674950336530367234083790113606424335480299447334067080806863412498173762221640827157735623429372601088493221339453757935498640479209807740318398196750129718650982172885628693308563995804317885824238185016605222210853909063725042302930666432199761930249021741031135410091629291425685693964162609257148704588105892016301017136207059582538937288869562887280694212366517236232789385698010364164842174760842939525720402089906661165496499385143174066921713383005026775550479979819421840872269097075727770647605171958262441964797037700600475418817727627198794203331761634877049025883102909313812173940806865009,E:65537",
"3": "N:23042692375312410209431212220075369771462168541828976026320601755763272594824373407764478848365436526694591289718064090312391596266175362762339688570384091184036790735835524995843250965899650417119088214278198081252039736558026593126004249635980391636156932973518463633425836933056837846295641919915481778165060305918908941364970990847253633286134796387741868110531509158096428372699733396641152569850203142332228887389259875141697509811882756250362520909700274525345433189515441976398006145115732492896165925241689797741642235420252764499666236348860360664007441160136624007453092632424487862102395682766150666456101,E:65537",
"4": "N:21337208502522474685005711940651693803475727242163713620444789044245266147535495914589870975049324678785714624922506474829846327024720934734118104490287818262683901844582119612996845095960577778170569718594900422185685716815552510694470115197448208188662115395989397031539224375738710207882656294390784763763186310443313779613617593951559857040470516653950915988725191691950810202094234619482654665864806813522940427455880495952725494490125337319788870622209333023580684603621981537652291244928295153437106217284653226990427880962061385215755047253829154445447638353249454557466303909832340558698228744210598460152099,E:65537"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -518,5 +518,20 @@
],
"OutputMessages": null,
"ExpectedError": "",
"omitempty": null
"omitempty": null,
"PrivateKeys": {
"ValidatorSK": "3515c7d08e5affd729e9579f7588d30f2342ee6f6a9334acf006345262162c6f",
"Shares": {
"1": "5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9",
"2": "48e4c0a38e90f9352d1d09489446443ebd17b1904f4f0002fe894c2c3f62457a",
"3": "65dc7c179f68347cf12f86e1c51e54e8aeeed579d4c715082bb8a0382c1a8153",
"4": "42409cb09fa945fa6a168cf8b0861045d6e562f211a70c4a1cdbcf0417898763"
},
"OperatorKeys": {
"1": "N:25348731840291078005825590325564487387577949984138751827574266177664799802680584081605774102312469830768088407225969049641628198941986718537192182035329752347438705924160238003123375008393636927002319273399963028135027120220608768798379686730122718844961148800683771492121773580137199597743450807936811529760891741387670792248144880659056035035137940232060428168762246489933916254065670890253117832600308471512165153060802815978636310598359088308975108508385218674502080634810394418240783986685733591058597222710267089535157571913548182632316336050742209572764848934897777374280786266604855970036470136926952122328657,E:65537",
"2": "N:19380692323952674950336530367234083790113606424335480299447334067080806863412498173762221640827157735623429372601088493221339453757935498640479209807740318398196750129718650982172885628693308563995804317885824238185016605222210853909063725042302930666432199761930249021741031135410091629291425685693964162609257148704588105892016301017136207059582538937288869562887280694212366517236232789385698010364164842174760842939525720402089906661165496499385143174066921713383005026775550479979819421840872269097075727770647605171958262441964797037700600475418817727627198794203331761634877049025883102909313812173940806865009,E:65537",
"3": "N:23042692375312410209431212220075369771462168541828976026320601755763272594824373407764478848365436526694591289718064090312391596266175362762339688570384091184036790735835524995843250965899650417119088214278198081252039736558026593126004249635980391636156932973518463633425836933056837846295641919915481778165060305918908941364970990847253633286134796387741868110531509158096428372699733396641152569850203142332228887389259875141697509811882756250362520909700274525345433189515441976398006145115732492896165925241689797741642235420252764499666236348860360664007441160136624007453092632424487862102395682766150666456101,E:65537",
"4": "N:21337208502522474685005711940651693803475727242163713620444789044245266147535495914589870975049324678785714624922506474829846327024720934734118104490287818262683901844582119612996845095960577778170569718594900422185685716815552510694470115197448208188662115395989397031539224375738710207882656294390784763763186310443313779613617593951559857040470516653950915988725191691950810202094234619482654665864806813522940427455880495952725494490125337319788870622209333023580684603621981537652291244928295153437106217284653226990427880962061385215755047253829154445447638353249454557466303909832340558698228744210598460152099,E:65537"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -518,5 +518,20 @@
],
"OutputMessages": null,
"ExpectedError": "",
"omitempty": null
"omitempty": null,
"PrivateKeys": {
"ValidatorSK": "3515c7d08e5affd729e9579f7588d30f2342ee6f6a9334acf006345262162c6f",
"Shares": {
"1": "5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9",
"2": "48e4c0a38e90f9352d1d09489446443ebd17b1904f4f0002fe894c2c3f62457a",
"3": "65dc7c179f68347cf12f86e1c51e54e8aeeed579d4c715082bb8a0382c1a8153",
"4": "42409cb09fa945fa6a168cf8b0861045d6e562f211a70c4a1cdbcf0417898763"
},
"OperatorKeys": {
"1": "N:25348731840291078005825590325564487387577949984138751827574266177664799802680584081605774102312469830768088407225969049641628198941986718537192182035329752347438705924160238003123375008393636927002319273399963028135027120220608768798379686730122718844961148800683771492121773580137199597743450807936811529760891741387670792248144880659056035035137940232060428168762246489933916254065670890253117832600308471512165153060802815978636310598359088308975108508385218674502080634810394418240783986685733591058597222710267089535157571913548182632316336050742209572764848934897777374280786266604855970036470136926952122328657,E:65537",
"2": "N:19380692323952674950336530367234083790113606424335480299447334067080806863412498173762221640827157735623429372601088493221339453757935498640479209807740318398196750129718650982172885628693308563995804317885824238185016605222210853909063725042302930666432199761930249021741031135410091629291425685693964162609257148704588105892016301017136207059582538937288869562887280694212366517236232789385698010364164842174760842939525720402089906661165496499385143174066921713383005026775550479979819421840872269097075727770647605171958262441964797037700600475418817727627198794203331761634877049025883102909313812173940806865009,E:65537",
"3": "N:23042692375312410209431212220075369771462168541828976026320601755763272594824373407764478848365436526694591289718064090312391596266175362762339688570384091184036790735835524995843250965899650417119088214278198081252039736558026593126004249635980391636156932973518463633425836933056837846295641919915481778165060305918908941364970990847253633286134796387741868110531509158096428372699733396641152569850203142332228887389259875141697509811882756250362520909700274525345433189515441976398006145115732492896165925241689797741642235420252764499666236348860360664007441160136624007453092632424487862102395682766150666456101,E:65537",
"4": "N:21337208502522474685005711940651693803475727242163713620444789044245266147535495914589870975049324678785714624922506474829846327024720934734118104490287818262683901844582119612996845095960577778170569718594900422185685716815552510694470115197448208188662115395989397031539224375738710207882656294390784763763186310443313779613617593951559857040470516653950915988725191691950810202094234619482654665864806813522940427455880495952725494490125337319788870622209333023580684603621981537652291244928295153437106217284653226990427880962061385215755047253829154445447638353249454557466303909832340558698228744210598460152099,E:65537"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -944,5 +944,20 @@
],
"OutputMessages": null,
"ExpectedError": "",
"omitempty": null
"omitempty": null,
"PrivateKeys": {
"ValidatorSK": "3515c7d08e5affd729e9579f7588d30f2342ee6f6a9334acf006345262162c6f",
"Shares": {
"1": "5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9",
"2": "48e4c0a38e90f9352d1d09489446443ebd17b1904f4f0002fe894c2c3f62457a",
"3": "65dc7c179f68347cf12f86e1c51e54e8aeeed579d4c715082bb8a0382c1a8153",
"4": "42409cb09fa945fa6a168cf8b0861045d6e562f211a70c4a1cdbcf0417898763"
},
"OperatorKeys": {
"1": "N:25348731840291078005825590325564487387577949984138751827574266177664799802680584081605774102312469830768088407225969049641628198941986718537192182035329752347438705924160238003123375008393636927002319273399963028135027120220608768798379686730122718844961148800683771492121773580137199597743450807936811529760891741387670792248144880659056035035137940232060428168762246489933916254065670890253117832600308471512165153060802815978636310598359088308975108508385218674502080634810394418240783986685733591058597222710267089535157571913548182632316336050742209572764848934897777374280786266604855970036470136926952122328657,E:65537",
"2": "N:19380692323952674950336530367234083790113606424335480299447334067080806863412498173762221640827157735623429372601088493221339453757935498640479209807740318398196750129718650982172885628693308563995804317885824238185016605222210853909063725042302930666432199761930249021741031135410091629291425685693964162609257148704588105892016301017136207059582538937288869562887280694212366517236232789385698010364164842174760842939525720402089906661165496499385143174066921713383005026775550479979819421840872269097075727770647605171958262441964797037700600475418817727627198794203331761634877049025883102909313812173940806865009,E:65537",
"3": "N:23042692375312410209431212220075369771462168541828976026320601755763272594824373407764478848365436526694591289718064090312391596266175362762339688570384091184036790735835524995843250965899650417119088214278198081252039736558026593126004249635980391636156932973518463633425836933056837846295641919915481778165060305918908941364970990847253633286134796387741868110531509158096428372699733396641152569850203142332228887389259875141697509811882756250362520909700274525345433189515441976398006145115732492896165925241689797741642235420252764499666236348860360664007441160136624007453092632424487862102395682766150666456101,E:65537",
"4": "N:21337208502522474685005711940651693803475727242163713620444789044245266147535495914589870975049324678785714624922506474829846327024720934734118104490287818262683901844582119612996845095960577778170569718594900422185685716815552510694470115197448208188662115395989397031539224375738710207882656294390784763763186310443313779613617593951559857040470516653950915988725191691950810202094234619482654665864806813522940427455880495952725494490125337319788870622209333023580684603621981537652291244928295153437106217284653226990427880962061385215755047253829154445447638353249454557466303909832340558698228744210598460152099,E:65537"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,20 @@
],
"OutputMessages": null,
"ExpectedError": "",
"omitempty": null
"omitempty": null,
"PrivateKeys": {
"ValidatorSK": "3515c7d08e5affd729e9579f7588d30f2342ee6f6a9334acf006345262162c6f",
"Shares": {
"1": "5f4711a796c1116b5118ec35279fb64d551d9b38813d2939954dd2df5160d3d9",
"2": "48e4c0a38e90f9352d1d09489446443ebd17b1904f4f0002fe894c2c3f62457a",
"3": "65dc7c179f68347cf12f86e1c51e54e8aeeed579d4c715082bb8a0382c1a8153",
"4": "42409cb09fa945fa6a168cf8b0861045d6e562f211a70c4a1cdbcf0417898763"
},
"OperatorKeys": {
"1": "N:25348731840291078005825590325564487387577949984138751827574266177664799802680584081605774102312469830768088407225969049641628198941986718537192182035329752347438705924160238003123375008393636927002319273399963028135027120220608768798379686730122718844961148800683771492121773580137199597743450807936811529760891741387670792248144880659056035035137940232060428168762246489933916254065670890253117832600308471512165153060802815978636310598359088308975108508385218674502080634810394418240783986685733591058597222710267089535157571913548182632316336050742209572764848934897777374280786266604855970036470136926952122328657,E:65537",
"2": "N:19380692323952674950336530367234083790113606424335480299447334067080806863412498173762221640827157735623429372601088493221339453757935498640479209807740318398196750129718650982172885628693308563995804317885824238185016605222210853909063725042302930666432199761930249021741031135410091629291425685693964162609257148704588105892016301017136207059582538937288869562887280694212366517236232789385698010364164842174760842939525720402089906661165496499385143174066921713383005026775550479979819421840872269097075727770647605171958262441964797037700600475418817727627198794203331761634877049025883102909313812173940806865009,E:65537",
"3": "N:23042692375312410209431212220075369771462168541828976026320601755763272594824373407764478848365436526694591289718064090312391596266175362762339688570384091184036790735835524995843250965899650417119088214278198081252039736558026593126004249635980391636156932973518463633425836933056837846295641919915481778165060305918908941364970990847253633286134796387741868110531509158096428372699733396641152569850203142332228887389259875141697509811882756250362520909700274525345433189515441976398006145115732492896165925241689797741642235420252764499666236348860360664007441160136624007453092632424487862102395682766150666456101,E:65537",
"4": "N:21337208502522474685005711940651693803475727242163713620444789044245266147535495914589870975049324678785714624922506474829846327024720934734118104490287818262683901844582119612996845095960577778170569718594900422185685716815552510694470115197448208188662115395989397031539224375738710207882656294390784763763186310443313779613617593951559857040470516653950915988725191691950810202094234619482654665864806813522940427455880495952725494490125337319788870622209333023580684603621981537652291244928295153437106217284653226990427880962061385215755047253829154445447638353249454557466303909832340558698228744210598460152099,E:65537"
}
}
}
Loading