@lodestar/fork-choice 1.37.0-dev.f0ce024c1a → 1.37.0-rc.0

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.
@@ -0,0 +1,21 @@
1
+ import { Root, RootHex } from "@lodestar/types";
2
+ import { IForkChoice } from "./interface.js";
3
+ /**
4
+ * Under honest majority and certain network synchronicity assumptions there exists a block
5
+ * that is safe from re-orgs. Normally this block is pretty close to the head of canonical
6
+ * chain which makes it valuable to expose a safe block to users.
7
+ *
8
+ * https://github.com/ethereum/consensus-specs/blob/v1.6.0/fork_choice/safe-block.md#get_safe_beacon_block_root
9
+ */
10
+ export declare function getSafeBeaconBlockRoot(fc: IForkChoice): Root;
11
+ /**
12
+ * Get execution payload hash for the safe block
13
+ * This function assumes that safe block is post Bellatrix and function should not be called otherwise.
14
+ *
15
+ * As our existing usage is aligned with above condition so not adding fork-check inside this function
16
+ *
17
+ *
18
+ * https://github.com/ethereum/consensus-specs/blob/v1.6.0/fork_choice/safe-block.md#get_safe_execution_block_hash
19
+ */
20
+ export declare function getSafeExecutionBlockHash(forkChoice: IForkChoice): RootHex;
21
+ //# sourceMappingURL=safeBlocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeBlocks.d.ts","sourceRoot":"","sources":["../../src/forkChoice/safeBlocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAE5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAE1E"}
@@ -0,0 +1,24 @@
1
+ import { ZERO_HASH_HEX } from "@lodestar/params";
2
+ /**
3
+ * Under honest majority and certain network synchronicity assumptions there exists a block
4
+ * that is safe from re-orgs. Normally this block is pretty close to the head of canonical
5
+ * chain which makes it valuable to expose a safe block to users.
6
+ *
7
+ * https://github.com/ethereum/consensus-specs/blob/v1.6.0/fork_choice/safe-block.md#get_safe_beacon_block_root
8
+ */
9
+ export function getSafeBeaconBlockRoot(fc) {
10
+ return fc.getJustifiedCheckpoint().root;
11
+ }
12
+ /**
13
+ * Get execution payload hash for the safe block
14
+ * This function assumes that safe block is post Bellatrix and function should not be called otherwise.
15
+ *
16
+ * As our existing usage is aligned with above condition so not adding fork-check inside this function
17
+ *
18
+ *
19
+ * https://github.com/ethereum/consensus-specs/blob/v1.6.0/fork_choice/safe-block.md#get_safe_execution_block_hash
20
+ */
21
+ export function getSafeExecutionBlockHash(forkChoice) {
22
+ return forkChoice.getJustifiedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
23
+ }
24
+ //# sourceMappingURL=safeBlocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeBlocks.js","sourceRoot":"","sources":["../../src/forkChoice/safeBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAI/C;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAe;IACpD,OAAO,EAAE,CAAC,sBAAsB,EAAE,CAAC,IAAI,CAAC;AAC1C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAuB;IAC/D,OAAO,UAAU,CAAC,iBAAiB,EAAE,CAAC,yBAAyB,IAAI,aAAa,CAAC;AACnF,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { ForkChoiceError, ForkChoiceErrorCode, type InvalidAttestation, InvalidAttestationCode, type InvalidBlock, InvalidBlockCode, } from "./forkChoice/errors.js";
2
2
  export { ForkChoice, type ForkChoiceOpts, UpdateHeadOpt, assertValidTerminalPowBlock } from "./forkChoice/forkChoice.js";
3
3
  export { type AncestorResult, AncestorStatus, EpochDifference, type IForkChoice, NotReorgedReason, type PowBlockHex, } from "./forkChoice/interface.js";
4
+ export * from "./forkChoice/safeBlocks.js";
4
5
  export { type CheckpointWithHex, ForkChoiceStore, type IForkChoiceStore, type JustifiedBalancesGetter, } from "./forkChoice/store.js";
5
6
  export { type ForkChoiceMetrics, getForkChoiceMetrics } from "./metrics.js";
6
7
  export type { BlockExtraMeta, LVHInvalidResponse, LVHValidResponse, MaybeValidExecutionStatus, ProtoBlock, ProtoNode, } from "./protoArray/interface.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,KAAK,YAAY,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,UAAU,EAAE,KAAK,cAAc,EAAE,aAAa,EAAE,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AACvH,OAAO,EACL,KAAK,cAAc,EACnB,cAAc,EACd,eAAe,EACf,KAAK,WAAW,EAChB,gBAAgB,EAChB,KAAK,WAAW,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,KAAK,iBAAiB,EACtB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,KAAK,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAC1E,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,UAAU,EACV,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,KAAK,YAAY,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,UAAU,EAAE,KAAK,cAAc,EAAE,aAAa,EAAE,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AACvH,OAAO,EACL,KAAK,cAAc,EACnB,cAAc,EACd,eAAe,EACf,KAAK,WAAW,EAChB,gBAAgB,EAChB,KAAK,WAAW,GACjB,MAAM,2BAA2B,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,KAAK,iBAAiB,EACtB,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,KAAK,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAC1E,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,UAAU,EACV,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC"}
