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
de95647d
Unverified
Commit
de95647d
authored
Aug 17, 2021
by
David Zagi
Committed by
GitHub
Aug 17, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into remixd_terminal
parents
9a44ad0c
e67180f2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
3 deletions
+76
-3
app.js
apps/remix-ide/src/app.js
+2
-1
blockchain.js
apps/remix-ide/src/blockchain/blockchain.js
+31
-1
remixAppManager.js
apps/remix-ide/src/remixAppManager.js
+1
-1
hhconsoleSigs.ts
libs/remix-lib/src/helpers/hhconsoleSigs.ts
+0
-0
web3VmProvider.ts
libs/remix-lib/src/web3Provider/web3VmProvider.ts
+27
-0
transactions.ts
libs/remix-simulator/src/methods/transactions.ts
+6
-0
provider.ts
libs/remix-simulator/src/provider.ts
+9
-0
No files found.
apps/remix-ide/src/app.js
View file @
de95647d
...
...
@@ -310,6 +310,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const
contextualListener
=
new
ContextualListener
({
editor
})
engine
.
register
([
blockchain
,
contentImport
,
themeModule
,
editor
,
...
...
@@ -485,7 +486,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
await
appManager
.
activatePlugin
([
'sidePanel'
])
// activating host plugin separately
await
appManager
.
activatePlugin
([
'home'
])
await
appManager
.
activatePlugin
([
'settings'
])
await
appManager
.
activatePlugin
([
'hiddenPanel'
,
'pluginManager'
,
'filePanel'
,
'contextualListener'
,
'terminal'
,
'fetchAndCompile'
,
'contentImport'
])
await
appManager
.
activatePlugin
([
'hiddenPanel'
,
'pluginManager'
,
'filePanel'
,
'contextualListener'
,
'terminal'
,
'
blockchain'
,
'
fetchAndCompile'
,
'contentImport'
])
// Set workspace after initial activation
if
(
Array
.
isArray
(
workspace
))
{
...
...
apps/remix-ide/src/blockchain/blockchain.js
View file @
de95647d
import
Web3
from
'web3'
import
{
Plugin
}
from
'@remixproject/engine'
import
{
toBuffer
,
addHexPrefix
}
from
'ethereumjs-util'
import
{
waterfall
}
from
'async'
import
{
EventEmitter
}
from
'events'
import
{
format
}
from
'util'
import
{
ExecutionContext
}
from
'./execution-context'
import
VMProvider
from
'./providers/vm.js'
import
InjectedProvider
from
'./providers/injected.js'
...
...
@@ -9,10 +11,20 @@ import NodeProvider from './providers/node.js'
import
{
execution
,
EventManager
,
helpers
}
from
'@remix-project/remix-lib'
const
{
txFormat
,
txExecution
,
typeConversion
,
txListener
:
Txlistener
,
TxRunner
,
TxRunnerWeb3
,
txHelper
}
=
execution
const
{
txResultHelper
:
resultToRemixTx
}
=
helpers
const
packageJson
=
require
(
'../../../../package.json'
)
const
profile
=
{
name
:
'blockchain'
,
displayName
:
'Blockchain'
,
description
:
'Blockchain - Logic'
,
methods
:
[],
version
:
packageJson
.
version
}
class
Blockchain
{
class
Blockchain
extends
Plugin
{
// NOTE: the config object will need to be refactored out in remix-lib
constructor
(
config
)
{
super
(
profile
)
this
.
event
=
new
EventManager
()
this
.
executionContext
=
new
ExecutionContext
()
...
...
@@ -487,6 +499,24 @@ class Blockchain {
let
execResult
let
returnValue
=
null
if
(
isVM
)
{
const
hhlogs
=
await
this
.
web3
().
eth
.
getHHLogsForTx
(
txResult
.
transactionHash
)
if
(
hhlogs
&&
hhlogs
.
length
)
{
let
finalLogs
=
'console.log:
\
n'
for
(
const
log
of
hhlogs
)
{
let
formattedLog
// Hardhat implements the same formatting options that can be found in Node.js' console.log,
// which in turn uses util.format: https://nodejs.org/dist/latest-v12.x/docs/api/util.html#util_util_format_format_args
// For example: console.log("Name: %s, Age: %d", remix, 6) will log 'Name: remix, Age: 6'
// We check first arg to determine if 'util.format' is needed
if
(
typeof
log
[
0
]
===
'string'
&&
(
log
[
0
].
includes
(
'%s'
)
||
log
[
0
].
includes
(
'%d'
)))
{
formattedLog
=
format
(
log
[
0
],
...
log
.
slice
(
1
))
}
else
{
formattedLog
=
log
.
join
(
' '
)
}
finalLogs
=
finalLogs
+
formattedLog
+
'
\
n'
}
this
.
call
(
'terminal'
,
'log'
,
{
type
:
'info'
,
value
:
finalLogs
})
}
execResult
=
await
this
.
web3
().
eth
.
getExecutionResultFromSimulator
(
txResult
.
transactionHash
)
if
(
execResult
)
{
// if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value.
...
...
apps/remix-ide/src/remixAppManager.js
View file @
de95647d
...
...
@@ -8,7 +8,7 @@ const _paq = window._paq = window._paq || []
const
requiredModules
=
[
// services + layout views + system views
'manager'
,
'compilerArtefacts'
,
'compilerMetadata'
,
'contextualListener'
,
'editor'
,
'offsetToLineColumnConverter'
,
'network'
,
'theme'
,
'fileManager'
,
'contentImport'
,
'web3Provider'
,
'scriptRunner'
,
'fetchAndCompile'
,
'mainPanel'
,
'hiddenPanel'
,
'sidePanel'
,
'menuicons'
,
'fileManager'
,
'contentImport'
,
'
blockchain'
,
'
web3Provider'
,
'scriptRunner'
,
'fetchAndCompile'
,
'mainPanel'
,
'hiddenPanel'
,
'sidePanel'
,
'menuicons'
,
'filePanel'
,
'terminal'
,
'settings'
,
'pluginManager'
,
'tabs'
,
'udapp'
,
'dGitProvider'
]
const
dependentModules
=
[
'git'
,
'hardhat'
]
// module which shouldn't be manually activated (e.g git is activated by remixd)
...
...
libs/remix-lib/src/helpers/hhconsoleSigs.ts
0 → 100644
View file @
de95647d
This diff is collapsed.
Click to expand it.
libs/remix-lib/src/web3Provider/web3VmProvider.ts
View file @
de95647d
import
{
hexListFromBNs
,
formatMemory
}
from
'../util'
import
{
normalizeHexAddress
}
from
'../helpers/uiHelper'
import
{
ConsoleLogs
}
from
'../helpers/hhconsoleSigs'
import
{
toChecksumAddress
,
BN
,
bufferToHex
,
Address
}
from
'ethereumjs-util'
import
Web3
from
'web3'
import
{
ethers
}
from
'ethers'
export
class
Web3VmProvider
{
web3
...
...
@@ -9,6 +11,7 @@ export class Web3VmProvider {
vmTraces
txs
txsReceipt
hhLogs
processingHash
processingAddress
processingIndex
...
...
@@ -41,6 +44,7 @@ export class Web3VmProvider {
this
.
vmTraces
=
{}
this
.
txs
=
{}
this
.
txsReceipt
=
{}
this
.
hhLogs
=
{}
this
.
processingHash
=
null
this
.
processingAddress
=
null
this
.
processingIndex
=
null
...
...
@@ -206,6 +210,29 @@ export class Web3VmProvider {
error
:
data
.
error
===
false
?
undefined
:
data
.
error
}
this
.
vmTraces
[
this
.
processingHash
].
structLogs
.
push
(
step
)
// Track hardhat console.log call
if
(
step
.
op
===
'STATICCALL'
&&
step
.
stack
[
step
.
stack
.
length
-
2
]
===
'0x000000000000000000000000000000000000000000636f6e736f6c652e6c6f67'
)
{
const
stackLength
=
step
.
stack
.
length
const
payloadStart
=
parseInt
(
step
.
stack
[
stackLength
-
3
],
16
)
const
memory
=
step
.
memory
.
join
(
''
)
let
payload
=
memory
.
substring
(
payloadStart
*
2
,
memory
.
length
)
const
fnselectorStr
=
payload
.
substring
(
0
,
8
)
const
fnselectorStrInHex
=
'0x'
+
fnselectorStr
const
fnselector
=
parseInt
(
fnselectorStrInHex
)
const
fnArgs
=
ConsoleLogs
[
fnselector
]
const
iface
=
new
ethers
.
utils
.
Interface
([
`function log
${
fnArgs
}
view`
])
const
functionDesc
=
iface
.
getFunction
(
`log
${
fnArgs
}
`
)
const
sigHash
=
iface
.
getSighash
(
`log
${
fnArgs
}
`
)
if
(
fnArgs
.
includes
(
'uint'
)
&&
sigHash
!==
fnselectorStrInHex
)
{
payload
=
payload
.
replace
(
fnselectorStr
,
sigHash
)
}
else
{
payload
=
'0x'
+
payload
}
const
consoleArgs
=
iface
.
decodeFunctionData
(
functionDesc
,
payload
)
this
.
hhLogs
[
this
.
processingHash
]
=
this
.
hhLogs
[
this
.
processingHash
]
?
this
.
hhLogs
[
this
.
processingHash
]
:
[]
this
.
hhLogs
[
this
.
processingHash
].
push
(
consoleArgs
)
}
if
(
step
.
op
===
'CREATE'
||
step
.
op
===
'CALL'
)
{
if
(
step
.
op
===
'CREATE'
)
{
this
.
processingAddress
=
'(Contract Creation - Step '
+
this
.
processingIndex
+
')'
...
...
libs/remix-simulator/src/methods/transactions.ts
View file @
de95647d
...
...
@@ -57,6 +57,7 @@ export class Transactions {
eth_getTransactionByBlockHashAndIndex
:
this
.
eth_getTransactionByBlockHashAndIndex
.
bind
(
this
),
eth_getTransactionByBlockNumberAndIndex
:
this
.
eth_getTransactionByBlockNumberAndIndex
.
bind
(
this
),
eth_getExecutionResultFromSimulator
:
this
.
eth_getExecutionResultFromSimulator
.
bind
(
this
),
eth_getHHLogsForTx
:
this
.
eth_getHHLogsForTx
.
bind
(
this
),
eth_getHashFromTagBySimulator
:
this
.
eth_getHashFromTagBySimulator
.
bind
(
this
)
}
}
...
...
@@ -83,6 +84,11 @@ export class Transactions {
cb
(
null
,
this
.
vmContext
.
exeResults
[
txHash
])
}
eth_getHHLogsForTx
(
payload
,
cb
)
{
const
txHash
=
payload
.
params
[
0
]
cb
(
null
,
this
.
vmContext
.
currentVm
.
web3vm
.
hhLogs
[
txHash
]
?
this
.
vmContext
.
currentVm
.
web3vm
.
hhLogs
[
txHash
]
:
[])
}
eth_getTransactionReceipt
(
payload
,
cb
)
{
this
.
vmContext
.
web3
().
eth
.
getTransactionReceipt
(
payload
.
params
[
0
],
(
error
,
receipt
)
=>
{
if
(
error
)
{
...
...
libs/remix-simulator/src/provider.ts
View file @
de95647d
...
...
@@ -103,6 +103,15 @@ export function extend (web3) {
}))
}
if
(
!
(
web3
.
eth
&&
web3
.
eth
.
getHHLogsForTx
))
{
methods
.
push
(
new
web3
.
extend
.
Method
({
name
:
'getHHLogsForTx'
,
call
:
'eth_getHHLogsForTx'
,
inputFormatter
:
[
null
],
params
:
1
}))
}
if
(
!
(
web3
.
eth
&&
web3
.
eth
.
getHashFromTagBySimulator
))
{
methods
.
push
(
new
web3
.
extend
.
Method
({
name
:
'getHashFromTagBySimulator'
,
...
...
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