Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions ledger/allegra/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeRegistrationCertificate{
StakeRegistration: common.StakeCredential{},
StakeRegistration: common.Credential{},
},
},
}
Expand All @@ -595,7 +595,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeDeregistrationCertificate{
StakeDeregistration: common.StakeCredential{},
StakeDeregistration: common.Credential{},
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/alonzo/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeRegistrationCertificate{
StakeRegistration: common.StakeCredential{},
StakeRegistration: common.Credential{},
},
},
}
Expand All @@ -629,7 +629,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeDeregistrationCertificate{
StakeDeregistration: common.StakeCredential{},
StakeDeregistration: common.Credential{},
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/babbage/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeRegistrationCertificate{
StakeRegistration: common.StakeCredential{},
StakeRegistration: common.Credential{},
},
},
}
Expand All @@ -628,7 +628,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeDeregistrationCertificate{
StakeDeregistration: common.StakeCredential{},
StakeDeregistration: common.Credential{},
},
},
}
Expand Down
36 changes: 18 additions & 18 deletions ledger/common/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ type StakeRegistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeRegistration StakeCredential
StakeRegistration Credential
}

func (c StakeRegistrationCertificate) isCertificate() {}
Expand All @@ -181,7 +181,7 @@ type StakeDeregistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeDeregistration StakeCredential
StakeDeregistration Credential
}

func (c StakeDeregistrationCertificate) isCertificate() {}
Expand All @@ -202,7 +202,7 @@ type StakeDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential *StakeCredential
StakeCredential *Credential
PoolKeyHash PoolKeyHash
}

Expand Down Expand Up @@ -435,7 +435,7 @@ const (

type MoveInstantaneousRewardsCertificateReward struct {
Source uint
Rewards map[*StakeCredential]uint64
Rewards map[*Credential]uint64
OtherPot uint64
}

Expand All @@ -446,7 +446,7 @@ func (r *MoveInstantaneousRewardsCertificateReward) UnmarshalCBOR(
tmpMapData := struct {
cbor.StructAsArray
Source uint
Rewards map[*StakeCredential]uint64
Rewards map[*Credential]uint64
}{}
if _, err := cbor.Decode(data, &tmpMapData); err == nil {
r.Rewards = tmpMapData.Rewards
Expand Down Expand Up @@ -512,7 +512,7 @@ type RegistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential StakeCredential
StakeCredential Credential
Amount int64
}

Expand All @@ -533,7 +533,7 @@ type DeregistrationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential StakeCredential
StakeCredential Credential
Amount int64
}

Expand All @@ -554,7 +554,7 @@ type VoteDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential StakeCredential
StakeCredential Credential
Drep Drep
}

Expand All @@ -575,7 +575,7 @@ type StakeVoteDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential StakeCredential
StakeCredential Credential
PoolKeyHash []byte
Drep Drep
}
Expand All @@ -597,7 +597,7 @@ type StakeRegistrationDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential StakeCredential
StakeCredential Credential
PoolKeyHash []byte
Amount int64
}
Expand All @@ -619,7 +619,7 @@ type VoteRegistrationDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential StakeCredential
StakeCredential Credential
Drep Drep
Amount int64
}
Expand All @@ -641,7 +641,7 @@ type StakeVoteRegistrationDelegationCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
StakeCredential StakeCredential
StakeCredential Credential
PoolKeyHash []byte
Drep Drep
Amount int64
Expand All @@ -664,8 +664,8 @@ type AuthCommitteeHotCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
ColdCredential StakeCredential
HostCredential StakeCredential
ColdCredential Credential
HostCredential Credential
}

func (c AuthCommitteeHotCertificate) isCertificate() {}
Expand All @@ -685,7 +685,7 @@ type ResignCommitteeColdCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
ColdCredential StakeCredential
ColdCredential Credential
Anchor *GovAnchor
}

Expand All @@ -706,7 +706,7 @@ type RegistrationDrepCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
DrepCredential StakeCredential
DrepCredential Credential
Amount int64
Anchor *GovAnchor
}
Expand All @@ -728,7 +728,7 @@ type DeregistrationDrepCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
DrepCredential StakeCredential
DrepCredential Credential
Amount int64
}

Expand All @@ -749,7 +749,7 @@ type UpdateDrepCertificate struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CertType uint
DrepCredential StakeCredential
DrepCredential Credential
Anchor *GovAnchor
}

Expand Down
16 changes: 8 additions & 8 deletions ledger/common/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ import (
)

const (
StakeCredentialTypeAddrKeyHash = 0
StakeCredentialTypeScriptHash = 1
CredentialTypeAddrKeyHash = 0
CredentialTypeScriptHash = 1
)

type StakeCredential struct {
type Credential struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
CredType uint
Credential []byte
}

func (c *StakeCredential) UnmarshalCBOR(data []byte) error {
func (c *Credential) UnmarshalCBOR(data []byte) error {
return c.UnmarshalCbor(data, c)
}

func (c *StakeCredential) Hash() Blake2b224 {
func (c *Credential) Hash() Blake2b224 {
hash, err := blake2b.New(28, nil)
if err != nil {
panic(
Expand All @@ -54,14 +54,14 @@ func (c *StakeCredential) Hash() Blake2b224 {
return Blake2b224(hash.Sum(nil))
}

func (c *StakeCredential) Utxorpc() *utxorpc.StakeCredential {
func (c *Credential) Utxorpc() *utxorpc.StakeCredential {
ret := &utxorpc.StakeCredential{}
switch c.CredType {
case StakeCredentialTypeAddrKeyHash:
case CredentialTypeAddrKeyHash:
ret.StakeCredential = &utxorpc.StakeCredential_AddrKeyHash{
AddrKeyHash: c.Credential[:],
}
case StakeCredentialTypeScriptHash:
case CredentialTypeScriptHash:
ret.StakeCredential = &utxorpc.StakeCredential_ScriptHash{
ScriptHash: c.Credential[:],
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/common/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ type UpdateCommitteeGovAction struct {
cbor.StructAsArray
Type uint
ActionId *GovActionId
Credentials []StakeCredential
CredEpochs map[*StakeCredential]uint
Credentials []Credential
CredEpochs map[*Credential]uint
Unknown cbor.Rat
}

Expand Down
4 changes: 2 additions & 2 deletions ledger/conway/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeRegistrationCertificate{
StakeRegistration: common.StakeCredential{},
StakeRegistration: common.Credential{},
},
},
}
Expand All @@ -628,7 +628,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeDeregistrationCertificate{
StakeDeregistration: common.StakeCredential{},
StakeDeregistration: common.Credential{},
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/mary/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeRegistrationCertificate{
StakeRegistration: common.StakeCredential{},
StakeRegistration: common.Credential{},
},
},
}
Expand All @@ -614,7 +614,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeDeregistrationCertificate{
StakeDeregistration: common.StakeCredential{},
StakeDeregistration: common.Credential{},
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions ledger/shelley/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeRegistrationCertificate{
StakeRegistration: common.StakeCredential{},
StakeRegistration: common.Credential{},
},
},
}
Expand All @@ -580,7 +580,7 @@ func TestUtxoValidateValueNotConservedUtxo(t *testing.T) {
{
Type: common.CertificateTypeStakeRegistration,
Certificate: &common.StakeDeregistrationCertificate{
StakeDeregistration: common.StakeCredential{},
StakeDeregistration: common.Credential{},
},
},
}
Expand Down
Loading