@nomicfoundation/edr 0.12.0-next.8 → 0.12.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.
- package/coverage.sol +38 -0
- package/dist/src/ts/coverage.d.ts +6 -0
- package/dist/src/ts/coverage.d.ts.map +1 -0
- package/dist/src/ts/coverage.js +51 -0
- package/dist/src/ts/coverage.js.map +1 -0
- package/index.d.ts +267 -27
- package/index.js +5 -2
- package/package.json +23 -12
- package/src/account.rs +0 -124
- package/src/block.rs +0 -28
- package/src/call_override.rs +0 -116
- package/src/cast.rs +0 -165
- package/src/chains/generic.rs +0 -58
- package/src/chains/l1.rs +0 -268
- package/src/chains/op.rs +0 -424
- package/src/chains.rs +0 -7
- package/src/config.rs +0 -700
- package/src/context.rs +0 -447
- package/src/contract_decoder.rs +0 -57
- package/src/debug_trace.rs +0 -40
- package/src/gas_report.rs +0 -92
- package/src/instrument.rs +0 -109
- package/src/lib.rs +0 -50
- package/src/log.rs +0 -28
- package/src/logger.rs +0 -120
- package/src/mock/time.rs +0 -134
- package/src/mock.rs +0 -71
- package/src/precompile.rs +0 -50
- package/src/provider/factory.rs +0 -22
- package/src/provider/response.rs +0 -73
- package/src/provider.rs +0 -162
- package/src/result.rs +0 -212
- package/src/scenarios.rs +0 -53
- package/src/serde.rs +0 -57
- package/src/solidity_tests/artifact.rs +0 -184
- package/src/solidity_tests/config.rs +0 -793
- package/src/solidity_tests/factory.rs +0 -22
- package/src/solidity_tests/l1.rs +0 -68
- package/src/solidity_tests/op.rs +0 -69
- package/src/solidity_tests/runner.rs +0 -51
- package/src/solidity_tests/test_results.rs +0 -736
- package/src/solidity_tests.rs +0 -56
- package/src/subscription.rs +0 -32
- package/src/trace/debug.rs +0 -61
- package/src/trace/exit.rs +0 -89
- package/src/trace/library_utils.rs +0 -11
- package/src/trace/model.rs +0 -59
- package/src/trace/return_data.rs +0 -96
- package/src/trace/solidity_stack_trace.rs +0 -869
- package/src/trace.rs +0 -199
- package/src/ts/solidity_tests.ts +0 -46
- package/src/withdrawal.rs +0 -49
package/coverage.sol
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.4.22 <0.9.0;
|
|
3
|
+
|
|
4
|
+
library __NomicFoundationCoverage {
|
|
5
|
+
address constant COVERAGE_ADDRESS =
|
|
6
|
+
0xc0bEc0BEc0BeC0bEC0beC0bEC0bEC0beC0beC0BE;
|
|
7
|
+
|
|
8
|
+
function _sendHitImplementation(uint256 coverageId) private view {
|
|
9
|
+
address coverageAddress = COVERAGE_ADDRESS;
|
|
10
|
+
/// @solidity memory-safe-assembly
|
|
11
|
+
assembly {
|
|
12
|
+
let ptr := mload(0x40) // Get free memory pointer
|
|
13
|
+
mstore(ptr, coverageId) // Store coverageId at free memory
|
|
14
|
+
pop(
|
|
15
|
+
staticcall(
|
|
16
|
+
gas(),
|
|
17
|
+
coverageAddress,
|
|
18
|
+
ptr,
|
|
19
|
+
32, // Size of uint256 is 32 bytes
|
|
20
|
+
0,
|
|
21
|
+
0
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _castToPure(
|
|
28
|
+
function(uint256) internal view fnIn
|
|
29
|
+
) private pure returns (function(uint256) pure fnOut) {
|
|
30
|
+
assembly {
|
|
31
|
+
fnOut := fnIn
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function sendHit(uint256 coverageId) internal pure {
|
|
36
|
+
_castToPure(_sendHitImplementation)(coverageId);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../../src/ts/coverage.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,IAAI,WAAW,CAYhD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getCoverageLibrary = getCoverageLibrary;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const edr_1 = require("@nomicfoundation/edr");
|
|
40
|
+
function getCoverageLibrary() {
|
|
41
|
+
const packageRoot = path.dirname(require.resolve("@nomicfoundation/edr"));
|
|
42
|
+
const sourcePath = path.join(packageRoot, "coverage.sol");
|
|
43
|
+
if (!fs.existsSync(sourcePath)) {
|
|
44
|
+
throw new Error(`Coverage library file not found at ${sourcePath}. It should be bundled with @nomicfoundation/edr.`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
content: fs.readFileSync(sourcePath, "utf-8"),
|
|
48
|
+
filename: edr_1.COVERAGE_LIBRARY_FILE_NAME,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../../src/ts/coverage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,gDAYC;AAtBD,uCAAyB;AACzB,2CAA6B;AAE7B,8CAAkE;AAOlE,SAAgB,kBAAkB;IAChC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAC1D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,sCAAsC,UAAU,mDAAmD,CACpG,CAAC;IACJ,CAAC;IACD,OAAO;QACL,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC;QAC7C,QAAQ,EAAE,gCAA0B;KACrC,CAAC;AACJ,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -91,7 +91,9 @@ export enum SpecId {
|
|
|
91
91
|
/** Cancun */
|
|
92
92
|
Cancun = 17,
|
|
93
93
|
/** Prague */
|
|
94
|
-
Prague = 18
|
|
94
|
+
Prague = 18,
|
|
95
|
+
/** Osaka */
|
|
96
|
+
Osaka = 19
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* Tries to parse the provided string to create a [`SpecId`] instance.
|
|
@@ -125,6 +127,7 @@ export const MERGE: string
|
|
|
125
127
|
export const SHANGHAI: string
|
|
126
128
|
export const CANCUN: string
|
|
127
129
|
export const PRAGUE: string
|
|
130
|
+
export const OSAKA: string
|
|
128
131
|
/** Enumeration of supported OP hardforks. */
|
|
129
132
|
export enum OpHardfork {
|
|
130
133
|
Bedrock = 100,
|
|
@@ -261,15 +264,42 @@ export interface IntervalRange {
|
|
|
261
264
|
/** Configuration for the provider's miner. */
|
|
262
265
|
export interface MiningConfig {
|
|
263
266
|
autoMine: boolean
|
|
267
|
+
/**
|
|
268
|
+
* The block gas limit to use for mining a block.
|
|
269
|
+
*
|
|
270
|
+
* When not set, enforcement of the block gas limit is disabled in the mem
|
|
271
|
+
* pool, miner, and REVM.
|
|
272
|
+
*/
|
|
273
|
+
blockGasLimit?: bigint
|
|
264
274
|
interval?: bigint | IntervalRange
|
|
265
275
|
memPool: MemPoolConfig
|
|
266
276
|
}
|
|
277
|
+
/** Configuration for a locally mined blockchain. */
|
|
278
|
+
export interface LocalConfig {
|
|
279
|
+
/**
|
|
280
|
+
* The blob gas used for the genesis block, introduced in [EIP-4844].
|
|
281
|
+
*
|
|
282
|
+
* [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
|
|
283
|
+
*/
|
|
284
|
+
genesisBlobGas?: BlobGas
|
|
285
|
+
/** The block gas limit of the genesis block. */
|
|
286
|
+
genesisBlockGasLimit: bigint
|
|
287
|
+
/** The date, in seconds since the Unix epoch, of the genesis block. */
|
|
288
|
+
genesisBlockTime?: bigint
|
|
289
|
+
}
|
|
267
290
|
/** Configuration for runtime observability. */
|
|
268
291
|
export interface ObservabilityConfig {
|
|
269
292
|
/** If present, configures runtime observability to collect code coverage. */
|
|
270
293
|
codeCoverage?: CodeCoverageConfig
|
|
271
294
|
/** If present, configures runtime observability to collect gas reports. */
|
|
272
295
|
gasReport?: GasReportConfig
|
|
296
|
+
/**
|
|
297
|
+
* Controls when to include call traces in the results of transaction
|
|
298
|
+
* execution.
|
|
299
|
+
*
|
|
300
|
+
* Defaults to `IncludeTraces.None`.
|
|
301
|
+
*/
|
|
302
|
+
includeCallTraces?: IncludeTraces
|
|
273
303
|
}
|
|
274
304
|
/** Configuration for a provider */
|
|
275
305
|
export interface ProviderConfig {
|
|
@@ -292,17 +322,15 @@ export interface ProviderConfig {
|
|
|
292
322
|
* will be used.
|
|
293
323
|
*/
|
|
294
324
|
baseFeeConfig?: Array<BaseFeeParamActivation>
|
|
295
|
-
/** The gas limit of each block */
|
|
296
|
-
blockGasLimit: bigint
|
|
297
325
|
/** The chain ID of the blockchain */
|
|
298
326
|
chainId: bigint
|
|
299
327
|
/** The address of the coinbase */
|
|
300
328
|
coinbase: Uint8Array
|
|
301
329
|
/**
|
|
302
|
-
* The
|
|
303
|
-
*
|
|
330
|
+
* The default transaction gas limit to use for RPC call and transaction
|
|
331
|
+
* requests that do not specify a `gas` value.
|
|
304
332
|
*/
|
|
305
|
-
|
|
333
|
+
defaultTransactionGasLimit: bigint
|
|
306
334
|
/** The genesis state of the blockchain */
|
|
307
335
|
genesisState: Array<AccountOverride>
|
|
308
336
|
/** The hardfork of the blockchain */
|
|
@@ -312,10 +340,6 @@ export interface ProviderConfig {
|
|
|
312
340
|
* transactions and later
|
|
313
341
|
*/
|
|
314
342
|
initialBaseFeePerGas?: bigint
|
|
315
|
-
/** The initial blob gas of the blockchain. Required for EIP-4844 */
|
|
316
|
-
initialBlobGas?: BlobGas
|
|
317
|
-
/** The initial date of the blockchain, in seconds since the Unix epoch */
|
|
318
|
-
initialDate?: bigint
|
|
319
343
|
/**
|
|
320
344
|
* The initial parent beacon block root of the blockchain. Required for
|
|
321
345
|
* EIP-4788
|
|
@@ -325,6 +349,8 @@ export interface ProviderConfig {
|
|
|
325
349
|
minGasPrice: bigint
|
|
326
350
|
/** The configuration for the miner */
|
|
327
351
|
mining: MiningConfig
|
|
352
|
+
/** The network configuration for the provider. */
|
|
353
|
+
network: ForkConfig | LocalConfig
|
|
328
354
|
/** The network ID of the blockchain */
|
|
329
355
|
networkId: bigint
|
|
330
356
|
/** The configuration for the provider's observability */
|
|
@@ -333,6 +359,20 @@ export interface ProviderConfig {
|
|
|
333
359
|
ownedAccounts: Array<string>
|
|
334
360
|
/** Overrides for precompiles */
|
|
335
361
|
precompileOverrides: Array<Precompile>
|
|
362
|
+
/**
|
|
363
|
+
* Transaction gas cap, introduced in [EIP-7825].
|
|
364
|
+
*
|
|
365
|
+
* Integer values should be larger than zero.
|
|
366
|
+
*
|
|
367
|
+
* When `false`, enforcement of the transaction gas cap is disabled and
|
|
368
|
+
* transactions with any `gas` value are accepted by the mempool and
|
|
369
|
+
* executed without REVM's transaction gas cap check.
|
|
370
|
+
*
|
|
371
|
+
* When not set, a hardfork-specific default value will be used.
|
|
372
|
+
*
|
|
373
|
+
* [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
|
|
374
|
+
*/
|
|
375
|
+
transactionGasCap?: bigint | false
|
|
336
376
|
}
|
|
337
377
|
/** Tracing config for Solidity stack trace generation. */
|
|
338
378
|
export interface TracingConfigWithBuffers {
|
|
@@ -399,11 +439,19 @@ export enum GasReportExecutionStatus {
|
|
|
399
439
|
export interface DeploymentGasReport {
|
|
400
440
|
gas: bigint
|
|
401
441
|
size: bigint
|
|
442
|
+
runtimeSize: bigint
|
|
402
443
|
status: GasReportExecutionStatus
|
|
403
444
|
}
|
|
404
445
|
export interface FunctionGasReport {
|
|
405
446
|
gas: bigint
|
|
406
447
|
status: GasReportExecutionStatus
|
|
448
|
+
/**
|
|
449
|
+
* The proxy delegation chain for this call, if the called contract is a
|
|
450
|
+
* proxy. Contains contract identifiers from outermost proxy to final
|
|
451
|
+
* implementation, e.g. `["Proxy", "Implementation"]`.
|
|
452
|
+
* Empty if the call is not through a proxy.
|
|
453
|
+
*/
|
|
454
|
+
proxyChain: Array<string>
|
|
407
455
|
}
|
|
408
456
|
export interface InstrumentationResult {
|
|
409
457
|
/** The generated source code with coverage instrumentation. */
|
|
@@ -434,11 +482,15 @@ export interface InstrumentationMetadata {
|
|
|
434
482
|
*/
|
|
435
483
|
readonly endUtf16: number
|
|
436
484
|
}
|
|
485
|
+
/** The instrumentation coverage library file name. */
|
|
486
|
+
export const COVERAGE_LIBRARY_FILE_NAME: string
|
|
437
487
|
/**
|
|
438
488
|
* Adds per-statement coverage instrumentation to the given Solidity source
|
|
439
489
|
* code.
|
|
440
490
|
*/
|
|
441
|
-
export declare function addStatementCoverageInstrumentation(sourceCode: string, sourceId: string, solidityVersion: string
|
|
491
|
+
export declare function addStatementCoverageInstrumentation(sourceCode: string, sourceId: string, solidityVersion: string): InstrumentationResult
|
|
492
|
+
/** Retrieves the latest version of `Solidity` supported for instrumentation. */
|
|
493
|
+
export declare function latestSupportedSolidityVersion(): string
|
|
442
494
|
/** Ethereum execution log. */
|
|
443
495
|
export interface ExecutionLog {
|
|
444
496
|
address: Uint8Array
|
|
@@ -574,6 +626,20 @@ export interface LinkReference {
|
|
|
574
626
|
start: number
|
|
575
627
|
length: number
|
|
576
628
|
}
|
|
629
|
+
/**Error codes that can be returned by cheatcodes in Solidity tests. */
|
|
630
|
+
export enum CheatcodeErrorCode {
|
|
631
|
+
/**The specified cheatcode is not supported. */
|
|
632
|
+
UnsupportedCheatcode = 'UnsupportedCheatcode',
|
|
633
|
+
/**The specified cheatcode is missing. */
|
|
634
|
+
MissingCheatcode = 'MissingCheatcode'
|
|
635
|
+
}
|
|
636
|
+
/**Error returned by a cheatcode in Solidity tests. */
|
|
637
|
+
export interface CheatcodeErrorDetails {
|
|
638
|
+
/**The error code representing the type of cheatcode error. */
|
|
639
|
+
code: CheatcodeErrorCode
|
|
640
|
+
/**The name of the cheatcode that caused the error. */
|
|
641
|
+
cheatcode: string
|
|
642
|
+
}
|
|
577
643
|
/**
|
|
578
644
|
* Solidity test runner configuration arguments exposed through the ffi.
|
|
579
645
|
* Docs based on <https://book.getfoundry.sh/reference/config/testing>.
|
|
@@ -586,8 +652,6 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
586
652
|
projectRoot: string
|
|
587
653
|
/** Configures the permissions of cheat codes that access the file system. */
|
|
588
654
|
fsPermissions?: Array<PathPermission>
|
|
589
|
-
/** Whether to support the `testFail` prefix. Defaults to false. */
|
|
590
|
-
testFail?: boolean
|
|
591
655
|
/** Address labels for traces. Defaults to none. */
|
|
592
656
|
labels?: Array<AddressLabel>
|
|
593
657
|
/**
|
|
@@ -635,6 +699,8 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
635
699
|
* Defaults to `31337`.
|
|
636
700
|
*/
|
|
637
701
|
chainId?: bigint
|
|
702
|
+
/** The hardfork to use for EVM execution. */
|
|
703
|
+
hardfork: string
|
|
638
704
|
/**
|
|
639
705
|
* The gas limit for each test case.
|
|
640
706
|
* Defaults to `9_223_372_036_854_775_807` (`i64::MAX`).
|
|
@@ -675,6 +741,21 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
675
741
|
* Defaults to false.
|
|
676
742
|
*/
|
|
677
743
|
disableBlockGasLimit?: boolean
|
|
744
|
+
/**
|
|
745
|
+
* Transaction gas cap, introduced in [EIP-7825].
|
|
746
|
+
*
|
|
747
|
+
* When not set, defaults to the value defined by the used hardfork.
|
|
748
|
+
*
|
|
749
|
+
* [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
|
|
750
|
+
*/
|
|
751
|
+
transactionGasCap?: bigint
|
|
752
|
+
/**
|
|
753
|
+
* Whether to disable the [EIP-7825] transaction gas cap.
|
|
754
|
+
* Defaults to false.
|
|
755
|
+
*
|
|
756
|
+
* [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
|
|
757
|
+
*/
|
|
758
|
+
disableTransactionGasCap?: boolean
|
|
678
759
|
/**
|
|
679
760
|
* The memory limit of the EVM in bytes.
|
|
680
761
|
* Defaults to `33_554_432` (2^25 = 32MiB).
|
|
@@ -743,6 +824,45 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
743
824
|
* Defaults to false.
|
|
744
825
|
*/
|
|
745
826
|
generateGasReport?: boolean
|
|
827
|
+
/**
|
|
828
|
+
* Test function level config overrides.
|
|
829
|
+
* Defaults to none.
|
|
830
|
+
*/
|
|
831
|
+
testFunctionOverrides?: Array<TestFunctionOverride>
|
|
832
|
+
/**
|
|
833
|
+
* A list of EIP-712 canonical type definitions that can be referenced by
|
|
834
|
+
* type name in the `eip712HashType` and `eip712HashStruct` cheatcodes.
|
|
835
|
+
*
|
|
836
|
+
* Each entry is an independent, self-contained type definition. A
|
|
837
|
+
* definition that references nested struct types must inline those
|
|
838
|
+
* struct definitions, per the EIP-712 `encodeType` spec.
|
|
839
|
+
*
|
|
840
|
+
* Only the primary (leftmost) type of each entry is registered by name.
|
|
841
|
+
* Nested struct types referenced inside an entry are *not* registered
|
|
842
|
+
* under their own names. To look up a nested struct by name from a
|
|
843
|
+
* cheatcode, add it as a separate top-level entry whose primary type
|
|
844
|
+
* is the nested struct.
|
|
845
|
+
*
|
|
846
|
+
* The type of a struct is encoded as:
|
|
847
|
+
*
|
|
848
|
+
* `name ‖ "(" ‖ member₁ ‖ "," ‖ member₂ ‖ "," ‖ … ‖ memberₙ ")"`
|
|
849
|
+
*
|
|
850
|
+
* where each member is written as `type ‖ " " ‖ name`.
|
|
851
|
+
*
|
|
852
|
+
* Entries that fail to parse cause a startup error listing every bad
|
|
853
|
+
* entry.
|
|
854
|
+
*
|
|
855
|
+
* Example — to make both `Mail` and `Person` reachable by name:
|
|
856
|
+
*
|
|
857
|
+
* ```text
|
|
858
|
+
* "Mail(Person from,Person to,string contents)Person(address wallet,string name)"
|
|
859
|
+
* "Person(address wallet,string name)"
|
|
860
|
+
* ```
|
|
861
|
+
*
|
|
862
|
+
* With *only* the first entry, `vm.eip712HashType("Mail")` works but
|
|
863
|
+
* `vm.eip712HashType("Person")` fails with an unknown-type error.
|
|
864
|
+
*/
|
|
865
|
+
eip712CanonicalTypes?: Array<string>
|
|
746
866
|
}
|
|
747
867
|
/** Fuzz testing configuration */
|
|
748
868
|
export interface FuzzConfigArgs {
|
|
@@ -788,6 +908,16 @@ export interface FuzzConfigArgs {
|
|
|
788
908
|
* Defaults to true.
|
|
789
909
|
*/
|
|
790
910
|
includePushBytes?: boolean
|
|
911
|
+
/**
|
|
912
|
+
* Show `console.log` in fuzz test.
|
|
913
|
+
* Defaults to false.
|
|
914
|
+
*/
|
|
915
|
+
showLogs?: boolean
|
|
916
|
+
/**
|
|
917
|
+
* Optional timeout (in seconds) for each property test.
|
|
918
|
+
* Defaults to none (no timeout).
|
|
919
|
+
*/
|
|
920
|
+
timeout?: number
|
|
791
921
|
}
|
|
792
922
|
/** Invariant testing configuration. */
|
|
793
923
|
export interface InvariantConfigArgs {
|
|
@@ -838,6 +968,17 @@ export interface InvariantConfigArgs {
|
|
|
838
968
|
* Defaults to 5000.
|
|
839
969
|
*/
|
|
840
970
|
shrinkRunLimit?: number
|
|
971
|
+
/**
|
|
972
|
+
* The maximum number of rejects via `vm.assume` which can be encountered
|
|
973
|
+
* during a single invariant run.
|
|
974
|
+
* Defaults to 65536.
|
|
975
|
+
*/
|
|
976
|
+
maxAssumeRejects?: number
|
|
977
|
+
/**
|
|
978
|
+
* Optional timeout (in seconds) for each invariant test.
|
|
979
|
+
* Defaults to none (no timeout).
|
|
980
|
+
*/
|
|
981
|
+
timeout?: number
|
|
841
982
|
}
|
|
842
983
|
/** Settings to configure caching of remote RPC endpoints. */
|
|
843
984
|
export interface StorageCachingConfig {
|
|
@@ -921,17 +1062,104 @@ export enum CollectStackTraces {
|
|
|
921
1062
|
OnFailure = 1
|
|
922
1063
|
}
|
|
923
1064
|
/**
|
|
924
|
-
* Configuration
|
|
925
|
-
*
|
|
1065
|
+
* Configuration that controls whether execution traces are decoded and
|
|
1066
|
+
* included in results.
|
|
1067
|
+
*
|
|
1068
|
+
* This can either be for Solidity test results or provider transaction
|
|
1069
|
+
* execution results.
|
|
926
1070
|
*/
|
|
927
1071
|
export enum IncludeTraces {
|
|
928
|
-
/** No traces will be included
|
|
1072
|
+
/** No traces will be included at all. */
|
|
929
1073
|
None = 0,
|
|
930
|
-
/**
|
|
1074
|
+
/**
|
|
1075
|
+
* Traces will be included only on the results of failed tests or
|
|
1076
|
+
* execution.
|
|
1077
|
+
*/
|
|
931
1078
|
Failing = 1,
|
|
932
|
-
/** Traces will be included
|
|
1079
|
+
/** Traces will be included for all test results or executed transactions. */
|
|
933
1080
|
All = 2
|
|
934
1081
|
}
|
|
1082
|
+
/** Test function level config override. */
|
|
1083
|
+
export interface TestFunctionConfigOverride {
|
|
1084
|
+
/**
|
|
1085
|
+
* Allow expecting reverts with `expectRevert` at the same callstack depth
|
|
1086
|
+
* as the test.
|
|
1087
|
+
*/
|
|
1088
|
+
allowInternalExpectRevert?: boolean
|
|
1089
|
+
/**
|
|
1090
|
+
* Whether to enable isolation of calls for the test. In isolation mode all
|
|
1091
|
+
* top-level calls are executed as a separate transaction in a separate
|
|
1092
|
+
* EVM context, enabling more precise gas accounting and transaction
|
|
1093
|
+
* state changes.
|
|
1094
|
+
* Ignored when gas reporting is enabled, as isolation is required for
|
|
1095
|
+
* accurate gas measurements.
|
|
1096
|
+
*/
|
|
1097
|
+
isolate?: boolean
|
|
1098
|
+
/**
|
|
1099
|
+
* The EVM version to use for this test, e.g. "Cancun". This will override
|
|
1100
|
+
* the global EVM version.
|
|
1101
|
+
*/
|
|
1102
|
+
evmVersion?: string
|
|
1103
|
+
/** Configuration override for fuzz testing. */
|
|
1104
|
+
fuzz?: FuzzConfigOverride
|
|
1105
|
+
/** Configuration override for invariant testing. */
|
|
1106
|
+
invariant?: InvariantConfigOverride
|
|
1107
|
+
}
|
|
1108
|
+
/** Test function override configuration. */
|
|
1109
|
+
export interface TestFunctionOverride {
|
|
1110
|
+
/** The test function identifier. */
|
|
1111
|
+
identifier: TestFunctionIdentifier
|
|
1112
|
+
/** The configuration override. */
|
|
1113
|
+
config: TestFunctionConfigOverride
|
|
1114
|
+
}
|
|
1115
|
+
/** Test function identifier. */
|
|
1116
|
+
export interface TestFunctionIdentifier {
|
|
1117
|
+
/** The contract artifact id. */
|
|
1118
|
+
contractArtifact: ArtifactId
|
|
1119
|
+
/** The function selector as hex string. */
|
|
1120
|
+
functionSelector: string
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Timeout configuration.
|
|
1124
|
+
* Note: This wrapper is needed to avoid ambiguity with NAPI conversion.
|
|
1125
|
+
*/
|
|
1126
|
+
export interface TimeoutConfig {
|
|
1127
|
+
/** Optional timeout (in seconds). */
|
|
1128
|
+
time?: number
|
|
1129
|
+
}
|
|
1130
|
+
/** Test function or test contract level fuzz config override. */
|
|
1131
|
+
export interface FuzzConfigOverride {
|
|
1132
|
+
/** The number of test cases that must execute for each property test. */
|
|
1133
|
+
runs?: number
|
|
1134
|
+
/**
|
|
1135
|
+
* The maximum number of test case rejections allowed by proptest, to be
|
|
1136
|
+
* encountered during usage of `vm.assume` cheatcode. This will be used
|
|
1137
|
+
* to set the `max_global_rejects` value in proptest test runner config.
|
|
1138
|
+
* `max_local_rejects` option isn't exposed here since we're not using
|
|
1139
|
+
* `prop_filter`.
|
|
1140
|
+
*/
|
|
1141
|
+
maxTestRejects?: number
|
|
1142
|
+
/** show `console.log` in fuzz test, defaults to `false`. */
|
|
1143
|
+
showLogs?: boolean
|
|
1144
|
+
/** Optional timeout (in seconds) for each property test. */
|
|
1145
|
+
timeout?: TimeoutConfig
|
|
1146
|
+
}
|
|
1147
|
+
/** Test function or test contract level invariant config override. */
|
|
1148
|
+
export interface InvariantConfigOverride {
|
|
1149
|
+
/** The number of runs that must execute for each invariant test group. */
|
|
1150
|
+
runs?: number
|
|
1151
|
+
/** The number of calls executed to attempt to break invariants in one run. */
|
|
1152
|
+
depth?: number
|
|
1153
|
+
/** Fails the invariant fuzzing if a revert occurs. */
|
|
1154
|
+
failOnRevert?: boolean
|
|
1155
|
+
/**
|
|
1156
|
+
* Allows overriding an unsafe external call when running invariant tests.
|
|
1157
|
+
* eg. reentrancy checks
|
|
1158
|
+
*/
|
|
1159
|
+
callOverride?: boolean
|
|
1160
|
+
/** Optional timeout (in seconds) for each invariant test. */
|
|
1161
|
+
timeout?: TimeoutConfig
|
|
1162
|
+
}
|
|
935
1163
|
export declare function l1SolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
936
1164
|
export declare function opSolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
937
1165
|
/** A grouping of value snapshot entries for a test. */
|
|
@@ -1003,7 +1231,7 @@ export enum TestStatus {
|
|
|
1003
1231
|
/**Test skipped */
|
|
1004
1232
|
Skipped = 'Skipped'
|
|
1005
1233
|
}
|
|
1006
|
-
/** See [`edr_solidity_tests::result::TestKind::
|
|
1234
|
+
/** See [`edr_solidity_tests::result::TestKind::Unit`] */
|
|
1007
1235
|
export interface StandardTestKind {
|
|
1008
1236
|
/** The gas consumed by the test. */
|
|
1009
1237
|
readonly consumedGas: bigint
|
|
@@ -1034,6 +1262,16 @@ export interface InvariantTestKind {
|
|
|
1034
1262
|
readonly calls: bigint
|
|
1035
1263
|
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1036
1264
|
readonly reverts: bigint
|
|
1265
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1266
|
+
readonly metrics: Record<string, InvariantMetrics>
|
|
1267
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1268
|
+
readonly failedCorpusReplays: bigint
|
|
1269
|
+
}
|
|
1270
|
+
/** See [`edr_solidity_tests::result::InvariantMetrics`] */
|
|
1271
|
+
export interface InvariantMetrics {
|
|
1272
|
+
readonly calls: bigint
|
|
1273
|
+
readonly reverts: bigint
|
|
1274
|
+
readonly discards: bigint
|
|
1037
1275
|
}
|
|
1038
1276
|
/**
|
|
1039
1277
|
* Original sequence size and sequence of calls used as a counter example
|
|
@@ -1348,6 +1586,7 @@ export interface CheatcodeErrorStackTraceEntry {
|
|
|
1348
1586
|
type: StackTraceEntryType.CHEATCODE_ERROR
|
|
1349
1587
|
message: string
|
|
1350
1588
|
sourceReference: SourceReference
|
|
1589
|
+
details?: CheatcodeErrorDetails
|
|
1351
1590
|
}
|
|
1352
1591
|
export interface TracingMessage {
|
|
1353
1592
|
/** Sender address */
|
|
@@ -1392,11 +1631,6 @@ export interface TracingMessageResult {
|
|
|
1392
1631
|
/** Execution result */
|
|
1393
1632
|
readonly executionResult: ExecutionResult
|
|
1394
1633
|
}
|
|
1395
|
-
/**
|
|
1396
|
-
* Returns the latest version of solc that EDR officially
|
|
1397
|
-
* supports and is tested against.
|
|
1398
|
-
*/
|
|
1399
|
-
export declare function getLatestSupportedSolcVersion(): string
|
|
1400
1634
|
export interface Withdrawal {
|
|
1401
1635
|
/** The index of withdrawal */
|
|
1402
1636
|
index: bigint
|
|
@@ -1455,9 +1689,15 @@ export declare class Response {
|
|
|
1455
1689
|
/**Returns the response data as a JSON string or a JSON object. */
|
|
1456
1690
|
get data(): string | any
|
|
1457
1691
|
/**Compute the error stack trace. Return the stack trace if it can be decoded, otherwise returns none. Throws if there was an error computing the stack trace. */
|
|
1458
|
-
stackTrace():
|
|
1459
|
-
/**
|
|
1460
|
-
|
|
1692
|
+
stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | null
|
|
1693
|
+
/**
|
|
1694
|
+
* Constructs the execution traces for the request. Returns an empty array
|
|
1695
|
+
* if traces are not enabled for this provider according to
|
|
1696
|
+
* [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
|
|
1697
|
+
* an array of the root calls of the trace, which always includes the
|
|
1698
|
+
* request's call itself.
|
|
1699
|
+
*/
|
|
1700
|
+
callTraces(): Array<CallTrace>
|
|
1461
1701
|
}
|
|
1462
1702
|
/** A JSON-RPC provider for Ethereum. */
|
|
1463
1703
|
export declare class Provider {
|
package/index.js
CHANGED
|
@@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { GENERIC_CHAIN_TYPE, genericChainProviderFactory, L1_CHAIN_TYPE, l1GenesisState, l1ProviderFactory, SpecId, l1HardforkFromString, l1HardforkToString, l1HardforkLatest, FRONTIER, FRONTIER_THAWING, HOMESTEAD, DAO_FORK, TANGERINE, SPURIOUS_DRAGON, BYZANTIUM, CONSTANTINOPLE, PETERSBURG, ISTANBUL, MUIR_GLACIER, BERLIN, LONDON, ARROW_GLACIER, GRAY_GLACIER, MERGE, SHANGHAI, CANCUN, PRAGUE, OpHardfork, opHardforkFromString, opHardforkToString, opLatestHardfork, OP_CHAIN_TYPE, opGenesisState, opProviderFactory, BEDROCK, REGOLITH, CANYON, ECOTONE, FJORD, GRANITE, HOLOCENE, ISTHMUS, MineOrdering, EdrContext, ContractDecoder, GasReportExecutionStatus, addStatementCoverageInstrumentation, Precompile, precompileP256Verify, ProviderFactory, Response, Provider, SuccessReason, ExceptionalHalt, CachedChains, CachedEndpoints, FsAccessPermission, CollectStackTraces, IncludeTraces, SolidityTestRunnerFactory, l1SolidityTestRunnerFactory, opSolidityTestRunnerFactory, SuiteResult, TestResult, TestStatus, CallKind, LogKind, linkHexStringBytecode, printStackTrace, Exit, ExitCode, BytecodeWrapper, ContractFunctionType, ReturnData, StackTraceEntryType, stackTraceEntryTypeToString, FALLBACK_FUNCTION_NAME, RECEIVE_FUNCTION_NAME, CONSTRUCTOR_FUNCTION_NAME, UNRECOGNIZED_FUNCTION_NAME, UNKNOWN_FUNCTION_NAME, PRECOMPILE_FUNCTION_NAME, UNRECOGNIZED_CONTRACT_NAME, RawTrace
|
|
313
|
+
const { GENERIC_CHAIN_TYPE, genericChainProviderFactory, L1_CHAIN_TYPE, l1GenesisState, l1ProviderFactory, SpecId, l1HardforkFromString, l1HardforkToString, l1HardforkLatest, FRONTIER, FRONTIER_THAWING, HOMESTEAD, DAO_FORK, TANGERINE, SPURIOUS_DRAGON, BYZANTIUM, CONSTANTINOPLE, PETERSBURG, ISTANBUL, MUIR_GLACIER, BERLIN, LONDON, ARROW_GLACIER, GRAY_GLACIER, MERGE, SHANGHAI, CANCUN, PRAGUE, OSAKA, OpHardfork, opHardforkFromString, opHardforkToString, opLatestHardfork, OP_CHAIN_TYPE, opGenesisState, opProviderFactory, BEDROCK, REGOLITH, CANYON, ECOTONE, FJORD, GRANITE, HOLOCENE, ISTHMUS, MineOrdering, EdrContext, ContractDecoder, GasReportExecutionStatus, COVERAGE_LIBRARY_FILE_NAME, addStatementCoverageInstrumentation, latestSupportedSolidityVersion, Precompile, precompileP256Verify, ProviderFactory, Response, Provider, SuccessReason, ExceptionalHalt, CheatcodeErrorCode, CachedChains, CachedEndpoints, FsAccessPermission, CollectStackTraces, IncludeTraces, SolidityTestRunnerFactory, l1SolidityTestRunnerFactory, opSolidityTestRunnerFactory, SuiteResult, TestResult, TestStatus, CallKind, LogKind, linkHexStringBytecode, printStackTrace, Exit, ExitCode, BytecodeWrapper, ContractFunctionType, ReturnData, StackTraceEntryType, stackTraceEntryTypeToString, FALLBACK_FUNCTION_NAME, RECEIVE_FUNCTION_NAME, CONSTRUCTOR_FUNCTION_NAME, UNRECOGNIZED_FUNCTION_NAME, UNKNOWN_FUNCTION_NAME, PRECOMPILE_FUNCTION_NAME, UNRECOGNIZED_CONTRACT_NAME, RawTrace } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.GENERIC_CHAIN_TYPE = GENERIC_CHAIN_TYPE
|
|
316
316
|
module.exports.genericChainProviderFactory = genericChainProviderFactory
|
|
@@ -340,6 +340,7 @@ module.exports.MERGE = MERGE
|
|
|
340
340
|
module.exports.SHANGHAI = SHANGHAI
|
|
341
341
|
module.exports.CANCUN = CANCUN
|
|
342
342
|
module.exports.PRAGUE = PRAGUE
|
|
343
|
+
module.exports.OSAKA = OSAKA
|
|
343
344
|
module.exports.OpHardfork = OpHardfork
|
|
344
345
|
module.exports.opHardforkFromString = opHardforkFromString
|
|
345
346
|
module.exports.opHardforkToString = opHardforkToString
|
|
@@ -359,7 +360,9 @@ module.exports.MineOrdering = MineOrdering
|
|
|
359
360
|
module.exports.EdrContext = EdrContext
|
|
360
361
|
module.exports.ContractDecoder = ContractDecoder
|
|
361
362
|
module.exports.GasReportExecutionStatus = GasReportExecutionStatus
|
|
363
|
+
module.exports.COVERAGE_LIBRARY_FILE_NAME = COVERAGE_LIBRARY_FILE_NAME
|
|
362
364
|
module.exports.addStatementCoverageInstrumentation = addStatementCoverageInstrumentation
|
|
365
|
+
module.exports.latestSupportedSolidityVersion = latestSupportedSolidityVersion
|
|
363
366
|
module.exports.Precompile = Precompile
|
|
364
367
|
module.exports.precompileP256Verify = precompileP256Verify
|
|
365
368
|
module.exports.ProviderFactory = ProviderFactory
|
|
@@ -367,6 +370,7 @@ module.exports.Response = Response
|
|
|
367
370
|
module.exports.Provider = Provider
|
|
368
371
|
module.exports.SuccessReason = SuccessReason
|
|
369
372
|
module.exports.ExceptionalHalt = ExceptionalHalt
|
|
373
|
+
module.exports.CheatcodeErrorCode = CheatcodeErrorCode
|
|
370
374
|
module.exports.CachedChains = CachedChains
|
|
371
375
|
module.exports.CachedEndpoints = CachedEndpoints
|
|
372
376
|
module.exports.FsAccessPermission = FsAccessPermission
|
|
@@ -397,4 +401,3 @@ module.exports.UNKNOWN_FUNCTION_NAME = UNKNOWN_FUNCTION_NAME
|
|
|
397
401
|
module.exports.PRECOMPILE_FUNCTION_NAME = PRECOMPILE_FUNCTION_NAME
|
|
398
402
|
module.exports.UNRECOGNIZED_CONTRACT_NAME = UNRECOGNIZED_CONTRACT_NAME
|
|
399
403
|
module.exports.RawTrace = RawTrace
|
|
400
|
-
module.exports.getLatestSupportedSolcVersion = getLatestSupportedSolcVersion
|