Skip to content

Commit c0afaca

Browse files
committed
feat: add Slither static analysis support and update README with installation instructions
1 parent b79eca6 commit c0afaca

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ else
1919
@echo "'SOURCE={ContractName}' is required, e.g. make abi SOURCE=CrossSimpleModule"
2020
@exit 1
2121
endif
22+
23+
.PHONY: slither
24+
slither:
25+
slither .

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@ interface IContractModule {
3939
To generate encoders and decoders in solidity from proto files, you need to use the code generator [solidity-protobuf](https://github.com/datachainlab/solidity-protobuf).
4040

4141
Currently, [this version](https://github.com/datachainlab/solidity-protobuf/commit/3def6706178e5407497f3d01b8f0ceb17b32108d) is required.
42+
43+
Install Slither and use it for static analysis.
44+
45+
```
46+
pip3 install slither-analyzer
47+
make slither
48+
```

slither.config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"exclude_dependencies": true,
3+
"exclude_informational": true,
4+
"filter_paths": "node_modules|lib|test|script|src/proto"
5+
}

src/Migrations.sol

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/core/IBCKeeper.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {IIBCHandler} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-
55

66
// IBCKeeper keeps the contracts of IBC
77
abstract contract IBCKeeper {
8-
IIBCHandler ibcHandler;
8+
IIBCHandler internal immutable ibcHandler;
99

1010
constructor(IIBCHandler handler_) {
1111
ibcHandler = handler_;

src/core/TxAtomicSimple.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ abstract contract TxAtomicSimple is IBCKeeper, PacketHandler, ContractRegistry {
3636
CrossContext(pdc.tx_id, txIndexParticipant, pdc.tx.signers), pdc.tx.call_info
3737
) returns (bytes memory ret) {
3838
ack.status = PacketAcknowledgementCall.CommitStatus.COMMIT_STATUS_OK;
39+
// slither-disable-next-line reentrancy-events
3940
emit OnContractCall(pdc.tx_id, txIndexParticipant, true, ret);
4041
} catch (bytes memory) {
4142
ack.status = PacketAcknowledgementCall.CommitStatus.COMMIT_STATUS_FAILED;
43+
// slither-disable-next-line reentrancy-events
4244
emit OnContractCall(pdc.tx_id, txIndexParticipant, false, new bytes(0));
4345
}
4446

0 commit comments

Comments
 (0)