Skip to content

Commit 46b68c0

Browse files
stiefnStefan Effenberger
andauthored
Blockscout pro api (#96)
* updated config handling * added trace filter method for retrieving txs * updated ci + cache * fmt * forge fmt * added missing cache files * added range limit for trace_filter * updated tests * fixed yarn version * adapted yarn command * added more test caches --------- Co-authored-by: Stefan Effenberger <stefan.effenberger@chainsecurity.com>
1 parent 329c960 commit 46b68c0

File tree

1,117 files changed

+7230
-15958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,117 files changed

+7230
-15958
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MAINNET_RPC=
22
ETHERSCAN_TEST_API_URL=https://api.etherscan.io/api
33
ETHERSCAN_API_KEY=
4-
BLOCKSCOUT_API_URL=https://graphql.bitquery.io
4+
BLOCKSCOUT_TEST_API_URL=
55
BLOCKSCOUT_API_KEY=
66
SIGNER_ADDRESS=
77
SIGNER_SECRET_KEY=

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
with:
5454
node-version: '20'
5555

56+
- name: Enable Corepack
57+
run: corepack enable
58+
5659
- name: Install Foundry
5760
uses: foundry-rs/foundry-toolchain@v1
5861

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ on_chain_bytecode.txt
1010
.env
1111
tests/hardhat/package-lock.json
1212
.dv_config.json
13+
/.claude

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,20 @@ Once you have it installed you can continue to [validate](#validate-dvf).
7272
To successfully create DVFs for on-chain smart contracts, you need access to the following APIs:
7373

7474
1. An RPC archive node for the desired chain ID.
75-
2. (Optional) A [Blockscout](https://blockscout.com/) API key.
75+
2. (Optional) A [Blockscout](https://blockscout.com/) Pro API key.
7676
3. (Optional) An [Etherscan](https://etherscan.io/apis) API key.
7777

7878
**Please note the following restrictions/requirements**:
7979

80-
1. The Blockscout API is required to fetch the transaction hashes of a contract. This API can only be omitted if you fetch transactions based on events.
81-
2. The Etherscan API is optional but can be used instead of Blockscout to fetch the deployment transaction of a contract.
82-
3. Your RPC node **must** support either `debug_traceTransaction` or `trace_transaction`.
83-
4. For faster execution, your RPC node **may** support `debug_traceTransaction` with [opcode logger](https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#struct-opcode-logger) enabled. Otherwise, `dv` will locally re-execute all transactions which might increase execution time.
80+
1. Etherscan and Blockscout API keys are optional for fetching the deployment transaction of a contract automatically.
81+
2. Your RPC node **must** support either `debug_traceTransaction` or `trace_transaction`.
82+
3. For fetching transactions, one of the following conditions must be met:
83+
84+
- Recommended: Your RPC supports the `trace_filter` endpoint.
85+
- Recommended if contract emits events in all state-changing functions: You are fetching transactions based on events (see [Initialization by event topics](#initialization-by-event-topics)).
86+
- Not recommended: You added a valid Blockscout Pro API key to your config (please be aware that Blockscout might not fetch all internal transactions of a contract).
87+
88+
4. For faster execution, your RPC node **may** support `debug_traceTransaction` with [opcode logger](https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#struct-opcode-logger) enabled. Otherwise, `dv` will locally re-execute all transactions which might increase execution time and can cause a crash when not enough memory is available.
8489
5. For faster execution, your RPC node **may** support `debug_storageRangeAt`.
8590

8691
To run `dv`, you can either [build from source](#building-from-source) it or use the pre-configured [Docker](#using-docker) image.
@@ -539,10 +544,10 @@ Please note that Foundry's `forge clone` provides similar functionality but is c
539544

540545
### Initialization by event topics
541546

542-
`dv` gets the transactions a contract has been involved in from third party APIs (namely, Blockscout). There are certain cases, in which this is not preferable:
547+
`dv` gets the transactions a contract has been involved in from the `trace_filter` endpoint of your RPC or third party APIs (namely, Blockscout). This might not work in the following cases:
543548

544-
- You don't trust the Blockscout API of the chain you are trying to validate a contract on (this will be solved with a future update).
545-
- You are working on a chain that does not have a Blockscout API or its Blockscout API does not work as intended.
549+
- The `trace_filter`endpoint is unavailable.
550+
- You don't trust the Blockscout API to deliver all existing transactions or Blockscout is unavailable for a certain chain.
546551
- Retrieving all transactions of a contract is too much and you are not interested in certain transactions (think of, e.g., ERC-20 transfers of the USDT contract).
547552

548553
If the contract you are validating emits events every time a security-relevant storage variable is written, you can use the `--eventtopics` argument if the `init` command to specify that only transactions in which the given events have been emitted are evaluated:
@@ -620,7 +625,6 @@ This section will be updated soon.
620625
- Only projects with `solc` version starting from `0.5.13` are supported due to the lack of generated storage layout in older versions (see [solc release 0.5.13](https://github.com/ethereum/solidity/releases/tag/v0.5.13)).
621626
- The RPC endpoints automatically parsed in `dv generate-config` are not guaranteed to be compatible.
622627
- As detailed [above](#dvf-creation), many public RPCs are not or only partially supported for DVF creation.
623-
- Finding the deployment transaction of a contract currently requires either Blockscout or Etherscan API keys to collect all relevant information.
624628
- Contracts performing `delegatecall` to more than one other contract are currently not supported.
625629
- Multiple contracts with the same name compiled with different compiler versions in one project are not supported.
626630
- Multi-dimensional mappings with static keys (e.g., `mapping[1][2]`) can currently not be decoded.

0 commit comments

Comments
 (0)