go-bitsong icon indicating copy to clipboard operation
go-bitsong copied to clipboard

Genesis validation before initialization

Open giorgionocera opened this issue 3 years ago • 3 comments

In the nft module, inside the InitGenesis method https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/x/nft/genesis.go#L21 it seems it is missing the validation step of the data.

A method called ValidateGenesis is provided inside the nft/types/genesis.go file https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/x/nft/types/genesis.go#L24 so it could be called to validate the passed data before the initialization.

Similar validation is executed on the fantoken module: https://github.com/bitsongofficial/go-bitsong/blob/84691c819214a1f9b9dd844ea2b49b7ccc8ece1b/x/fantoken/genesis.go#L11-L24

What do you think about this? Could it be better to add this validation step? Or maybe am I missing something and this step is already evaluated?

giorgionocera avatar Sep 28 '22 11:09 giorgionocera

I think validate genesis is already executed before init genesis execution on SDK side.

ryusmo avatar Sep 28 '22 17:09 ryusmo

I thought it was possible but I'm not sure. Do you have any references for it?

giorgionocera avatar Sep 28 '22 17:09 giorgionocera

I think validate genesis is already executed before init genesis execution on SDK side.

Yes, please post any reference

angelorc avatar Sep 29 '22 11:09 angelorc