Skip to content

Commit b903ad4

Browse files
committed
Some more solid/qualified EVM dummy blockchain + interface naming to allow for exporting
1 parent 57cad15 commit b903ad4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

packages/evm/src/constructors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Common, Mainnet } from '@ethereumjs/common'
22
import { SimpleStateManager } from '@ethereumjs/statemanager'
33

44
import { NobleBN254 } from './precompiles/index.js'
5-
import { DefaultBlockchain } from './types.js'
5+
import { EVMMockBlockchain } from './types.js'
66

77
import { EVM } from './index.js'
88

@@ -25,7 +25,7 @@ export async function createEVM(createOpts?: EVMOpts) {
2525
}
2626

2727
if (opts.blockchain === undefined) {
28-
opts.blockchain = new DefaultBlockchain()
28+
opts.blockchain = new EVMMockBlockchain()
2929
}
3030

3131
if (opts.stateManager === undefined) {

packages/evm/src/types.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,13 @@ export interface EVMOpts {
343343
stateManager?: StateManagerInterface
344344

345345
/**
346+
* The EVM comes with a basic mock blockchain interface and implementation for
347+
* non-block containing use cases.
346348
*
349+
* For block-containing setups use the full blockchain implementation from the
350+
* `@ethereumjs/blockchain package.
347351
*/
348-
blockchain?: Blockchain
352+
blockchain?: EVMMockBlockchainInterface
349353

350354
/**
351355
*
@@ -472,16 +476,16 @@ export interface TransientStorageInterface {
472476
clear(): void
473477
}
474478

475-
type MockBlock = {
479+
export type EVMMockBlock = {
476480
hash(): Uint8Array
477481
}
478482

479-
export interface Blockchain {
480-
getBlock(blockId: number): Promise<MockBlock>
481-
shallowCopy(): Blockchain
483+
export interface EVMMockBlockchainInterface {
484+
getBlock(blockId: number): Promise<EVMMockBlock>
485+
shallowCopy(): EVMMockBlockchainInterface
482486
}
483487

484-
export class DefaultBlockchain implements Blockchain {
488+
export class EVMMockBlockchain implements EVMMockBlockchainInterface {
485489
async getBlock() {
486490
return {
487491
hash() {

0 commit comments

Comments
 (0)