-
Notifications
You must be signed in to change notification settings - Fork 803
/
Copy pathenums.ts
105 lines (94 loc) · 2.86 KB
/
enums.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { BIGINT_0, hexToBytes } from '@ethereumjs/util'
export type Chain = (typeof Chain)[keyof typeof Chain]
export const Chain = {
Mainnet: 1,
Sepolia: 11155111,
Holesky: 17000,
Hoodi: 560048,
Kaustinen6: 69420,
} as const
// Reverse mapping: from numeric value back to the key name
export const ChainNameFromNumber: { [key in Chain]: string } = Object.entries(Chain).reduce(
(acc, [key, value]) => {
acc[value as Chain] = key
return acc
},
{} as { [key in Chain]: string },
)
/**
* Genesis state meta info which is decoupled from common's genesis params
*/
type GenesisState = {
name: string
/* blockNumber that can be used to update and track the regenesis marker */
blockNumber: bigint
/* stateRoot of the chain at the blockNumber */
stateRoot: Uint8Array
}
// Having this info as record will force typescript to make sure no chain is missed
/**
* GenesisState info about well known ethereum chains
*/
export const ChainGenesis: Record<Chain, GenesisState> = {
[Chain.Mainnet]: {
name: 'mainnet',
blockNumber: BIGINT_0,
stateRoot: hexToBytes('0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544'),
},
[Chain.Sepolia]: {
name: 'sepolia',
blockNumber: BIGINT_0,
stateRoot: hexToBytes('0x5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494'),
},
[Chain.Holesky]: {
name: 'holesky',
blockNumber: BIGINT_0,
stateRoot: hexToBytes('0x69d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783'),
},
[Chain.Hoodi]: {
name: 'hoodi',
blockNumber: BIGINT_0,
stateRoot: hexToBytes('0xda87d7f5f91c51508791bbcbd4aa5baf04917830b86985eeb9ad3d5bfb657576'),
},
[Chain.Kaustinen6]: {
name: 'kaustinen6',
blockNumber: BIGINT_0,
stateRoot: hexToBytes('0x1fbf85345a3cbba9a6d44f991b721e55620a22397c2a93ee8d5011136ac300ee'),
},
}
export type Hardfork = (typeof Hardfork)[keyof typeof Hardfork]
export const Hardfork = {
Chainstart: 'chainstart',
Homestead: 'homestead',
Dao: 'dao',
TangerineWhistle: 'tangerineWhistle',
SpuriousDragon: 'spuriousDragon',
Byzantium: 'byzantium',
Constantinople: 'constantinople',
Petersburg: 'petersburg',
Istanbul: 'istanbul',
MuirGlacier: 'muirGlacier',
Berlin: 'berlin',
London: 'london',
ArrowGlacier: 'arrowGlacier',
GrayGlacier: 'grayGlacier',
MergeNetsplitBlock: 'mergeNetsplitBlock',
Paris: 'paris',
Shanghai: 'shanghai',
Cancun: 'cancun',
Prague: 'prague',
Osaka: 'osaka',
Verkle: 'verkle',
} as const
export type ConsensusType = (typeof ConsensusType)[keyof typeof ConsensusType]
export const ConsensusType = {
ProofOfStake: 'pos',
ProofOfWork: 'pow',
ProofOfAuthority: 'poa',
} as const
export type ConsensusAlgorithm = (typeof ConsensusAlgorithm)[keyof typeof ConsensusAlgorithm]
export const ConsensusAlgorithm = {
Ethash: 'ethash',
Clique: 'clique',
Casper: 'casper',
} as const