Skip to content

feat(shelley): created genesis pools from shelley genesis #1054

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jkawan
Copy link
Contributor

@jkawan jkawan commented Jul 6, 2025

  1. Added function to generate initial pools
  2. Added changes to convert pools to cbor format
  3. Added function to return a specific pool by its ID
  4. Added unit tests for the above changes

Closes #1042

Signed-off-by: Jenita <jkawan@blinklabs.io>
@jkawan jkawan requested a review from a team as a code owner July 6, 2025 04:30
Signed-off-by: Jenita <jkawan@blinklabs.io>
@@ -128,6 +204,32 @@ func (g *ShelleyGenesis) GenesisUtxos() ([]common.Utxo, error) {
return ret, nil
}

// GetInitialPools returns all initial stake pools with their delegators
func (g *ShelleyGenesis) GetInitialPools() (map[string]GenesisPool, map[string][]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Drop the Get prefix on the function. It's not idiomatic Go

}

// GetPoolById returns a specific pool by its ID along with its delegators
func (g *ShelleyGenesis) GetPoolById(poolId string) (*GenesisPool, []string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Drop the Get prefix on the function. It's not idiomatic Go

@@ -128,6 +204,32 @@ func (g *ShelleyGenesis) GenesisUtxos() ([]common.Utxo, error) {
return ret, nil
}

// GetInitialPools returns all initial stake pools with their delegators
func (g *ShelleyGenesis) GetInitialPools() (map[string]GenesisPool, map[string][]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should return native ledger types here like we do above for GenesisUtxos(). At minimum, we should use common.Address where appropriate.

Credential struct {
KeyHash string `json:"key hash"`
} `json:"credential"`
Network string `json:"network"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a lot of overlap between these structures and common.PoolRegistrationCertificate, common.PoolRelay, and related types. We could probably merge them and avoid the need to convert/copy between them later.

}

// GetPoolById returns a specific pool by its ID along with its delegators
func (g *ShelleyGenesis) GetPoolById(poolId string) (*GenesisPool, []string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should return []common.Address instead of []string

Jenita added 7 commits July 18, 2025 17:40
Signed-off-by: Jenita <jkawan@blinklabs.io>
Signed-off-by: Jenita <jkawan@blinklabs.io>
Signed-off-by: Jenita <jkawan@blinklabs.io>
Signed-off-by: Jenita <jkawan@blinklabs.io>
Signed-off-by: Jenita <jkawan@blinklabs.io>
Signed-off-by: Jenita <jkawan@blinklabs.io>
Signed-off-by: Jenita <jkawan@blinklabs.io>
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.

Create genesis pools from Shelley Genesis
2 participants