Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common/tx/vm: export access lists / authority lists from tx #3577

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions packages/common/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,46 +49,6 @@ export type Proof = {
storageProof: StorageProof[]
}

/*
* Access List types
*/

export type AccessListItem = {
address: PrefixedHexString
storageKeys: PrefixedHexString[]
}

/*
* An Access List as a tuple of [address: Uint8Array, storageKeys: Uint8Array[]]
*/
export type AccessListBytesItem = [Uint8Array, Uint8Array[]]
export type AccessListBytes = AccessListBytesItem[]
export type AccessList = AccessListItem[]

/**
* Authorization list types
*/
export type AuthorizationListItem = {
chainId: PrefixedHexString
address: PrefixedHexString
nonce: PrefixedHexString[]
yParity: PrefixedHexString
r: PrefixedHexString
s: PrefixedHexString
}

// Tuple of [chain_id, address, [nonce], y_parity, r, s]
export type AuthorizationListBytesItem = [
Uint8Array,
Uint8Array,
Uint8Array[],
Uint8Array,
Uint8Array,
Uint8Array,
]
export type AuthorizationListBytes = AuthorizationListBytesItem[]
export type AuthorizationList = AuthorizationListItem[]

/**
* Verkle related
*
Expand Down
61 changes: 41 additions & 20 deletions packages/tx/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,14 @@ import type { AccessListEIP2930Transaction } from './2930/tx.js'
import type { BlobEIP4844Transaction } from './4844/tx.js'
import type { EOACodeEIP7702Transaction } from './7702/tx.js'
import type { LegacyTransaction } from './legacy/tx.js'
import type {
AccessList,
AccessListBytes,
AuthorizationList,
AuthorizationListBytes,
Common,
Hardfork,
ParamsDict,
} from '@ethereumjs/common'
import type { Common, Hardfork, ParamsDict } from '@ethereumjs/common'
import type {
Address,
AddressLike,
BigIntLike,
BytesLike,
PrefixedHexString,
} from '@ethereumjs/util'
export type {
AccessList,
AccessListBytes,
AccessListBytesItem,
AccessListItem,
AuthorizationList,
AuthorizationListBytes,
AuthorizationListBytesItem,
AuthorizationListItem,
} from '@ethereumjs/common'

/**
* Can be used in conjunction with {@link Transaction[TransactionType].supports}
* to query on tx capabilities
Expand Down Expand Up @@ -596,3 +577,43 @@ export interface JsonRpcTx {
blobVersionedHashes?: string[] // DATA - array of 32 byte versioned hashes for blob transactions
yParity?: string // DATA - parity of the y-coordinate of the public key
}

/*
* Access List types
*/

export type AccessListItem = {
address: PrefixedHexString
storageKeys: PrefixedHexString[]
}

/*
* An Access List as a tuple of [address: Uint8Array, storageKeys: Uint8Array[]]
*/
export type AccessListBytesItem = [Uint8Array, Uint8Array[]]
export type AccessListBytes = AccessListBytesItem[]
export type AccessList = AccessListItem[]

/**
* Authorization list types
*/
export type AuthorizationListItem = {
chainId: PrefixedHexString
address: PrefixedHexString
nonce: PrefixedHexString[]
yParity: PrefixedHexString
r: PrefixedHexString
s: PrefixedHexString
}

// Tuple of [chain_id, address, [nonce], y_parity, r, s]
export type AuthorizationListBytesItem = [
Uint8Array,
Uint8Array,
Uint8Array[],
Uint8Array,
Uint8Array,
Uint8Array,
]
export type AuthorizationListBytes = AuthorizationListBytesItem[]
export type AuthorizationList = AuthorizationListItem[]
3 changes: 2 additions & 1 deletion packages/tx/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import type {
AccessListItem,
AuthorizationList,
AuthorizationListBytes,
AuthorizationListItem,
TransactionType,
} from './types.js'
import type { AuthorizationListItem, Common } from '@ethereumjs/common'
import type { Common } from '@ethereumjs/common'

export function checkMaxInitCodeSize(common: Common, length: number) {
const maxInitCodeSize = common.param('maxInitCodeSize')
Expand Down
4 changes: 3 additions & 1 deletion packages/vm/src/runTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ import type {
} from './types.js'
import type { VM } from './vm.js'
import type { Block } from '@ethereumjs/block'
import type { AccessList, AccessListItem, Common } from '@ethereumjs/common'
import type { Common } from '@ethereumjs/common'
import type { EVM } from '@ethereumjs/evm'
import type {
AccessList,
AccessListEIP2930Transaction,
AccessListItem,
EIP7702CompatibleTx,
FeeMarketEIP1559Transaction,
LegacyTransaction,
Expand Down
Loading