Prevent non-typed transactions from unsafely ignoring specified access lists (#1364).

This commit is contained in:
Richard Moore 2021-04-17 22:35:40 -04:00
parent 1cb3199e5c
commit 4577444c44
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -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) {