Skip to content

Commit fe21f3c

Browse files
authored
Removal of graphviz as it requires CGO (#213)
1 parent e475a9a commit fe21f3c

14 files changed

+175
-163
lines changed

cfg/builder.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ import (
44
"context"
55
"errors"
66

7-
"github.com/goccy/go-graphviz"
87
"github.com/unpackdev/solgo/ir"
98
)
109

1110
// Builder is responsible for constructing the control flow graph (CFG) of Solidity contracts.
1211
// It utilizes the Intermediate Representation (IR) provided by solgo and Graphviz for graph operations.
1312
type Builder struct {
14-
ctx context.Context // Context for the builder operations.
15-
builder *ir.Builder // IR builder from solgo, used for generating the IR of the contracts.
16-
viz *graphviz.Graphviz // Graphviz instance for visualizing the CFG.
17-
graph *Graph // Internal representation of the CFG.
13+
ctx context.Context // Context for the builder operations.
14+
builder *ir.Builder // IR builder from solgo, used for generating the IR of the contracts.
15+
graph *Graph // Internal representation of the CFG.
1816
}
1917

2018
// NewBuilder initializes a new CFG builder with the given context and IR builder.
@@ -27,7 +25,6 @@ func NewBuilder(ctx context.Context, builder *ir.Builder) (*Builder, error) {
2725
return &Builder{
2826
ctx: ctx,
2927
builder: builder,
30-
viz: graphviz.New(),
3128
graph: NewGraph(),
3229
}, nil
3330
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"address":"7fd57c4c7e6939f51984bdba674b753faa22f103","crypto":{"cipher":"aes-128-ctr","ciphertext":"599886ff30cfb90adc17aa3721ecdbb385bd6668295ac811c57722744865e3a4","cipherparams":{"iv":"18cbd176fcb20e8b5e8dff3f9cab8b18"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"6a9e417bb94b0a7e55ee3f3d73ca057fb1b6a2b83a1a8fddbd7ac7aa199fcb93"},"mac":"0f186098c6cb515b81fa39ccc88c5a5c55d9df637227328f3bfbfe9686df4ee4"},"id":"51db1626-f54c-4fee-b310-1727df5a476d","version":3}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"address": "0x30e3dd25fefb75f7a72c3a891ba64f2232d8c69b",
3+
"type": "keystore",
4+
"private_key": "",
5+
"public_key": "",
6+
"account": {
7+
"address": "0x30e3dd25fefb75f7a72c3a891ba64f2232d8c69b",
8+
"url": "keystore:///home/nevio/dev/unpack/solgo-orig/data/faucets/ethereum/UTC--2024-05-07T18-52-44.644622000Z--30e3dd25fefb75f7a72c3a891ba64f2232d8c69b"
9+
},
10+
"password": "c2ltdWxhdG9y",
11+
"network": "ethereum",
12+
"tags": [
13+
"test"
14+
]
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"address": "0xa6cd0a3f561e45dd82456116623d72f44f28c0df",
3+
"type": "keystore",
4+
"private_key": "",
5+
"public_key": "",
6+
"account": {
7+
"address": "0xa6cd0a3f561e45dd82456116623d72f44f28c0df",
8+
"url": "keystore:///home/nevio/dev/unpack/solgo-orig/data/faucets/ethereum/UTC--2024-05-07T18-51-30.345504099Z--a6cd0a3f561e45dd82456116623d72f44f28c0df"
9+
},
10+
"password": "c2ltdWxhdG9y",
11+
"network": "ethereum",
12+
"tags": [
13+
"test"
14+
]
15+
}

data/solc/releases/releases.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

