Skip to content

Commit

Permalink
Mix fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
0x19 committed Apr 20, 2024
1 parent fde1734 commit 30d8b7a
Show file tree
Hide file tree
Showing 25 changed files with 369 additions and 170 deletions.
9 changes: 9 additions & 0 deletions bytecode/constructor_test.go

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions bytecode/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,27 @@ func (m *Metadata) GetUrls() []string {
return urls
}

// IsPartial checks whenever decoded bytecode data is partial (some fields are missing, not known)
func (m *Metadata) IsPartial() bool {
if m.cborLength == 0 {
return true
}

if len(m.auxbytes) == 0 {
return true
}

if len(m.Solc) == 0 {
return true
}

if len(m.Ipfs) == 0 && len(m.Bzzr0) == 0 && len(m.Bzzr1) == 0 {
return true
}

return false
}

// DecodeContractMetadata decodes the metadata from Ethereum contract creation bytecode.
// It returns a Metadata object and an error, if any occurred during decoding.
func DecodeContractMetadata(bytecode []byte) (*Metadata, error) {
Expand Down
1 change: 0 additions & 1 deletion contracts/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func (c *Contract) DiscoverMetadata(ctx context.Context) (*bytecode.Metadata, er
return nil, fmt.Errorf("failed to decode contract %s metadata: %s", c.GetAddress(), err)
}
c.descriptor.Metadata = bMetadata

return bMetadata, nil
}
}
1 change: 1 addition & 0 deletions contracts/test

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"address": "0x5f060ba7658176299a53739f0d3a9a5befe3b514",
"type": "keystore",
"private_key": "",
"public_key": "",
"account": {
"address": "0x5f060ba7658176299a53739f0d3a9a5befe3b514",
"url": "keystore:///home/nevio/dev/unpack/solgo-orig/data/faucets/ethereum/UTC--2024-04-20T07-24-54.551601436Z--5f060ba7658176299a53739f0d3a9a5befe3b514"
},
"password": "c2ltdWxhdG9y",
"network": "ethereum",
"tags": [
"test"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"address": "0xdef19352bc69ce8553196fb75df199729079a635",
"type": "keystore",
"private_key": "",
"public_key": "",
"account": {
"address": "0xdef19352bc69ce8553196fb75df199729079a635",
"url": "keystore:///home/nevio/dev/unpack/solgo-orig/data/faucets/ethereum/UTC--2024-04-15T07-30-49.417826720Z--def19352bc69ce8553196fb75df199729079a635"
},
"password": "c2ltdWxhdG9y",
"network": "ethereum",
"tags": [
"test"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"address":"def19352bc69ce8553196fb75df199729079a635","crypto":{"cipher":"aes-128-ctr","ciphertext":"583343f8386762b44313f9580199b5400e3708a7cd7667fd1a863f757192e93d","cipherparams":{"iv":"d02104a664245a7b9789ff0ac7a6ee2b"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"c059f05b6db8bfec7919d2fae01371effbf033fe0142b1379c1ef73882a259e6"},"mac":"68acfe2d44e5048083ee5d819ed5c4a3c0e826a27d12ab3a52d180d4e31ef837"},"id":"93a87a7b-b892-4147-9eb9-cc0caed77c8e","version":3}
2 changes: 1 addition & 1 deletion data/solc/releases/releases.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/tests/audits/ERC20.slither.raw.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/tests/audits/Lottery.slither.raw.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/tests/audits/SimpleStorage.slither.raw.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/tests/audits/TokenSale.slither.raw.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/tests/audits/VulnerableBank.slither.raw.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15590,14 +15590,14 @@
},
"member_name": "remove",
"argument_types": [],
"referenced_declaration": 672,
"referenced_declaration": 759,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
},
"text": "tokenIdToOrder.remove"
},
"referenced_declaration": 672,
"referenced_declaration": 759,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
Expand Down Expand Up @@ -16926,17 +16926,17 @@
},
"member_name": "set",
"argument_types": [],
"referenced_declaration": 1207,
"referenced_declaration": 731,
"type_description": {
"type_identifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$_t_struct$_IterableMapping_Order_$1130$",
"type_string": "function(struct IterableMapping.Map,uint128,struct IterableMapping.Order)"
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
},
"text": "tokenIdToOrder.set"
},
"referenced_declaration": 1207,
"referenced_declaration": 731,
"type_description": {
"type_identifier": "t_function_$_t_uint128$_t_address$",
"type_string": "function(uint128,address)"
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
}
}
]
Expand Down Expand Up @@ -17804,14 +17804,14 @@
},
"member_name": "remove",
"argument_types": [],
"referenced_declaration": 759,
"referenced_declaration": 672,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
},
"text": "tokenIdToOrder.remove"
},
"referenced_declaration": 759,
"referenced_declaration": 672,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
Expand Down Expand Up @@ -18977,14 +18977,14 @@
},
"member_name": "remove",
"argument_types": [],
"referenced_declaration": 759,
"referenced_declaration": 772,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
},
"text": "tokenIdToOrder.remove"
},
"referenced_declaration": 759,
"referenced_declaration": 772,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
Expand Down Expand Up @@ -19702,14 +19702,14 @@
},
"member_name": "remove",
"argument_types": [],
"referenced_declaration": 759,
"referenced_declaration": 772,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
},
"text": "tokenIdToOrder.remove"
},
"referenced_declaration": 759,
"referenced_declaration": 772,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
Expand Down Expand Up @@ -20775,17 +20775,17 @@
},
"member_name": "get",
"argument_types": [],
"referenced_declaration": 518,
"referenced_declaration": 1155,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
"type_identifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
"type_string": "function(struct IterableMapping.Map,uint128)"
},
"text": "tokenIdToOrder.get"
},
"referenced_declaration": 518,
"referenced_declaration": 1155,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
"type_identifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
"type_string": "function(struct IterableMapping.Map,uint128)"
}
}
},
Expand Down Expand Up @@ -21581,14 +21581,14 @@
},
"member_name": "size",
"argument_types": [],
"referenced_declaration": 786,
"referenced_declaration": 957,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
},
"text": "tokenIdToOrder.size"
},
"referenced_declaration": 786,
"referenced_declaration": 957,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
Expand Down Expand Up @@ -23393,17 +23393,17 @@
},
"member_name": "get",
"argument_types": [],
"referenced_declaration": 518,
"referenced_declaration": 913,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
"type_identifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
"type_string": "function(struct IterableMapping.Map,uint128)"
},
"text": "tokenIdToOrder.get"
},
"referenced_declaration": 518,
"referenced_declaration": 913,
"type_description": {
"type_identifier": "t_contract$_IterableMapping_$1121",
"type_string": "contract IterableMapping"
"type_identifier": "t_function_$_t_struct$_IterableMapping_Map_$1144$_t_uint128$",
"type_string": "function(struct IterableMapping.Map,uint128)"
}
}
},
Expand Down
Loading

0 comments on commit 30d8b7a

Please sign in to comment.