diff --git a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
index bc9ea96580..d5a936bc95 100644
--- a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
+++ b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
@@ -14,6 +14,8 @@ export const initialState = {
display: [],
index: 0,
nextIndex: -1,
+ returnInstructionIndexes: [],
+ outOfGasInstructionIndexes: [],
top: 0,
bottom: 0,
isRequesting: false,
@@ -21,7 +23,7 @@ export const initialState = {
hasError: null
}
-const reducedOpcode = (opCodes) => {
+const reducedOpcode = (opCodes, payload) => {
const length = 100
let bottom = opCodes.index - 10
bottom = bottom < 0 ? 0 : bottom
@@ -29,7 +31,9 @@ const reducedOpcode = (opCodes) => {
return {
index: opCodes.index - bottom,
nextIndex: opCodes.nextIndex - bottom,
- display: opCodes.code.slice(bottom, top)
+ display: opCodes.code.slice(bottom, top),
+ returnInstructionIndexes: payload.returnInstructionIndexes.map((index) => index.instructionIndex - bottom ),
+ outOfGasInstructionIndexes: payload.outOfGasInstructionIndexes.map((index) => index.instructionIndex - bottom )
}
}
@@ -48,7 +52,7 @@ export const reducer = (state = initialState, action: Action) => {
...state.opCodes, index: action.payload.index, nextIndex: action.payload.nextIndex
} : deepEqual(action.payload.code, state.opCodes.code) ? state.opCodes : action.payload
- const reduced = reducedOpcode(opCodes)
+ const reduced = reducedOpcode(opCodes, action.payload)
return {
opCodes,
display: reduced.display,
@@ -56,7 +60,9 @@ export const reducer = (state = initialState, action: Action) => {
nextIndex: reduced.nextIndex,
isRequesting: false,
isSuccessful: true,
- hasError: null
+ hasError: null,
+ returnInstructionIndexes: reduced.returnInstructionIndexes,
+ outOfGasInstructionIndexes: reduced.outOfGasInstructionIndexes
}
}
case 'FETCH_OPCODES_ERROR': {
From 3d2db3b6b53ca4d65ce43a1310e02402e533b70c Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Jun 2021 09:01:55 +0200
Subject: [PATCH 45/51] linting
---
libs/remix-debug/src/code/codeManager.ts | 11 +++++------
libs/remix-debug/src/trace/traceAnalyser.ts | 4 ++--
.../debugger-ui/src/reducers/assembly-items.ts | 4 ++--
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/libs/remix-debug/src/code/codeManager.ts b/libs/remix-debug/src/code/codeManager.ts
index fb04f64945..207f3e0510 100644
--- a/libs/remix-debug/src/code/codeManager.ts
+++ b/libs/remix-debug/src/code/codeManager.ts
@@ -148,8 +148,8 @@ export class CodeManager {
private async retrieveIndexAndTrigger (codeMananger, address, step, code) {
let result
let next
- let returnInstructionIndexes = []
- let outOfGasInstructionIndexes = []
+ const returnInstructionIndexes = []
+ const outOfGasInstructionIndexes = []
try {
result = codeMananger.getInstructionIndex(address, step)
@@ -170,10 +170,9 @@ export class CodeManager {
outOfGasInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
}
}
-
- } catch (error) {
- return console.log(error)
- }
+ } catch (error) {
+ return console.log(error)
+ }
try {
codeMananger.event.trigger('changed', [code, address, result, next, returnInstructionIndexes, outOfGasInstructionIndexes])
} catch (e) {
diff --git a/libs/remix-debug/src/trace/traceAnalyser.ts b/libs/remix-debug/src/trace/traceAnalyser.ts
index ba66f2dbb1..74651b228d 100644
--- a/libs/remix-debug/src/trace/traceAnalyser.ts
+++ b/libs/remix-debug/src/trace/traceAnalyser.ts
@@ -52,14 +52,14 @@ export class TraceAnalyser {
if (traceHelper.isReturnInstruction(step) || traceHelper.isStopInstruction(step) || traceHelper.isRevertInstruction(step)) {
this.traceCache.pushStopIndex(index, this.traceCache.currentCall.call.address)
}
-
+
try {
if (parseInt(step.gas) - parseInt(step.gasCost) <= 0 || step.error === 'OutOfGas') {
this.traceCache.pushOutOfGasIndex(index, this.traceCache.currentCall.call.address)
}
} catch (e) {
console.error(e)
- }
+ }
}
buildCalldata (index, step, tx, newContext) {
diff --git a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
index d5a936bc95..18622bfa68 100644
--- a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
+++ b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts
@@ -32,8 +32,8 @@ const reducedOpcode = (opCodes, payload) => {
index: opCodes.index - bottom,
nextIndex: opCodes.nextIndex - bottom,
display: opCodes.code.slice(bottom, top),
- returnInstructionIndexes: payload.returnInstructionIndexes.map((index) => index.instructionIndex - bottom ),
- outOfGasInstructionIndexes: payload.outOfGasInstructionIndexes.map((index) => index.instructionIndex - bottom )
+ returnInstructionIndexes: payload.returnInstructionIndexes.map((index) => index.instructionIndex - bottom),
+ outOfGasInstructionIndexes: payload.outOfGasInstructionIndexes.map((index) => index.instructionIndex - bottom)
}
}
From e16b071108d0caf1aa3cd94c2dab5693339a582a Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Jun 2021 14:37:50 +0200
Subject: [PATCH 46/51] remove unneeded loop
---
libs/remix-debug/src/code/codeManager.ts | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libs/remix-debug/src/code/codeManager.ts b/libs/remix-debug/src/code/codeManager.ts
index 207f3e0510..390c988eed 100644
--- a/libs/remix-debug/src/code/codeManager.ts
+++ b/libs/remix-debug/src/code/codeManager.ts
@@ -156,18 +156,20 @@ export class CodeManager {
next = codeMananger.getInstructionIndex(address, step + 1)
let values = this.traceManager.getAllStopIndexes()
- values = values.filter((value) => value.address === address)
if (values) {
for (const value of values) {
- returnInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
+ if (value.address === address) {
+ returnInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
+ }
}
}
values = this.traceManager.getAllOutofGasIndexes()
- values = values.filter((value) => value.address === address)
if (values) {
for (const value of values) {
- outOfGasInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
+ if (value.address === address) {
+ outOfGasInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
+ }
}
}
} catch (error) {
From 2720bbdda349e2858d962a85bac1960a4ec5e616 Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Jun 2021 14:38:25 +0200
Subject: [PATCH 47/51] remove console.log
---
libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
index de9c37e1bc..3f1a4c5235 100644
--- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
+++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
@@ -19,7 +19,6 @@ export const AssemblyItems = ({ registerEvent }) => {
}, [])
useEffect(() => {
- console.log('useEffect', assemblyItems.index)
if (absoluteSelectedIndex !== assemblyItems.index) {
clearItems()
indexChanged(assemblyItems.index)
From 8d44d31cb32c5b70bfc33126b3e7309c7a34cc82 Mon Sep 17 00:00:00 2001
From: yann300
Date: Thu, 24 Jun 2021 14:42:14 +0200
Subject: [PATCH 48/51] refactor
---
.../src/lib/vm-debugger/assembly-items.tsx | 41 ++++---------------
1 file changed, 8 insertions(+), 33 deletions(-)
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
index 3f1a4c5235..af6c061e6c 100644
--- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
+++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
@@ -28,19 +28,7 @@ export const AssemblyItems = ({ registerEvent }) => {
}
}, [assemblyItems.opCodes.index])
- const clearItems = () => {
- let currentItem = refs.current[selectedItem] ? refs.current[selectedItem] : null
-
- if (currentItem) {
- currentItem.removeAttribute('selected')
- currentItem.removeAttribute('style')
- if (currentItem.firstChild) {
- currentItem.firstChild.removeAttribute('style')
- }
- }
-
- currentItem = refs.current[nextSelectedItem] ? refs.current[nextSelectedItem] : null
-
+ let clearItem = (currentItem) => {
if (currentItem) {
currentItem.removeAttribute('selected')
currentItem.removeAttribute('style')
@@ -48,33 +36,20 @@ export const AssemblyItems = ({ registerEvent }) => {
currentItem.firstChild.removeAttribute('style')
}
}
+ }
+ const clearItems = () => {
+ clearItem(refs.current[selectedItem] ? refs.current[selectedItem] : null)
+ clearItem(refs.current[nextSelectedItem] ? refs.current[nextSelectedItem] : null)
+
returnInstructionIndexes.map((index) => {
if (index < 0) return
-
- currentItem = refs.current[index] ? refs.current[index] : null
-
- if (currentItem) {
- currentItem.removeAttribute('selected')
- currentItem.removeAttribute('style')
- if (currentItem.firstChild) {
- currentItem.firstChild.removeAttribute('style')
- }
- }
+ clearItem(refs.current[index] ? refs.current[index] : null)
})
outOfGasInstructionIndexes.map((index) => {
if (index < 0) return
-
- currentItem = refs.current[index] ? refs.current[index] : null
-
- if (currentItem) {
- currentItem.removeAttribute('selected')
- currentItem.removeAttribute('style')
- if (currentItem.firstChild) {
- currentItem.firstChild.removeAttribute('style')
- }
- }
+ clearItem(refs.current[index] ? refs.current[index] : null)
})
}
From ef2034a484f94b51bd2f7f31e3b50e963a40c2c0 Mon Sep 17 00:00:00 2001
From: yann300
Date: Tue, 29 Jun 2021 15:07:20 +0200
Subject: [PATCH 49/51] linting
---
libs/remix-debug/src/code/codeManager.ts | 4 ++--
.../debugger-ui/src/lib/vm-debugger/assembly-items.tsx | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libs/remix-debug/src/code/codeManager.ts b/libs/remix-debug/src/code/codeManager.ts
index 390c988eed..f0b38ea3d9 100644
--- a/libs/remix-debug/src/code/codeManager.ts
+++ b/libs/remix-debug/src/code/codeManager.ts
@@ -159,7 +159,7 @@ export class CodeManager {
if (values) {
for (const value of values) {
if (value.address === address) {
- returnInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
+ returnInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
}
}
}
@@ -168,7 +168,7 @@ export class CodeManager {
if (values) {
for (const value of values) {
if (value.address === address) {
- outOfGasInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
+ outOfGasInstructionIndexes.push({ instructionIndex: this.getInstructionIndex(address, value.index), address })
}
}
}
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
index af6c061e6c..8b0ed07d9c 100644
--- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
+++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
@@ -28,7 +28,7 @@ export const AssemblyItems = ({ registerEvent }) => {
}
}, [assemblyItems.opCodes.index])
- let clearItem = (currentItem) => {
+ const clearItem = (currentItem) => {
if (currentItem) {
currentItem.removeAttribute('selected')
currentItem.removeAttribute('style')
@@ -41,7 +41,7 @@ export const AssemblyItems = ({ registerEvent }) => {
const clearItems = () => {
clearItem(refs.current[selectedItem] ? refs.current[selectedItem] : null)
clearItem(refs.current[nextSelectedItem] ? refs.current[nextSelectedItem] : null)
-
+
returnInstructionIndexes.map((index) => {
if (index < 0) return
clearItem(refs.current[index] ? refs.current[index] : null)
From 0354ece63b3e7208eeac7497a9cad5fa2cef0ba7 Mon Sep 17 00:00:00 2001
From: yann300
Date: Wed, 30 Jun 2021 16:52:09 +0200
Subject: [PATCH 50/51] change font style
---
.../debugger-ui/src/lib/vm-debugger/assembly-items.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
index 8b0ed07d9c..1606ce8491 100644
--- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
+++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx
@@ -60,8 +60,8 @@ export const AssemblyItems = ({ registerEvent }) => {
const currentItem = codeView.children[index]
if (currentItem) {
- currentItem.style.setProperty('border-color', 'var(--primary)')
- currentItem.style.setProperty('border-style', 'solid')
+ currentItem.style.setProperty('background-color', 'var(--primary)')
+ currentItem.style.setProperty('color', 'var(--light)')
currentItem.setAttribute('selected', 'selected')
codeView.scrollTop = currentItem.offsetTop - parseInt(codeView.offsetTop)
}
From 3baf06687f06e3b685b2f7558e43454f37f50b80 Mon Sep 17 00:00:00 2001
From: yann300
Date: Wed, 30 Jun 2021 21:38:46 +0200
Subject: [PATCH 51/51] fix e2e
---
apps/remix-ide-e2e/src/tests/pluginManager.spec.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/remix-ide-e2e/src/tests/pluginManager.spec.ts b/apps/remix-ide-e2e/src/tests/pluginManager.spec.ts
index bd2884e4e5..f87bf1269e 100644
--- a/apps/remix-ide-e2e/src/tests/pluginManager.spec.ts
+++ b/apps/remix-ide-e2e/src/tests/pluginManager.spec.ts
@@ -5,7 +5,7 @@ import init from '../helpers/init'
const testData = {
pluginName: 'remixIde',
pluginDisplayName: 'Remix IDE',
- pluginUrl: 'https://zokrates-remix-plugin.netlify.app/'
+ pluginUrl: 'https://zokrates.github.io/zokrates-remix-plugin/'
}
module.exports = {