Skip to content

Commit

Permalink
fix: add exported values into genesis state
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Jul 29, 2024
1 parent a70e8b8 commit 0f843f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions x/audit/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func ValidateGenesis(data *types.GenesisState) error {
}

if err := record.Attributes.Validate(); err != nil {
sdkerrors.Wrap(err, "audited attributes: invalid attributes")
return sdkerrors.Wrap(err, "audited attributes: invalid attributes")
}
}

Expand Down Expand Up @@ -71,7 +71,9 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
return false
})

return &types.GenesisState{}
return &types.GenesisState{
Attributes: attr,
}
}

// DefaultGenesisState returns default genesis state as raw bytes for the provider
Expand Down
8 changes: 5 additions & 3 deletions x/cert/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
k.WithCertificates1(ctx, func(id types.CertID, certificate types.CertificateResponse) bool {
block, rest := pem.Decode(certificate.Certificate.Cert)
if len(rest) > 0 {
panic(fmt.Sprintf("unable to decode certificate"))
panic("unable to decode certificate")
}

cert, err := x509.ParseCertificate(block.Bytes)
Expand All @@ -58,7 +58,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
}

if cert.SerialNumber.String() != id.Serial.String() {
panic(fmt.Sprintf("certificate id does not match"))
panic("certificate id does not match")
}

res = append(res, types.GenesisCertificate{
Expand All @@ -69,7 +69,9 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
return false
})

return &types.GenesisState{}
return &types.GenesisState{
Certificates: res,
}
}

// DefaultGenesisState returns default genesis state as raw bytes for the provider
Expand Down

0 comments on commit 0f843f3

Please sign in to comment.