Skip to content
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

chore: Validate pop cmd #118

Merged
merged 5 commits into from
Jan 24, 2025
Merged

chore: Validate pop cmd #118

merged 5 commits into from
Jan 24, 2025

Conversation

gitferry
Copy link
Member

@gitferry gitferry commented Jan 24, 2025

This PR:

  • let generate-create-pop output the result to a JSON file
  • added validate pop cmd which takes the pop JSON file and verify pop

@gitferry gitferry marked this pull request as ready for review January 24, 2025 09:19
@@ -67,7 +75,7 @@ var generateCreatePopCmd = cli.Command{
cli.StringFlag{
Name: btcNetworkFlag,
Usage: "Bitcoin network on which staking should take place (testnet3, mainnet, regtest, simnet, signet)",
Value: "testnet3",
Value: "main",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a blocker, but imo commands by defaults should use testnets and act of acting on mainnet should be concious choice of the operator


secp256SigBase64, err := base64.StdEncoding.DecodeString(babySigOverBTCPk)
if err != nil {
return err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets wrap the error

babySignBtcDoc := staker.NewCosmosSignDoc(babyAddr, base64Bytes)
babySignBtcMarshaled, err := json.Marshal(babySignBtcDoc)
if err != nil {
return err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets wrap the error

ArgsUsage: "<path-to-pop.json>",
}

type ValidationResult struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems unused


bech32cosmosAddressString, err := sdk.Bech32ifyAddressBytes(babyPrefix, sdkAddress.Bytes())
if err != nil {
return fmt.Errorf("failed to get babylon address bytes")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets wrap error


var popsToVerify = []staker.Response{
{
BabyAddress: "bbn1xjz8fs9vkmefdqaxan5kv2d09vmwzru7jhy424",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question, as I assume this data was generated by generate pop command ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, but that would require some e2e tests to set up wallet, generate btc account, etc.

@gitferry gitferry merged commit 6539356 into main Jan 24, 2025
15 checks passed
@gitferry gitferry deleted the gai/validate-pop-cmd branch January 24, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants