@lodestar/beacon-node 1.47.0-dev.ee197a8d7f → 1.47.0-dev.f0f26cd2b6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +44 -12
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +21 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +2 -1
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/events/index.d.ts +1 -1
- package/lib/api/impl/events/index.d.ts.map +1 -1
- package/lib/api/impl/events/index.js +12 -3
- package/lib/api/impl/events/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.js +1 -1
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +232 -49
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/impl/validator/utils.js +1 -1
- package/lib/api/impl/validator/utils.js.map +1 -1
- package/lib/api/rest/base.d.ts.map +1 -1
- package/lib/api/rest/base.js +7 -0
- package/lib/api/rest/base.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +1 -1
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +3 -2
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +11 -9
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +21 -13
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +2 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +6 -2
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +14 -5
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.js +5 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +5 -2
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +22 -12
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/bls/index.d.ts +1 -1
- package/lib/chain/bls/index.d.ts.map +1 -1
- package/lib/chain/bls/interface.d.ts +5 -5
- package/lib/chain/bls/interface.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +5 -11
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +116 -101
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/jobItem.d.ts +5 -19
- package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
- package/lib/chain/bls/multithread/jobItem.js +10 -65
- package/lib/chain/bls/multithread/jobItem.js.map +1 -1
- package/lib/chain/bls/multithread/types.d.ts +29 -8
- package/lib/chain/bls/multithread/types.d.ts.map +1 -1
- package/lib/chain/bls/multithread/types.js +12 -0
- package/lib/chain/bls/multithread/types.js.map +1 -1
- package/lib/chain/bls/multithread/utils.d.ts +4 -0
- package/lib/chain/bls/multithread/utils.d.ts.map +1 -1
- package/lib/chain/bls/multithread/utils.js +10 -0
- package/lib/chain/bls/multithread/utils.js.map +1 -1
- package/lib/chain/bls/multithread/worker.js +49 -23
- package/lib/chain/bls/multithread/worker.js.map +1 -1
- package/lib/chain/bls/singleThread.d.ts +4 -10
- package/lib/chain/bls/singleThread.d.ts.map +1 -1
- package/lib/chain/bls/singleThread.js +8 -45
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.d.ts +4 -4
- package/lib/chain/bls/utils.d.ts.map +1 -1
- package/lib/chain/bls/utils.js +18 -19
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +9 -4
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +22 -8
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +1 -0
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +6 -1
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/proposerPreferences.d.ts +6 -0
- package/lib/chain/errors/proposerPreferences.d.ts.map +1 -1
- package/lib/chain/errors/proposerPreferences.js +1 -0
- package/lib/chain/errors/proposerPreferences.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +4 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +8 -4
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/attestationPool.d.ts +1 -1
- package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/attestationPool.js +1 -1
- package/lib/chain/opPools/attestationPool.js.map +1 -1
- package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts +16 -0
- package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts.map +1 -0
- package/lib/chain/opPools/deferredVoluntaryExitPool.js +57 -0
- package/lib/chain/opPools/deferredVoluntaryExitPool.js.map +1 -0
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +7 -2
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.js +4 -4
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
- package/lib/chain/opPools/index.d.ts +2 -1
- package/lib/chain/opPools/index.d.ts.map +1 -1
- package/lib/chain/opPools/index.js +1 -0
- package/lib/chain/opPools/index.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +3 -3
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.js +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +1 -1
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +1 -1
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +5 -0
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +47 -6
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +3 -25
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +5 -2
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +3 -0
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +2 -2
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +5 -5
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/seenCache/seenAttesters.d.ts +9 -5
- package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js +25 -4
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +28 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +121 -13
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +5 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js +6 -0
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +47 -5
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +117 -7
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +3 -3
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +1 -4
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +1 -1
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +40 -10
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +13 -3
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +147 -12
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +5 -14
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.d.ts.map +1 -1
- package/lib/chain/validation/proposerPreferences.js +12 -3
- package/lib/chain/validation/proposerPreferences.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.d.ts +9 -1
- package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +46 -1
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/execution/builder/apiClient.d.ts +70 -0
- package/lib/execution/builder/apiClient.d.ts.map +1 -0
- package/lib/execution/builder/apiClient.js +202 -0
- package/lib/execution/builder/apiClient.js.map +1 -0
- package/lib/execution/builder/validateBid.d.ts +22 -0
- package/lib/execution/builder/validateBid.d.ts.map +1 -0
- package/lib/execution/builder/validateBid.js +111 -0
- package/lib/execution/builder/validateBid.js.map +1 -0
- package/lib/metrics/metrics/lodestar.d.ts +84 -23
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +161 -55
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +13 -0
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +37 -0
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +23 -43
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/constants.d.ts +7 -0
- package/lib/network/processor/constants.d.ts.map +1 -0
- package/lib/network/processor/constants.js +7 -0
- package/lib/network/processor/constants.js.map +1 -0
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +6 -2
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/indexed.d.ts.map +1 -1
- package/lib/network/processor/gossipQueues/indexed.js +0 -1
- package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
- package/lib/network/processor/index.d.ts +3 -0
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +52 -23
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +5 -11
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/util.d.ts +0 -1
- package/lib/network/util.d.ts.map +1 -1
- package/lib/network/util.js +0 -4
- package/lib/network/util.js.map +1 -1
- package/lib/node/deferredVoluntaryExitPublisher.d.ts +15 -0
- package/lib/node/deferredVoluntaryExitPublisher.d.ts.map +1 -0
- package/lib/node/deferredVoluntaryExitPublisher.js +38 -0
- package/lib/node/deferredVoluntaryExitPublisher.js.map +1 -0
- package/lib/node/nodejs.d.ts +2 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +7 -0
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/range/batch.d.ts +23 -5
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +61 -22
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +2 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +32 -12
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.js +1 -1
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/types.d.ts +32 -0
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +33 -0
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +15 -2
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +220 -61
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +16 -11
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +3 -1
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/package.json +35 -35
- package/src/api/impl/beacon/blocks/index.ts +51 -15
- package/src/api/impl/beacon/pool/index.ts +22 -2
- package/src/api/impl/beacon/state/utils.ts +2 -1
- package/src/api/impl/events/index.ts +12 -4
- package/src/api/impl/lodestar/index.ts +1 -1
- package/src/api/impl/validator/index.ts +285 -49
- package/src/api/impl/validator/utils.ts +1 -1
- package/src/api/rest/base.ts +7 -0
- package/src/chain/archiveStore/archiveStore.ts +1 -1
- package/src/chain/blocks/importExecutionPayload.ts +12 -11
- package/src/chain/blocks/index.ts +25 -13
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +8 -2
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +17 -4
- package/src/chain/blocks/verifyBlock.ts +5 -2
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +25 -16
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -9
- package/src/chain/bls/index.ts +1 -1
- package/src/chain/bls/interface.ts +7 -3
- package/src/chain/bls/multithread/index.ts +148 -120
- package/src/chain/bls/multithread/jobItem.ts +12 -82
- package/src/chain/bls/multithread/types.ts +33 -8
- package/src/chain/bls/multithread/utils.ts +11 -0
- package/src/chain/bls/multithread/worker.ts +85 -27
- package/src/chain/bls/singleThread.ts +11 -55
- package/src/chain/bls/utils.ts +23 -24
- package/src/chain/chain.ts +25 -7
- package/src/chain/errors/blockError.ts +8 -2
- package/src/chain/errors/proposerPreferences.ts +7 -0
- package/src/chain/forkChoice/index.ts +4 -0
- package/src/chain/interface.ts +8 -3
- package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
- package/src/chain/opPools/attestationPool.ts +1 -1
- package/src/chain/opPools/deferredVoluntaryExitPool.ts +65 -0
- package/src/chain/opPools/executionPayloadBidPool.ts +13 -7
- package/src/chain/opPools/index.ts +2 -1
- package/src/chain/opPools/payloadAttestationPool.ts +3 -3
- package/src/chain/opPools/syncCommitteeMessagePool.ts +1 -1
- package/src/chain/opPools/syncContributionAndProofPool.ts +1 -1
- package/src/chain/opPools/utils.ts +1 -1
- package/src/chain/prepareNextSlot.ts +49 -6
- package/src/chain/produceBlock/computeNewStateRoot.ts +3 -38
- package/src/chain/produceBlock/produceBlockBody.ts +1 -1
- package/src/chain/regen/interface.ts +5 -2
- package/src/chain/regen/queued.ts +5 -5
- package/src/chain/seenCache/seenAttesters.ts +31 -5
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +143 -14
- package/src/chain/stateCache/fifoBlockStateCache.ts +8 -1
- package/src/chain/stateCache/persistentCheckpointsCache.ts +133 -8
- package/src/chain/stateCache/types.ts +3 -3
- package/src/chain/validation/attestation.ts +1 -7
- package/src/chain/validation/attesterSlashing.ts +1 -8
- package/src/chain/validation/block.ts +43 -10
- package/src/chain/validation/executionPayloadBid.ts +168 -14
- package/src/chain/validation/executionPayloadEnvelope.ts +0 -1
- package/src/chain/validation/payloadAttestationMessage.ts +6 -17
- package/src/chain/validation/proposerPreferences.ts +14 -4
- package/src/chain/validation/proposerSlashing.ts +1 -1
- package/src/chain/validation/voluntaryExit.ts +59 -2
- package/src/execution/builder/apiClient.ts +264 -0
- package/src/execution/builder/validateBid.ts +166 -0
- package/src/metrics/metrics/lodestar.ts +176 -61
- package/src/network/gossip/topic.ts +38 -0
- package/src/network/network.ts +29 -54
- package/src/network/processor/constants.ts +6 -0
- package/src/network/processor/gossipHandlers.ts +6 -2
- package/src/network/processor/gossipQueues/indexed.ts +0 -1
- package/src/network/processor/index.ts +67 -30
- package/src/network/reqresp/score.ts +5 -11
- package/src/network/util.ts +0 -5
- package/src/node/deferredVoluntaryExitPublisher.ts +54 -0
- package/src/node/nodejs.ts +10 -1
- package/src/sync/range/batch.ts +83 -28
- package/src/sync/range/chain.ts +35 -13
- package/src/sync/range/range.ts +1 -1
- package/src/sync/types.ts +36 -1
- package/src/sync/unknownBlock.ts +258 -68
- package/src/sync/utils/downloadByRange.ts +21 -12
- package/src/sync/utils/downloadByRoot.ts +3 -1
- package/lib/chain/bls/maybeBatch.d.ts +0 -12
- package/lib/chain/bls/maybeBatch.d.ts.map +0 -1
- package/lib/chain/bls/maybeBatch.js +0 -35
- package/lib/chain/bls/maybeBatch.js.map +0 -1
- package/src/chain/bls/maybeBatch.ts +0 -45
|
@@ -3,7 +3,7 @@ import { ExecutionStatus, PayloadStatus } from "@lodestar/fork-choice";
|
|
|
3
3
|
import { BUILDER_INDEX_SELF_BUILD, ForkName, ForkSeq, GENESIS_SLOT, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT, SYNC_COMMITTEE_SUBNET_SIZE, isForkPostBellatrix, isForkPostDeneb, isForkPostElectra, isForkPostFulu, isForkPostGloas, } from "@lodestar/params";
|
|
4
4
|
import { DataAvailabilityStatus, beaconBlockToBlinded, calculateCommitteeAssignments, computeEpochAtSlot, computeStartSlotAtEpoch, computeTimeAtSlot, getCurrentSlot, isStatePostAltair, isStatePostGloas, proposerShufflingDecisionRoot, } from "@lodestar/state-transition";
|
|
5
5
|
import { ProducedBlockSource, getValidatorStatus, ssz, } from "@lodestar/types";
|
|
6
|
-
import { GWEI_TO_WEI, TimeoutError, defer, formatWeiToEth, fromHex, prettyWeiToEth, resolveOrRacePromises, toHex, toRootHex, } from "@lodestar/utils";
|
|
6
|
+
import { GWEI_TO_WEI, TimeoutError, byteArrayEquals, defer, formatWeiToEth, fromHex, prettyGweiToEth, prettyWeiToEth, resolveOrRacePromises, sleep, toHex, toPrintableUrl, toRootHex, } from "@lodestar/utils";
|
|
7
7
|
import { MAX_BUILDER_BOOST_FACTOR } from "@lodestar/validator";
|
|
8
8
|
import { BlockInputSource } from "../../../chain/blocks/blockInput/types.js";
|
|
9
9
|
import { AttestationError, AttestationErrorCode, GossipAction, ProposerPreferencesError, ProposerPreferencesErrorCode, SyncCommitteeError, SyncCommitteeErrorCode, } from "../../../chain/errors/index.js";
|
|
@@ -15,7 +15,9 @@ import { validateApiAggregateAndProof } from "../../../chain/validation/index.js
|
|
|
15
15
|
import { validateGossipProposerPreferences } from "../../../chain/validation/proposerPreferences.js";
|
|
16
16
|
import { validateSyncCommitteeGossipContributionAndProof } from "../../../chain/validation/syncCommitteeContributionAndProof.js";
|
|
17
17
|
import { ZERO_HASH } from "../../../constants/index.js";
|
|
18
|
+
import { BUILDER_BID_DEADLINE_MS, decodeBuilderUrl } from "../../../execution/builder/apiClient.js";
|
|
18
19
|
import { BuilderStatus, NoBidReceived } from "../../../execution/builder/http.js";
|
|
20
|
+
import { getBuilderBidTotalGwei, validateBuilderApiExecutionPayloadBid } from "../../../execution/builder/validateBid.js";
|
|
19
21
|
import { validateGossipFnRetryUnknownRoot } from "../../../network/processor/gossipHandlers.js";
|
|
20
22
|
import { callInNextEventLoop } from "../../../util/eventLoop.js";
|
|
21
23
|
import { isOptimisticBlock } from "../../../util/forkChoice.js";
|
|
@@ -38,6 +40,43 @@ import { computeSubnetForCommitteesAtSlot, getPubkeysForIndices, selectBlockProd
|
|
|
38
40
|
const BLOCK_PRODUCTION_RACE_CUTOFF_MS = 2_000;
|
|
39
41
|
/** Overall timeout for execution and block production apis */
|
|
40
42
|
const BLOCK_PRODUCTION_RACE_TIMEOUT_MS = 12_000;
|
|
43
|
+
/** Rejection message of the bid block branch when there is no viable bid to commit to */
|
|
44
|
+
const NO_BID_AVAILABLE = "No builder bid available";
|
|
45
|
+
/**
|
|
46
|
+
* Return the best bid by boosted total payment. A candidate with the max boost factor is
|
|
47
|
+
* preferred over any other regardless of value, ties prefer a builder api bid over the
|
|
48
|
+
* p2p bid, and the earlier received bid between builder api bids.
|
|
49
|
+
*/
|
|
50
|
+
function selectBestBid(candidates) {
|
|
51
|
+
const boostedValue = ({ totalGwei, boostFactor }) => boostFactor * totalGwei;
|
|
52
|
+
let best = null;
|
|
53
|
+
for (const candidate of candidates) {
|
|
54
|
+
if (best === null) {
|
|
55
|
+
best = candidate;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
// Preserve max boost preference before comparing bid values
|
|
59
|
+
const candidateIsMaxBoost = candidate.boostFactor === MAX_BUILDER_BOOST_FACTOR;
|
|
60
|
+
const bestIsMaxBoost = best.boostFactor === MAX_BUILDER_BOOST_FACTOR;
|
|
61
|
+
if (candidateIsMaxBoost !== bestIsMaxBoost) {
|
|
62
|
+
if (candidateIsMaxBoost) {
|
|
63
|
+
best = candidate;
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const candidateValue = boostedValue(candidate);
|
|
68
|
+
const bestValue = boostedValue(best);
|
|
69
|
+
if (candidateValue > bestValue) {
|
|
70
|
+
best = candidate;
|
|
71
|
+
}
|
|
72
|
+
else if (candidateValue === bestValue &&
|
|
73
|
+
// A tie prefers a builder api bid over the p2p bid, and the earlier received bid otherwise
|
|
74
|
+
(best.url === undefined || (candidate.url !== undefined && candidate.receivedMs < best.receivedMs))) {
|
|
75
|
+
best = candidate;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return best;
|
|
79
|
+
}
|
|
41
80
|
/**
|
|
42
81
|
* Engine block selection reasons tracked in metrics / logs
|
|
43
82
|
*/
|
|
@@ -613,12 +652,12 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
|
|
|
613
652
|
}
|
|
614
653
|
return { data, meta };
|
|
615
654
|
},
|
|
616
|
-
async produceBlockV4({ slot, randaoReveal, graffiti, feeRecipient, strictFeeRecipientCheck, includePayload,
|
|
655
|
+
async produceBlockV4({ slot, randaoReveal, graffiti, feeRecipient, strictFeeRecipientCheck, includePayload, builderConfig, }) {
|
|
617
656
|
const fork = config.getForkName(slot);
|
|
618
657
|
if (!isForkPostGloas(fork)) {
|
|
619
658
|
throw new ApiError(400, `produceBlockV4 not supported for pre-gloas fork=${fork}`);
|
|
620
659
|
}
|
|
621
|
-
builderBoostFactor = builderBoostFactor
|
|
660
|
+
const builderBoostFactor = builderConfig.builderBoostFactor;
|
|
622
661
|
if (builderBoostFactor > MAX_BUILDER_BOOST_FACTOR) {
|
|
623
662
|
throw new ApiError(400, `Invalid builderBoostFactor=${builderBoostFactor} > MAX_BUILDER_BOOST_FACTOR`);
|
|
624
663
|
}
|
|
@@ -637,31 +676,98 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
|
|
|
637
676
|
private: opts.private,
|
|
638
677
|
graffitiAppend: chain.opts.graffitiAppend,
|
|
639
678
|
}));
|
|
640
|
-
// TODO GLOAS: add external builder api support when it is implemented
|
|
641
679
|
const isBuildingOnFull = chain.forkChoice.shouldBuildOnFull(parentBlock, slot);
|
|
642
680
|
const bidParentBlockHash = isBuildingOnFull ? parentBlock.executionPayloadBlockHash : parentBlock.parentBlockHash;
|
|
681
|
+
// Post-gloas every proposal parent has an execution payload hash
|
|
682
|
+
if (bidParentBlockHash === null) {
|
|
683
|
+
throw new ApiError(500, `Unknown parent block hash for proposal parent ${parentBlockRootHex}`);
|
|
684
|
+
}
|
|
643
685
|
const circuitBreakerActive = chain.builderCircuitBreaker.isActive(slot, parentBlock);
|
|
644
|
-
//
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
686
|
+
// Fire builder API bid requests while the local payload is built, one request per entry.
|
|
687
|
+
// Any entry failure yields no bid and never fails block production.
|
|
688
|
+
let builderApiBidsPromise = Promise.resolve([]);
|
|
689
|
+
if (builderConfig.builders.length > 0 && !circuitBreakerActive) {
|
|
690
|
+
try {
|
|
691
|
+
const proposerIndex = chain.getHeadState().getBeaconProposer(slot);
|
|
692
|
+
const proposerPubkey = chain.pubkeyCache.getOrThrow(proposerIndex).toBytes();
|
|
693
|
+
builderApiBidsPromise = chain.builderApiClient.getExecutionPayloadBids(builderConfig.builders, slot, fromHex(bidParentBlockHash), parentBlockRoot, proposerPubkey);
|
|
694
|
+
}
|
|
695
|
+
catch (e) {
|
|
696
|
+
logger.warn("Unable to request builder API bids", { slot }, e);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
// A builder bid is expected if builders are configured or a p2p bid was already received.
|
|
700
|
+
// Used by the censorship override which may run before the bid deadline
|
|
701
|
+
const builderBidExpected = builderConfig.builders.length > 0 ||
|
|
702
|
+
(!circuitBreakerActive &&
|
|
703
|
+
chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex) !== null);
|
|
704
|
+
// Select the p2p bid once builders had time to bid up, matching the deadline advertised
|
|
705
|
+
// on builder API bid requests, unless the circuit breaker is active
|
|
706
|
+
const p2pBidPromise = circuitBreakerActive
|
|
707
|
+
? Promise.resolve(null)
|
|
708
|
+
: sleep(Math.max(0, BUILDER_BID_DEADLINE_MS - chain.clock.msFromSlot(slot))).then(() => {
|
|
709
|
+
const p2pBid = chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex);
|
|
710
|
+
// Discard p2p bids below the proposer's configured floor on the total payment.
|
|
711
|
+
// A p2p bid's total is just its value since gossip validation enforces executionPayment=0.
|
|
712
|
+
if (p2pBid !== null && BigInt(p2pBid.signedBid.message.value) < builderConfig.minBid) {
|
|
713
|
+
logger.info("Best p2p bid below configured minimum", {
|
|
714
|
+
slot,
|
|
715
|
+
bidValue: prettyGweiToEth(p2pBid.signedBid.message.value),
|
|
716
|
+
minBid: prettyGweiToEth(builderConfig.minBid),
|
|
717
|
+
});
|
|
718
|
+
return null;
|
|
662
719
|
}
|
|
663
|
-
|
|
664
|
-
|
|
720
|
+
return p2pBid;
|
|
721
|
+
});
|
|
722
|
+
// Candidates are ranked by their boosted counted total payment, the p2p bid is governed
|
|
723
|
+
// by the top-level factors and each builder API bid by its own entry. Ties prefer the
|
|
724
|
+
// earliest received builder API bid, so the signed block can be routed back to its
|
|
725
|
+
// builder directly.
|
|
726
|
+
const bestBidPromise = (async () => {
|
|
727
|
+
const [builderApiBids, p2pBid] = await Promise.all([builderApiBidsPromise, p2pBidPromise]);
|
|
728
|
+
const candidates = (await Promise.all(builderApiBids.map(async ({ url, entry, signedBid, receivedMs }) => {
|
|
729
|
+
try {
|
|
730
|
+
await validateBuilderApiExecutionPayloadBid(chain, signedBid, {
|
|
731
|
+
slot,
|
|
732
|
+
parentBlock,
|
|
733
|
+
parentBlockHash: bidParentBlockHash,
|
|
734
|
+
parentBlockRoot: parentBlockRootHex,
|
|
735
|
+
entry,
|
|
736
|
+
});
|
|
737
|
+
return {
|
|
738
|
+
signedBid,
|
|
739
|
+
totalGwei: getBuilderBidTotalGwei(signedBid.message, entry.maxExecutionPayment),
|
|
740
|
+
boostFactor: entry.builderBoostFactor,
|
|
741
|
+
url,
|
|
742
|
+
receivedMs,
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
catch (e) {
|
|
746
|
+
metrics?.builderApi.bidsDiscarded.inc();
|
|
747
|
+
logger.warn("Ignoring invalid builder API bid", { slot, builder: toPrintableUrl(url) }, e);
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
750
|
+
}))).filter((candidate) => candidate !== null);
|
|
751
|
+
if (p2pBid !== null) {
|
|
752
|
+
candidates.push({
|
|
753
|
+
signedBid: p2pBid.signedBid,
|
|
754
|
+
totalGwei: BigInt(p2pBid.signedBid.message.value),
|
|
755
|
+
boostFactor: builderConfig.builderBoostFactor,
|
|
756
|
+
receivedMs: p2pBid.receivedMs,
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
const best = selectBestBid(candidates);
|
|
760
|
+
if (candidates.length > 0) {
|
|
761
|
+
logger.debug("Ranked builder bid candidates", {
|
|
762
|
+
slot,
|
|
763
|
+
candidates: candidates
|
|
764
|
+
.map((candidate) => `${candidate.url ?? "p2p"}:total=${prettyGweiToEth(candidate.totalGwei)}:boost=${candidate.boostFactor}:received=${candidate.receivedMs}ms`)
|
|
765
|
+
.join(","),
|
|
766
|
+
bidSource: best?.url ?? "p2p",
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
return best;
|
|
770
|
+
})();
|
|
665
771
|
const commonBlockBodyPromise = chain.produceCommonBlockBody({
|
|
666
772
|
slot,
|
|
667
773
|
parentBlock,
|
|
@@ -678,9 +784,6 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
|
|
|
678
784
|
commonBlockBodyPromise,
|
|
679
785
|
};
|
|
680
786
|
metrics?.blockProductionRequests.inc({ source: ProducedBlockSource.engine });
|
|
681
|
-
if (builderBid !== null) {
|
|
682
|
-
metrics?.blockProductionRequests.inc({ source: ProducedBlockSource.builder });
|
|
683
|
-
}
|
|
684
787
|
const timed = (source, fn) => {
|
|
685
788
|
const t = metrics?.blockProductionTime.startTimer();
|
|
686
789
|
return fn().finally(() => t?.({ source }));
|
|
@@ -691,48 +794,92 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
|
|
|
691
794
|
// use abort controller to stop waiting for the bid block if the engine block will be selected
|
|
692
795
|
const controller = new AbortController();
|
|
693
796
|
const enginePromise = timed(ProducedBlockSource.engine, () => chain.produceBlock(baseAttrs)).then((engineBlock) => {
|
|
694
|
-
// No need to wait for the bid block if the engine block will always be selected
|
|
695
|
-
// suspected builder censorship or
|
|
696
|
-
|
|
797
|
+
// No need to wait for the bid block if the engine block will always be selected, either
|
|
798
|
+
// due to suspected builder censorship, or because no builders are configured and the
|
|
799
|
+
// boost factor of 0 always prefers the local block over p2p bids
|
|
800
|
+
if (engineBlock.shouldOverrideBuilder || (builderConfig.builders.length === 0 && builderBoostFactor === 0n)) {
|
|
697
801
|
controller.abort();
|
|
698
802
|
}
|
|
699
803
|
return engineBlock;
|
|
700
804
|
});
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
805
|
+
const bidBlockPromise = bestBidPromise.then((candidate) => {
|
|
806
|
+
if (candidate === null) {
|
|
807
|
+
throw new Error(NO_BID_AVAILABLE);
|
|
808
|
+
}
|
|
809
|
+
metrics?.blockProductionRequests.inc({ source: ProducedBlockSource.builder });
|
|
810
|
+
return timed(ProducedBlockSource.builder, () => chain.produceBlock({ ...baseAttrs, builderBid: candidate.signedBid }));
|
|
811
|
+
});
|
|
812
|
+
const [engineResult, bidBlockResult] = await resolveOrRacePromises([enginePromise, bidBlockPromise], {
|
|
705
813
|
resolveTimeoutMs: cutoffMs,
|
|
706
814
|
raceTimeoutMs: BLOCK_PRODUCTION_RACE_TIMEOUT_MS,
|
|
707
815
|
signal: controller.signal,
|
|
708
816
|
});
|
|
709
817
|
let bestResult = null;
|
|
710
818
|
let source = ProducedBlockSource.engine;
|
|
819
|
+
// Resolved instantly whenever the bid branch produced a block
|
|
820
|
+
const bestBid = bidBlockResult.status === "fulfilled" ? await bestBidPromise : null;
|
|
821
|
+
const logCtx = {
|
|
822
|
+
slot,
|
|
823
|
+
parentSlot,
|
|
824
|
+
parentBlockRoot: parentBlockRootHex,
|
|
825
|
+
parentBlockHash: parentBlock.executionPayloadBlockHash,
|
|
826
|
+
fork,
|
|
827
|
+
builderBoostFactor,
|
|
828
|
+
strictFeeRecipientCheck,
|
|
829
|
+
circuitBreakerActive,
|
|
830
|
+
builderEntries: builderConfig.builders.length,
|
|
831
|
+
...(bestBid !== null
|
|
832
|
+
? {
|
|
833
|
+
bidSource: bestBid.url !== undefined ? toPrintableUrl(bestBid.url) : "p2p",
|
|
834
|
+
bidValue: prettyGweiToEth(bestBid.signedBid.message.value),
|
|
835
|
+
bidExecutionPayment: prettyGweiToEth(bestBid.signedBid.message.executionPayment),
|
|
836
|
+
// The full bid total and the counted total used during bid selection
|
|
837
|
+
bidTotal: prettyGweiToEth(BigInt(bestBid.signedBid.message.value) + bestBid.signedBid.message.executionPayment),
|
|
838
|
+
bidCountedTotal: prettyGweiToEth(bestBid.totalGwei),
|
|
839
|
+
bidBoostFactor: bestBid.boostFactor,
|
|
840
|
+
builderIndex: bestBid.signedBid.message.builderIndex,
|
|
841
|
+
bidBlockHash: toRootHex(bestBid.signedBid.message.blockHash),
|
|
842
|
+
bidReceivedMs: bestBid.receivedMs,
|
|
843
|
+
}
|
|
844
|
+
: {}),
|
|
845
|
+
};
|
|
711
846
|
// handle shouldOverrideBuilder separately
|
|
712
|
-
if (engineResult.status === "fulfilled" &&
|
|
847
|
+
if (engineResult.status === "fulfilled" &&
|
|
848
|
+
engineResult.value.shouldOverrideBuilder &&
|
|
849
|
+
(builderBidExpected || bidBlockResult.status === "fulfilled")) {
|
|
713
850
|
source = ProducedBlockSource.engine;
|
|
714
851
|
bestResult = engineResult;
|
|
715
852
|
metrics?.blockProductionSelectionResults.inc({
|
|
716
853
|
source: ProducedBlockSource.engine,
|
|
717
854
|
reason: EngineBlockSelectionReason.BuilderCensorship,
|
|
718
855
|
});
|
|
719
|
-
logger.warn("Selected local block: censorship suspected in builder bid",
|
|
856
|
+
logger.warn("Selected local block: censorship suspected in builder bid", {
|
|
857
|
+
...logCtx,
|
|
858
|
+
durationMs: engineResult.durationMs,
|
|
859
|
+
...getBlockValueLogInfo(engineResult.value),
|
|
860
|
+
});
|
|
720
861
|
}
|
|
721
|
-
else if (engineResult.status === "fulfilled" &&
|
|
862
|
+
else if (engineResult.status === "fulfilled" && bidBlockResult.status === "fulfilled") {
|
|
722
863
|
const result = selectBlockProductionSourceByBoostFactor({
|
|
723
|
-
builderBoostFactor,
|
|
864
|
+
builderBoostFactor: bestBid?.boostFactor ?? builderBoostFactor,
|
|
724
865
|
engineExecutionPayloadValue: engineResult.value.executionPayloadValue,
|
|
725
|
-
// The bid
|
|
726
|
-
builderExecutionPayloadValue:
|
|
866
|
+
// The bid total payment is its value plus its counted executionPayment, in Gwei
|
|
867
|
+
builderExecutionPayloadValue: (bestBid?.totalGwei ?? 0n) * GWEI_TO_WEI,
|
|
727
868
|
});
|
|
728
869
|
source = result.source;
|
|
729
870
|
metrics?.blockProductionSelectionResults.inc(result);
|
|
730
|
-
logger.info(`Selected ${source} block`, {
|
|
731
|
-
|
|
871
|
+
logger.info(`Selected ${source} block`, {
|
|
872
|
+
reason: result.reason,
|
|
873
|
+
...logCtx,
|
|
874
|
+
engineDurationMs: engineResult.durationMs,
|
|
875
|
+
...getBlockValueLogInfo(engineResult.value, ProducedBlockSource.engine),
|
|
876
|
+
builderDurationMs: bidBlockResult.durationMs,
|
|
877
|
+
});
|
|
878
|
+
bestResult = source === ProducedBlockSource.builder ? bidBlockResult : engineResult;
|
|
732
879
|
}
|
|
733
|
-
else if (
|
|
880
|
+
else if (bidBlockResult.status === "fulfilled") {
|
|
734
881
|
source = ProducedBlockSource.builder;
|
|
735
|
-
bestResult =
|
|
882
|
+
bestResult = bidBlockResult;
|
|
736
883
|
const reason = engineResult.status === "pending"
|
|
737
884
|
? BuilderBlockSelectionReason.EnginePending
|
|
738
885
|
: BuilderBlockSelectionReason.EngineError;
|
|
@@ -740,27 +887,31 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
|
|
|
740
887
|
logger.info("Selected builder bid block: no local block produced", {
|
|
741
888
|
reason,
|
|
742
889
|
...logCtx,
|
|
890
|
+
durationMs: bidBlockResult.durationMs,
|
|
891
|
+
...getBlockValueLogInfo(bidBlockResult.value),
|
|
743
892
|
error: engineResult.status === "rejected" ? engineResult.reason.message : undefined,
|
|
744
893
|
});
|
|
745
894
|
}
|
|
746
895
|
else if (engineResult.status === "fulfilled") {
|
|
747
896
|
source = ProducedBlockSource.engine;
|
|
748
897
|
bestResult = engineResult;
|
|
749
|
-
const reason =
|
|
898
|
+
const reason = bidBlockResult.status === "rejected" && bidBlockResult.reason.message === NO_BID_AVAILABLE
|
|
750
899
|
? EngineBlockSelectionReason.BuilderNoBid
|
|
751
|
-
:
|
|
900
|
+
: bidBlockResult.status === "pending"
|
|
752
901
|
? EngineBlockSelectionReason.BuilderPending
|
|
753
902
|
: EngineBlockSelectionReason.BuilderError;
|
|
754
903
|
metrics?.blockProductionSelectionResults.inc({ source: ProducedBlockSource.engine, reason });
|
|
755
904
|
logger.info("Selected local block: no builder bid block produced", {
|
|
756
905
|
reason,
|
|
757
906
|
...logCtx,
|
|
758
|
-
|
|
907
|
+
durationMs: engineResult.durationMs,
|
|
908
|
+
...getBlockValueLogInfo(engineResult.value),
|
|
909
|
+
error: bidBlockResult.status === "rejected" ? bidBlockResult.reason.message : undefined,
|
|
759
910
|
});
|
|
760
911
|
}
|
|
761
912
|
if (bestResult === null || bestResult.status !== "fulfilled") {
|
|
762
913
|
const engineReason = engineResult.status === "rejected" ? engineResult.reason : engineResult.status;
|
|
763
|
-
const bidReason =
|
|
914
|
+
const bidReason = bidBlockResult.status === "rejected" ? bidBlockResult.reason : bidBlockResult.status;
|
|
764
915
|
logger.error("Block production failed", {
|
|
765
916
|
...logCtx,
|
|
766
917
|
engineReason: String(engineReason),
|
|
@@ -812,7 +963,13 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
|
|
|
812
963
|
}
|
|
813
964
|
return {
|
|
814
965
|
data: block,
|
|
815
|
-
meta: {
|
|
966
|
+
meta: {
|
|
967
|
+
version: fork,
|
|
968
|
+
consensusBlockValue,
|
|
969
|
+
executionPayloadValue,
|
|
970
|
+
executionPayloadIncluded: false,
|
|
971
|
+
builderUrl: source === ProducedBlockSource.builder ? bestBid?.url : undefined,
|
|
972
|
+
},
|
|
816
973
|
};
|
|
817
974
|
},
|
|
818
975
|
async produceAttestationData({ committeeIndex, slot }) {
|
|
@@ -1443,6 +1600,32 @@ export function getValidatorApi(opts, { chain, config, logger, metrics, network,
|
|
|
1443
1600
|
throw new IndexedError("Error processing signed proposer preferences", failures);
|
|
1444
1601
|
}
|
|
1445
1602
|
},
|
|
1603
|
+
async submitBuilderPreferences({ builderPreferences }) {
|
|
1604
|
+
const failures = [];
|
|
1605
|
+
await Promise.all(builderPreferences.map(async (entry, i) => {
|
|
1606
|
+
let builder = Buffer.from(entry.url).toString("utf8");
|
|
1607
|
+
try {
|
|
1608
|
+
const url = decodeBuilderUrl(entry.url);
|
|
1609
|
+
builder = toPrintableUrl(url);
|
|
1610
|
+
const proposerIndex = chain.getHeadState().getBeaconProposer(entry.auth.message.slot);
|
|
1611
|
+
const expectedProposerPubkey = chain.pubkeyCache.getOrThrow(proposerIndex).toBytes();
|
|
1612
|
+
if (!byteArrayEquals(entry.proposerPubkey, expectedProposerPubkey)) {
|
|
1613
|
+
throw new ApiError(400, `Invalid proposer pubkey for builder preferences slot=${entry.auth.message.slot}`);
|
|
1614
|
+
}
|
|
1615
|
+
await chain.builderApiClient.submitBuilderPreferences(url, entry.proposerPubkey, {
|
|
1616
|
+
preferences: { maxExecutionPayment: entry.maxExecutionPayment },
|
|
1617
|
+
auth: entry.auth,
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
catch (e) {
|
|
1621
|
+
failures.push({ index: i, message: e.message });
|
|
1622
|
+
logger.verbose(`Error on submitBuilderPreferences [${i}]`, { slot: entry.auth.message.slot, builder }, e);
|
|
1623
|
+
}
|
|
1624
|
+
}));
|
|
1625
|
+
if (failures.length > 0) {
|
|
1626
|
+
throw new IndexedError("Error submitting builder preferences", failures);
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1446
1629
|
async getExecutionPayloadEnvelope({ slot, beaconBlockRoot }) {
|
|
1447
1630
|
const fork = config.getForkName(slot);
|
|
1448
1631
|
if (!isForkPostGloas(fork)) {
|