Documentation
¶
Overview ¶
Package conformance provides a DingoStateManager that implements the ouroboros-mock conformance.StateManager interface using dingo's database and ledger packages with an in-memory SQLite database.
Index ¶
- Variables
- type DingoStateManager
- func (m *DingoStateManager) ApplyTransaction(tx common.Transaction, slot uint64) error
- func (m *DingoStateManager) Close() error
- func (m *DingoStateManager) GetGovernanceState() *conformance.GovernanceState
- func (m *DingoStateManager) GetProtocolParameters() common.ProtocolParameters
- func (m *DingoStateManager) GetStateProvider() conformance.StateProvider
- func (m *DingoStateManager) LoadInitialState(state *conformance.ParsedInitialState, pp common.ProtocolParameters) error
- func (m *DingoStateManager) ProcessEpochBoundary(newEpoch uint64) error
- func (m *DingoStateManager) Reset() error
- func (m *DingoStateManager) SetRewardBalances(balances map[common.Blake2b224]uint64)
- type DingoStateProvider
- func (p *DingoStateProvider) CalculateRewards(pots common.AdaPots, snapshot common.RewardSnapshot, ...) (*common.RewardCalculationResult, error)
- func (p *DingoStateProvider) CommitteeMember(coldKey common.Blake2b224) (*common.CommitteeMember, error)
- func (p *DingoStateProvider) CommitteeMembers() ([]common.CommitteeMember, error)
- func (p *DingoStateProvider) Constitution() (*common.Constitution, error)
- func (p *DingoStateProvider) CostModels() map[common.PlutusLanguage]common.CostModel
- func (p *DingoStateProvider) DRepRegistration(credential common.Blake2b224) (*common.DRepRegistration, error)
- func (p *DingoStateProvider) DRepRegistrations() ([]common.DRepRegistration, error)
- func (p *DingoStateProvider) GetAdaPots() common.AdaPots
- func (p *DingoStateProvider) GetRewardSnapshot(epoch uint64) (common.RewardSnapshot, error)
- func (p *DingoStateProvider) GovActionById(id common.GovActionId) (*common.GovActionState, error)
- func (p *DingoStateProvider) GovActionExists(id common.GovActionId) bool
- func (p *DingoStateProvider) IsPoolRegistered(poolKeyHash common.PoolKeyHash) bool
- func (p *DingoStateProvider) IsRewardAccountRegistered(cred common.Credential) bool
- func (p *DingoStateProvider) IsStakeCredentialRegistered(cred common.Credential) bool
- func (p *DingoStateProvider) IsVrfKeyInUse(vrfKeyHash common.Blake2b256) (bool, common.PoolKeyHash, error)
- func (p *DingoStateProvider) NetworkId() uint
- func (p *DingoStateProvider) PoolCurrentState(poolKeyHash common.PoolKeyHash) (*common.PoolRegistrationCertificate, *uint64, error)
- func (p *DingoStateProvider) RewardAccountBalance(cred common.Credential) (*uint64, error)
- func (p *DingoStateProvider) SlotToTime(slot uint64) (time.Time, error)
- func (p *DingoStateProvider) StakeRegistration(stakingKey []byte) ([]common.StakeRegistrationCertificate, error)
- func (p *DingoStateProvider) TimeToSlot(t time.Time) (uint64, error)
- func (p *DingoStateProvider) TreasuryValue() (uint64, error)
- func (p *DingoStateProvider) UpdateAdaPots(pots common.AdaPots) error
- func (p *DingoStateProvider) UtxoById(id common.TransactionInput) (common.Utxo, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("conformance: not found")
ErrNotFound is returned when a requested item is not found
Functions ¶
This section is empty.
Types ¶
type DingoStateManager ¶
type DingoStateManager struct {
// contains filtered or unexported fields
}
DingoStateManager implements conformance.StateManager using dingo's database with an in-memory SQLite backend for testing.
func NewDingoStateManager ¶
func NewDingoStateManager() (*DingoStateManager, error)
NewDingoStateManager creates a new DingoStateManager with an in-memory SQLite database.
func (*DingoStateManager) ApplyTransaction ¶
func (m *DingoStateManager) ApplyTransaction( tx common.Transaction, slot uint64, ) error
ApplyTransaction implements conformance.StateManager.ApplyTransaction.
func (*DingoStateManager) Close ¶
func (m *DingoStateManager) Close() error
Close closes the database connection.
func (*DingoStateManager) GetGovernanceState ¶
func (m *DingoStateManager) GetGovernanceState() *conformance.GovernanceState
GetGovernanceState implements conformance.StateManager.GetGovernanceState.
func (*DingoStateManager) GetProtocolParameters ¶
func (m *DingoStateManager) GetProtocolParameters() common.ProtocolParameters
GetProtocolParameters implements conformance.StateManager.GetProtocolParameters.
func (*DingoStateManager) GetStateProvider ¶
func (m *DingoStateManager) GetStateProvider() conformance.StateProvider
GetStateProvider implements conformance.StateManager.GetStateProvider.
func (*DingoStateManager) LoadInitialState ¶
func (m *DingoStateManager) LoadInitialState( state *conformance.ParsedInitialState, pp common.ProtocolParameters, ) error
LoadInitialState implements conformance.StateManager.LoadInitialState.
func (*DingoStateManager) ProcessEpochBoundary ¶
func (m *DingoStateManager) ProcessEpochBoundary(newEpoch uint64) error
ProcessEpochBoundary implements conformance.StateManager.ProcessEpochBoundary.
func (*DingoStateManager) Reset ¶
func (m *DingoStateManager) Reset() error
Reset implements conformance.StateManager.Reset.
func (*DingoStateManager) SetRewardBalances ¶
func (m *DingoStateManager) SetRewardBalances( balances map[common.Blake2b224]uint64, )
SetRewardBalances implements conformance.StateManager.SetRewardBalances.
type DingoStateProvider ¶
type DingoStateProvider struct {
// contains filtered or unexported fields
}
DingoStateProvider implements conformance.StateProvider by wrapping DingoStateManager to satisfy all gouroboros state interfaces.
func NewDingoStateProvider ¶
func NewDingoStateProvider(manager *DingoStateManager) *DingoStateProvider
NewDingoStateProvider creates a new DingoStateProvider.
func (*DingoStateProvider) CalculateRewards ¶
func (p *DingoStateProvider) CalculateRewards( pots common.AdaPots, snapshot common.RewardSnapshot, params common.RewardParameters, ) (*common.RewardCalculationResult, error)
CalculateRewards calculates rewards for the given epoch
func (*DingoStateProvider) CommitteeMember ¶
func (p *DingoStateProvider) CommitteeMember( coldKey common.Blake2b224, ) (*common.CommitteeMember, error)
CommitteeMember looks up a constitutional committee member by credential hash
func (*DingoStateProvider) CommitteeMembers ¶
func (p *DingoStateProvider) CommitteeMembers() ([]common.CommitteeMember, error)
CommitteeMembers returns all committee members
func (*DingoStateProvider) Constitution ¶
func (p *DingoStateProvider) Constitution() (*common.Constitution, error)
Constitution returns the current constitution
func (*DingoStateProvider) CostModels ¶
func (p *DingoStateProvider) CostModels() map[common.PlutusLanguage]common.CostModel
CostModels returns which Plutus language versions have cost models defined. CostModel values are empty markers (struct{} upstream).
func (*DingoStateProvider) DRepRegistration ¶
func (p *DingoStateProvider) DRepRegistration( credential common.Blake2b224, ) (*common.DRepRegistration, error)
DRepRegistration looks up a DRep registration by credential hash
func (*DingoStateProvider) DRepRegistrations ¶
func (p *DingoStateProvider) DRepRegistrations() ([]common.DRepRegistration, error)
DRepRegistrations returns all DRep registrations
func (*DingoStateProvider) GetAdaPots ¶
func (p *DingoStateProvider) GetAdaPots() common.AdaPots
GetAdaPots returns the current ADA pots
func (*DingoStateProvider) GetRewardSnapshot ¶
func (p *DingoStateProvider) GetRewardSnapshot( epoch uint64, ) (common.RewardSnapshot, error)
GetRewardSnapshot returns the stake snapshot for reward calculation
func (*DingoStateProvider) GovActionById ¶
func (p *DingoStateProvider) GovActionById( id common.GovActionId, ) (*common.GovActionState, error)
GovActionById looks up a governance action by its ID
func (*DingoStateProvider) GovActionExists ¶
func (p *DingoStateProvider) GovActionExists(id common.GovActionId) bool
GovActionExists checks if a governance action exists
func (*DingoStateProvider) IsPoolRegistered ¶
func (p *DingoStateProvider) IsPoolRegistered( poolKeyHash common.PoolKeyHash, ) bool
IsPoolRegistered checks if a pool is currently registered
func (*DingoStateProvider) IsRewardAccountRegistered ¶
func (p *DingoStateProvider) IsRewardAccountRegistered( cred common.Credential, ) bool
IsRewardAccountRegistered checks if a reward account is registered
func (*DingoStateProvider) IsStakeCredentialRegistered ¶
func (p *DingoStateProvider) IsStakeCredentialRegistered( cred common.Credential, ) bool
IsStakeCredentialRegistered checks if a stake credential is currently registered
func (*DingoStateProvider) IsVrfKeyInUse ¶
func (p *DingoStateProvider) IsVrfKeyInUse( vrfKeyHash common.Blake2b256, ) (bool, common.PoolKeyHash, error)
IsVrfKeyInUse checks if a VRF key hash is registered by another pool. Conformance tests don't currently test VRF key uniqueness.
func (*DingoStateProvider) NetworkId ¶
func (p *DingoStateProvider) NetworkId() uint
NetworkId returns the network identifier
func (*DingoStateProvider) PoolCurrentState ¶
func (p *DingoStateProvider) PoolCurrentState( poolKeyHash common.PoolKeyHash, ) (*common.PoolRegistrationCertificate, *uint64, error)
PoolCurrentState returns the current state of a pool
func (*DingoStateProvider) RewardAccountBalance ¶
func (p *DingoStateProvider) RewardAccountBalance( cred common.Credential, ) (*uint64, error)
RewardAccountBalance returns the current reward balance for a stake credential
func (*DingoStateProvider) SlotToTime ¶
func (p *DingoStateProvider) SlotToTime(slot uint64) (time.Time, error)
SlotToTime converts a slot number to a time
func (*DingoStateProvider) StakeRegistration ¶
func (p *DingoStateProvider) StakeRegistration( stakingKey []byte, ) ([]common.StakeRegistrationCertificate, error)
StakeRegistration looks up stake registrations by staking key
func (*DingoStateProvider) TimeToSlot ¶
func (p *DingoStateProvider) TimeToSlot(t time.Time) (uint64, error)
TimeToSlot converts a time to a slot number
func (*DingoStateProvider) TreasuryValue ¶
func (p *DingoStateProvider) TreasuryValue() (uint64, error)
TreasuryValue returns the current treasury value
func (*DingoStateProvider) UpdateAdaPots ¶
func (p *DingoStateProvider) UpdateAdaPots(pots common.AdaPots) error
UpdateAdaPots updates the ADA pots
func (*DingoStateProvider) UtxoById ¶
func (p *DingoStateProvider) UtxoById( id common.TransactionInput, ) (common.Utxo, error)
UtxoById looks up a UTxO by transaction input