Add support for never-ending transformer

This commit is contained in:
Edvard 2018-11-09 11:55:43 +01:00 committed by Rob Mulholand
parent 82fd73ba3f
commit 8f4648a9e3
31 changed files with 50 additions and 42 deletions

View File

@ -27,5 +27,5 @@ var BiteConfig = shared.TransformerConfig{
ContractAbi: constants.CatABI,
Topic: constants.BiteSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var CatFileChopLumpConfig = shared.TransformerConfig{
ContractAbi: constants.CatABI,
Topic: constants.CatFileChopLumpSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var CatFileFlipConfig = shared.TransformerConfig{
ContractAbi: constants.CatABI,
Topic: constants.CatFileFlipSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var CatFilePitVowConfig = shared.TransformerConfig{
ContractAbi: constants.CatABI,
Topic: constants.CatFilePitVowSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var DealConfig = shared.TransformerConfig{
ContractAbi: constants.FlipperABI,
Topic: constants.DealSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var DentConfig = shared.TransformerConfig{
ContractAbi: constants.FlipperABI,
Topic: constants.DentFunctionSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var DripDripConfig = shared.TransformerConfig{
ContractAbi: constants.DripABI,
Topic: constants.DripDripSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var DripFileIlkConfig = shared.TransformerConfig{
ContractAbi: constants.DripABI,
Topic: constants.DripFileIlkSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var DripFileRepoConfig = shared.TransformerConfig{
ContractAbi: constants.DripABI,
Topic: constants.DripFileRepoSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var DripFileVowConfig = shared.TransformerConfig{
ContractAbi: constants.DripABI,
Topic: constants.DripFileVowSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var FlapKickConfig = shared.TransformerConfig{
ContractAbi: constants.FlapperABI,
Topic: constants.FlapKickSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var FlipKickConfig = shared.TransformerConfig{
ContractAbi: constants.FlipperABI,
Topic: constants.FlipKickSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var Config = shared.TransformerConfig{
ContractAbi: constants.FlopperABI,
Topic: constants.FlopKickSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var FrobConfig = shared.TransformerConfig{
ContractAbi: constants.PitABI,
Topic: constants.FrobSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var DebtCeilingFileConfig = shared.TransformerConfig{
ContractAbi: constants.PitABI,
Topic: constants.PitFileDebtCeilingSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var IlkFileConfig = shared.TransformerConfig{
ContractAbi: constants.PitABI,
Topic: constants.PitFileIlkSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var StabilityFeeFileConfig = shared.TransformerConfig{
ContractAbi: constants.PitABI,
Topic: constants.PitFileStabilityFeeSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -29,5 +29,5 @@ var PriceFeedConfig = shared.TransformerConfig{
ContractAbi: constants.MedianizerABI,
Topic: constants.LogValueSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -55,17 +55,25 @@ func MarkHeaderCheckedInTransaction(headerID int64, tx *sql.Tx, checkedHeadersCo
func MissingHeaders(startingBlockNumber, endingBlockNumber int64, db *postgres.DB, checkedHeadersColumn string) ([]core.Header, error) {
var result []core.Header
err := db.Select(
&result,
`SELECT headers.id, headers.block_number FROM headers
var query string
var err error
if endingBlockNumber == -1 {
query = `SELECT headers.id, headers.block_number FROM headers
LEFT JOIN checked_headers on headers.id = header_id
WHERE (header_id ISNULL OR `+checkedHeadersColumn+` IS FALSE)
WHERE (header_id ISNULL OR ` + checkedHeadersColumn + ` IS FALSE)
AND headers.block_number >= $1
AND headers.eth_node_fingerprint = $2`
err = db.Select(&result, query, startingBlockNumber, db.Node.ID)
} else {
query = `SELECT headers.id, headers.block_number FROM headers
LEFT JOIN checked_headers on headers.id = header_id
WHERE (header_id ISNULL OR ` + checkedHeadersColumn + ` IS FALSE)
AND headers.block_number >= $1
AND headers.block_number <= $2
AND headers.eth_node_fingerprint = $3`,
startingBlockNumber,
endingBlockNumber,
db.Node.ID,
)
AND headers.eth_node_fingerprint = $3`
err = db.Select(&result, query, startingBlockNumber, endingBlockNumber, db.Node.ID)
}
return result, err
}

View File

@ -33,7 +33,7 @@ type TransformerConfig struct {
ContractAbi string
Topic string
StartingBlockNumber int64
EndingBlockNumber int64
EndingBlockNumber int64 // Set -1 for indefinite transformer
}
func HexToInt64(byteString string) int64 {

View File

@ -25,5 +25,5 @@ var TendConfig = shared.TransformerConfig{
ContractAbi: constants.FlipperABI,
Topic: constants.TendFunctionSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -11,5 +11,5 @@ var VatFluxConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatFluxSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var VatFoldConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatFoldSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -11,5 +11,5 @@ var VatGrabConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatGrabSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var VatHealConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatHealSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var VatInitConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatInitSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var VatMoveConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatMoveSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -11,5 +11,5 @@ var VatSlipConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatSlipSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -11,5 +11,5 @@ var VatTollConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatTollSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -11,5 +11,5 @@ var VatTuneConfig = shared.TransformerConfig{
ContractAbi: constants.VatABI,
Topic: constants.VatTuneSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}

View File

@ -25,5 +25,5 @@ var VowFlogConfig = shared.TransformerConfig{
ContractAbi: constants.VowABI,
Topic: constants.VowFlogSignature,
StartingBlockNumber: 0,
EndingBlockNumber: 10000000,
EndingBlockNumber: -1,
}