From 4577444c448f41114263077c5b54fbe6af749fd4 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Sat, 17 Apr 2021 22:35:40 -0400 Subject: [PATCH] Prevent non-typed transactions from unsafely ignoring specified access lists (#1364). --- packages/transactions/src.ts/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/transactions/src.ts/index.ts b/packages/transactions/src.ts/index.ts index f3e3556512..f5c433a9c4 100644 --- a/packages/transactions/src.ts/index.ts +++ b/packages/transactions/src.ts/index.ts @@ -252,7 +252,12 @@ function _serialize(transaction: UnsignedTransaction, signature?: SignatureLike) export function serialize(transaction: UnsignedTransaction, signature?: SignatureLike): string { // Legacy and EIP-155 Transactions - if (transaction.type == null) { return _serialize(transaction, signature); } + if (transaction.type == null) { + if (transaction.accessList != null) { + logger.throwArgumentError("untyped transactions do not support accessList; include type: 1", "transaction", transaction); + } + return _serialize(transaction, signature); + } // Typed Transactions (EIP-2718) switch (transaction.type) {