Skip to content

Commit b5a33f5

Browse files
committed
dockerized
1 parent 553a65c commit b5a33f5

File tree

9 files changed

+58
-36
lines changed

9 files changed

+58
-36
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist/*
44
.DS_Store
55
coverage/*
66
.vscode/*
7+
contracts/*

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:8-alpine
2+
3+
RUN apk update && apk upgrade && \
4+
apk add --no-cache bash git python g++ gcc libgcc libstdc++ linux-headers make
5+
6+
RUN npm install --quiet node-gyp -g
7+
8+
WORKDIR /opt/app
9+
10+
COPY package.json ./
11+
12+
RUN npm i -g npm@^6.1.0 && npm install
13+
14+
COPY . .
15+
16+
EXPOSE 9090
17+
18+
CMD [ "npm", "run", "start" ]

README.md

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ There are already tools that allow you to debug Ethereum transactions (Solidity)
2020

2121
Use release link:
2222

23-
* [v3.5.0](https://github.com/fergarrui/ethereum-graph-debugger/releases/tag/v3.5.0)
23+
* [v3.6.0](https://github.com/fergarrui/ethereum-graph-debugger/releases/tag/v3.6.0)
2424

2525
If you want to use master (it can be more unstable), clone and start the application
2626

@@ -39,6 +39,14 @@ npm start
3939

4040
Go to localhost:9090
4141

42+
### With docker
43+
44+
`docker-compose up`
45+
46+
Go to localhost:9090
47+
48+
Add contracts to `./contracts` (you will need to create the directory) and empty string at the 'Load contracts from URI' form.
49+
4250
### Use
4351

4452
* Go to localhost:9090
@@ -53,33 +61,6 @@ Go to localhost:9090
5361
* Scan the directory as described above
5462
* You won't get source code mappings when clicking in operations of the CFG
5563

56-
### [Temporal] - switch solc version
57-
58-
Current `solc` version is `0.5.8`, if you want to use an earlier version, for now it can only be done via API (UI coming soon)
59-
60-
* List supported `solc` versions
61-
* `curl http://localhost:9090/solc/list`
62-
* Output will be like:
63-
```
64-
[
65-
{
66-
"version": "0.5.8",
67-
"commit": "v0.5.8+commit.23d335f2"
68-
},
69-
{
70-
"version": "0.5.7",
71-
"commit": "v0.5.7+commit.6da8b019"
72-
},
73-
{
74-
"version": "0.5.6",
75-
"commit": "v0.5.6+commit.b259423e"
76-
},
77-
(... truncated ...)
78-
```
79-
* Select a commit, for example: `v0.5.6+commit.b259423e`
80-
* Set the version to that commit: `curl -X POST --data '{"version": "v0.5.8+commit.23d335f2"}' http://localhost:9090/solc -H 'Content-Type: application/json'`
81-
* Check what version is loaded: `curl http://localhost:9090/solc`
82-
8364
# Features
8465

8566
* **Now interactive** :star2:: it has a sepparate frontend and API instead of building a static HTML file like in earlier versions

docker-compose.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: '3.4'
2+
3+
services:
4+
debugger:
5+
image: ethereum-graph-debugger
6+
build:
7+
context: ./
8+
environment:
9+
- BLOCKCHAIN_HOST=ganache:8545
10+
ports:
11+
- 9090:9090
12+
volumes:
13+
- ./src:/opt/app/src:delegated
14+
- ./contracts:/opt/app/contracts:delegated
15+
16+
ganache:
17+
image: trufflesuite/ganache-cli:v6.1.6
18+
container_name: ganache
19+
restart: always
20+
command: -l 804247552 -h 0.0.0.0 -d
21+
ports:
22+
- 8545:8545

src/api/blockchain/Web3Instance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export class Web3Instance implements IWeb3 {
88
constructor(config: Web3Configuration) {
99
const isEmpty = Object.values(config).every(x => (!x) || x === '')
1010
if (isEmpty) {
11-
this.web3Instance = new Web3('http://127.0.0.1:8545')
11+
this.web3Instance = new Web3(process.env.BLOCKCHAIN_HOST? `http://${process.env.BLOCKCHAIN_HOST }`:'http://127.0.0.1:8545')
1212
} else {
1313
const protocol = config.blockchainProtocol || 'http'
14-
const url = config.blockchainHost || '127.0.0.1:8545'
14+
const url = config.blockchainHost || process.env.BLOCKCHAIN_HOST || '127.0.0.1:8545'
1515
let blockchainUrl = `${protocol}://`
1616
if (config.blockchainBasicAuthUsername && config.blockchainBasicAuthPassword) {
1717
blockchainUrl += `${config.blockchainBasicAuthUsername}:${config.blockchainBasicAuthPassword}@`

src/api/service/controller/ControlFlowGraphController.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { GFCResponse } from '../response/CFGResponse'
88
import { OperationResponse } from '../response/OperationResponse'
99
import { logger } from '../../../Logger'
1010
import { StringBodyRequest } from '../request/StringBodyRequest';
11-
const fs = require('fs')
1211

1312
@Route('cfg')
1413
@provideSingleton(ControlFlowGraphController)
@@ -33,7 +32,6 @@ export class ControlFlowGraphController extends Controller {
3332
throw new Error('Constructor is true but no constructor found in bytecode')
3433
}
3534
const cfg = this.createCFG(contractBlocks, constructor)
36-
await fs.writeFileSync('cfg', cfg)
3735
return this.buildResponse(contractBlocks, constructor, cfg)
3836
} catch (err) {
3937
logger.error(err)

src/api/service/controller/FileController.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ export class FileController extends Controller {
1616
@Get('{dir}')
1717
async findContractsInDir(@Path() dir: string, @Query('extension') extension: string): Promise<ContractFile[]> {
1818
try {
19-
const contracts = await this.fileService.findContractssWithExtension(dir, extension)
19+
let directory = dir
20+
if (!dir || dir === '' || dir === ' ') {
21+
directory = './contracts'
22+
}
23+
const contracts = await this.fileService.findContractssWithExtension(directory, extension)
2024
if (contracts.length === 0) {
2125
throw new Error(`No contracts found at ${dir} with extension ${extension}`)
2226
}

src/client/components/Main/Main.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ class Main extends React.Component {
203203

204204
handleControlFlowGraphClick(isConstructor) {
205205
const { name, path, code } = this.props;
206-
console.log('isConstructor aaaaaaaaaaaaaaaa')
207-
console.log(isConstructor)
208206
const params = {
209207
name: name.replace('.sol', '').replace('.evm', ''),
210208
path: encodeURIComponent(path),

src/client/components/TopNavBar/TopNavBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class TopNavBar extends React.Component {
9797
</div>
9898
}
9999
<button className={styles['top-navbar__versions-dropdown__toggler']} onClick={() => this.handleVersionsButtonClick()}>
100-
<span>Solc Version</span>
100+
<span>Change solc version</span>
101101
</button>
102102
<Dropdown active={!!versionsVisible}>
103103
{ fetchRequestStatus === 'success' && versions.length &&

0 commit comments

Comments
 (0)