data/tests/contracts/0x7C3a812bBfC759bf85097211253e63f9e5F49439/ItemsMarketplace.solgo.ast.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12018,14 +12018,14 @@
1201812018
},
1201912019
"memberName": "get",
1202012020
"argumentTypes": [],
12021-
"referencedDeclaration": 543,
12021+
"referencedDeclaration": 995,
1202212022
"typeDescription": {
1202312023
"typeIdentifier": "t_contract$_IterableMapping_$1121",
1202412024
"typeString": "contract IterableMapping"
1202512025
},
1202612026
"text": "tokenIdToOrder.get"
1202712027
},
12028-
"referencedDeclaration": 543,
12028+
"referencedDeclaration": 995,
1202912029
"typeDescription": {
1203012030
"typeIdentifier": "t_function_$_t_uint128$",
1203112031
"typeString": "function(uint128)"
@@ -12675,14 +12675,14 @@
1267512675
},
1267612676
"memberName": "get",
1267712677
"argumentTypes": [],
12678-
"referencedDeclaration": 702,
12678+
"referencedDeclaration": 518,
1267912679
"typeDescription": {
1268012680
"typeIdentifier": "t_contract$_IterableMapping_$1121",
1268112681
"typeString": "contract IterableMapping"
1268212682
},
1268312683
"text": "tokenIdToOrder.get"
1268412684
},
12685-
"referencedDeclaration": 702,
12685+
"referencedDeclaration": 518,
1268612686
"typeDescription": {
1268712687
"typeIdentifier": "t_function_$_t_uint128$",
1268812688
"typeString": "function(uint128)"
@@ -15590,14 +15590,14 @@
1559015590
},
1559115591
"memberName": "remove",
1559215592
"argumentTypes": [],
15593-
"referencedDeclaration": 672,
15593+
"referencedDeclaration": 1233,
1559415594
"typeDescription": {
15595-
"typeIdentifier": "t_contract$_IterableMapping_$1121",
15596-
"typeString": "contract IterableMapping"
15595+
"typeIdentifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
15596+
"typeString": "function(struct IterableMapping.Map,uint128)"
1559715597
},
1559815598
"text": "tokenIdToOrder.remove"
1559915599
},
15600-
"referencedDeclaration": 672,
15600+
"referencedDeclaration": 1233,
1560115601
"typeDescription": {
1560215602
"typeIdentifier": "t_function_$_t_uint128$",
1560315603
"typeString": "function(uint128)"
@@ -16188,14 +16188,14 @@
1618816188
},
1618916189
"memberName": "get",
1619016190
"argumentTypes": [],
16191-
"referencedDeclaration": 702,
16191+
"referencedDeclaration": 518,
1619216192
"typeDescription": {
1619316193
"typeIdentifier": "t_contract$_IterableMapping_$1121",
1619416194
"typeString": "contract IterableMapping"
1619516195
},
1619616196
"text": "tokenIdToOrder.get"
1619716197
},
16198-
"referencedDeclaration": 702,
16198+
"referencedDeclaration": 518,
1619916199
"typeDescription": {
1620016200
"typeIdentifier": "t_function_$_t_uint128$",
1620116201
"typeString": "function(uint128)"
@@ -16926,14 +16926,14 @@
1692616926
},
1692716927
"memberName": "set",
1692816928
"argumentTypes": [],
16929-
"referencedDeclaration": 731,
16929+
"referencedDeclaration": 1207,
1693016930
"typeDescription": {
16931-
"typeIdentifier": "t_contract$_IterableMapping_$1121",
16932-
"typeString": "contract IterableMapping"
16931+
"typeIdentifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$_t_struct$_IterableMapping_Order_$1130$",
16932+
"typeString": "function(struct IterableMapping.Map,uint128,struct IterableMapping.Order)"
1693316933
},
1693416934
"text": "tokenIdToOrder.set"
1693516935
},
16936-
"referencedDeclaration": 731,
16936+
"referencedDeclaration": 1207,
1693716937
"typeDescription": {
1693816938
"typeIdentifier": "t_function_$_t_uint128$_t_address$",
1693916939
"typeString": "function(uint128,address)"
@@ -17275,14 +17275,14 @@
1727517275
},
1727617276
"memberName": "get",
1727717277
"argumentTypes": [],
17278-
"referencedDeclaration": 543,
17278+
"referencedDeclaration": 518,
1727917279
"typeDescription": {
1728017280
"typeIdentifier": "t_contract$_IterableMapping_$1121",
1728117281
"typeString": "contract IterableMapping"
1728217282
},
1728317283
"text": "tokenIdToOrder.get"
1728417284
},
17285-
"referencedDeclaration": 543,
17285+
"referencedDeclaration": 518,
1728617286
"typeDescription": {
1728717287
"typeIdentifier": "t_function_$_t_uint128$",
1728817288
"typeString": "function(uint128)"
@@ -17581,8 +17581,8 @@
1758117581
"argumentTypes": [],
1758217582
"referencedDeclaration": 672,
1758317583
"typeDescription": {
17584-
"typeIdentifier": "t_contract$_IterableMapping_$1121",
17585-
"typeString": "contract IterableMapping"
17584+
"typeIdentifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
17585+
"typeString": "function(struct IterableMapping.Map,uint128)"
1758617586
},
1758717587
"text": "tokenIdToOrder.remove"
1758817588
},
@@ -17806,8 +17806,8 @@
1780617806
"argumentTypes": [],
1780717807
"referencedDeclaration": 672,
1780817808
"typeDescription": {
17809-
"typeIdentifier": "t_contract$_IterableMapping_$1121",
17810-
"typeString": "contract IterableMapping"
17809+
"typeIdentifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
17810+
"typeString": "function(struct IterableMapping.Map,uint128)"
1781117811
},
1781217812
"text": "tokenIdToOrder.remove"
1781317813
},
@@ -18092,14 +18092,14 @@
1809218092
},
1809318093
"memberName": "size",
1809418094
"argumentTypes": [],
18095-
"referencedDeclaration": 839,
18095+
"referencedDeclaration": 786,
1809618096
"typeDescription": {
1809718097
"typeIdentifier": "t_contract$_IterableMapping_$1121",
1809818098
"typeString": "contract IterableMapping"
1809918099
},
1810018100
"text": "tokenIdToOrder.size"
1810118101
},
18102-
"referencedDeclaration": 839,
18102+
"referencedDeclaration": 786,
1810318103
"typeDescription": {
1810418104
"typeIdentifier": "t_function_$",
1810518105
"typeString": "function()"
@@ -18979,8 +18979,8 @@
1897918979
"argumentTypes": [],
1898018980
"referencedDeclaration": 672,
1898118981
"typeDescription": {
18982-
"typeIdentifier": "t_contract$_IterableMapping_$1121",
18983-
"typeString": "contract IterableMapping"
18982+
"typeIdentifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
18983+
"typeString": "function(struct IterableMapping.Map,uint128)"
1898418984
},
1898518985
"text": "tokenIdToOrder.remove"
1898618986
},
@@ -19226,14 +19226,14 @@
1922619226
},
1922719227
"memberName": "size",
1922819228
"argumentTypes": [],
19229-
"referencedDeclaration": 786,
19229+
"referencedDeclaration": 839,
1923019230
"typeDescription": {
1923119231
"typeIdentifier": "t_contract$_IterableMapping_$1121",
1923219232
"typeString": "contract IterableMapping"
1923319233
},
1923419234
"text": "tokenIdToOrder.size"
1923519235
},
19236-
"referencedDeclaration": 786,
19236+
"referencedDeclaration": 839,
1923719237
"typeDescription": {
1923819238
"typeIdentifier": "t_function_$",
1923919239
"typeString": "function()"
@@ -19702,14 +19702,14 @@
1970219702
},
1970319703
"memberName": "remove",
1970419704
"argumentTypes": [],
19705-
"referencedDeclaration": 825,
19705+
"referencedDeclaration": 672,
1970619706
"typeDescription": {
19707-
"typeIdentifier": "t_contract$_IterableMapping_$1121",
19708-
"typeString": "contract IterableMapping"
19707+
"typeIdentifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
19708+
"typeString": "function(struct IterableMapping.Map,uint128)"
1970919709
},
1971019710
"text": "tokenIdToOrder.remove"
1971119711
},
19712-
"referencedDeclaration": 825,
19712+
"referencedDeclaration": 672,
1971319713
"typeDescription": {
1971419714
"typeIdentifier": "t_function_$_t_uint128$",
1971519715
"typeString": "function(uint128)"
@@ -20775,14 +20775,14 @@
2077520775
},
2077620776
"memberName": "get",
2077720777
"argumentTypes": [],
20778-
"referencedDeclaration": 543,
20778+
"referencedDeclaration": 518,
2077920779
"typeDescription": {
2078020780
"typeIdentifier": "t_contract$_IterableMapping_$1121",
2078120781
"typeString": "contract IterableMapping"
2078220782
},
2078320783
"text": "tokenIdToOrder.get"
2078420784
},
20785-
"referencedDeclaration": 543,
20785+
"referencedDeclaration": 518,
2078620786
"typeDescription": {
2078720787
"typeIdentifier": "t_function_$_t_uint128$",
2078820788
"typeString": "function(uint128)"
@@ -23393,14 +23393,14 @@
2339323393
},
2339423394
"memberName": "get",
2339523395
"argumentTypes": [],
23396-
"referencedDeclaration": 1155,
23396+
"referencedDeclaration": 518,
2339723397
"typeDescription": {
23398-
"typeIdentifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
23399-
"typeString": "function(struct IterableMapping.Map,uint128)"
23398+
"typeIdentifier": "t_contract$_IterableMapping_$1121",
23399+
"typeString": "contract IterableMapping"
2340023400
},
2340123401
"text": "tokenIdToOrder.get"
2340223402
},
23403-
"referencedDeclaration": 1155,
23403+
"referencedDeclaration": 518,
2340423404
"typeDescription": {
2340523405
"typeIdentifier": "t_function_$_t_uint128$",
2340623406
"typeString": "function(uint128)"

0 commit comments

Comments
 (0)