Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol I changes - part 2 #1078

Merged
4 changes: 4 additions & 0 deletions conseil-api/src/main/resources/metadata.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ metadata-configuration {
include "metadata/tezos.hangzhounet.conf"
visible: true
}
ithacanet {
include "metadata/tezos.ithacanet.conf"
visible: true
}
}
}
bitcoin {
Expand Down
3,413 changes: 3,413 additions & 0 deletions conseil-api/src/main/resources/metadata/tezos.ithacanet.conf

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ object TezosOptics {
case x: EndorsementWithSlot =>
index += 1
x.copy(blockOrder = Some(index))
case x: Preendorsement =>
index += 1
x.copy(blockOrder = Some(index))
case x: SeedNonceRevelation =>
index += 1
x.copy(blockOrder = Some(index))
Expand All @@ -187,6 +190,9 @@ object TezosOptics {
case x: DoubleEndorsementEvidence =>
index += 1
x.copy(blockOrder = Some(index))
case x: DoublePreendorsementEvidence =>
index += 1
x.copy(blockOrder = Some(index))
case x: DoubleBakingEvidence =>
index += 1
x.copy(blockOrder = Some(index))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ object TezosTypes {
"endorsement",
"proposals",
"ballot",
"endorsement_with_slot"
"endorsement_with_slot",
"preendorsement",
"double_preendorsement_evidence"
)

final case class Operations(
Expand All @@ -247,6 +249,12 @@ object TezosTypes {
blockOrder: Option[Int] = None
) extends Operation

final case class Preendorsement(
level: BlockLevel,
metadata: PreendorsementMetadata,
blockOrder: Option[Int] = None
) extends Operation

final case class SeedNonceRevelation(
level: BlockLevel,
nonce: Nonce,
Expand Down Expand Up @@ -319,6 +327,8 @@ object TezosTypes {
) extends Operation

final case class DoubleEndorsementEvidence(blockOrder: Option[Int] = None) extends Operation
final case class DoublePreendorsementEvidence(blockOrder: Option[Int] = None) extends Operation

final case class DoubleBakingEvidence(blockOrder: Option[Int] = None) extends Operation
final case class Proposals(
source: Option[ContractId],
Expand Down Expand Up @@ -348,7 +358,12 @@ object TezosTypes {
//metadata definitions, both shared or specific to operation kind
final case class EndorsementMetadata(
slot: Option[Int],
slots: List[Int],
slots: Option[List[Int]],
delegate: PublicKeyHash,
balance_updates: List[OperationMetadata.BalanceUpdate]
)

final case class PreendorsementMetadata(
delegate: PublicKeyHash,
balance_updates: List[OperationMetadata.BalanceUpdate]
)
Expand Down Expand Up @@ -727,7 +742,8 @@ object TezosTypes {
final case class BakingRights(
level: BlockLevel,
delegate: String,
priority: Int,
priority: Option[Int],
round: Option[Int],
estimated_time: Option[ZonedDateTime],
cycle: Option[Int],
governancePeriod: Option[Int]
Expand Down
8 changes: 4 additions & 4 deletions conseil-lorre/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ lorre {

# feature flags: select if some functionality should be turned off
enabled-features {
future-rights-fetching-is-on: true
future-rights-fetching-is-on: false
future-rights-fetching-is-on: ${?CONSEIL_LORRE_FUTURE_RIGHTS_FETCHING_ENABLED}
metadata-fetching-is-on: true
metadata-fetching-is-on: false
metadata-fetching-is-on: ${?CONSEIL_LORRE_BLOCK_RIGHTS_FETCHING_ENABLED}
fork-handling-is-on: false
fork-handling-is-on: ${?CONSEIL_LORRE_FORK_DETECTION_ENABLED}
registered-tokens-is-on: false
registered-tokens-is-on: ${?CONSEIL_LORRE_REGISTERED_TOKENS_FETCHING_ENABLED}
rights-processing-is-on: true
rights-processing-is-on: false
rights-processing-is-on: ${?CONSEIL_LORRE_RIGHTS_PROCESSING_ENABLED}
baker-features-are-on: true
baker-features-are-on: false
baker-features-are-on: ${?CONSEIL_LORRE_BAKER_FEATURES_ENABLED}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ private[tezos] object TezosDatabaseConversions {
kind = "endorsement_with_slot",
level = Some(endorsement.operations.level),
delegate = Some(metadata.delegate.value),
slots = Some(metadata.slots).map(concatenateToString),
slots = metadata.slots.map(concatenateToString),
operationOrder = blockOrder,
blockHash = block.data.hash.value,
blockLevel = block.data.header.level,
timestamp = toSql(block.data.header.timestamp),
internal = false,
cycle = TezosOptics.Blocks.extractCycle(block),
branch = block.operationGroups.find(h => h.hash == groupHash).map(_.branch.value),
numberOfSlots = Some(metadata.slots.length),
numberOfSlots = metadata.slots.map(_.length),
period = TezosOptics.Blocks.extractPeriod(block.data.metadata),
utcYear = year,
utcMonth = month,
Expand All @@ -290,15 +290,15 @@ private[tezos] object TezosDatabaseConversions {
kind = "endorsement",
level = Some(level),
delegate = Some(metadata.delegate.value),
slots = Some(metadata.slots).map(concatenateToString),
slots = metadata.slots.map(concatenateToString),
operationOrder = blockOrder,
blockHash = block.data.hash.value,
blockLevel = block.data.header.level,
timestamp = toSql(block.data.header.timestamp),
internal = false,
cycle = TezosOptics.Blocks.extractCycle(block),
branch = block.operationGroups.find(h => h.hash == groupHash).map(_.branch.value),
numberOfSlots = Some(metadata.slots.length),
numberOfSlots = metadata.slots.map(_.length),
period = TezosOptics.Blocks.extractPeriod(block.data.metadata),
utcYear = year,
utcMonth = month,
Expand Down Expand Up @@ -646,6 +646,7 @@ private[tezos] object TezosDatabaseConversions {
] = { case (block, groupHash, op) =>
val kind = op match {
case DoubleEndorsementEvidence(_) => "double_endorsement_evidence"
case DoublePreendorsementEvidence(_) => "double_preendorsement_evidence"
case DoubleBakingEvidence(_) => "double_baking_evidence"
case _ => ""
}
Expand Down Expand Up @@ -904,7 +905,7 @@ private[tezos] object TezosDatabaseConversions {
blockHash = Some(fetchKey.blockHash.value),
blockLevel = bakingRights.level,
delegate = bakingRights.delegate,
priority = bakingRights.priority,
priority = bakingRights.priority.orElse(bakingRights.round).get,
estimatedTime = bakingRights.estimated_time.map(toSql),
cycle = fetchKey.cycle,
governancePeriod = fetchKey.governancePeriod,
Expand Down Expand Up @@ -940,7 +941,7 @@ private[tezos] object TezosDatabaseConversions {
blockHash = None,
blockLevel = from.level,
delegate = from.delegate,
priority = from.priority,
priority = from.priority.orElse(from.round).get,
estimatedTime = from.estimated_time.map(toSql),
cycle = from.cycle,
governancePeriod = from.governancePeriod,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class TezosIndexer private (
_ <- feeOperations
.processTezosAverageFees(lorreConf.feesAverageTimeWindow)
.whenA(iteration % lorreConf.feeUpdateInterval == 0)
_ <- rightsProcessor.updateRights()
_ <- if (featureFlags.futureRightsFetchingIsOn) rightsProcessor.updateRights() else Future.successful(())
} yield Some(unhandled)

/* Won't stop Lorre on failure from processing the chain, unless overridden by the environment to halt.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ private[tezos] object TezosJsonDecoders {
//derive all the remaining decoders, sorted to preserve dependencies
implicit val balanceUpdateDecoder: Decoder[OperationMetadata.BalanceUpdate] = deriveConfiguredDecoder
implicit val endorsementMetadataDecoder: Decoder[EndorsementMetadata] = deriveConfiguredDecoder
implicit val preendorsementMetadataDecoder: Decoder[PreendorsementMetadata] = deriveConfiguredDecoder
implicit val balanceUpdatesMetadataDecoder: Decoder[BalanceUpdatesMetadata] = deriveConfiguredDecoder
implicit val revealResultDecoder: Decoder[OperationResult.Reveal] = deriveConfiguredDecoder
implicit val transactionResultDecoder: Decoder[OperationResult.Transaction] = deriveConfiguredDecoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ trait OperationsJsonData {
level = 182308,
metadata = EndorsementMetadata(
slot = None,
slots = List(29, 27, 20, 17),
slots = Some(List(29, 27, 20, 17)),
delegate = PublicKeyHash("tz1fyvFH2pd3V9UEq5psqVokVBYkt7rHTKio"),
balance_updates = List(
BalanceUpdate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait TezosDatabaseConversionsTestFixtures {
level = 182308,
metadata = EndorsementMetadata(
slot = None,
slots = List(29, 27, 20, 17),
slots = Some(List(29, 27, 20, 17)),
delegate = PublicKeyHash("tz1fyvFH2pd3V9UEq5psqVokVBYkt7rHTKio"),
balance_updates = List(
BalanceUpdate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ trait TezosDatabaseOperationsTestFixtures extends RandomGenerationKit {
level = 182308,
metadata = EndorsementMetadata(
slot = None,
slots = List(29, 27, 20, 17),
slots = Some(List(29, 27, 20, 17)),
delegate = PublicKeyHash("tz1fyvFH2pd3V9UEq5psqVokVBYkt7rHTKio"),
balance_updates = List(
BalanceUpdate(
Expand Down