Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions ledger/byron/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,52 +39,52 @@ type ByronGenesis struct {
}

type ByronGenesisBlockVersionData struct {
HeavyDelThd int `json:",string"`
MaxBlockSize int `json:",string"`
MaxHeaderSize int `json:",string"`
MaxProposalSize int `json:",string"`
MaxTxSize int `json:",string"`
MpcThd int `json:",string"`
ScriptVersion int
SlotDuration int `json:",string"`
SoftforkRule ByronGenesisBlockVersionDataSoftforkRule
TxFeePolicy ByronGenesisBlockVersionDataTxFeePolicy
UnlockStakeEpoch uint64 `json:",string"`
UpdateImplicit int `json:",string"`
UpdateProposalThd int `json:",string"`
UpdateVoteThd int `json:",string"`
HeavyDelThd int `json:"heavyDelThd,string"`
MaxBlockSize int `json:"maxBlockSize,string"`
MaxHeaderSize int `json:"maxHeaderSize,string"`
MaxProposalSize int `json:"maxProposalSize,string"`
MaxTxSize int `json:"maxTxSize,string"`
MpcThd int `json:"mpcThd,string"`
ScriptVersion int `json:"scriptVersion"`
SlotDuration int `json:"slotDuration,string"`
SoftforkRule ByronGenesisBlockVersionDataSoftforkRule `json:"softforkRule"`
TxFeePolicy ByronGenesisBlockVersionDataTxFeePolicy `json:"txFeePolicy"`
UnlockStakeEpoch uint64 `json:"unlockStakeEpoch,string"`
UpdateImplicit int `json:"updateImplicit,string"`
UpdateProposalThd int `json:"updateProposalThd,string"`
UpdateVoteThd int `json:"updateVoteThd,string"`
}

type ByronGenesisBlockVersionDataSoftforkRule struct {
InitThd int `json:",string"`
MinThd int `json:",string"`
ThdDecrement int `json:",string"`
InitThd int `json:"initThd,string"`
MinThd int `json:"minThd,string"`
ThdDecrement int `json:"thdDecrement,string"`
}

type ByronGenesisBlockVersionDataTxFeePolicy struct {
Multiplier int `json:",string"`
Summand int `json:",string"`
Multiplier int `json:"multiplier,string"`
Summand int `json:"summand,string"`
}

type ByronGenesisProtocolConsts struct {
K int
ProtocolMagic int
VssMinTTL int
VssMaxTTL int
K int `json:"k"`
ProtocolMagic int `json:"protocolMagic"`
VssMinTTL int `json:"vssMinTtl"`
VssMaxTTL int `json:"vssMaxTtl"`
}

type ByronGenesisHeavyDelegation struct {
Cert string
DelegatePk string
IssuerPk string
Omega int
Cert string `json:"cert"`
DelegatePk string `json:"delegatePk"`
IssuerPk string `json:"issuerPk"`
Omega int `json:"omega"`
}

type ByronGenesisVssCert struct {
ExpiryEpoch int
Signature string
SigningKey string
VssKey string
ExpiryEpoch int `json:"expiryEpoch"`
Signature string `json:"signature"`
SigningKey string `json:"signingKey"`
VssKey string `json:"vssKey"`
}

