Files
Rabby/patches/@ethereumjs+tx+5.4.0.patch
DMY 39510ce712 feat: revoke 7702 (#2994)
* wip

* fix: update transaction type handling for EIP-7702 and 1559 compatibility

* fix: conditionally show table header based on data source length

* chore: @rabby-wallet/eth-simple-keyring@5.1.0
2025-07-17 15:40:35 +08:00

131 lines
6.3 KiB
Diff

diff --git a/node_modules/@ethereumjs/tx/dist/cjs/util.js b/node_modules/@ethereumjs/tx/dist/cjs/util.js
index d60cf92..ea54945 100644
--- a/node_modules/@ethereumjs/tx/dist/cjs/util.js
+++ b/node_modules/@ethereumjs/tx/dist/cjs/util.js
@@ -119,14 +119,11 @@ class AuthorizationLists {
}
const chainId = (0, util_1.hexToBytes)(item.chainId);
const addressBytes = (0, util_1.hexToBytes)(item.address);
- const nonceList = [];
- for (let j = 0; j < item.nonce.length; j++) {
- nonceList.push((0, util_1.hexToBytes)(item.nonce[j]));
- }
+ const nonce = (0, util_1.hexToBytes)(item.nonce);
const yParity = (0, util_1.hexToBytes)(item.yParity);
const r = (0, util_1.hexToBytes)(item.r);
const s = (0, util_1.hexToBytes)(item.s);
- newAuthorizationList.push([chainId, addressBytes, nonceList, yParity, r, s]);
+ newAuthorizationList.push([chainId, addressBytes, nonce, yParity, r, s]);
}
bufferAuthorizationList = newAuthorizationList;
}
@@ -138,18 +135,14 @@ class AuthorizationLists {
const data = bufferAuthorizationList[i];
const chainId = (0, util_1.bytesToHex)(data[0]);
const address = (0, util_1.bytesToHex)(data[1]);
- const nonces = data[2];
- const nonceList = [];
- for (let j = 0; j < nonces.length; j++) {
- nonceList.push((0, util_1.bytesToHex)(nonces[j]));
- }
+ const nonce = (0, util_1.bytesToHex)(data[2]);
const yParity = (0, util_1.bytesToHex)(data[3]);
const r = (0, util_1.bytesToHex)(data[4]);
const s = (0, util_1.bytesToHex)(data[5]);
const jsonItem = {
chainId,
address,
- nonce: nonceList,
+ nonce,
yParity,
r,
s,
@@ -167,20 +160,14 @@ class AuthorizationLists {
for (let key = 0; key < authorizationList.length; key++) {
const authorizationListItem = authorizationList[key];
const address = authorizationListItem[1];
- const nonceList = authorizationListItem[2];
+ const nonce = authorizationListItem[2];
const yParity = authorizationListItem[3];
const r = authorizationListItem[4];
const s = authorizationListItem[5];
- (0, util_1.validateNoLeadingZeroes)({ yParity, r, s });
+ (0, util_1.validateNoLeadingZeroes)({ yParity, r, s, nonce });
if (address.length !== 20) {
throw new Error('Invalid EIP-7702 transaction: address length should be 20 bytes');
}
- if (nonceList.length > 1) {
- throw new Error('Invalid EIP-7702 transaction: nonce list should consist of at most 1 item');
- }
- else if (nonceList.length === 1) {
- (0, util_1.validateNoLeadingZeroes)({ nonce: nonceList[0] });
- }
}
}
static getDataFeeEIP7702(authorityList, common) {
diff --git a/node_modules/@ethereumjs/tx/dist/esm/util.js b/node_modules/@ethereumjs/tx/dist/esm/util.js
index 36fa7e9..de454fa 100644
--- a/node_modules/@ethereumjs/tx/dist/esm/util.js
+++ b/node_modules/@ethereumjs/tx/dist/esm/util.js
@@ -114,14 +114,11 @@ export class AuthorizationLists {
}
const chainId = hexToBytes(item.chainId);
const addressBytes = hexToBytes(item.address);
- const nonceList = [];
- for (let j = 0; j < item.nonce.length; j++) {
- nonceList.push(hexToBytes(item.nonce[j]));
- }
+ const nonce = hexToBytes(item.nonce);
const yParity = hexToBytes(item.yParity);
const r = hexToBytes(item.r);
const s = hexToBytes(item.s);
- newAuthorizationList.push([chainId, addressBytes, nonceList, yParity, r, s]);
+ newAuthorizationList.push([chainId, addressBytes, nonce, yParity, r, s]);
}
bufferAuthorizationList = newAuthorizationList;
}
@@ -133,18 +130,14 @@ export class AuthorizationLists {
const data = bufferAuthorizationList[i];
const chainId = bytesToHex(data[0]);
const address = bytesToHex(data[1]);
- const nonces = data[2];
- const nonceList = [];
- for (let j = 0; j < nonces.length; j++) {
- nonceList.push(bytesToHex(nonces[j]));
- }
+ const nonce = bytesToHex(data[2]);
const yParity = bytesToHex(data[3]);
const r = bytesToHex(data[4]);
const s = bytesToHex(data[5]);
const jsonItem = {
chainId,
address,
- nonce: nonceList,
+ nonce,
yParity,
r,
s,
@@ -162,20 +155,14 @@ export class AuthorizationLists {
for (let key = 0; key < authorizationList.length; key++) {
const authorizationListItem = authorizationList[key];
const address = authorizationListItem[1];
- const nonceList = authorizationListItem[2];
+ const nonce = authorizationListItem[2];
const yParity = authorizationListItem[3];
const r = authorizationListItem[4];
const s = authorizationListItem[5];
- validateNoLeadingZeroes({ yParity, r, s });
+ validateNoLeadingZeroes({ yParity, r, s, nonce });
if (address.length !== 20) {
throw new Error('Invalid EIP-7702 transaction: address length should be 20 bytes');
}
- if (nonceList.length > 1) {
- throw new Error('Invalid EIP-7702 transaction: nonce list should consist of at most 1 item');
- }
- else if (nonceList.length === 1) {
- validateNoLeadingZeroes({ nonce: nonceList[0] });
- }
}
}
static getDataFeeEIP7702(authorityList, common) {