@lodestar/api 1.39.0-dev.aceb5b7416 → 1.39.0-dev.b2437a6348
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/README.md +1 -1
- package/lib/beacon/routes/beacon/index.d.ts +0 -1
- package/lib/beacon/routes/beacon/index.d.ts.map +1 -1
- package/lib/beacon/routes/beacon/index.js.map +1 -1
- package/lib/beacon/routes/beacon/pool.d.ts.map +1 -1
- package/lib/beacon/routes/beacon/pool.js +2 -2
- package/lib/beacon/routes/beacon/pool.js.map +1 -1
- package/lib/beacon/routes/beacon/rewards.d.ts +4 -115
- package/lib/beacon/routes/beacon/rewards.d.ts.map +1 -1
- package/lib/beacon/routes/beacon/rewards.js +5 -48
- package/lib/beacon/routes/beacon/rewards.js.map +1 -1
- package/lib/beacon/routes/beacon/state.d.ts.map +1 -1
- package/lib/beacon/routes/beacon/state.js +2 -2
- package/lib/beacon/routes/beacon/state.js.map +1 -1
- package/lib/beacon/routes/config.d.ts.map +1 -1
- package/lib/beacon/routes/config.js +2 -2
- package/lib/beacon/routes/config.js.map +1 -1
- package/lib/beacon/routes/debug.d.ts.map +1 -1
- package/lib/beacon/routes/debug.js +2 -2
- package/lib/beacon/routes/debug.js.map +1 -1
- package/lib/beacon/routes/lodestar.d.ts.map +1 -1
- package/lib/beacon/routes/lodestar.js +2 -2
- package/lib/beacon/routes/lodestar.js.map +1 -1
- package/lib/beacon/routes/node.d.ts.map +1 -1
- package/lib/beacon/routes/node.js +2 -2
- package/lib/beacon/routes/node.js.map +1 -1
- package/lib/beacon/routes/proof.d.ts.map +1 -1
- package/lib/beacon/routes/proof.js +1 -2
- package/lib/beacon/routes/proof.js.map +1 -1
- package/lib/beacon/routes/validator.d.ts +7 -0
- package/lib/beacon/routes/validator.d.ts.map +1 -1
- package/lib/beacon/routes/validator.js +2 -2
- package/lib/beacon/routes/validator.js.map +1 -1
- package/lib/builder/routes.d.ts.map +1 -1
- package/lib/builder/routes.js +2 -2
- package/lib/builder/routes.js.map +1 -1
- package/lib/utils/codecs.d.ts +1 -2
- package/lib/utils/codecs.d.ts.map +1 -1
- package/lib/utils/codecs.js +0 -10
- package/lib/utils/codecs.js.map +1 -1
- package/package.json +11 -11
- package/src/beacon/routes/beacon/index.ts +0 -7
- package/src/beacon/routes/beacon/pool.ts +1 -1
- package/src/beacon/routes/beacon/rewards.ts +8 -108
- package/src/beacon/routes/beacon/state.ts +2 -1
- package/src/beacon/routes/config.ts +1 -2
- package/src/beacon/routes/debug.ts +1 -2
- package/src/beacon/routes/lodestar.ts +1 -2
- package/src/beacon/routes/node.ts +1 -2
- package/src/beacon/routes/proof.ts +1 -2
- package/src/beacon/routes/validator.ts +8 -1
- package/src/builder/routes.ts +1 -1
- package/src/utils/codecs.ts +1 -11
|
@@ -1,112 +1,12 @@
|
|
|
1
|
-
import {ContainerType, ValueOf} from "@chainsafe/ssz";
|
|
2
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {Epoch,
|
|
4
|
-
import {
|
|
2
|
+
import {Epoch, rewards} from "@lodestar/types";
|
|
3
|
+
import {JsonOnlyReq} from "../../../utils/codecs.js";
|
|
5
4
|
import {Endpoint, RouteDefinitions, Schema} from "../../../utils/index.js";
|
|
6
5
|
import {ExecutionOptimisticAndFinalizedCodec, ExecutionOptimisticAndFinalizedMeta} from "../../../utils/metadata.js";
|
|
7
6
|
import {fromValidatorIdsStr, toValidatorIdsStr} from "../../../utils/serdes.js";
|
|
8
7
|
import {BlockArgs} from "./block.js";
|
|
9
8
|
import {ValidatorId} from "./state.js";
|
|
10
9
|
|
|
11
|
-
const BlockRewardsType = new ContainerType(
|
|
12
|
-
{
|
|
13
|
-
/** Proposer of the block, the proposer index who receives these rewards */
|
|
14
|
-
proposerIndex: ssz.ValidatorIndex,
|
|
15
|
-
/** Total block reward, equal to attestations + sync_aggregate + proposer_slashings + attester_slashings */
|
|
16
|
-
total: ssz.UintNum64,
|
|
17
|
-
/** Block reward component due to included attestations */
|
|
18
|
-
attestations: ssz.UintNum64,
|
|
19
|
-
/** Block reward component due to included sync_aggregate */
|
|
20
|
-
syncAggregate: ssz.UintNum64,
|
|
21
|
-
/** Block reward component due to included proposer_slashings */
|
|
22
|
-
proposerSlashings: ssz.UintNum64,
|
|
23
|
-
/** Block reward component due to included attester_slashings */
|
|
24
|
-
attesterSlashings: ssz.UintNum64,
|
|
25
|
-
},
|
|
26
|
-
{jsonCase: "eth2"}
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const AttestationsRewardType = new ContainerType(
|
|
30
|
-
{
|
|
31
|
-
/** Reward for head vote. Could be negative to indicate penalty */
|
|
32
|
-
head: ssz.UintNum64,
|
|
33
|
-
/** Reward for target vote. Could be negative to indicate penalty */
|
|
34
|
-
target: ssz.UintNum64,
|
|
35
|
-
/** Reward for source vote. Could be negative to indicate penalty */
|
|
36
|
-
source: ssz.UintNum64,
|
|
37
|
-
/** Inclusion delay reward (phase0 only) */
|
|
38
|
-
inclusionDelay: ssz.UintNum64,
|
|
39
|
-
/** Inactivity penalty. Should be a negative number to indicate penalty */
|
|
40
|
-
inactivity: ssz.UintNum64,
|
|
41
|
-
},
|
|
42
|
-
{jsonCase: "eth2"}
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const IdealAttestationsRewardsType = new ContainerType(
|
|
46
|
-
{
|
|
47
|
-
...AttestationsRewardType.fields,
|
|
48
|
-
effectiveBalance: ssz.UintNum64,
|
|
49
|
-
},
|
|
50
|
-
{jsonCase: "eth2"}
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const TotalAttestationsRewardsType = new ContainerType(
|
|
54
|
-
{
|
|
55
|
-
...AttestationsRewardType.fields,
|
|
56
|
-
validatorIndex: ssz.ValidatorIndex,
|
|
57
|
-
},
|
|
58
|
-
{jsonCase: "eth2"}
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const AttestationsRewardsType = new ContainerType(
|
|
62
|
-
{
|
|
63
|
-
idealRewards: ArrayOf(IdealAttestationsRewardsType),
|
|
64
|
-
totalRewards: ArrayOf(TotalAttestationsRewardsType),
|
|
65
|
-
},
|
|
66
|
-
{jsonCase: "eth2"}
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const SyncCommitteeRewardsType = ArrayOf(
|
|
70
|
-
new ContainerType(
|
|
71
|
-
{
|
|
72
|
-
validatorIndex: ssz.ValidatorIndex,
|
|
73
|
-
reward: ssz.UintNum64,
|
|
74
|
-
},
|
|
75
|
-
{jsonCase: "eth2"}
|
|
76
|
-
)
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Rewards info for a single block. Every reward value is in Gwei.
|
|
81
|
-
*/
|
|
82
|
-
export type BlockRewards = ValueOf<typeof BlockRewardsType>;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Rewards for a single set of (ideal or actual depending on usage) attestations. Reward value is in Gwei
|
|
86
|
-
*/
|
|
87
|
-
export type AttestationsReward = ValueOf<typeof AttestationsRewardType>;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Rewards info for ideal attestations ie. Maximum rewards could be earned by making timely head, target and source vote.
|
|
91
|
-
* `effectiveBalance` is in Gwei
|
|
92
|
-
*/
|
|
93
|
-
export type IdealAttestationsReward = ValueOf<typeof IdealAttestationsRewardsType>;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Rewards info for actual attestations
|
|
97
|
-
*/
|
|
98
|
-
export type TotalAttestationsReward = ValueOf<typeof TotalAttestationsRewardsType>;
|
|
99
|
-
|
|
100
|
-
export type AttestationsRewards = ValueOf<typeof AttestationsRewardsType>;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Rewards info for sync committee participation. Every reward value is in Gwei.
|
|
104
|
-
* Note: In the case that block proposer is present in `SyncCommitteeRewards`, the reward value only reflects rewards for
|
|
105
|
-
* participating in sync committee. Please refer to `BlockRewards.syncAggregate` for rewards of proposer including sync committee
|
|
106
|
-
* outputs into their block
|
|
107
|
-
*/
|
|
108
|
-
export type SyncCommitteeRewards = ValueOf<typeof SyncCommitteeRewardsType>;
|
|
109
|
-
|
|
110
10
|
export type Endpoints = {
|
|
111
11
|
/**
|
|
112
12
|
* Get block rewards
|
|
@@ -116,7 +16,7 @@ export type Endpoints = {
|
|
|
116
16
|
"GET",
|
|
117
17
|
BlockArgs,
|
|
118
18
|
{params: {block_id: string}},
|
|
119
|
-
BlockRewards,
|
|
19
|
+
rewards.BlockRewards,
|
|
120
20
|
ExecutionOptimisticAndFinalizedMeta
|
|
121
21
|
>;
|
|
122
22
|
|
|
@@ -133,7 +33,7 @@ export type Endpoints = {
|
|
|
133
33
|
validatorIds?: ValidatorId[];
|
|
134
34
|
},
|
|
135
35
|
{params: {epoch: number}; body: string[]},
|
|
136
|
-
AttestationsRewards,
|
|
36
|
+
rewards.AttestationsRewards,
|
|
137
37
|
ExecutionOptimisticAndFinalizedMeta
|
|
138
38
|
>;
|
|
139
39
|
|
|
@@ -148,7 +48,7 @@ export type Endpoints = {
|
|
|
148
48
|
validatorIds?: ValidatorId[];
|
|
149
49
|
},
|
|
150
50
|
{params: {block_id: string}; body: string[]},
|
|
151
|
-
SyncCommitteeRewards,
|
|
51
|
+
rewards.SyncCommitteeRewards,
|
|
152
52
|
ExecutionOptimisticAndFinalizedMeta
|
|
153
53
|
>;
|
|
154
54
|
};
|
|
@@ -164,7 +64,7 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
|
|
|
164
64
|
schema: {params: {block_id: Schema.StringRequired}},
|
|
165
65
|
},
|
|
166
66
|
resp: {
|
|
167
|
-
data: BlockRewardsType,
|
|
67
|
+
data: rewards.BlockRewardsType,
|
|
168
68
|
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
169
69
|
},
|
|
170
70
|
},
|
|
@@ -186,7 +86,7 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
|
|
|
186
86
|
},
|
|
187
87
|
}),
|
|
188
88
|
resp: {
|
|
189
|
-
data: AttestationsRewardsType,
|
|
89
|
+
data: rewards.AttestationsRewardsType,
|
|
190
90
|
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
191
91
|
},
|
|
192
92
|
},
|
|
@@ -208,7 +108,7 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
|
|
|
208
108
|
},
|
|
209
109
|
}),
|
|
210
110
|
resp: {
|
|
211
|
-
data: SyncCommitteeRewardsType,
|
|
111
|
+
data: rewards.SyncCommitteeRewardsType,
|
|
212
112
|
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
213
113
|
},
|
|
214
114
|
},
|
|
@@ -2,6 +2,7 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz";
|
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
3
|
import {MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params";
|
|
4
4
|
import {
|
|
5
|
+
ArrayOf,
|
|
5
6
|
CommitteeIndex,
|
|
6
7
|
Epoch,
|
|
7
8
|
RootHex,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
phase0,
|
|
14
15
|
ssz,
|
|
15
16
|
} from "@lodestar/types";
|
|
16
|
-
import {
|
|
17
|
+
import {JsonOnlyReq} from "../../../utils/codecs.js";
|
|
17
18
|
import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js";
|
|
18
19
|
import {
|
|
19
20
|
ExecutionOptimisticAndFinalizedCodec,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {ContainerType, ValueOf} from "@chainsafe/ssz";
|
|
2
2
|
import {ChainForkConfig, SpecJson} from "@lodestar/config";
|
|
3
|
-
import {ssz} from "@lodestar/types";
|
|
3
|
+
import {ArrayOf, ssz} from "@lodestar/types";
|
|
4
4
|
import {
|
|
5
|
-
ArrayOf,
|
|
6
5
|
EmptyArgs,
|
|
7
6
|
EmptyMeta,
|
|
8
7
|
EmptyMetaCodec,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {ContainerType, Type, ValueOf} from "@chainsafe/ssz";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {BeaconState, StringType, fulu, ssz} from "@lodestar/types";
|
|
3
|
+
import {ArrayOf, BeaconState, StringType, fulu, ssz} from "@lodestar/types";
|
|
4
4
|
import {
|
|
5
|
-
ArrayOf,
|
|
6
5
|
EmptyArgs,
|
|
7
6
|
EmptyMeta,
|
|
8
7
|
EmptyMetaCodec,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {ContainerType, Type, ValueOf} from "@chainsafe/ssz";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {BeaconState, Epoch, RootHex, Slot, ssz} from "@lodestar/types";
|
|
3
|
+
import {ArrayOf, BeaconState, Epoch, RootHex, Slot, ssz} from "@lodestar/types";
|
|
4
4
|
import {
|
|
5
|
-
ArrayOf,
|
|
6
5
|
EmptyArgs,
|
|
7
6
|
EmptyMeta,
|
|
8
7
|
EmptyRequest,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {ContainerType, OptionalType, ValueOf} from "@chainsafe/ssz";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {StringType, fulu, ssz, stringType} from "@lodestar/types";
|
|
3
|
+
import {ArrayOf, StringType, fulu, ssz, stringType} from "@lodestar/types";
|
|
4
4
|
import {
|
|
5
|
-
ArrayOf,
|
|
6
5
|
EmptyArgs,
|
|
7
6
|
EmptyMeta,
|
|
8
7
|
EmptyMetaCodec,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {CompactMultiProof, ProofType} from "@chainsafe/persistent-merkle-tree";
|
|
2
2
|
import {ByteListType, ContainerType} from "@chainsafe/ssz";
|
|
3
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
4
|
-
import {ssz} from "@lodestar/types";
|
|
4
|
+
import {ArrayOf, ssz} from "@lodestar/types";
|
|
5
5
|
import {fromHex, toHex} from "@lodestar/utils";
|
|
6
|
-
import {ArrayOf} from "../../utils/codecs.js";
|
|
7
6
|
import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js";
|
|
8
7
|
import {VersionCodec, VersionMeta} from "../../utils/metadata.js";
|
|
9
8
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isForkPostElectra,
|
|
9
9
|
} from "@lodestar/params";
|
|
10
10
|
import {
|
|
11
|
+
ArrayOf,
|
|
11
12
|
Attestation,
|
|
12
13
|
BLSSignature,
|
|
13
14
|
BeaconBlock,
|
|
@@ -28,7 +29,6 @@ import {
|
|
|
28
29
|
} from "@lodestar/types";
|
|
29
30
|
import {fromHex, toHex, toRootHex} from "@lodestar/utils";
|
|
30
31
|
import {
|
|
31
|
-
ArrayOf,
|
|
32
32
|
EmptyMeta,
|
|
33
33
|
EmptyMetaCodec,
|
|
34
34
|
EmptyResponseCodec,
|
|
@@ -498,6 +498,10 @@ export type Endpoints = {
|
|
|
498
498
|
* a validator client to correctly determine if one of its validators has been selected to
|
|
499
499
|
* perform an aggregation duty in this slot.
|
|
500
500
|
*
|
|
501
|
+
* Validator clients running in a distributed validator cluster must query this endpoint
|
|
502
|
+
* at the start of an epoch for the current and lookahead (next) epochs for all validators
|
|
503
|
+
* that have attester duties in the current and lookahead epochs.
|
|
504
|
+
*
|
|
501
505
|
* Note that this endpoint is not implemented by the beacon node and will return a 501 error
|
|
502
506
|
*
|
|
503
507
|
* Returns an array of threshold aggregated beacon committee selection proofs
|
|
@@ -521,6 +525,9 @@ export type Endpoints = {
|
|
|
521
525
|
* a validator client to correctly determine if one of its validators has been selected to
|
|
522
526
|
* perform a sync committee contribution (sync aggregation) duty in this slot.
|
|
523
527
|
*
|
|
528
|
+
* Validator clients running in a distributed validator cluster must query this endpoint
|
|
529
|
+
* at the start of each slot for all validators that are included in the current sync committee.
|
|
530
|
+
*
|
|
524
531
|
* Note that this endpoint is not implemented by the beacon node and will return a 501 error
|
|
525
532
|
*
|
|
526
533
|
* Returns an array of threshold aggregated sync committee selection proofs
|
package/src/builder/routes.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {ForkName, VALIDATOR_REGISTRY_LIMIT, isForkPostDeneb} from "@lodestar/params";
|
|
3
3
|
import {
|
|
4
|
+
ArrayOf,
|
|
4
5
|
BLSPubkey,
|
|
5
6
|
ExecutionPayload,
|
|
6
7
|
ExecutionPayloadAndBlobsBundle,
|
|
@@ -14,7 +15,6 @@ import {
|
|
|
14
15
|
} from "@lodestar/types";
|
|
15
16
|
import {fromHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
|
|
16
17
|
import {
|
|
17
|
-
ArrayOf,
|
|
18
18
|
EmptyArgs,
|
|
19
19
|
EmptyMeta,
|
|
20
20
|
EmptyRequest,
|
package/src/utils/codecs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Type} from "@chainsafe/ssz";
|
|
2
2
|
import {ForkName} from "@lodestar/params";
|
|
3
3
|
import {objectToExpectedCase} from "@lodestar/utils";
|
|
4
4
|
import {
|
|
@@ -68,16 +68,6 @@ export const EmptyResponseCodec: ResponseCodec<EmptyResponseEndpoint> = {
|
|
|
68
68
|
isEmpty: true,
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
export function ArrayOf<T>(elementType: Type<T>, limit = Infinity): ArrayType<Type<T>, unknown, unknown> {
|
|
72
|
-
if (isCompositeType(elementType)) {
|
|
73
|
-
return new ListCompositeType(elementType, limit) as unknown as ArrayType<Type<T>, unknown, unknown>;
|
|
74
|
-
}
|
|
75
|
-
if (isBasicType(elementType)) {
|
|
76
|
-
return new ListBasicType(elementType, limit) as unknown as ArrayType<Type<T>, unknown, unknown>;
|
|
77
|
-
}
|
|
78
|
-
throw Error(`Unknown type ${elementType.typeName}`);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
71
|
export function WithMeta<T, M extends {version: ForkName}>(getType: (m: M) => Type<T>): ResponseDataCodec<T, M> {
|
|
82
72
|
return {
|
|
83
73
|
toJson: (data, meta: M) => getType(meta).toJson(data),
|