Merge pull request #1523 from ethereum/variousFixes

Various fixes
pull/1/head
yann300 6 years ago committed by GitHub
commit b53f594ba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      .circleci/config.yml
  2. 2
      ci/browser_tests.sh
  3. 2
      ci/browser_tests_debugger.sh
  4. 4
      src/app/debugger/debugger.js
  5. 2
      src/app/editor/contextView.js
  6. 2
      src/app/editor/contextualListener.js
  7. 4
      src/app/plugin/pluginAPI.js
  8. 2
      src/app/staticanalysis/staticAnalysisView.js
  9. 2
      src/app/tabs/compile-tab.js
  10. 38
      src/app/tabs/run-tab.js
  11. 17
      src/app/tabs/styles/run-tab-styles.js
  12. 13
      src/lib/cmdInterpreterAPI.js
  13. 9
      src/lib/offsetToLineColumnConverter.js
  14. 2
      src/multiParamManager.js

@ -26,10 +26,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-21-{{ checksum "package.json" }} - dep-bundle-22-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-21-{{ checksum "package.json" }} key: dep-bundle-22-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run lint && npm run test && npm run make-mock-compiler && npm run build - run: npm run lint && npm run test && npm run make-mock-compiler && npm run build
@ -46,10 +46,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-16-{{ checksum "package.json" }} - dep-bundle-17-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-16-{{ checksum "package.json" }} key: dep-bundle-17-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run build_debugger - run: npm run build_debugger

@ -19,7 +19,7 @@ else
OS="linux" OS="linux"
FILEFORMAT="tar.gz" FILEFORMAT="tar.gz"
fi fi
SC_VERSION="4.4.11" SC_VERSION="4.5.1"
SAUCECONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-$OS.$FILEFORMAT" SAUCECONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-$OS.$FILEFORMAT"
SAUCECONNECT_USERNAME="chriseth" SAUCECONNECT_USERNAME="chriseth"
SAUCECONNECT_ACCESSKEY="b781828a-9e9c-43d8-89d4-2fbb879595ca" SAUCECONNECT_ACCESSKEY="b781828a-9e9c-43d8-89d4-2fbb879595ca"

@ -10,7 +10,7 @@ else
OS="linux" OS="linux"
FILEFORMAT="tar.gz" FILEFORMAT="tar.gz"
fi fi
SC_VERSION="4.4.11" SC_VERSION="4.5.1"
SAUCECONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-$OS.$FILEFORMAT" SAUCECONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-$OS.$FILEFORMAT"
SAUCECONNECT_USERNAME="yanneth" SAUCECONNECT_USERNAME="yanneth"
SAUCECONNECT_ACCESSKEY="1f5a4560-b02b-41aa-b52b-f033aad30870" SAUCECONNECT_ACCESSKEY="1f5a4560-b02b-41aa-b52b-f033aad30870"