func (g *ByronGenesis) GenesisUtxos() ([]common.Utxo, error) {
Expand Down
2 changes: 1 addition & 1 deletion ledger/common/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

// GenesisRat is a wrapper to big.Rat that allows for unmarshaling from a bare float from JSON
type GenesisRat struct {
*big.Rat
*big.Rat `json:"string"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is "wrong" and probably not effective in any meaningful way. This field is an embedded struct, and the GenesisRat type has custom UnmarshalJSON and MarshalJSON functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed it and tested again. Please review it once

}

func (r *GenesisRat) UnmarshalJSON(data []byte) error {
Expand Down
42 changes: 21 additions & 21 deletions ledger/conway/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,39 @@ type ConwayGenesis struct {
}

type ConwayGenesisPoolVotingThresholds struct {
CommitteeNormal *common.GenesisRat
CommitteeNoConfidence *common.GenesisRat
HardForkInitiation *common.GenesisRat
MotionNoConfidence *common.GenesisRat
PpSecurityGroup *common.GenesisRat
CommitteeNormal *common.GenesisRat `json:"committeeNormal"`
CommitteeNoConfidence *common.GenesisRat `json:"committeeNoConfidence"`
HardForkInitiation *common.GenesisRat `json:"hardForkInitiation"`
MotionNoConfidence *common.GenesisRat `json:"motionNoConfidence"`
PpSecurityGroup *common.GenesisRat `json:"ppSecurityGroup"`
}

type ConwayGenesisDRepVotingThresholds struct {
MotionNoConfidence *common.GenesisRat
CommitteeNormal *common.GenesisRat
CommitteeNoConfidence *common.GenesisRat
UpdateToConstitution *common.GenesisRat
HardForkInitiation *common.GenesisRat
PpNetworkGroup *common.GenesisRat
PpEconomicGroup *common.GenesisRat
PpTechnicalGroup *common.GenesisRat
PpGovGroup *common.GenesisRat
TreasuryWithdrawal *common.GenesisRat
MotionNoConfidence *common.GenesisRat `json:"motionNoConfidence"`
CommitteeNormal *common.GenesisRat `json:"committeeNormal"`
CommitteeNoConfidence *common.GenesisRat `json:"committeeNoConfidence"`
UpdateToConstitution *common.GenesisRat `json:"updateToConstitution"`
HardForkInitiation *common.GenesisRat `json:"hardForkInitiation"`
PpNetworkGroup *common.GenesisRat `json:"ppNetworkGroup"`
PpEconomicGroup *common.GenesisRat `json:"ppEconomicGroup"`
PpTechnicalGroup *common.GenesisRat `json:"ppTechnicalGroup"`
PpGovGroup *common.GenesisRat `json:"ppGovGroup"`
TreasuryWithdrawal *common.GenesisRat `json:"treasuryWithdrawal"`
}

type ConwayGenesisConstitution struct {
Anchor ConwayGenesisConstitutionAnchor
Script string
Anchor ConwayGenesisConstitutionAnchor `json:"anchor"`
Script string `json:"script"`
}

type ConwayGenesisConstitutionAnchor struct {
DataHash string
Url string
DataHash string `json:"dataHash"`
Url string `json:"url"`
}

type ConwayGenesisCommittee struct {
Members map[string]int
Threshold map[string]int
Members map[string]int `json:"members"`
Threshold map[string]int `json:"threshold"`
}

func NewConwayGenesisFromReader(r io.Reader) (ConwayGenesis, error) {
Expand Down
34 changes: 17 additions & 17 deletions ledger/shelley/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,26 @@ func (g ShelleyGenesis) MarshalCBOR() ([]byte, error) {

type ShelleyGenesisProtocolParams struct {
cbor.StructAsArray
MinFeeA uint
MinFeeB uint
MaxBlockBodySize uint
MaxTxSize uint
MaxBlockHeaderSize uint
KeyDeposit uint
PoolDeposit uint
MaxEpoch uint `json:"eMax"`
NOpt uint
A0 *common.GenesisRat
Rho *common.GenesisRat
Tau *common.GenesisRat
MinFeeA uint `json:"minFeeA"`
MinFeeB uint `json:"minFeeB"`
MaxBlockBodySize uint `json:"maxBlockBodySize"`
MaxTxSize uint `json:"maxTxSize"`
MaxBlockHeaderSize uint `json:"maxBlockHeaderSize"`
KeyDeposit uint `json:"keyDeposit"`
PoolDeposit uint `json:"poolDeposit"`
MaxEpoch uint `json:"eMax"`
NOpt uint `json:"nOpt"`
A0 *common.GenesisRat `json:"a0"`
Rho *common.GenesisRat `json:"rho"`
Tau *common.GenesisRat `json:"tau"`
Decentralization *common.GenesisRat `json:"decentralisationParam"`
ExtraEntropy common.Nonce
ExtraEntropy common.Nonce `json:"extraEntropy"`
ProtocolVersion struct {
Major uint
Minor uint
}
Major uint `json:"major"`
Minor uint `json:"minor"`
} `json:"protocolVersion"`
MinUtxoValue uint `json:"minUTxOValue"`
MinPoolCost uint
MinPoolCost uint `json:"minPoolCost"`
}

func (p ShelleyGenesisProtocolParams) MarshalCBOR() ([]byte, error) {
Expand Down
4 changes: 2 additions & 2 deletions ledger/shelley/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ var expectedGenesisObj = shelley.ShelleyGenesis{
Type: common.NonceTypeNeutral,
},
ProtocolVersion: struct {
Major uint
Minor uint
Major uint `json:"major"`
Minor uint `json:"minor"`
}{
Major: 2,
Minor: 0,
Expand Down
Loading