From 1be27c28b27c7e0b4e0229e9ea372ec213f7fc75 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Wed, 13 Mar 2024 10:35:28 +0200 Subject: [PATCH] inherit version and options from inner transaction when building relayedV2 tx --- src/relayedTransactionV2Builder.spec.ts | 4 +++- src/relayedTransactionV2Builder.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/relayedTransactionV2Builder.spec.ts b/src/relayedTransactionV2Builder.spec.ts index 04e20666..434892a6 100644 --- a/src/relayedTransactionV2Builder.spec.ts +++ b/src/relayedTransactionV2Builder.spec.ts @@ -67,6 +67,7 @@ describe("test relayed v2 transaction builder", function () { gasLimit: 0, chainID: networkConfig.ChainID, data: new TransactionPayload("getContractConfig"), + version: 2, }); await bob.signer.sign(innerTx); @@ -84,9 +85,10 @@ describe("test relayed v2 transaction builder", function () { await alice.signer.sign(relayedTxV2); assert.equal(relayedTxV2.getNonce().valueOf(), 37); + assert.equal(relayedTxV2.getVersion().valueOf(), 2); assert.equal( relayedTxV2.getData().toString(), - "relayedTxV2@000000000000000000010000000000000000000000000000000000000002ffff@0f@676574436f6e7472616374436f6e666967@b6c5262d9837853e2201de357c1cc4c9803988a42d7049d26b7785dd0ac2bd4c6a8804b6fd9cf845fe2c2a622774b1a2dbd0a417c9a0bc3f0563a85bd15e710a"); + "relayedTxV2@000000000000000000010000000000000000000000000000000000000002ffff@0f@676574436f6e7472616374436f6e666967@fc3ed87a51ee659f937c1a1ed11c1ae677e99629fae9cc289461f033e6514d1a8cfad1144ae9c1b70f28554d196bd6ba1604240c1c1dc19c959e96c1c3b62d0c"); }); }); diff --git a/src/relayedTransactionV2Builder.ts b/src/relayedTransactionV2Builder.ts index 2717e775..bd363885 100644 --- a/src/relayedTransactionV2Builder.ts +++ b/src/relayedTransactionV2Builder.ts @@ -98,6 +98,8 @@ export class RelayedTransactionV2Builder { this.innerTransactionGasLimit.valueOf() + this.netConfig.MinGasLimit + this.netConfig.GasPerDataByte * payload.length(), data: payload, chainID: this.netConfig.ChainID, + version: this.innerTransaction.getVersion(), + options: this.innerTransaction.getOptions() }); if (this.relayerNonce) {