@ -39,7 +39,7 @@ function Debugger (container, sourceHighlighter, localRegistry) {
this.isActive = false this.isActive = false
this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, (sourceLocation) => { this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, (sourceLocation) => {
return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this._deps.compiler.lastCompilationResult.source.sources) return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this._deps.compiler.lastCompilationResult.source.sources, this._deps.compiler.lastCompilationResult.data.sources)
}, (step) => { }, (step) => {
this.debugger_ui.stepManager.jumpTo(step) this.debugger_ui.stepManager.jumpTo(step)
}) })
@ -80,7 +80,7 @@ function Debugger (container, sourceHighlighter, localRegistry) {
if (error) return console.log(error) if (error) return console.log(error)
self.debugger.callTree.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, index, self._deps.compiler.lastCompilationResult.data.contracts, function (error, rawLocation) { self.debugger.callTree.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, index, self._deps.compiler.lastCompilationResult.data.contracts, function (error, rawLocation) {
if (!error && self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) { if (!error && self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) {
var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self._deps.compiler.lastCompilationResult.source.sources) var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self._deps.compiler.lastCompilationResult.source.sources, self._deps.compiler.lastCompilationResult.data.sources)
self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation) self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation)
} else { } else {
self._components.sourceHighlighter.currentSourceLocation(null) self._components.sourceHighlighter.currentSourceLocation(null)

@ -98,7 +98,7 @@ class ContextView {
} }
} }
if (self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) { if (self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) {
var lineColumn = self._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, self._deps.compiler.lastCompilationResult.source.sources) var lineColumn = self._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, self._deps.compiler.lastCompilationResult.source.sources, self._deps.compiler.lastCompilationResult.data.sources)
var filename = self._deps.compiler.getSourceName(position.file) var filename = self._deps.compiler.getSourceName(position.file)
// TODO: refactor with rendererAPI.errorClick // TODO: refactor with rendererAPI.errorClick
if (filename !== self._deps.config.get('currentFile')) { if (filename !== self._deps.config.get('currentFile')) {

@ -114,7 +114,7 @@ class ContextualListener {
_highlightInternal (position, node) { _highlightInternal (position, node) {
var self = this var self = this
if (self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) { if (self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) {
var lineColumn = self._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, self._deps.compiler.lastCompilationResult.source.sources) var lineColumn = self._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, self._deps.compiler.lastCompilationResult.source.sources, self._deps.compiler.lastCompilationResult.data.sources)
var css = 'highlightreference' var css = 'highlightreference'
if (node.children && node.children.length) { if (node.children && node.children.length) {
// If node has children, highlight the entire line. if not, just highlight the current source position of the node. // If node has children, highlight the entire line. if not, just highlight the current source position of the node.

@ -127,6 +127,10 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
highlighter.currentSourceLocation(null) highlighter.currentSourceLocation(null)
highlighter.currentSourceLocationFromfileName(position, filePath, hexColor) highlighter.currentSourceLocationFromfileName(position, filePath, hexColor)
cb() cb()
},
discardHighlight: (mod, cb) => {
highlighter.currentSourceLocation(null)
cb()
} }
} }
} }

@ -97,7 +97,7 @@ staticAnalysisView.prototype.run = function () {
start: parseInt(split[0]), start: parseInt(split[0]),
length: parseInt(split[1]) length: parseInt(split[1])
} }
location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location, file, self.lastCompilationSource.sources) location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location, parseInt(file), self._deps.compiler.lastCompilationResult.source.sources, self._deps.compiler.lastCompilationResult.data.sources)
location = Object.keys(self.lastCompilationResult.contracts)[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':' location = Object.keys(self.lastCompilationResult.contracts)[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':'
} }
warningCount++ warningCount++

