@lodestar/beacon-node 1.47.0-dev.467f8a72f2 → 1.47.0-dev.4c05b80034
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeNewStateRoot.d.ts","sourceRoot":"","sources":["../../../src/chain/produceBlock/computeNewStateRoot.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"computeNewStateRoot.d.ts","sourceRoot":"","sources":["../../../src/chain/produceBlock/computeNewStateRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,GAAG,IAAI,EACvB,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,WAAW,GAAG,kBAAkB,GACtC;IAAC,YAAY,EAAE,IAAI,CAAC;IAAC,cAAc,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,gBAAgB,CAAA;CAAC,CAIzE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ZERO_HASH } from "../../constants/index.js";
|
|
1
|
+
import { EMPTY_SIGNATURE } from "@lodestar/state-transition";
|
|
3
2
|
/**
|
|
4
3
|
* Instead of running fastStateTransition(), only need to process block since
|
|
5
4
|
* state is processed until block.slot already (this is to avoid double
|
|
@@ -7,28 +6,7 @@ import { ZERO_HASH } from "../../constants/index.js";
|
|
|
7
6
|
*/
|
|
8
7
|
export function computeNewStateRoot(metrics, state, block) {
|
|
9
8
|
// Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
// ExecutionPayloadStatus.valid: Assume payload valid, it has been produced by a trusted EL
|
|
13
|
-
executionPayloadStatus: ExecutionPayloadStatus.valid,
|
|
14
|
-
// DataAvailabilityStatus.available: Assume the blobs to be available, have just been produced by trusted EL
|
|
15
|
-
dataAvailabilityStatus: DataAvailabilityStatus.Available,
|
|
16
|
-
// verifyStateRoot: false | the root in the block is zero-ed, it's being computed here
|
|
17
|
-
verifyStateRoot: false,
|
|
18
|
-
// verifyProposer: false | as the block signature is zero-ed
|
|
19
|
-
verifyProposer: false,
|
|
20
|
-
// verifySignatures: false | since the data to assemble the block is trusted
|
|
21
|
-
verifySignatures: false,
|
|
22
|
-
// Preserve cache in source state, since the resulting state is not added to the state cache
|
|
23
|
-
dontTransferCache: true,
|
|
24
|
-
}, { metrics });
|
|
25
|
-
const { attestations, syncAggregate, slashing } = postState.proposerRewards;
|
|
26
|
-
const proposerReward = BigInt(attestations + syncAggregate + slashing);
|
|
27
|
-
const hashTreeRootTimer = metrics?.stateHashTreeRootTime.startTimer({
|
|
28
|
-
source: StateHashTreeRootSource.computeNewStateRoot,
|
|
29
|
-
});
|
|
30
|
-
const newStateRoot = postState.hashTreeRoot();
|
|
31
|
-
hashTreeRootTimer?.();
|
|
32
|
-
return { newStateRoot, proposerReward, postState };
|
|
9
|
+
const signedBlock = { message: block, signature: EMPTY_SIGNATURE };
|
|
10
|
+
return state.computeNewStateRoot({ block: signedBlock }, { metrics });
|
|
33
11
|
}
|
|
34
12
|
//# sourceMappingURL=computeNewStateRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeNewStateRoot.js","sourceRoot":"","sources":["../../../src/chain/produceBlock/computeNewStateRoot.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"computeNewStateRoot.js","sourceRoot":"","sources":["../../../src/chain/produceBlock/computeNewStateRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAmB,MAAM,4BAA4B,CAAC;AAI7E;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAuB,EACvB,KAAuB,EACvB,KAAuC;IAEvC,uGAAuG;IACvG,MAAM,WAAW,GAAG,EAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;IACjE,OAAO,KAAK,CAAC,mBAAmB,CAAC,EAAC,KAAK,EAAE,WAAW,EAAC,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC;AACpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.47.0-dev.
|
|
14
|
+
"version": "1.47.0-dev.4c05b80034",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -126,17 +126,17 @@
|
|
|
126
126
|
"@libp2p/peer-id": "^6.0.15",
|
|
127
127
|
"@libp2p/prometheus-metrics": "^5.0.28",
|
|
128
128
|
"@libp2p/tcp": "^11.0.27",
|
|
129
|
-
"@lodestar/api": "^1.47.0-dev.
|
|
130
|
-
"@lodestar/config": "^1.47.0-dev.
|
|
131
|
-
"@lodestar/db": "^1.47.0-dev.
|
|
132
|
-
"@lodestar/fork-choice": "^1.47.0-dev.
|
|
133
|
-
"@lodestar/logger": "^1.47.0-dev.
|
|
134
|
-
"@lodestar/params": "^1.47.0-dev.
|
|
135
|
-
"@lodestar/reqresp": "^1.47.0-dev.
|
|
136
|
-
"@lodestar/state-transition": "^1.47.0-dev.
|
|
137
|
-
"@lodestar/types": "^1.47.0-dev.
|
|
138
|
-
"@lodestar/utils": "^1.47.0-dev.
|
|
139
|
-
"@lodestar/validator": "^1.47.0-dev.
|
|
129
|
+
"@lodestar/api": "^1.47.0-dev.4c05b80034",
|
|
130
|
+
"@lodestar/config": "^1.47.0-dev.4c05b80034",
|
|
131
|
+
"@lodestar/db": "^1.47.0-dev.4c05b80034",
|
|
132
|
+
"@lodestar/fork-choice": "^1.47.0-dev.4c05b80034",
|
|
133
|
+
"@lodestar/logger": "^1.47.0-dev.4c05b80034",
|
|
134
|
+
"@lodestar/params": "^1.47.0-dev.4c05b80034",
|
|
135
|
+
"@lodestar/reqresp": "^1.47.0-dev.4c05b80034",
|
|
136
|
+
"@lodestar/state-transition": "^1.47.0-dev.4c05b80034",
|
|
137
|
+
"@lodestar/types": "^1.47.0-dev.4c05b80034",
|
|
138
|
+
"@lodestar/utils": "^1.47.0-dev.4c05b80034",
|
|
139
|
+
"@lodestar/validator": "^1.47.0-dev.4c05b80034",
|
|
140
140
|
"@multiformats/multiaddr": "^13.0.1",
|
|
141
141
|
"datastore-core": "^12.0.1",
|
|
142
142
|
"datastore-level": "^13.0.1",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"@libp2p/interface-internal": "^3.1.12",
|
|
159
159
|
"@libp2p/logger": "^6.2.13",
|
|
160
160
|
"@libp2p/utils": "^7.4.0",
|
|
161
|
-
"@lodestar/spec-test-util": "^1.47.0-dev.
|
|
161
|
+
"@lodestar/spec-test-util": "^1.47.0-dev.4c05b80034",
|
|
162
162
|
"@types/js-yaml": "^4.0.5",
|
|
163
163
|
"@types/qs": "^6.9.7",
|
|
164
164
|
"@types/tmp": "^0.2.3",
|
|
@@ -175,5 +175,5 @@
|
|
|
175
175
|
"beacon",
|
|
176
176
|
"blockchain"
|
|
177
177
|
],
|
|
178
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "94fc252424478b129920afe1f200fa50ce00d655"
|
|
179
179
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataAvailabilityStatus,
|
|
3
|
-
ExecutionPayloadStatus,
|
|
4
|
-
IBeaconStateView,
|
|
5
|
-
StateHashTreeRootSource,
|
|
6
|
-
} from "@lodestar/state-transition";
|
|
1
|
+
import {EMPTY_SIGNATURE, IBeaconStateView} from "@lodestar/state-transition";
|
|
7
2
|
import {BeaconBlock, BlindedBeaconBlock, Gwei, Root} from "@lodestar/types";
|
|
8
|
-
import {ZERO_HASH} from "../../constants/index.js";
|
|
9
3
|
import {Metrics} from "../../metrics/index.js";
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -19,35 +13,6 @@ export function computeNewStateRoot(
|
|
|
19
13
|
block: BeaconBlock | BlindedBeaconBlock
|
|
20
14
|
): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} {
|
|
21
15
|
// Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const postState = state.stateTransition(
|
|
25
|
-
blockEmptySig,
|
|
26
|
-
{
|
|
27
|
-
// ExecutionPayloadStatus.valid: Assume payload valid, it has been produced by a trusted EL
|
|
28
|
-
executionPayloadStatus: ExecutionPayloadStatus.valid,
|
|
29
|
-
// DataAvailabilityStatus.available: Assume the blobs to be available, have just been produced by trusted EL
|
|
30
|
-
dataAvailabilityStatus: DataAvailabilityStatus.Available,
|
|
31
|
-
// verifyStateRoot: false | the root in the block is zero-ed, it's being computed here
|
|
32
|
-
verifyStateRoot: false,
|
|
33
|
-
// verifyProposer: false | as the block signature is zero-ed
|
|
34
|
-
verifyProposer: false,
|
|
35
|
-
// verifySignatures: false | since the data to assemble the block is trusted
|
|
36
|
-
verifySignatures: false,
|
|
37
|
-
// Preserve cache in source state, since the resulting state is not added to the state cache
|
|
38
|
-
dontTransferCache: true,
|
|
39
|
-
},
|
|
40
|
-
{metrics}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const {attestations, syncAggregate, slashing} = postState.proposerRewards;
|
|
44
|
-
const proposerReward = BigInt(attestations + syncAggregate + slashing);
|
|
45
|
-
|
|
46
|
-
const hashTreeRootTimer = metrics?.stateHashTreeRootTime.startTimer({
|
|
47
|
-
source: StateHashTreeRootSource.computeNewStateRoot,
|
|
48
|
-
});
|
|
49
|
-
const newStateRoot = postState.hashTreeRoot();
|
|
50
|
-
hashTreeRootTimer?.();
|
|
51
|
-
|
|
52
|
-
return {newStateRoot, proposerReward, postState};
|
|
16
|
+
const signedBlock = {message: block, signature: EMPTY_SIGNATURE};
|
|
17
|
+
return state.computeNewStateRoot({block: signedBlock}, {metrics});
|
|
53
18
|
}
|