2020-10-28 17:35:56 +00:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
2020-11-12 14:18:30 +00:00
|
|
|
"github.com/libp2p/go-libp2p-core/peer"
|
|
|
|
|
2020-10-28 17:35:56 +00:00
|
|
|
"github.com/Secured-Finance/dione/config"
|
2020-11-12 14:18:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type TaskType byte
|
|
|
|
|
|
|
|
const (
|
|
|
|
EthereumTaskType = TaskType(iota)
|
|
|
|
FilecoinTaskType
|
|
|
|
SolanaTaskType
|
2020-10-28 17:35:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// TaskEpoch represents the timestamp of Task computed by the Dione miner
|
|
|
|
type TaskEpoch int64
|
|
|
|
|
2020-10-31 03:48:15 +00:00
|
|
|
const TicketRandomnessLookback = TaskEpoch(1)
|
|
|
|
|
2020-10-28 17:35:56 +00:00
|
|
|
func (e TaskEpoch) String() string {
|
|
|
|
return strconv.FormatInt(int64(e), 10)
|
|
|
|
}
|
|
|
|
|
|
|
|
// DioneTask represents the values of task computation
|
|
|
|
// Miner is an address of miner node
|
|
|
|
type DioneTask struct {
|
2020-11-12 14:18:30 +00:00
|
|
|
Type TaskType
|
|
|
|
Miner peer.ID
|
2020-10-28 17:35:56 +00:00
|
|
|
Ticket *Ticket
|
|
|
|
ElectionProof *ElectionProof
|
|
|
|
BeaconEntries []BeaconEntry
|
2020-11-12 14:18:30 +00:00
|
|
|
Signature *Signature
|
2020-10-31 04:38:51 +00:00
|
|
|
Epoch TaskEpoch
|
|
|
|
Payload []byte
|
2020-10-28 17:35:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var tasksPerEpoch = NewInt(config.TasksPerEpoch)
|
|
|
|
|
|
|
|
const sha256bits = 256
|