@ -615,7 +615,7 @@ const css = csjs`
color: ${styles.rightPanel.modalDialog_text_Secondary}; color: ${styles.rightPanel.modalDialog_text_Secondary};
} }
.icon { .icon {
margin-right: 3%; margin-right: 0.3em;
} }
.spinningIcon { .spinningIcon {
margin-right: .3em; margin-right: .3em;

@ -292,6 +292,7 @@ function contractDropdown (events, self) {
instanceContainer.appendChild(instanceContainerTitle) instanceContainer.appendChild(instanceContainerTitle)
instanceContainer.appendChild(self._view.noInstancesText) instanceContainer.appendChild(self._view.noInstancesText)
var compFails = yo`<i title="Contract compilation failed. Please check the compile tab for more information." class="fa fa-times-circle ${css.errorIcon}" ></i>` var compFails = yo`<i title="Contract compilation failed. Please check the compile tab for more information." class="fa fa-times-circle ${css.errorIcon}" ></i>`
var info = yo`<i class="fa fa-info ${css.infoDeployAction}" aria-hidden="true" title="*.sol files allows deploying and accessing contracts. *.abi files only allows accessing contracts."></i>`
self._deps.compiler.event.register('compilationFinished', function (success, data, source) { self._deps.compiler.event.register('compilationFinished', function (success, data, source) {
getContractNames(success, data) getContractNames(success, data)
if (success) { if (success) {
@ -303,6 +304,25 @@ function contractDropdown (events, self) {
} }
}) })
var deployAction = (value) => {
self._view.createPanel.style.display = value
self._view.orLabel.style.display = value
}
self._deps.fileManager.event.register('currentFileChanged', (currentFile) => {
document.querySelector(`.${css.contractNames}`).classList.remove(css.contractNamesError)
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
contractNames.innerHTML = ''
if (/.(.abi)$/.exec(currentFile)) {
deployAction('none')
compFails.style.display = 'none'
contractNames.appendChild(yo`<option>(abi)</option>`)
selectContractNames.setAttribute('disabled', true)
} else if (/.(.sol)$/.exec(currentFile)) {
deployAction('block')
}
})
var atAddressButtonInput = yo`<input class="${css.input} ataddressinput" placeholder="Load contract from Address" title="atAddress" />` var atAddressButtonInput = yo`<input class="${css.input} ataddressinput" placeholder="Load contract from Address" title="atAddress" />`
var selectContractNames = yo`<select class="${css.contractNames}" disabled></select>` var selectContractNames = yo`<select class="${css.contractNames}" disabled></select>`
@ -317,15 +337,16 @@ function contractDropdown (events, self) {
return null return null
} }
var createPanel = yo`<div class="${css.button}"></div>` self._view.createPanel = yo`<div class="${css.button}"></div>`
self._view.orLabel = yo`<div class="${css.orLabel}">or</div>`
var el = yo` var el = yo`
<div class="${css.container}"> <div class="${css.container}">
<div class="${css.subcontainer}"> <div class="${css.subcontainer}">
${selectContractNames} ${compFails} ${selectContractNames} ${compFails} ${info}
</div> </div>
<div class="${css.buttons}"> <div>
${createPanel} ${self._view.createPanel}
${self._view.orLabel}
<div class="${css.button} ${css.atAddressSect}"> <div class="${css.button} ${css.atAddressSect}">
<div class="${css.atAddress}" onclick=${function () { loadFromAddress() }}>At Address</div> <div class="${css.atAddress}" onclick=${function () { loadFromAddress() }}>At Address</div>
${atAddressButtonInput} ${atAddressButtonInput}
@ -335,17 +356,17 @@ function contractDropdown (events, self) {
` `
function setInputParamsPlaceHolder () { function setInputParamsPlaceHolder () {
createPanel.innerHTML = '' self._view.createPanel.innerHTML = ''
if (self._deps.compiler.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) { if (self._deps.compiler.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) {
var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi) var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi)
var ctrEVMbc = getSelectedContract().contract.object.evm.bytecode.object var ctrEVMbc = getSelectedContract().contract.object.evm.bytecode.object
var createConstructorInstance = new MultiParamManager(0, ctrabi, (valArray, inputsValues) => { var createConstructorInstance = new MultiParamManager(0, ctrabi, (valArray, inputsValues) => {
createInstance(inputsValues) createInstance(inputsValues)
}, txHelper.inputParametersDeclarationToString(ctrabi.inputs), 'Deploy', ctrEVMbc) }, txHelper.inputParametersDeclarationToString(ctrabi.inputs), 'Deploy', ctrEVMbc)
createPanel.appendChild(createConstructorInstance.render()) self._view.createPanel.appendChild(createConstructorInstance.render())
return return
} else { } else {
createPanel.innerHTML = 'No compiled contracts' self._view.createPanel.innerHTML = 'No compiled contracts'
} }
} }
@ -624,7 +645,6 @@ function settings (container, self) {
function newAccount () { function newAccount () {
self._deps.udapp.newAccount('', (error, address) => { self._deps.udapp.newAccount('', (error, address) => {
if (!error) { if (!error) {
container.querySelector('#txorigin').appendChild(yo`<option value=${address}>${address}</option>`)
addTooltip(`account ${address} created`) addTooltip(`account ${address} created`)
} else { } else {
addTooltip('Cannot create an account: ' + error) addTooltip('Cannot create an account: ' + error)

@ -124,7 +124,7 @@ var css = csjs`
.button { .button {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: 2%; margin-top: 13px;
} }
.transaction { .transaction {
${styles.rightPanel.runTab.button_transaction} ${styles.rightPanel.runTab.button_transaction}
@ -140,6 +140,9 @@ var css = csjs`
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-right: 0; border-right: 0;
} }
.atAddressSect {
margin-top: 6px;
}
.atAddressSect input { .atAddressSect input {
border-top-left-radius: 0; border-top-left-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
@ -148,7 +151,8 @@ var css = csjs`
${styles.rightPanel.runTab.button_Create} ${styles.rightPanel.runTab.button_Create}
} }
.input { .input {
${styles.rightPanel.runTab.input_RunTab} ${styles.rightPanel.runTab.input_RunTab};
font-size: 10px;
} }
.noInstancesText { .noInstancesText {
${styles.rightPanel.runTab.box_Instance} ${styles.rightPanel.runTab.box_Instance}
@ -233,7 +237,14 @@ var css = csjs`
justify-content: space-evenly; justify-content: space-evenly;
${styles.rightPanel.runTab.box_Info_RunTab}; ${styles.rightPanel.runTab.box_Info_RunTab};
width: 145px; width: 145px;
} }
.orLabel {
margin-left: 44px;
}
.infoDeployAction {
margin-left: 5px;
font-size: 13px;
}
` `
module.exports = css module.exports = css

@ -28,6 +28,7 @@ class CmdInterpreterAPI {
offsetToLineColumnConverter: self._components.registry.get('offsettolinecolumnconverter').api offsetToLineColumnConverter: self._components.registry.get('offsettolinecolumnconverter').api
} }
self.commandHelp = { self.commandHelp = {
'remix.getFile(path)': 'Returns te content of the file located at the given path',
'remix.debug(hash)': 'Start debugging a transaction.', 'remix.debug(hash)': 'Start debugging a transaction.',
'remix.loadgist(id)': 'Load a gist in the file explorer.', 'remix.loadgist(id)': 'Load a gist in the file explorer.',
'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm, ipfs or raw http', 'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm, ipfs or raw http',
@ -45,7 +46,7 @@ class CmdInterpreterAPI {
self._components.sourceHighlighter.currentSourceLocation(null) self._components.sourceHighlighter.currentSourceLocation(null)
return return
} }
var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self._deps.compiler.lastCompilationResult.source.sources) var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self._deps.compiler.lastCompilationResult.source.sources, self._deps.compiler.lastCompilationResult.data.sources)
self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation) self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation)
} }
debug (hash, cb) { debug (hash, cb) {
@ -106,7 +107,7 @@ class CmdInterpreterAPI {
self.d.goTo = (row) => { self.d.goTo = (row) => {
if (self._deps.editor.current()) { if (self._deps.editor.current()) {
var breakPoint = new remixLib.code.BreakpointManager(self.d, (sourceLocation) => { var breakPoint = new remixLib.code.BreakpointManager(self.d, (sourceLocation) => {
return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, self._deps.compiler.lastCompilationResult.source.sources) return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, self._deps.compiler.lastCompilationResult.source.sources, self._deps.compiler.lastCompilationResult.data.sources)
}) })
breakPoint.event.register('breakpointHit', (sourceLocation, currentStep) => { breakPoint.event.register('breakpointHit', (sourceLocation, currentStep) => {
self.log(null, 'step index ' + currentStep) self.log(null, 'step index ' + currentStep)
@ -163,6 +164,14 @@ class CmdInterpreterAPI {
exeCurrent (cb) { exeCurrent (cb) {
return this.execute(undefined, cb) return this.execute(undefined, cb)
} }
getFile (path, cb) {
var provider = this._deps.fileManager.fileProviderOf(path)
if (provider) {
provider.get(path, cb)
} else {
cb('file not found')
}
}
execute (file, cb) { execute (file, cb) {
const self = this const self = this

@ -10,10 +10,15 @@ function offsetToColumnConverter (compilerEvent) {
}) })
} }
offsetToColumnConverter.prototype.offsetToLineColumn = function (rawLocation, file, sources) { offsetToColumnConverter.prototype.offsetToLineColumn = function (rawLocation, file, sources, asts) {
if (!this.lineBreakPositionsByContent[file]) { if (!this.lineBreakPositionsByContent[file]) {
var filename = Object.keys(sources)[file] for (var filename in asts) {
var source = asts[filename]
if (source.id === file) {
this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[filename].content) this.lineBreakPositionsByContent[file] = this.sourceMappingDecoder.getLinebreakPositions(sources[filename].content)
break
}
}
} }
return this.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, this.lineBreakPositionsByContent[file]) return this.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, this.lineBreakPositionsByContent[file])
} }

@ -122,7 +122,6 @@ class MultiParamManager {
var onClick = (domEl) => { var onClick = (domEl) => {
this.clickCallBack(this.funABI.inputs, this.basicInputField.value) this.clickCallBack(this.funABI.inputs, this.basicInputField.value)
this.emptyInputs()
} }
this.contractActionsContainerSingle = yo`<div class="${css.contractActionsContainerSingle}" > this.contractActionsContainerSingle = yo`<div class="${css.contractActionsContainerSingle}" >
@ -138,7 +137,6 @@ class MultiParamManager {
} else { } else {
this.clickCallBack(this.funABI.inputs, '') this.clickCallBack(this.funABI.inputs, '')
} }
this.emptyInputs()
} }
var button = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}"></button>` var button = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}"></button>`

Loading…
Cancel
Save