Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
1ca80d12
Commit
1ca80d12
authored
Apr 27, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure contract creation are handled properly (address from the receipt)
parent
10511853
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
compiler-sourceVerifier-fetchAndCompile.js
src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js
+2
-9
debugger-tab.js
src/app/tabs/debugger-tab.js
+5
-1
debuggerUI.js
src/app/tabs/debugger/debuggerUI.js
+8
-3
No files found.
src/app/compiler/compiler-sourceVerifier-fetchAndCompile.js
View file @
1ca80d12
...
@@ -17,7 +17,6 @@ export default class FetchAndCompile extends Plugin {
...
@@ -17,7 +17,6 @@ export default class FetchAndCompile extends Plugin {
constructor
()
{
constructor
()
{
super
(
profile
)
super
(
profile
)
this
.
unresolvedAddresses
=
[]
this
.
unresolvedAddresses
=
[]
this
.
firstResolvedAddress
=
null
this
.
sourceVerifierNetWork
=
[
'Main'
,
'Rinkeby'
,
'Ropsten'
,
'Goerli'
]
this
.
sourceVerifierNetWork
=
[
'Main'
,
'Rinkeby'
,
'Ropsten'
,
'Goerli'
]
}
}
...
@@ -26,15 +25,12 @@ export default class FetchAndCompile extends Plugin {
...
@@ -26,15 +25,12 @@ export default class FetchAndCompile extends Plugin {
* Put the artifacts in the file explorer
* Put the artifacts in the file explorer
* Compile the code using Solidity compiler
* Compile the code using Solidity compiler
* Returns compilation data
* Returns compilation data
* if no contract address are passed, we default to the first resolved address.
*
*
* @param {string} contractAddress - Address of the contrac to resolve
* @param {string} contractAddress - Address of the contrac to resolve
* @param {string} compilersartefacts - Object containing a mapping of compilation results (byContractAddress and __last)
* @param {string} compilersartefacts - Object containing a mapping of compilation results (byContractAddress and __last)
* @return {CompilerAbstract} - compilation data targeting the given @arg contractAddress
* @return {CompilerAbstract} - compilation data targeting the given @arg contractAddress
*/
*/
async
resolve
(
contractAddress
,
targetPath
,
web3
)
{
async
resolve
(
contractAddress
,
targetPath
,
web3
)
{
contractAddress
=
contractAddress
||
this
.
firstResolvedAddress
const
compilersartefacts
=
globalRegistry
.
get
(
'compilersartefacts'
).
api
const
compilersartefacts
=
globalRegistry
.
get
(
'compilersartefacts'
).
api
const
localCompilation
=
()
=>
compilersartefacts
.
get
(
'__last'
)
?
compilersartefacts
.
get
(
'__last'
)
:
null
const
localCompilation
=
()
=>
compilersartefacts
.
get
(
'__last'
)
?
compilersartefacts
.
get
(
'__last'
)
:
null
...
@@ -42,9 +38,8 @@ export default class FetchAndCompile extends Plugin {
...
@@ -42,9 +38,8 @@ export default class FetchAndCompile extends Plugin {
const
resolved
=
compilersartefacts
.
get
(
contractAddress
)
const
resolved
=
compilersartefacts
.
get
(
contractAddress
)
if
(
resolved
)
return
resolved
if
(
resolved
)
return
resolved
if
(
this
.
unresolvedAddresses
.
includes
(
contractAddress
))
return
localCompilation
()
if
(
this
.
unresolvedAddresses
.
includes
(
contractAddress
))
return
localCompilation
()
if
(
this
.
firstResolvedAddress
)
return
compilersartefacts
.
get
(
this
.
firstResolvedAddress
)
// ^ for the moment we don't add compilation result for each adddress, but just for the root addres ^ . We can add this later.
// sometimes when doing an internal call, the only available artifact is the Solidity interface.
// usecase is: sometimes when doing an internal call, the only available artifact is the Solidity interface.
// resolving addresses of internal call would allow to step over the source code, even if the declaration was made using an Interface.
// resolving addresses of internal call would allow to step over the source code, even if the declaration was made using an Interface.
let
network
let
network
...
@@ -67,7 +62,6 @@ export default class FetchAndCompile extends Plugin {
...
@@ -67,7 +62,6 @@ export default class FetchAndCompile extends Plugin {
})
})
if
(
found
)
{
if
(
found
)
{
compilersartefacts
.
addResolvedContract
(
contractAddress
,
compilation
)
compilersartefacts
.
addResolvedContract
(
contractAddress
,
compilation
)
this
.
firstResolvedAddress
=
contractAddress
setTimeout
(
_
=>
this
.
emit
(
'usingLocalCompilation'
,
contractAddress
),
0
)
setTimeout
(
_
=>
this
.
emit
(
'usingLocalCompilation'
,
contractAddress
),
0
)
return
compilation
return
compilation
}
}
...
@@ -119,7 +113,6 @@ export default class FetchAndCompile extends Plugin {
...
@@ -119,7 +113,6 @@ export default class FetchAndCompile extends Plugin {
setTimeout
(
_
=>
this
.
emit
(
'compiling'
,
settings
),
0
)
setTimeout
(
_
=>
this
.
emit
(
'compiling'
,
settings
),
0
)
const
compData
=
await
compile
(
compilationTargets
,
settings
)
const
compData
=
await
compile
(
compilationTargets
,
settings
)
compilersartefacts
.
addResolvedContract
(
contractAddress
,
compData
)
compilersartefacts
.
addResolvedContract
(
contractAddress
,
compData
)
this
.
firstResolvedAddress
=
contractAddress
return
compData
return
compData
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
unresolvedAddresses
.
push
(
contractAddress
)
this
.
unresolvedAddresses
.
push
(
contractAddress
)
...
...
src/app/tabs/debugger-tab.js
View file @
1ca80d12
const
yo
=
require
(
'yo-yo'
)
const
yo
=
require
(
'yo-yo'
)
const
remixLib
=
require
(
'remix-lib'
)
const
css
=
require
(
'./styles/debugger-tab-styles'
)
const
css
=
require
(
'./styles/debugger-tab-styles'
)
import
toaster
from
'../ui/tooltip'
import
toaster
from
'../ui/tooltip'
const
DebuggerUI
=
require
(
'./debugger/debuggerUI'
)
const
DebuggerUI
=
require
(
'./debugger/debuggerUI'
)
...
@@ -57,7 +58,10 @@ class DebuggerTab extends ViewPlugin {
...
@@ -57,7 +58,10 @@ class DebuggerTab extends ViewPlugin {
this
.
debuggerUI
=
new
DebuggerUI
(
this
.
debuggerUI
=
new
DebuggerUI
(
this
.
el
.
querySelector
(
'#debugger'
),
this
.
el
.
querySelector
(
'#debugger'
),
this
.
blockchain
,
this
.
blockchain
,
adddress
=>
this
.
call
(
'fetchAndCompile'
,
'resolve'
,
adddress
,
'.debug'
,
this
.
blockchain
.
web3
()))
(
address
,
receipt
)
=>
{
const
target
=
(
address
&&
remixLib
.
helpers
.
trace
.
isContractCreation
(
address
))
?
receipt
.
contractAddress
:
address
return
this
.
call
(
'fetchAndCompile'
,
'resolve'
,
target
||
receipt
.
contractAddress
||
receipt
.
to
,
'.debug'
,
this
.
blockchain
.
web3
())
})
this
.
call
(
'manager'
,
'activatePlugin'
,
'source-verification'
)
this
.
call
(
'manager'
,
'activatePlugin'
,
'source-verification'
)
// this.call('manager', 'activatePlugin', 'udapp')
// this.call('manager', 'activatePlugin', 'udapp')
...
...
src/app/tabs/debugger/debuggerUI.js
View file @
1ca80d12
...
@@ -44,6 +44,7 @@ class DebuggerUI {
...
@@ -44,6 +44,7 @@ class DebuggerUI {
this
.
stepManager
=
null
this
.
stepManager
=
null
this
.
statusMessage
=
''
this
.
statusMessage
=
''
this
.
currentReceipt
this
.
view
this
.
view
...
@@ -79,7 +80,9 @@ class DebuggerUI {
...
@@ -79,7 +80,9 @@ class DebuggerUI {
})
})
this
.
debugger
.
event
.
register
(
'newSourceLocation'
,
async
function
(
lineColumnPos
,
rawLocation
)
{
this
.
debugger
.
event
.
register
(
'newSourceLocation'
,
async
function
(
lineColumnPos
,
rawLocation
)
{
const
contracts
=
await
self
.
fetchContractAndCompile
()
const
contracts
=
await
self
.
fetchContractAndCompile
(
self
.
currentReceipt
.
contractAddress
||
self
.
currentReceipt
.
to
,
self
.
currentReceipt
)
if
(
contracts
)
{
if
(
contracts
)
{
const
path
=
contracts
.
getSourceName
(
rawLocation
.
file
)
const
path
=
contracts
.
getSourceName
(
rawLocation
.
file
)
if
(
path
)
self
.
sourceHighlighter
.
currentSourceLocationFromfileName
(
lineColumnPos
,
path
)
if
(
path
)
self
.
sourceHighlighter
.
currentSourceLocationFromfileName
(
lineColumnPos
,
path
)
...
@@ -128,12 +131,13 @@ class DebuggerUI {
...
@@ -128,12 +131,13 @@ class DebuggerUI {
if
(
this
.
debugger
)
this
.
unLoad
()
if
(
this
.
debugger
)
this
.
unLoad
()
let
web3
=
await
this
.
getDebugWeb3
()
let
web3
=
await
this
.
getDebugWeb3
()
this
.
currentReceipt
=
await
web3
.
eth
.
getTransactionReceipt
(
txNumber
)
this
.
debugger
=
new
Debugger
({
this
.
debugger
=
new
Debugger
({
web3
,
web3
,
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
,
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
,
compilationResult
:
async
(
address
)
=>
{
compilationResult
:
async
(
address
)
=>
{
try
{
try
{
return
await
this
.
fetchContractAndCompile
(
address
)
return
await
this
.
fetchContractAndCompile
(
address
,
this
.
currentReceipt
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
)
console
.
error
(
e
)
}
}
...
@@ -157,12 +161,13 @@ class DebuggerUI {
...
@@ -157,12 +161,13 @@ class DebuggerUI {
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
web3
=
await
this
.
getDebugWeb3
()
const
web3
=
await
this
.
getDebugWeb3
()
this
.
currentReceipt
=
await
web3
.
eth
.
getTransactionReceipt
(
hash
)
const
debug
=
new
Debugger
({
const
debug
=
new
Debugger
({
web3
,
web3
,
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
,
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
,
compilationResult
:
async
(
address
)
=>
{
compilationResult
:
async
(
address
)
=>
{
try
{
try
{
return
await
this
.
fetchContractAndCompile
(
address
)
return
await
this
.
fetchContractAndCompile
(
address
,
this
.
currentReceipt
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
)
console
.
error
(
e
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment