You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: reduce the bitcoin adapter maximum response size to 1MB for testnet4 (#3769)
Before, the total response of the `get_successors` rpc in the bitcoin
adapter was 2MB, regardless of the bitcoin network. In the worst case,
this lead to the response containing either :
- ~100 medium 20KB blocks, each with many small transactions, or
- 2 large 1MB blocks, each with really many small transactions
Both of those cases made serialization take really long, and the
`get_successors` request would exceed the [50ms timeout in
consensus](https://github.com/dfinity/ic/blob/b7a0b3d3b896cdaabc06c0ee6cd13cd54c939e67/rs/config/src/bitcoin_payload_builder_config.rs#L12).
After, the maximum response size is reduced to just 1MB for the testnet4
network. This speeds up the serialization, while not sacrificing the
canister performance too much (on average, there will be 2x more
requests to the adapter when the canister starts up, but after it
reaches the tip, it anyway receives maximum 1 block per request).
Note that the Bitcoin mainnet network can't suffer from the same problem
because:
1. Its blocks are quicker to serialize due to the transactions being
larger
2. There are no storm blocks / crazy difficulty variations on it, hence
the adapter will always send 1 block per response (which is anyway
enforced after block height
[750_000](https://github.com/dfinity/ic/blob/b7a0b3d3b896cdaabc06c0ee6cd13cd54c939e67/rs/bitcoin/adapter/src/get_successors_handler.rs#L236)).
0 commit comments