Expand description
The root-cause matcher: decides which failing tests of different agents prove the same bug.
root_cause_groups is the only entry point, so another matcher can replace this one. A claim
with a @bug <Contract>.<function> <file>:<line> tag names its target, and two tagged claims
agree on the target. Other claims are free text, and the word matcher compares them.
Re-exportsΒ§
StructsΒ§
- BugTag π
- The target of a tagged claim: two tagged claims agree when they name the same function in the same file, at lines that are near.
- Root
Cause π - What two failing tests with free-text claims must share to have one root cause: the file that their claims name, and a function name at near lines or most of the claimsβ words.
ConstantsΒ§
- CLAIM_
OVERLAP π - Two claims agree when at least 3/10 of their combined words are shared, the threshold of the offline analysis.
- LINE_
WINDOW π - Two tagged claims about one function agree only when their lines are at most this far apart. A function rarely spans more lines, so the window keeps apart functions with one name in one file, such as overloads or functions of two contracts, but not two lines of one function.
- STOP_
WORDS π - Words that do not tell two claims apart.
StaticsΒ§
- BUG_TAG π
- A
@bug <Contract>.<function> <file>:<line>tag at the start of a claim, also as the NatSpec tag@custom:bug. The contract and an argument list after the function are optional. - CAMEL_
CASE π - A camelCase identifier.
- FUNCTION_
CALL π - A function name followed by its argument list.
- GENERIC_
CALL π - A call that names no function of the code under test, such as a builtin or a type conversion.
- SOLIDITY_
FILE π - A Solidity file path.
- SOLIDITY_
LOCATION π - A Solidity file path and an optional line.
- WORD π
- A lowercase word.
FunctionsΒ§
- root_
cause_ πgroups - Returns a group number for the claim of each failing test: tests with the same number have one
root cause. Two tagged claims agree by their tags. Otherwise the word matcher compares the
claims, also when only one of them has a tag. Groups use complete linkage: in claim order, a
test joins the first group whose every test agrees with it, else starts a group numbered by its
index. A chain of agreeing pairs, such as a bare
Vault.solbetween twoVault.solfiles or lines that step across the line window, does not link two tests, so it cannot inflate the quorum. A test without a claim, or whose claim names no Solidity file, agrees with no other test. - same_
file π - Returns whether two Solidity paths of claims can name the same file: one is the other or ends
with it. Agents name a file relative to the project, by its file name, or by its path in their
copy of the project, so
Vault.soland/tmp/copy/src/Vault.solagree withsrc/Vault.sol, butsrc/one/Vault.solandsrc/two/Vault.soldo not.