From 438cb2cca976119090eb74da4abf95ab4b1571b4 Mon Sep 17 00:00:00 2001 From: retricsu Date: Thu, 16 Feb 2023 14:33:10 +0800 Subject: [PATCH] fix(v0): don't validate gas price in raw tx --- packages/api-server/src/convert-tx.ts | 3 --- packages/api-server/src/methods/modules/gw.ts | 13 +------------ packages/api-server/src/methods/modules/poly.ts | 4 ---- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/packages/api-server/src/convert-tx.ts b/packages/api-server/src/convert-tx.ts index 7d4c1585..74e315ea 100644 --- a/packages/api-server/src/convert-tx.ts +++ b/packages/api-server/src/convert-tx.ts @@ -4,7 +4,6 @@ import { rlp } from "ethereumjs-util"; import keccak256 from "keccak256"; import * as secp256k1 from "secp256k1"; import { logger } from "./base/logger"; -import { verifyGasPrice } from "./methods/validator"; export const EMPTY_ETH_ADDRESS = "0x" + "00".repeat(20); @@ -129,8 +128,6 @@ function encodePolyjuiceTransaction(tx: PolyjuiceTransaction) { async function parseRawTransactionData(rawTx: PolyjuiceTransaction, rpc: RPC) { const { nonce, gasPrice, gasLimit, to: toA, value, data, v, r, s } = rawTx; - verifyGasPrice(gasPrice === "0x" ? "0x0" : gasPrice, 0); - let real_v = "0x00"; if (+v % 2 === 0) { real_v = "0x01"; diff --git a/packages/api-server/src/methods/modules/gw.ts b/packages/api-server/src/methods/modules/gw.ts index f41321b1..a9164cb3 100644 --- a/packages/api-server/src/methods/modules/gw.ts +++ b/packages/api-server/src/methods/modules/gw.ts @@ -6,10 +6,7 @@ import { Store } from "../../cache/store"; import { envConfig } from "../../base/env-config"; import { CACHE_EXPIRED_TIME_MILSECS, GW_RPC_KEY } from "../../cache/constant"; import { logger } from "../../base/logger"; -import { - L2Transaction, - RawL2Transaction, -} from "@godwoken-web3/godwoken/schemas"; +import { L2Transaction } from "@godwoken-web3/godwoken/schemas"; import { Reader } from "@ckb-lumos/toolkit"; import { decodeArgs } from "@polyjuice-provider/base"; @@ -311,14 +308,6 @@ export class Gw { */ async execute_raw_l2transaction(args: any[]) { try { - // validate minimal gas price - const serializedRawL2Tx = args[0]; - const rawL2Tx = new RawL2Transaction(new Reader(serializedRawL2Tx)); - const { gas_price } = decodeArgs( - new Reader(rawL2Tx.getArgs().raw()).serializeJson() - ); - verifyGasPrice(gas_price === "0x" ? "0x0" : gas_price, 0); - args[1] = formatHexNumber(args[1]); const result = await this.readonlyRpc.gw_execute_raw_l2transaction( diff --git a/packages/api-server/src/methods/modules/poly.ts b/packages/api-server/src/methods/modules/poly.ts index b3cd1920..8898dfb6 100644 --- a/packages/api-server/src/methods/modules/poly.ts +++ b/packages/api-server/src/methods/modules/poly.ts @@ -151,10 +151,6 @@ export class Poly { deserializeRawL2TransactionWithAddressMapping(serializeRawL2Tx); const rawL2Tx = txWithAddressMapping.raw_tx; - // validate minimal gas price - const { gas_price } = decodeArgs(rawL2Tx.args); - verifyGasPrice(gas_price === "0x" ? "0x0" : gas_price, 0); - const jsonResult = await this.rpc.executeRawL2Transaction( rawL2Tx, blockNumber