Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

fix(v0): don't validate gas price in raw tx #615

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/api-server/src/convert-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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";
Expand Down
13 changes: 1 addition & 12 deletions packages/api-server/src/methods/modules/gw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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(
Expand Down
4 changes: 0 additions & 4 deletions packages/api-server/src/methods/modules/poly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down