From 9e9d45685366e11dcce26b1d783b190be89deb38 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 14 Mar 2024 19:08:21 +0100 Subject: [PATCH] fix tests --- libs/remix-debug/src/code/codeUtils.ts | 2 +- libs/remix-lib/src/helpers/txResultHelper.ts | 7 ++++--- libs/remix-lib/test/txResultHelper.ts | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/remix-debug/src/code/codeUtils.ts b/libs/remix-debug/src/code/codeUtils.ts index ad46aa7afc..9cfb5c75ee 100644 --- a/libs/remix-debug/src/code/codeUtils.ts +++ b/libs/remix-debug/src/code/codeUtils.ts @@ -50,7 +50,7 @@ type Opcode = { */ export function parseCode (raw) { const common = new Common({ chain: 'mainnet', hardfork: 'cancun' }) - const opcodes = null // getOpcodesForHF(common).opcodes + const opcodes = getOpcodesForHF(common).opcodes const code = [] for (let i = 0; i < raw.length; i++) { diff --git a/libs/remix-lib/src/helpers/txResultHelper.ts b/libs/remix-lib/src/helpers/txResultHelper.ts index c406fd2701..d28f370a51 100644 --- a/libs/remix-lib/src/helpers/txResultHelper.ts +++ b/libs/remix-lib/src/helpers/txResultHelper.ts @@ -32,12 +32,13 @@ export function resultToRemixTx (txResult, execResult?) { errorMessage = execResult.exceptionError } + console.log('resultToRemixTx', returnValue) return { transactionHash, status, - gasUsed: convertToPrefixedHex(gasUsed), + gasUsed: bytesToHex(gasUsed), error: errorMessage, - return: convertToPrefixedHex(returnValue), - createdAddress: convertToPrefixedHex(contractAddress) + return: returnValue ? bytesToHex(returnValue) : '0x0', + createdAddress: bytesToHex(contractAddress) } } diff --git a/libs/remix-lib/test/txResultHelper.ts b/libs/remix-lib/test/txResultHelper.ts index cb972b68b7..c2ab1780ca 100644 --- a/libs/remix-lib/test/txResultHelper.ts +++ b/libs/remix-lib/test/txResultHelper.ts @@ -2,16 +2,16 @@ import tape from 'tape' import { BN } from 'bn.js' -import { toBuffer } from '@ethereumjs/util' +import { toBytes } from '@ethereumjs/util' import { resultToRemixTx } from '../src/helpers/txResultHelper' const TRANSACTION_HASH = '0x538ad944d09c2df403f064c1e4556fae877fe3f1b600c567622e330c2bdbbe2e' const CONTRACT_ADDRESS_HEX = '0x692a70d2e424a56d2c6c27aa97d1a86395877b3a' -const CONTRACT_ADDRESS_BUFFER = toBuffer( +const CONTRACT_ADDRESS_BUFFER = toBytes( [105, 42, 112, 210, 228, 36, 165, 109, 44, 108, 39, 170, 151, 209, 168, 99, 149, 135, 123, 58]) const RETURN_VALUE_HEX = '0x0000000000000000000000000000000000000000000000000000000000000001' -const RETURN_VALUE_BUFFER = toBuffer( +const RETURN_VALUE_BUFFER = toBytes( [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) const STATUS_OK = '0x1'