Assessment reports>Brevis>Discussion>Code duplication

Code duplication

We observed several instances of duplicated code within and across repositories. For example, various functions were duplicated across the original scopes in the repos zk-bridge and zk-utils. In the scopes ultimately audited, we observed less duplication; however, some duplication is still present. For example, in the sdk repo, common/utils/binary.go only contains a function that exists identically in the zk-hash repo at utils/binary.go, which could be used instead. In zk-hash, the files keccak/keccakf/keccakf_old.go and keccak/keccakf/keccakf.go are mostly duplicate.

We recommend to avoid code duplication and instead refactor code to use a single implementation to prevent mistakes in the future, should the two implementations diverge.

Zellic © 2025Back to top ↑