Skip to content

Commit

Permalink
Prevent non-typed transactions from unsafely ignoring specified acces…
Browse files Browse the repository at this point in the history
…s lists (#1364).
  • Loading branch information
ricmoo committed Apr 18, 2021
1 parent 1cb3199 commit 4577444
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/transactions/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4577444

Please sign in to comment.