@feelyourprotocol/common 8141.0.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.
Files changed (115) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +409 -0
  3. package/dist/cjs/chains.d.ts +6 -0
  4. package/dist/cjs/chains.d.ts.map +1 -0
  5. package/dist/cjs/chains.js +637 -0
  6. package/dist/cjs/chains.js.map +1 -0
  7. package/dist/cjs/common.d.ts +318 -0
  8. package/dist/cjs/common.d.ts.map +1 -0
  9. package/dist/cjs/common.js +789 -0
  10. package/dist/cjs/common.js.map +1 -0
  11. package/dist/cjs/constructors.d.ts +27 -0
  12. package/dist/cjs/constructors.d.ts.map +1 -0
  13. package/dist/cjs/constructors.js +53 -0
  14. package/dist/cjs/constructors.js.map +1 -0
  15. package/dist/cjs/crc.d.ts +8 -0
  16. package/dist/cjs/crc.d.ts.map +1 -0
  17. package/dist/cjs/crc.js +63 -0
  18. package/dist/cjs/crc.js.map +1 -0
  19. package/dist/cjs/eips.d.ts +3 -0
  20. package/dist/cjs/eips.d.ts.map +1 -0
  21. package/dist/cjs/eips.js +589 -0
  22. package/dist/cjs/eips.js.map +1 -0
  23. package/dist/cjs/enums.d.ts +65 -0
  24. package/dist/cjs/enums.d.ts.map +1 -0
  25. package/dist/cjs/enums.js +80 -0
  26. package/dist/cjs/enums.js.map +1 -0
  27. package/dist/cjs/gethGenesis.d.ts +145 -0
  28. package/dist/cjs/gethGenesis.d.ts.map +1 -0
  29. package/dist/cjs/gethGenesis.js +26 -0
  30. package/dist/cjs/gethGenesis.js.map +1 -0
  31. package/dist/cjs/hardforks.d.ts +3 -0
  32. package/dist/cjs/hardforks.d.ts.map +1 -0
  33. package/dist/cjs/hardforks.js +207 -0
  34. package/dist/cjs/hardforks.js.map +1 -0
  35. package/dist/cjs/index.d.ts +9 -0
  36. package/dist/cjs/index.d.ts.map +1 -0
  37. package/dist/cjs/index.js +25 -0
  38. package/dist/cjs/index.js.map +1 -0
  39. package/dist/cjs/interfaces.d.ts +132 -0
  40. package/dist/cjs/interfaces.d.ts.map +1 -0
  41. package/dist/cjs/interfaces.js +13 -0
  42. package/dist/cjs/interfaces.js.map +1 -0
  43. package/dist/cjs/package.json +3 -0
  44. package/dist/cjs/types.d.ts +167 -0
  45. package/dist/cjs/types.d.ts.map +1 -0
  46. package/dist/cjs/types.js +3 -0
  47. package/dist/cjs/types.js.map +1 -0
  48. package/dist/cjs/utils.d.ts +60 -0
  49. package/dist/cjs/utils.d.ts.map +1 -0
  50. package/dist/cjs/utils.js +263 -0
  51. package/dist/cjs/utils.js.map +1 -0
  52. package/dist/esm/chains.d.ts +6 -0
  53. package/dist/esm/chains.d.ts.map +1 -0
  54. package/dist/esm/chains.js +634 -0
  55. package/dist/esm/chains.js.map +1 -0
  56. package/dist/esm/common.d.ts +318 -0
  57. package/dist/esm/common.d.ts.map +1 -0
  58. package/dist/esm/common.js +785 -0
  59. package/dist/esm/common.js.map +1 -0
  60. package/dist/esm/constructors.d.ts +27 -0
  61. package/dist/esm/constructors.d.ts.map +1 -0
  62. package/dist/esm/constructors.js +49 -0
  63. package/dist/esm/constructors.js.map +1 -0
  64. package/dist/esm/crc.d.ts +8 -0
  65. package/dist/esm/crc.d.ts.map +1 -0
  66. package/dist/esm/crc.js +59 -0
  67. package/dist/esm/crc.js.map +1 -0
  68. package/dist/esm/eips.d.ts +3 -0
  69. package/dist/esm/eips.d.ts.map +1 -0
  70. package/dist/esm/eips.js +586 -0
  71. package/dist/esm/eips.js.map +1 -0
  72. package/dist/esm/enums.d.ts +65 -0
  73. package/dist/esm/enums.d.ts.map +1 -0
  74. package/dist/esm/enums.js +77 -0
  75. package/dist/esm/enums.js.map +1 -0
  76. package/dist/esm/gethGenesis.d.ts +145 -0
  77. package/dist/esm/gethGenesis.d.ts.map +1 -0
  78. package/dist/esm/gethGenesis.js +23 -0
  79. package/dist/esm/gethGenesis.js.map +1 -0
  80. package/dist/esm/hardforks.d.ts +3 -0
  81. package/dist/esm/hardforks.d.ts.map +1 -0
  82. package/dist/esm/hardforks.js +204 -0
  83. package/dist/esm/hardforks.js.map +1 -0
  84. package/dist/esm/index.d.ts +9 -0
  85. package/dist/esm/index.d.ts.map +1 -0
  86. package/dist/esm/index.js +9 -0
  87. package/dist/esm/index.js.map +1 -0
  88. package/dist/esm/interfaces.d.ts +132 -0
  89. package/dist/esm/interfaces.d.ts.map +1 -0
  90. package/dist/esm/interfaces.js +10 -0
  91. package/dist/esm/interfaces.js.map +1 -0
  92. package/dist/esm/package.json +3 -0
  93. package/dist/esm/types.d.ts +167 -0
  94. package/dist/esm/types.d.ts.map +1 -0
  95. package/dist/esm/types.js +2 -0
  96. package/dist/esm/types.js.map +1 -0
  97. package/dist/esm/utils.d.ts +60 -0
  98. package/dist/esm/utils.d.ts.map +1 -0
  99. package/dist/esm/utils.js +258 -0
  100. package/dist/esm/utils.js.map +1 -0
  101. package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
  102. package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
  103. package/package.json +77 -0
  104. package/src/chains.ts +638 -0
  105. package/src/common.ts +913 -0
  106. package/src/constructors.ts +60 -0
  107. package/src/crc.ts +63 -0
  108. package/src/eips.ts +588 -0
  109. package/src/enums.ts +104 -0
  110. package/src/gethGenesis.ts +175 -0
  111. package/src/hardforks.ts +205 -0
  112. package/src/index.ts +8 -0
  113. package/src/interfaces.ts +191 -0
  114. package/src/types.ts +193 -0
  115. package/src/utils.ts +324 -0
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsensusAlgorithm = exports.ConsensusType = exports.Hardfork = exports.ChainGenesis = exports.ChainNameFromNumber = exports.Chain = void 0;
4
+ const util_1 = require("@feelyourprotocol/util");
5
+ exports.Chain = {
6
+ Mainnet: 1,
7
+ Sepolia: 11155111,
8
+ Holesky: 17000,
9
+ Hoodi: 560048,
10
+ };
11
+ // Reverse mapping: from numeric value back to the key name
12
+ exports.ChainNameFromNumber = Object.entries(exports.Chain).reduce((acc, [key, value]) => {
13
+ acc[value] = key;
14
+ return acc;
15
+ }, {});
16
+ // Having this info as record will force typescript to make sure no chain is missed
17
+ /**
18
+ * GenesisState info about well known ethereum chains
19
+ */
20
+ exports.ChainGenesis = {
21
+ [exports.Chain.Mainnet]: {
22
+ name: 'mainnet',
23
+ blockNumber: util_1.BIGINT_0,
24
+ stateRoot: (0, util_1.hexToBytes)('0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544'),
25
+ },
26
+ [exports.Chain.Sepolia]: {
27
+ name: 'sepolia',
28
+ blockNumber: util_1.BIGINT_0,
29
+ stateRoot: (0, util_1.hexToBytes)('0x5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494'),
30
+ },
31
+ [exports.Chain.Holesky]: {
32
+ name: 'holesky',
33
+ blockNumber: util_1.BIGINT_0,
34
+ stateRoot: (0, util_1.hexToBytes)('0x69d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783'),
35
+ },
36
+ [exports.Chain.Hoodi]: {
37
+ name: 'hoodi',
38
+ blockNumber: util_1.BIGINT_0,
39
+ stateRoot: (0, util_1.hexToBytes)('0xda87d7f5f91c51508791bbcbd4aa5baf04917830b86985eeb9ad3d5bfb657576'),
40
+ },
41
+ };
42
+ exports.Hardfork = {
43
+ Chainstart: 'chainstart',
44
+ Homestead: 'homestead',
45
+ Dao: 'dao',
46
+ TangerineWhistle: 'tangerineWhistle',
47
+ SpuriousDragon: 'spuriousDragon',
48
+ Byzantium: 'byzantium',
49
+ Constantinople: 'constantinople',
50
+ Petersburg: 'petersburg',
51
+ Istanbul: 'istanbul',
52
+ MuirGlacier: 'muirGlacier',
53
+ Berlin: 'berlin',
54
+ London: 'london',
55
+ ArrowGlacier: 'arrowGlacier',
56
+ GrayGlacier: 'grayGlacier',
57
+ MergeNetsplitBlock: 'mergeNetsplitBlock',
58
+ Paris: 'paris',
59
+ Shanghai: 'shanghai',
60
+ Cancun: 'cancun',
61
+ Prague: 'prague',
62
+ Osaka: 'osaka',
63
+ Bpo1: 'bpo1',
64
+ Bpo2: 'bpo2',
65
+ Bpo3: 'bpo3',
66
+ Bpo4: 'bpo4',
67
+ Bpo5: 'bpo5',
68
+ Amsterdam: 'amsterdam',
69
+ };
70
+ exports.ConsensusType = {
71
+ ProofOfStake: 'pos',
72
+ ProofOfWork: 'pow',
73
+ ProofOfAuthority: 'poa',
74
+ };
75
+ exports.ConsensusAlgorithm = {
76
+ Ethash: 'ethash',
77
+ Clique: 'clique',
78
+ Casper: 'casper',
79
+ };
80
+ //# sourceMappingURL=enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/enums.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAI1C,QAAA,KAAK,GAAG;IACnB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,MAAM;CACL,CAAA;AAEV,2DAA2D;AAC9C,QAAA,mBAAmB,GAA+B,MAAM,CAAC,OAAO,CAAC,aAAK,CAAC,CAAC,MAAM,CACzF,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IACpB,GAAG,CAAC,KAAc,CAAC,GAAG,GAAG,CAAA;IACzB,OAAO,GAAG,CAAA;AACZ,CAAC,EACD,EAAgC,CACjC,CAAA;AAaD,mFAAmF;AACnF;;GAEG;AACU,QAAA,YAAY,GAAgC;IACvD,CAAC,aAAK,CAAC,OAAO,CAAC,EAAE;QACf,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,eAAQ;QACrB,SAAS,EAAE,IAAA,iBAAU,EAAC,oEAAoE,CAAC;KAC5F;IACD,CAAC,aAAK,CAAC,OAAO,CAAC,EAAE;QACf,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,eAAQ;QACrB,SAA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AAM,EAAE,QAAQ;CACR,CAAA"}
@@ -0,0 +1,145 @@
1
+ import { type PrefixedHexString } from '@feelyourprotocol/util';
2
+ /**
3
+ * Interface for Geth Genesis Config
4
+ */
5
+ export interface GethGenesisConfig {
6
+ chainId: number;
7
+ depositContractAddress?: string;
8
+ homesteadBlock?: number;
9
+ daoForkBlock?: number;
10
+ daoForkSupport?: boolean;
11
+ eip150Block?: number;
12
+ eip150Hash?: string;
13
+ eip155Block?: number;
14
+ eip158Block?: number;
15
+ byzantiumBlock?: number;
16
+ constantinopleBlock?: number;
17
+ petersburgBlock?: number;
18
+ istanbulBlock?: number;
19
+ muirGlacierBlock?: number;
20
+ berlinBlock?: number;
21
+ londonBlock?: number;
22
+ mergeForkBlock?: number;
23
+ cancunBlock?: number;
24
+ arrowGlacierBlock?: number;
25
+ grayGlacierBlock?: number;
26
+ mergeNetsplitBlock?: number;
27
+ shanghaiTime?: number;
28
+ cancunTime?: number;
29
+ pragueTime?: number;
30
+ terminalTotalDifficulty?: number;
31
+ terminalTotalDifficultyPassed?: boolean;
32
+ ethash?: {};
33
+ clique?: {
34
+ period?: number;
35
+ epoch?: number;
36
+ blockperiodseconds?: number;
37
+ epochlength?: number;
38
+ };
39
+ trustedCheckpoint?: {
40
+ sectionIndex: number;
41
+ sectionHead: string;
42
+ chtRoot: string;
43
+ bloomRoot: string;
44
+ };
45
+ trustedCheckpointOracle?: {
46
+ address: string;
47
+ signers: string[];
48
+ threshold: number;
49
+ };
50
+ blobSchedule?: GethGenesisBlobSchedule;
51
+ proofInBlocks?: boolean;
52
+ }
53
+ /**
54
+ * Interface for account allocation in Geth Genesis
55
+ */
56
+ export interface GethGenesisAlloc {
57
+ [address: string]: {
58
+ balance: string;
59
+ code?: string;
60
+ storage?: {
61
+ [key: string]: string;
62
+ };
63
+ nonce?: string;
64
+ };
65
+ }
66
+ /**
67
+ * Interface for blob schedule in Geth Genesis (EIP-7840)
68
+ */
69
+ export interface GethGenesisBlobSchedule {
70
+ [fork: string]: {
71
+ target?: number;
72
+ max?: number;
73
+ baseFeeUpdateFraction?: number;
74
+ };
75
+ }
76
+ /**
77
+ * Interface for Geth Genesis object
78
+ */
79
+ export interface GethGenesis {
80
+ config: GethGenesisConfig;
81
+ name?: string;
82
+ excessBlobGas?: string;
83
+ requestsHash?: string;
84
+ nonce: string;
85
+ timestamp: string;
86
+ extraData?: string;
87
+ gasLimit: PrefixedHexString;
88
+ difficulty?: PrefixedHexString;
89
+ mixHash?: PrefixedHexString;
90
+ coinbase?: PrefixedHexString;
91
+ alloc: GethGenesisAlloc;
92
+ number?: PrefixedHexString;
93
+ gasUsed?: PrefixedHexString;
94
+ parentHash?: PrefixedHexString;
95
+ baseFeePerGas?: PrefixedHexString | number | null;
96
+ }
97
+ /**
98
+ * Type for the options passed to createCommonFromGethGenesis
99
+ */
100
+ export interface CreateCommonFromGethGenesisOpts {
101
+ chain?: string;
102
+ genesisHash?: string;
103
+ mergeForkIdPostMerge?: boolean;
104
+ }
105
+ export type StoragePair = [key: PrefixedHexString, value: PrefixedHexString];
106
+ export type AccountState = [
107
+ balance: PrefixedHexString,
108
+ code?: PrefixedHexString,
109
+ storage?: Array<StoragePair>,
110
+ nonce?: PrefixedHexString
111
+ ];
112
+ /**
113
+ * If you are using a custom chain {@link Common}, pass the genesis state.
114
+ *
115
+ * Pattern 1 (with genesis state see {@link GenesisState} for format):
116
+ *
117
+ * ```javascript
118
+ * {
119
+ * '0x0...01': '0x100', // For EoA
120
+ * }
121
+ * ```
122
+ *
123
+ * Pattern 2 (with complex genesis state, containing contract accounts and storage).
124
+ * Note that in {@link AccountState} there are two
125
+ * accepted types. This allows to easily insert accounts in the genesis state:
126
+ *
127
+ * A complex genesis state with Contract and EoA states would have the following format:
128
+ *
129
+ * ```javascript
130
+ * {
131
+ * '0x0...01': '0x100', // For EoA
132
+ * '0x0...02': ['0x1', '0xRUNTIME_BYTECODE', [[storageKey1, storageValue1], [storageKey2, storageValue2]]] // For contracts
133
+ * }
134
+ * ```
135
+ */
136
+ export interface GenesisState {
137
+ [key: PrefixedHexString]: PrefixedHexString | AccountState;
138
+ }
139
+ /**
140
+ * Parses the geth genesis state into Blockchain {@link GenesisState}
141
+ * @param gethGenesis GethGenesis object
142
+ * @returns Parsed {@link GenesisState}
143
+ */
144
+ export declare function parseGethGenesisState(gethGenesis: GethGenesis): GenesisState;
145
+ //# sourceMappingURL=gethGenesis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gethGenesis.d.ts","sourceRoot":"","sources":["../../src/gethGenesis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAA0C,MAAM,kBAAkB,CAAA;AAEjG;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,Y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G;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,YAAY,CAwB5E"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseGethGenesisState = parseGethGenesisState;
4
+ const util_1 = require("@feelyourprotocol/util");
5
+ /**
6
+ * Parses the geth genesis state into Blockchain {@link GenesisState}
7
+ * @param gethGenesis GethGenesis object
8
+ * @returns Parsed {@link GenesisState}
9
+ */
10
+ function parseGethGenesisState(gethGenesis) {
11
+ const state = {};
12
+ for (const address of Object.keys(gethGenesis.alloc)) {
13
+ const { balance: rawBalance, code: rawCode, nonce: rawNonce, storage: rawStorage, } = gethGenesis.alloc[address];
14
+ // create a map with lowercase for easy lookups
15
+ const prefixedAddress = (0, util_1.addHexPrefix)(address.toLowerCase());
16
+ const balance = (0, util_1.isHexString)(rawBalance) ? rawBalance : (0, util_1.bigIntToHex)(BigInt(rawBalance));
17
+ const code = rawCode !== undefined ? (0, util_1.addHexPrefix)(rawCode) : undefined;
18
+ const storage = rawStorage !== undefined
19
+ ? Object.entries(rawStorage).map((storagePair) => storagePair.map(util_1.addHexPrefix))
20
+ : undefined;
21
+ const nonce = rawNonce !== undefined ? (0, util_1.addHexPrefix)(rawNonce) : undefined;
22
+ state[prefixedAddress] = [balance, code, storage, nonce];
23
+ }
24
+ return state;
25
+ }
26
+ //# sourceMappingURL=gethGenesis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gethGenesis.js","sourceRoot":"","sources":["../../src/gethGenesis.ts"],"names":[],"mappings":";;AAsJA,sDAwBC;AA9KD,2CAAiG;AAiJjG;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,WAAwB;IAC5D,MAAM,KAAK,GAAiB,EAAE,CAAA;IAE9B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,MAAM,EACJ,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,UAAU,GACpB,GAAG,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC9B,+CAA+C;QAC/C,MAAM,eAAe,GAAG,IAAA,mBAAY,EAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;QAC3D,MAAM,OAAO,GAAG,IAAA,kBAAW,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,kBAAW,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;QACtF,MAAM,IAAI,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,mBAAY,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACtE,MAAM,OAAO,GACX,UAAU,KAAK,SAAS;YACtB,CAAC,CAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAC9C,WAAW,CAAC,GAAG,CAAC,mBAAY,CAAC,CACZ;YACrB,CAAC,CAAC,SAAS,CAAA;QACf,MAAM,KAAK,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,mBAAY,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACzE,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IAC1D,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { HardforksDict } from './types.ts';
2
+ export declare const hardforksDict: HardforksDict;
3
+ //# sourceMappingURL=hardforks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardforks.d.ts","sourceRoot":"","sources":["../../src/hardforks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,eAAO,MAAM,aAAa,EAAE,aA0M3B,CAAA"}
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hardforksDict = void 0;
4
+ exports.hardforksDict = {
5
+ /**
6
+ * Description: Start of the Ethereum main chain
7
+ * URL : -
8
+ * Status : Final
9
+ */
10
+ chainstart: {
11
+ eips: [1],
12
+ },
13
+ /**
14
+ * Description: Homestead hardfork with protocol and network changes
15
+ * URL : https://eips.ethereum.org/EIPS/eip-606
16
+ * Status : Final
17
+ */
18
+ homestead: {
19
+ eips: [606],
20
+ },
21
+ /**
22
+ * Description: DAO rescue hardfork
23
+ * URL : https://eips.ethereum.org/EIPS/eip-779
24
+ * Status : Final
25
+ */
26
+ dao: {
27
+ eips: [],
28
+ },
29
+ /**
30
+ * Description: Hardfork with gas cost changes for IO-heavy operations
31
+ * URL : https://eips.ethereum.org/EIPS/eip-608
32
+ * Status : Final
33
+ */
34
+ tangerineWhistle: {
35
+ eips: [608],
36
+ },
37
+ /**
38
+ * Description: HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit
39
+ * URL : https://eips.ethereum.org/EIPS/eip-607
40
+ * Status : Final
41
+ */
42
+ spuriousDragon: {
43
+ eips: [607],
44
+ },
45
+ /**
46
+ * Description: Hardfork with new precompiles, instructions and other protocol changes
47
+ * URL : https://eips.ethereum.org/EIPS/eip-609
48
+ * Status : Final
49
+ */
50
+ byzantium: {
51
+ eips: [609],
52
+ },
53
+ /**
54
+ * Description: Postponed hardfork including EIP-1283 (SSTORE gas metering changes)
55
+ * URL : https://eips.ethereum.org/EIPS/eip-1013
56
+ * Status : Final
57
+ */
58
+ constantinople: {
59
+ eips: [1013],
60
+ },
61
+ /**
62
+ * Description: Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople
63
+ * URL : https://eips.ethereum.org/EIPS/eip-1716
64
+ * Status : Final
65
+ */
66
+ petersburg: {
67
+ eips: [1716],
68
+ },
69
+ /**
70
+ * Description: HF targeted for December 2019 following the Constantinople/Petersburg HF
71
+ * URL : https://eips.ethereum.org/EIPS/eip-1679
72
+ * Status : Final
73
+ */
74
+ istanbul: {
75
+ eips: [1679],
76
+ },
77
+ /**
78
+ * Description: HF to delay the difficulty bomb
79
+ * URL : https://eips.ethereum.org/EIPS/eip-2384
80
+ * Status : Final
81
+ */
82
+ muirGlacier: {
83
+ eips: [2384],
84
+ },
85
+ /**
86
+ * Description: HF targeted for July 2020 following the Muir Glacier HF
87
+ * URL : https://eips.ethereum.org/EIPS/eip-2070
88
+ * Status : Final
89
+ */
90
+ berlin: {
91
+ eips: [2565, 2929, 2718, 2930],
92
+ },
93
+ /**
94
+ * Description: HF targeted for July 2021 following the Berlin fork
95
+ * URL : https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md
96
+ * Status : Final
97
+ */
98
+ london: {
99
+ eips: [1559, 3198, 3529, 3541],
100
+ },
101
+ /**
102
+ * Description: HF to delay the difficulty bomb
103
+ * URL : https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md
104
+ * Status : Final
105
+ */
106
+ arrowGlacier: {
107
+ eips: [4345],
108
+ },
109
+ /**
110
+ * Description: Delaying the difficulty bomb to Mid September 2022
111
+ * URL : https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md
112
+ * Status : Final
113
+ */
114
+ grayGlacier: {
115
+ eips: [5133],
116
+ },
117
+ /**
118
+ * Description: Hardfork to upgrade the consensus mechanism to Proof-of-Stake
119
+ * URL : https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md
120
+ * Status : Final
121
+ */
122
+ paris: {
123
+ consensus: {
124
+ type: 'pos',
125
+ algorithm: 'casper',
126
+ casper: {},
127
+ },
128
+ eips: [3675, 4399],
129
+ },
130
+ /**
131
+ * Description: Pre-merge hardfork to fork off non-upgraded clients
132
+ * URL : https://eips.ethereum.org/EIPS/eip-3675
133
+ * Status : Final
134
+ */
135
+ mergeNetsplitBlock: {
136
+ eips: [],
137
+ },
138
+ /**
139
+ * Description: Next feature hardfork after the merge hardfork having withdrawals, warm coinbase, push0, limit/meter initcode
140
+ * URL : https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md
141
+ * Status : Final
142
+ */
143
+ shanghai: {
144
+ eips: [3651, 3855, 3860, 4895],
145
+ },
146
+ /**
147
+ * Description: Next feature hardfork after shanghai, includes proto-danksharding EIP 4844 blobs,
148
+ * transient storage opcodes, parent beacon block root availability in EVM, selfdestruct only in
149
+ * same transaction, and blob base fee opcode
150
+ * URL : https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md
151
+ * Status : Final
152
+ */
153
+ cancun: {
154
+ eips: [1153, 4844, 4788, 5656, 6780, 7516],
155
+ },
156
+ /**
157
+ * Description: Next feature hardfork after cancun including EIP-7702 account abstraction + other EIPs
158
+ * URL : https://eips.ethereum.org/EIPS/eip-7600
159
+ * Status : Final
160
+ */
161
+ prague: {
162
+ eips: [2537, 2935, 6110, 7002, 7251, 7623, 7685, 7691, 7702],
163
+ },
164
+ /**
165
+ * Description: Next feature hardfork after prague (headliner: PeerDAS)
166
+ * URL : https://eips.ethereum.org/EIPS/eip-7607
167
+ * Status : Final
168
+ */
169
+ osaka: {
170
+ eips: [7594, 7823, 7825, 7883, 7892, 7939, 7951, 7918],
171
+ },
172
+ /**
173
+ * Description: HF to update the blob target, max and updateFraction (see also EIP-7892)
174
+ * URL : TBD
175
+ * Status : Final
176
+ */
177
+ bpo1: {
178
+ eips: [],
179
+ params: {
180
+ target: 10,
181
+ max: 15,
182
+ blobGasPriceUpdateFraction: 8346193,
183
+ },
184
+ },
185
+ /**
186
+ * Description: HF to update the blob target, max and updateFraction (see also EIP-7892)
187
+ * URL : TBD
188
+ * Status : Final
189
+ */
190
+ bpo2: {
191
+ eips: [],
192
+ params: {
193
+ target: 14,
194
+ max: 21,
195
+ blobGasPriceUpdateFraction: 11684671,
196
+ },
197
+ },
198
+ /**
199
+ * Description: Feature hardfork after osaka (headliner: EIP-7928 Block Level Access Lists (BAL))
200
+ * URL : https://eips.ethereum.org/EIPS/eip-7773
201
+ * Status : Draft (implementation incomplete + spec still moving!)
202
+ */
203
+ amsterdam: {
204
+ eips: [7708, 7843, 7778, 7928, 8024],
205
+ },
206
+ };
207
+ //# sourceMappingURL=hardforks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardforks.js","sourceRoot":"","sources":["../../src/hardforks.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAkB;IAC1C;;;;OAIG;IACH,UAAU,EAAE;QACV,IAAI,EAAE,CAAC,CAAC,CAAC;KACV;IACD;;;;OAIG;IACH,SAAS,EAAE;QACT,IAAI,EAAE,CAAC,GAAG,CAAC;KACZ;IACD;;;;OAIG;IACH,GAAG,EAAE;QACH,IAAI,EAAE,EAAE;KACT;IACD;;;;OAIG;IACH,gBAAgB,EAAE;QAChB,IAAI,EAAE,CAAC,GAAG,CAAC;KACZ;IACD;;;;OAIG;IACH,cAAc,EAAE;QACd,IAAI,EAAE,CAAC,GAAG,CAAC;KACZ;IACD;;;;OAIG;IACH,SAAS,EAAE;QACT,IAAI,EAAE,CAAC,GAAG,CAAC;KACZ;IACD;;;;OAIG;IACH,cAAc,EAAE;QACd,IAAI,EAAE,CAAC,IAAI,CAAC;KACb;IACD;;;;OAIG;IACH,UAAU,EAAE;QACV,IAAI,EAAE,CAAC,IAAI,CAAC;KACb;IACD;;;;OAIG;IACH,QAAQ,EAAE;QACR,IAAI,EAAE,CAAC,IAAI,CAAC;KACb;IACD;;;;OAIG;IACH,WAAW,EAAE;QACX,IAAI,EAAE,CAAC,IAAI,CAAC;KACb;IACD;;;;OAIG;IACH,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;KAC/B;IACD;;;;OAI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EAAE;QACJ,IAAI,EAAE,EAAE;QACR,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,GAAG,EAAE,EAAE;YACP,0BAA0B,EAAE,QAAQ;SACrC;KACF;IACD;;;;OAIG;IACH,SAAS,EAAE;QACT,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;KACrC;CACF,CAAA"}
@@ -0,0 +1,9 @@
1
+ export * from './chains.ts';
2
+ export * from './common.ts';
3
+ export * from './constructors.ts';
4
+ export * from './enums.ts';
5
+ export * from './gethGenesis.ts';
6
+ export * from './interfaces.ts';
7
+ export * from './types.ts';
8
+ export * from './utils.ts';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./chains.js"), exports);
18
+ __exportStar(require("./common.js"), exports);
19
+ __exportStar(require("./constructors.js"), exports);
20
+ __exportStar(require("./enums.js"), exports);
21
+ __exportStar(require("./gethGenesis.js"), exports);
22
+ __exportStar(require("./interfaces.js"), exports);
23
+ __exportStar(require("./types.js"), exports);
24
+ __exportStar(require("./utils.js"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,8CAA2B;AAC3B,oDAAiC;AACjC,6CAA0B;AAC1B,mDAAgC;AAChC,kDAA+B;AAC/B,6CAA0B;AAC1B,6CAA0B"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * External Interfaces for other EthereumJS libraries
3
+ */
4
+ import type { Account, Address, BinaryTreeExecutionWitness, PrefixedHexString } from '@feelyourprotocol/util';
5
+ export interface StorageDump {
6
+ [key: string]: string;
7
+ }
8
+ /**
9
+ * Object that can contain a set of storage keys associated with an account.
10
+ */
11
+ export interface StorageRange {
12
+ /**
13
+ * A dictionary where the keys are hashed storage keys, and the values are
14
+ * objects containing the preimage of the hashed key (in `key`) and the
15
+ * storage key (in `value`). Currently, there is no way to retrieve preimages,
16
+ * so they are always `null`.
17
+ */
18
+ storage: {
19
+ [key: string]: {
20
+ key: string | null;
21
+ value: string;
22
+ };
23
+ };
24
+ /**
25
+ * The next (hashed) storage key after the greatest storage key
26
+ * contained in `storage`.
27
+ */
28
+ nextKey: string | null;
29
+ }
30
+ export type AccountFields = Partial<Pick<Account, 'nonce' | 'balance' | 'storageRoot' | 'codeHash' | 'codeSize'>>;
31
+ export type StorageProof = {
32
+ key: PrefixedHexString;
33
+ proof: PrefixedHexString[];
34
+ value: PrefixedHexString;
35
+ };
36
+ export type Proof = {
37
+ address: PrefixedHexString;
38
+ balance: PrefixedHexString;
39
+ codeHash: PrefixedHexString;
40
+ nonce: PrefixedHexString;
41
+ storageHash: PrefixedHexString;
42
+ accountProof: PrefixedHexString[];
43
+ storageProof: StorageProof[];
44
+ };
45
+ /**
46
+ * Binary tree related
47
+ *
48
+ * Experimental (do not implement)
49
+ */
50
+ export type AccessEventFlags = {
51
+ stemRead: boolean;
52
+ stemWrite: boolean;
53
+ chunkRead: boolean;
54
+ chunkWrite: boolean;
55
+ chunkFill: boolean;
56
+ };
57
+ export type BinaryTreeAccessedStateType = (typeof BinaryTreeAccessedStateType)[keyof typeof BinaryTreeAccessedStateType];
58
+ export declare const BinaryTreeAccessedStateType: {
59
+ readonly BasicData: "basicData";
60
+ readonly CodeHash: "codeHash";
61
+ readonly Code: "code";
62
+ readonly Storage: "storage";
63
+ };
64
+ export type RawBinaryTreeAccessedState = {
65
+ address: Address;
66
+ treeIndex: number | bigint;
67
+ chunkIndex: number;
68
+ chunkKey: PrefixedHexString;
69
+ };
70
+ export type BinaryTreeAccessedState = {
71
+ type: Exclude<BinaryTreeAccessedStateType, typeof BinaryTreeAccessedStateType.Code | typeof BinaryTreeAccessedStateType.Storage>;
72
+ } | {
73
+ type: typeof BinaryTreeAccessedStateType.Code;
74
+ codeOffset: number;
75
+ } | {
76
+ type: typeof BinaryTreeAccessedStateType.Storage;
77
+ slot: bigint;
78
+ };
79
+ export type BinaryTreeAccessedStateWithAddress = BinaryTreeAccessedState & {
80
+ address: Address;
81
+ chunkKey: PrefixedHexString;
82
+ };
83
+ export interface BinaryTreeAccessWitnessInterface {
84
+ accesses(): Generator<BinaryTreeAccessedStateWithAddress>;
85
+ rawAccesses(): Generator<RawBinaryTreeAccessedState>;
86
+ debugWitnessCost(): void;
87
+ readAccountBasicData(address: Address): bigint;
88
+ writeAccountBasicData(address: Address): bigint;
89
+ readAccountCodeHash(address: Address): bigint;
90
+ writeAccountCodeHash(address: Address): bigint;
91
+ readAccountHeader(address: Address): bigint;
92
+ writeAccountHeader(address: Address): bigint;
93
+ readAccountCodeChunks(contract: Address, startPc: number, endPc: number): bigint;
94
+ writeAccountCodeChunks(contract: Address, startPc: number, endPc: number): bigint;
95
+ readAccountStorage(contract: Address, storageSlot: bigint): bigint;
96
+ writeAccountStorage(contract: Address, storageSlot: bigint): bigint;
97
+ merge(accessWitness: BinaryTreeAccessWitnessInterface): void;
98
+ commit(): void;
99
+ revert(): void;
100
+ }
101
+ export interface StateManagerInterface {
102
+ getAccount(address: Address): Promise<Account | undefined>;
103
+ putAccount(address: Address, account?: Account): Promise<void>;
104
+ deleteAccount(address: Address): Promise<void>;
105
+ modifyAccountFields(address: Address, accountFields: AccountFields): Promise<void>;
106
+ putCode(address: Address, value: Uint8Array): Promise<void>;
107
+ getCode(address: Address): Promise<Uint8Array>;
108
+ getCodeSize(address: Address): Promise<number>;
109
+ getStorage(address: Address, key: Uint8Array): Promise<Uint8Array>;
110
+ putStorage(address: Address, key: Uint8Array, value: Uint8Array): Promise<void>;
111
+ clearStorage(address: Address): Promise<void>;
112
+ checkpoint(): Promise<void>;
113
+ commit(): Promise<void>;
114
+ revert(): Promise<void>;
115
+ getStateRoot(): Promise<Uint8Array>;
116
+ setStateRoot(stateRoot: Uint8Array, clearCache?: boolean): Promise<void>;
117
+ hasStateRoot(root: Uint8Array): Promise<boolean>;
118
+ dumpStorage?(address: Address): Promise<StorageDump>;
119
+ dumpStorageRange?(address: Address, startKey: bigint, limit: number): Promise<StorageRange>;
120
+ originalStorageCache: {
121
+ get(address: Address, key: Uint8Array): Promise<Uint8Array>;
122
+ clear(): void;
123
+ };
124
+ generateCanonicalGenesis?(initState: any): Promise<void>;
125
+ initBinaryTreeExecutionWitness?(blockNum: bigint, executionWitness?: BinaryTreeExecutionWitness | null): void;
126
+ verifyBinaryTreePostState?(accessWitness: BinaryTreeAccessWitnessInterface): Promise<boolean>;
127
+ checkChunkWitnessPresent?(contract: Address, programCounter: number): Promise<boolean>;
128
+ getAppliedKey?(address: Uint8Array): Uint8Array;
129
+ clearCaches(): void;
130
+ shallowCopy(downlevelCaches?: boolean): StateManagerInterface;
131
+ }
132
+ //# sourceMappingURL=interfaces.d.ts.map