package/lib/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { ForkChoiceError, ForkChoiceErrorCode, InvalidAttestationCode, InvalidBlockCode, } from "./forkChoice/errors.js";
2
2
  export { ForkChoice, UpdateHeadOpt, assertValidTerminalPowBlock } from "./forkChoice/forkChoice.js";
3
3
  export { AncestorStatus, EpochDifference, NotReorgedReason, } from "./forkChoice/interface.js";
4
+ export * from "./forkChoice/safeBlocks.js";
4
5
  export { ForkChoiceStore, } from "./forkChoice/store.js";
5
6
  export { getForkChoiceMetrics } from "./metrics.js";
6
7
  export { ExecutionStatus } from "./protoArray/interface.js";
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EAEnB,sBAAsB,EAEtB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,UAAU,EAAuB,aAAa,EAAE,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AACvH,OAAO,EAEL,cAAc,EACd,eAAe,EAEf,gBAAgB,GAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,eAAe,GAGhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAyB,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAS1E,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EAEnB,sBAAsB,EAEtB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,UAAU,EAAuB,aAAa,EAAE,2BAA2B,EAAC,MAAM,4BAA4B,CAAC;AACvH,OAAO,EAEL,cAAc,EACd,eAAe,EAEf,gBAAgB,GAEjB,MAAM,2BAA2B,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAEL,eAAe,GAGhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAyB,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAS1E,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,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.37.0-dev.f0ce024c1a",
14
+ "version": "1.37.0-rc.0",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -40,11 +40,11 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@chainsafe/ssz": "^1.2.2",
43
- "@lodestar/config": "1.37.0-dev.f0ce024c1a",
44
- "@lodestar/params": "1.37.0-dev.f0ce024c1a",
45
- "@lodestar/state-transition": "1.37.0-dev.f0ce024c1a",
46
- "@lodestar/types": "1.37.0-dev.f0ce024c1a",
47
- "@lodestar/utils": "1.37.0-dev.f0ce024c1a"
43
+ "@lodestar/config": "1.37.0-rc.0",
44
+ "@lodestar/params": "1.37.0-rc.0",
45
+ "@lodestar/state-transition": "1.37.0-rc.0",
46
+ "@lodestar/types": "1.37.0-rc.0",
47
+ "@lodestar/utils": "1.37.0-rc.0"
48
48
  },
49
49
  "keywords": [
50
50
  "ethereum",
@@ -52,5 +52,5 @@
52
52
  "beacon",
53
53
  "blockchain"
54
54
  ],
55
- "gitHead": "5c8ae73b8b627e0ecde4543e02d52e212bcb6b18"
55
+ "gitHead": "f67eb777ee4528e5bb9dc7420c6e7ab28b6e0ff8"
56
56
  }
@@ -0,0 +1,27 @@
1
+ import {ZERO_HASH_HEX} from "@lodestar/params";
2
+ import {Root, RootHex} from "@lodestar/types";
3
+ import {IForkChoice} from "./interface.js";
4
+
5
+ /**
6
+ * Under honest majority and certain network synchronicity assumptions there exists a block
7
+ * that is safe from re-orgs. Normally this block is pretty close to the head of canonical
8
+ * chain which makes it valuable to expose a safe block to users.
9
+ *
10
+ * https://github.com/ethereum/consensus-specs/blob/v1.6.0/fork_choice/safe-block.md#get_safe_beacon_block_root
11
+ */
12
+ export function getSafeBeaconBlockRoot(fc: IForkChoice): Root {
13
+ return fc.getJustifiedCheckpoint().root;
14
+ }
15
+
16
+ /**
17
+ * Get execution payload hash for the safe block
18
+ * This function assumes that safe block is post Bellatrix and function should not be called otherwise.
19
+ *
20
+ * As our existing usage is aligned with above condition so not adding fork-check inside this function
21
+ *
22
+ *
23
+ * https://github.com/ethereum/consensus-specs/blob/v1.6.0/fork_choice/safe-block.md#get_safe_execution_block_hash
24
+ */
25
+ export function getSafeExecutionBlockHash(forkChoice: IForkChoice): RootHex {
26
+ return forkChoice.getJustifiedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
27
+ }
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export {
15
15
  NotReorgedReason,
16
16
  type PowBlockHex,
17
17
  } from "./forkChoice/interface.js";
18
+ export * from "./forkChoice/safeBlocks.js";
18
19
  export {
19
20
  type CheckpointWithHex,
20
21
  ForkChoiceStore,