Documentation
¶
Index ¶
- Constants
- Variables
- func NewHareOracleFromClient(oc *OracleClient) *hareOracle
- func NewLocalOracle(rolacle *eligibility.FixedRolacle, committeeSize int, nodeID types.NodeId) *localOracle
- func SetServerAddress(addr string)
- type ActivationDb
- type BlockEligibilityValidator
- type BlockOracle
- type EpochBeaconProvider
- type HTTPRequester
- type HareOracle
- type MinerBlockOracle
- type OracleClient
- func (oc *OracleClient) Eligible(layer types.LayerID, round int32, committeeSize int, id types.NodeId, ...) (bool, error)
- func (oc *OracleClient) IsIdentityActive(s string, id types.LayerID) (bool, error)
- func (o *OracleClient) Proof(layer types.LayerID, round int32) ([]byte, error)
- func (oc *OracleClient) Register(honest bool, id string)
- func (oc *OracleClient) Unregister(honest bool, id string)
- func (oc *OracleClient) ValidateSingle(instanceID []byte, K int, committeeSize int, proof []byte, pubKey string) bool
- func (oc *OracleClient) World() uint64
- type Requester
- type Signer
- type VRFValidationFunction
Constants ¶
const DefaultOracleServerAddress = "http://localhost:3030"
const Register = "register"
const Unregister = "unregister"
const Validate = "validatemap"
const ValidateSingle = "validate"
Variables ¶
var ServerAddress = DefaultOracleServerAddress
ServerAddress is the oracle server we're using
Functions ¶
func NewHareOracleFromClient ¶
func NewHareOracleFromClient(oc *OracleClient) *hareOracle
func NewLocalOracle ¶
func NewLocalOracle(rolacle *eligibility.FixedRolacle, committeeSize int, nodeID types.NodeId) *localOracle
func SetServerAddress ¶
func SetServerAddress(addr string)
Types ¶
type ActivationDb ¶
type BlockEligibilityValidator ¶
type BlockEligibilityValidator struct {
// contains filtered or unexported fields
}
func NewBlockEligibilityValidator ¶
func NewBlockEligibilityValidator(committeeSize, genesisActiveSetSize uint32, layersPerEpoch uint16, activationDb ActivationDb, beaconProvider *EpochBeaconProvider, validateVRF VRFValidationFunction, log log.Log) *BlockEligibilityValidator
func (BlockEligibilityValidator) BlockSignedAndEligible ¶
func (v BlockEligibilityValidator) BlockSignedAndEligible(block *types.Block) (bool, error)
type BlockOracle ¶
type EpochBeaconProvider ¶
type EpochBeaconProvider struct { }
type HTTPRequester ¶
type HTTPRequester struct {
// contains filtered or unexported fields
}
func NewHTTPRequester ¶
func NewHTTPRequester(url string) *HTTPRequester
func (*HTTPRequester) Get ¶
func (hr *HTTPRequester) Get(api, data string) []byte
type HareOracle ¶
type MinerBlockOracle ¶
type MinerBlockOracle struct {
// contains filtered or unexported fields
}
func NewMinerBlockOracle ¶
func NewMinerBlockOracle(committeeSize uint32, genesisActiveSetSize uint32, layersPerEpoch uint16, activationDb ActivationDb, beaconProvider *EpochBeaconProvider, vrfSigner Signer, nodeId types.NodeId, isSynced func() bool, log log.Log) *MinerBlockOracle
func (*MinerBlockOracle) BlockEligible ¶
func (bo *MinerBlockOracle) BlockEligible(layerID types.LayerID) (types.AtxId, []types.BlockEligibilityProof, error)
func (*MinerBlockOracle) GetEligibleLayers ¶
func (bo *MinerBlockOracle) GetEligibleLayers() []types.LayerID
type OracleClient ¶
type OracleClient struct {
// contains filtered or unexported fields
}
OracleClient is a temporary replacement fot the real oracle. its gets accurate results from a server.
func NewOracleClient ¶
func NewOracleClient() *OracleClient
NewOracleClient creates a new client to query the oracle. it generates a random worldid
func NewOracleClientWithWorldID ¶
func NewOracleClientWithWorldID(world uint64) *OracleClient
NewOracleClientWithWorldID creates a new client with a specific worldid
func (*OracleClient) Eligible ¶
func (oc *OracleClient) Eligible(layer types.LayerID, round int32, committeeSize int, id types.NodeId, sig []byte) (bool, error)
Eligible checks whether a given ID is in the eligible list or not. it fetches the list once and gives answers locally after that.
func (*OracleClient) IsIdentityActive ¶
func (*OracleClient) Register ¶
func (oc *OracleClient) Register(honest bool, id string)
Register asks the oracle server to add this node to the active set
func (*OracleClient) Unregister ¶
func (oc *OracleClient) Unregister(honest bool, id string)
Unregister asks the oracle server to de-list this node from the active set
func (*OracleClient) ValidateSingle ¶
func (oc *OracleClient) ValidateSingle(instanceID []byte, K int, committeeSize int, proof []byte, pubKey string) bool
NOTE: this is old code, the new Validate fetches the whole map at once instead of requesting for each ID
func (*OracleClient) World ¶
func (oc *OracleClient) World() uint64
World returns the world this oracle works in