Handle genesis
This commit is contained in:
parent
771c7969f6
commit
48d7b0a416
3
.github/workflows/on-pr.yml
vendored
3
.github/workflows/on-pr.yml
vendored
@ -206,4 +206,5 @@ jobs:
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
args: --timeout 90s --disable deadcode
|
||||
args: --timeout 90s --disable deadcode,
|
||||
# args: --timeout 90s --disable deadcode,unused
|
||||
|
@ -18,6 +18,8 @@
|
||||
package beaconclient
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/vulcanize/ipld-ethcl-indexer/pkg/database/sql"
|
||||
"golang.org/x/sync/errgroup"
|
||||
@ -85,10 +87,24 @@ func handleBatchProcess(maxWorkers int, bp BatchProcessing, db sql.Database, ser
|
||||
// Process all ranges and send each individual slot to the worker.
|
||||
go func() {
|
||||
for slots := range slotsCh {
|
||||
for i := slots.startSlot; i <= slots.endSlot; i++ {
|
||||
workCh <- i
|
||||
if slots.startSlot > slots.endSlot {
|
||||
log.Error("We received a batch process request where the startSlot is greater than the end slot.")
|
||||
errCh <- batchHistoricError{
|
||||
err: fmt.Errorf("We received a startSlot where the start was greater than the end."),
|
||||
errProcess: "RangeOrder",
|
||||
slot: slots.startSlot,
|
||||
}
|
||||
errCh <- batchHistoricError{
|
||||
err: fmt.Errorf("We received a endSlot where the start was greater than the end."),
|
||||
errProcess: "RangeOrder",
|
||||
slot: slots.endSlot,
|
||||
}
|
||||
} else {
|
||||
for i := slots.startSlot; i <= slots.endSlot; i++ {
|
||||
workCh <- i
|
||||
}
|
||||
processedCh <- slots
|
||||
}
|
||||
processedCh <- slots
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -45,7 +45,6 @@ var (
|
||||
return fmt.Sprintf("Unable to properly unmarshal the Slot field in the %s.", obj)
|
||||
}
|
||||
ParentRootUnmarshalError = "Unable to properly unmarshal the ParentRoot field in the SignedBeaconBlock."
|
||||
MissingIdentifiedError = "Can't query state without a set slot or block_root"
|
||||
MissingEth1Data = "Can't get the Eth1 block_hash"
|
||||
VersionedUnmarshalerError = "Unable to create a versioned unmarshaler"
|
||||
)
|
||||
@ -160,11 +159,8 @@ func (ps *ProcessSlot) getSignedBeaconBlock(serverAddress string, vmCh <-chan *d
|
||||
var blockIdentifier string // Used to query the block
|
||||
if ps.BlockRoot != "" {
|
||||
blockIdentifier = ps.BlockRoot
|
||||
} else if ps.Slot != 0 {
|
||||
blockIdentifier = strconv.Itoa(ps.Slot)
|
||||
} else {
|
||||
log.Error(MissingIdentifiedError)
|
||||
return fmt.Errorf(MissingIdentifiedError)
|
||||
blockIdentifier = strconv.Itoa(ps.Slot)
|
||||
}
|
||||
blockEndpoint := serverAddress + BcBlockQueryEndpoint + blockIdentifier
|
||||
var err error
|
||||
@ -209,11 +205,8 @@ func (ps *ProcessSlot) getBeaconState(serverEndpoint string, vmCh chan<- *dt.Ver
|
||||
var stateIdentifier string // Used to query the state
|
||||
if ps.StateRoot != "" {
|
||||
stateIdentifier = ps.StateRoot
|
||||
} else if ps.Slot != 0 {
|
||||
stateIdentifier = strconv.Itoa(ps.Slot)
|
||||
} else {
|
||||
log.Error(MissingIdentifiedError)
|
||||
return fmt.Errorf(MissingIdentifiedError)
|
||||
stateIdentifier = strconv.Itoa(ps.Slot)
|
||||
}
|
||||
stateEndpoint := serverEndpoint + BcStateQueryEndpoint + stateIdentifier
|
||||
ps.SszBeaconState, _, _ = querySsz(stateEndpoint, strconv.Itoa(ps.Slot))
|
||||
|
Loading…
Reference in New Issue
Block a user