diff --git a/package.json b/package.json index fb0e1b98..f07ba535 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "dependencies": { "@0x/contract-addresses": "^8.0.0", "@noble/ed25519": "^1.7.1", - "@railgun-community/shared-models": "^8.0.0", - "@railgun-community/wallet": "^10.8.1", + "@railgun-community/shared-models": "^8.0.1", + "@railgun-community/wallet": "^10.9.0", "@walletconnect/jsonrpc-types": "^1.0.2", "@walletconnect/jsonrpc-utils": "^1.0.4", "axios": "1.7.2", diff --git a/src/server/api/block-native/gas-by-speed-block-native.ts b/src/server/api/block-native/gas-by-speed-block-native.ts index d7c7238b..1ac7f538 100644 --- a/src/server/api/block-native/gas-by-speed-block-native.ts +++ b/src/server/api/block-native/gas-by-speed-block-native.ts @@ -207,6 +207,12 @@ export const getGasDetailsBySpeedBlockNative = async ( }, }; } + case EVMGasType.Type4: { + // EIP-7702 not yet supported by this broadcaster. + throw new Error( + 'EVMGasType 4 (EIP-7702) not yet supported for gas-by-speed lookups.', + ); + } } } catch (err) { dbg(err); diff --git a/src/server/fees/gas-by-speed.ts b/src/server/fees/gas-by-speed.ts index 83bf4327..c544e632 100644 --- a/src/server/fees/gas-by-speed.ts +++ b/src/server/fees/gas-by-speed.ts @@ -164,6 +164,12 @@ export const getGasDetailsForSpeed = async ( ); return gasDetailsBySpeed[percentile]; } + case EVMGasType.Type4: { + // EIP-7702 not yet supported by this broadcaster. + throw new Error( + 'EVMGasType 4 (EIP-7702) not yet supported for gas-by-speed lookups.', + ); + } } }; diff --git a/src/server/fees/gas-estimate.ts b/src/server/fees/gas-estimate.ts index 39c10b08..28f50738 100644 --- a/src/server/fees/gas-estimate.ts +++ b/src/server/fees/gas-estimate.ts @@ -124,6 +124,11 @@ export const getEstimateGasDetailsRelayed = async ( // minGasPrice not allowed on EVMGasType 2 throw new Error('EVMGasType 2 not allowed for Broadcaster transactions.'); } + if (evmGasType === EVMGasType.Type4) { + // EIP-7702 (Type4) transactions use maxFeePerGas/maxPriorityFeePerGas, + // not gasPrice - not yet supported on this relayed estimation path. + throw new Error('EVMGasType 4 (EIP-7702) not yet supported for Broadcaster transactions.'); + } const gasPrice = minGasPrice; const transactionWithOptionalMinGas: ContractTransaction = { ...transaction, diff --git a/src/server/transactions/process-transaction.ts b/src/server/transactions/process-transaction.ts index 874e6597..31761361 100644 --- a/src/server/transactions/process-transaction.ts +++ b/src/server/transactions/process-transaction.ts @@ -58,6 +58,12 @@ export const processTransaction = async ( if (evmGasType === EVMGasType.Type2) { throw new Error('Invalid gas type for Broadcaster transaction.'); } + if (evmGasType === EVMGasType.Type4) { + // EIP-7702 requests are rejected earlier, in transact-method.ts, before + // reaching this point - this is a defensive guard, not expected in + // practice today. + throw new Error('EVMGasType 4 (EIP-7702) not yet supported for Broadcaster transactions.'); + } const transactionRequestForGasEstimate: ContractTransaction = { ...transaction, diff --git a/src/server/waku-broadcaster/methods/transact-method.ts b/src/server/waku-broadcaster/methods/transact-method.ts index 06ea61d3..6c9d135b 100644 --- a/src/server/waku-broadcaster/methods/transact-method.ts +++ b/src/server/waku-broadcaster/methods/transact-method.ts @@ -27,6 +27,7 @@ import configNetworks from '../../config/config-networks'; import { BroadcasterEncryptedMethodParams, BroadcasterRawParamsTransact, + BroadcasterTransactRequestType, TXIDVersion, isDefined, versionCompare, @@ -98,6 +99,17 @@ export const transactMethod = async ( return undefined; } + // EIP-7702 (TX7702) requests are not yet supported by this broadcaster. + // Reject explicitly instead of assuming the old COMMON-only shape - the + // fields below (to/data/minGasPrice/useRelayAdapt/etc.) only exist on the + // COMMON variant. + if (decrypted.transactType !== BroadcasterTransactRequestType.COMMON) { + dbg('Cannot process tx - TX7702 (EIP-7702) requests not yet supported'); + // Do nothing. No error response. + await incrementReliability(incomingChain, ReliabilityMetric.BAD_DATA); + return undefined; + } + const { chainType, chainID, diff --git a/yarn.lock b/yarn.lock index 2802a9c9..2b767d32 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1353,10 +1353,10 @@ resolved "https://registry.yarnpkg.com/@railgun-community/curve25519-scalarmult-wasm/-/curve25519-scalarmult-wasm-0.1.5.tgz#edb5e40a8f1fdb7f7e0de1d04e8badabe41cb2a8" integrity sha512-Cur8uM/IdNW3WzUwdPloDG1CF0rpSBDWq2yGXJMZ7IMeBGdc4Jj0h9tnNMFRZ35ZuCVVbZ3yClmqSa4PsbpdGQ== -"@railgun-community/engine@9.5.1": - version "9.5.1" - resolved "https://registry.yarnpkg.com/@railgun-community/engine/-/engine-9.5.1.tgz#ed761969c133ef85edc15900de7fdad96dbeeb37" - integrity sha512-tLX0WSHABzRC1VB7vhdwSBDFUYCFqRYHD2ek5/GT9+AZaKZJ6fU+UrAJYKxyEaGJ066l3M70fChc0Q6qM21scQ== +"@railgun-community/engine@^9.6.0": + version "9.6.0" + resolved "https://registry.yarnpkg.com/@railgun-community/engine/-/engine-9.6.0.tgz#c2d2f07bd37dce7c95f65ab827131e4c1fdc0683" + integrity sha512-dFMhO8i+hxFIr/u0gtaVKV0C3SRaM6bHccfIzzJ/nAWQOK5gPI/h6cgkw0ICjycDUy8ZSkism19jWsIuIBJVwg== dependencies: "@noble/ciphers" "^0.4.0" "@noble/ed25519" "^1.7.1" @@ -1371,7 +1371,7 @@ chai-as-promised "^7.1.1" encoding-down "^7.1.0" ethereum-cryptography "^2.0.0" - ethers "6.13.1" + ethers "6.14.3" fast-text-encoding "^1.0.6" levelup "^5.1.1" msgpack-lite "^0.1.26" @@ -1388,15 +1388,15 @@ resolved "https://registry.yarnpkg.com/@railgun-community/poseidon-hash-wasm/-/poseidon-hash-wasm-1.0.1.tgz#bfd3b3f915391a59486d8c9d632069f029e152d6" integrity sha512-zDAbMu095ZjMqsKIoyOnuKR4Zofnqqx4eTCtnA6qYglnexX5cadxItvJa3ozhDDTmFkDGAidDssQ7Pzl3wwLDA== -"@railgun-community/shared-models@8.0.0", "@railgun-community/shared-models@^8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@railgun-community/shared-models/-/shared-models-8.0.0.tgz#689d4f6a3a80060e018abeb1b351cc711f97e77c" - integrity sha512-JY2HOobRlZpX9CsfiOfbjA2zmG3qLYA/QUupfz0V3ERUErQIm1ZQBSdMfVDZWhflW/4As+rbsY7vc3rXLGbpvA== +"@railgun-community/shared-models@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@railgun-community/shared-models/-/shared-models-8.0.1.tgz#185a74f9fa60b7da74de7afde583926efc52b180" + integrity sha512-g5Gt3j2O8XAMoJ+SzxvzyuB/KioFXXOs+2T0wxFQS5ebXB52e+HFBZ5UFVlORCbHteaAwLiURRcR2W8hOBUuoA== -"@railgun-community/wallet@^10.8.1": - version "10.8.1" - resolved "https://registry.yarnpkg.com/@railgun-community/wallet/-/wallet-10.8.1.tgz#361c6a11e41b194dcc4878ef8a66848d0d8dfd24" - integrity sha512-UEVydOi6k2nWEXh54gsgTpX5/ncbiV/uqnkV0DQzinXSeGcCLKNEopcogSYT/1mcIjTwHEs+rR6iNc5IwlZdcA== +"@railgun-community/wallet@^10.9.0": + version "10.9.0" + resolved "https://registry.yarnpkg.com/@railgun-community/wallet/-/wallet-10.9.0.tgz#60061855c37cf74a045ba8a718312520ee36475d" + integrity sha512-y2ncKCWkG3rWSYysBzXzPsTQvKMGE2lCFVwCgKjS3JnkZAHiKRYWjWrcMw1mSrFYmNjTO1/loYO4qALGz09cbg== dependencies: "@graphql-mesh/cache-localforage" "^0.7.20" "@graphql-mesh/cross-helpers" "^0.3.4" @@ -1409,8 +1409,8 @@ "@graphql-mesh/types" "^0.91.14" "@graphql-mesh/utils" "^0.43.22" "@noble/ed25519" "^1.7.1" - "@railgun-community/engine" "9.5.1" - "@railgun-community/shared-models" "8.0.0" + "@railgun-community/engine" "^9.6.0" + "@railgun-community/shared-models" "^8.0.1" "@whatwg-node/fetch" "^0.8.4" assert "2.0.0" axios "1.7.2" @@ -1418,7 +1418,7 @@ buffer "^6.0.3" crypto-browserify "3.12.0" ethereum-cryptography "^2.0.0" - ethers "6.13.1" + ethers "6.14.3" events "3.3.0" graphql "^16.6.0" stream-browserify "3.0.0" @@ -1662,6 +1662,13 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== +"@types/node@22.7.5": + version "22.7.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== + dependencies: + undici-types "~6.19.2" + "@types/node@^12.12.6": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" @@ -3748,6 +3755,19 @@ ethers@6.13.1: tslib "2.4.0" ws "8.17.1" +ethers@6.14.3: + version "6.14.3" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.14.3.tgz#7c4443c165ee59b2964e691600fd4586004b2000" + integrity sha512-qq7ft/oCJohoTcsNPFaXSQUm457MA5iWqkf1Mb11ujONdg7jBI6sAOrHaTi3j0CBqIGFSCeR/RMc+qwRRub7IA== + dependencies: + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "22.7.5" + aes-js "4.0.0-beta.5" + tslib "2.7.0" + ws "8.17.1" + ethjs-unit@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" @@ -7593,6 +7613,11 @@ tslib@2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== +tslib@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + tslib@^2.0.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" @@ -7732,6 +7757,11 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + unique-filename@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-3.0.0.tgz#48ba7a5a16849f5080d26c760c86cf5cf05770ea"