-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify ExportCmd to export genesis with bech32_prefix #402
Conversation
Co-authored-by: Trinity <[email protected]>
Co-authored-by: Omri <[email protected]> Co-authored-by: danwt <[email protected]>
Is there an issue? |
linter fails btw |
yea, it relate to: dymensionxyz/rollapp-evm#178 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of missing the TLDR here
what is the problem being solved?
server/commands.go
Outdated
@@ -19,7 +20,7 @@ import ( | |||
) | |||
|
|||
// add Rollapp commands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong docstr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a previous comment, but I'll add some comments to it
server/export.go
Outdated
"os" | ||
"strconv" | ||
|
||
rdk_genutiltypes "github.com/dymensionxyz/dymension-rdk/x/genutil/types" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no snake
server/commands.go
Outdated
func AddRollappCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator types.AppCreator, appExport rdk_types.AppExporter, addStartFlags types.ModuleInitFlags) { | ||
dymintCmd := &cobra.Command{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this have usages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server/export.go
Outdated
if _, err := fmt.Fprintln(os.Stderr, "WARNING: App exporter not defined. Returning genesis file."); err != nil { | ||
return err | ||
} | ||
|
||
genesis, err := os.ReadFile(config.GenesisFile()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println(string(genesis)) | ||
return nil | ||
} | ||
|
||
genDoc, err := rdk_genutiltypes.GenesisDocFromFile(config.GenesisFile()) | ||
if err != nil { | ||
fmt.Println("Failed to read genesis doc from file", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why sometimes stderr, sometimes stdout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just a function taken from cosmos-sdk with a little change
|
||
exported, err := appExporter(serverCtx.Logger, db, traceWriter, height, forZeroHeight, jailAllowedAddrs, serverCtx.Viper) | ||
if err != nil { | ||
return fmt.Errorf("error exporting state: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error exporting state: %v", err) | |
return fmt.Errorf("exporting state: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't change it
|
||
exported, err := appExporter(serverCtx.Logger, db, traceWriter, height, forZeroHeight, jailAllowedAddrs, serverCtx.Viper) | ||
if err != nil { | ||
return fmt.Errorf("error exporting state: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error exporting state: %v", err) | |
return fmt.Errorf("exporting state: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't change it
server/export.go
Outdated
consensus_param := doc["consensus_params"].(map[string]interface{}) | ||
block := consensus_param["block"].(map[string]interface{}) | ||
time_iota_ms, _ := strconv.ParseInt(block["time_iota_ms"].(string), 10, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no snake
Need to check OK for type assertion?
// the expected types and could result in type assertion errors. It is recommend | ||
// to either use the cast package or perform manual conversion for safety. | ||
AppOptions interface { | ||
Get(string) interface{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get(string) interface{} | |
Get(string) any |
// for the application. | ||
// | ||
// NOTE: The pubkey input is this machines pubkey. | ||
func GenesisStateFromGenFile(genFile string) (genesisState map[string]json.RawMessage, genDoc map[string]interface{}, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you do concrete type assertions without checking ok
on the genesisState, can we have a concrete type instead?
I have updated description of this PR. |
PR Standards
Since Exported type of Cosmos-SDK default return format is GenesisDoc which does not include the
bech32_prefix
field, we need to modify it to allowbech32_prefix
to be exported every time we export genesisOpening a pull request should be able to meet the following requirements
Closes #XXX
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.
For Author:
godoc
commentsFor Reviewer:
After reviewer approval: