diff --git a/gittensor/constants.py b/gittensor/constants.py index b592f5078..3e4159e34 100644 --- a/gittensor/constants.py +++ b/gittensor/constants.py @@ -81,7 +81,7 @@ CONTRIBUTION_SCORE_FOR_FULL_BONUS = 1500 # Boosts -MAX_CODE_DENSITY_MULTIPLIER = 1.5 +MAX_CODE_DENSITY_MULTIPLIER = 1.15 # Label multipliers - applied based on the last label set on the PR (requires triage+ access) LABEL_MULTIPLIERS: dict[str, float] = { diff --git a/gittensor/validator/weights/programming_languages.json b/gittensor/validator/weights/programming_languages.json index b4ed3a9b0..0293b0aaf 100644 --- a/gittensor/validator/weights/programming_languages.json +++ b/gittensor/validator/weights/programming_languages.json @@ -3,25 +3,25 @@ "asciidoc": { "weight": 0.08 }, "asm": { "weight": 1.5, "language": "asm" }, "astro": { "weight": 1.25, "language": "astro" }, - "bash": { "weight": 1.5, "language": "bash" }, + "bash": { "weight": 1.6, "language": "bash" }, "c": { "weight": 2.0, "language": "c" }, "cairo": { "weight": 1.0, "language": "cairo" }, "cc": { "weight": 2.0, "language": "cpp" }, "cfg": { "weight": 0.5 }, - "cjs": { "weight": 1.3, "language": "javascript" }, - "clj": { "weight": 1.75, "language": "clojure" }, - "cljc": { "weight": 1.75, "language": "clojure" }, - "cljs": { "weight": 1.75, "language": "clojure" }, + "cjs": { "weight": 1.15, "language": "javascript" }, + "clj": { "weight": 1.5, "language": "clojure" }, + "cljc": { "weight": 1.5, "language": "clojure" }, + "cljs": { "weight": 1.5, "language": "clojure" }, "cmake": { "weight": 1.5, "language": "cmake" }, "conf": { "weight": 0.5 }, "config": { "weight": 0.5 }, "cpp": { "weight": 2.0, "language": "cpp" }, - "cs": { "weight": 1.75, "language": "csharp" }, + "cs": { "weight": 2.0, "language": "csharp" }, "css": { "weight": 0.95, "language": "css" }, "csv": { "weight": 0.1 }, - "cts": { "weight": 1.5, "language": "typescript" }, + "cts": { "weight": 1.20, "language": "typescript" }, "cu": { "weight": 2.0, "language": "cuda" }, - "cuh": { "weight": 2.0, "language": "cuda" }, + "cuh": { "weight": 1.8, "language": "cuda" }, "cxx": { "weight": 2.0, "language": "cpp" }, "d": { "weight": 1.75, "language": "d" }, "dart": { "weight": 1.0, "language": "dart" }, @@ -35,7 +35,7 @@ "f03": { "weight": 1.75, "language": "fortran" }, "f90": { "weight": 1.75, "language": "fortran" }, "f95": { "weight": 1.75, "language": "fortran" }, - "fish": { "weight": 1.5, "language": "fish" }, + "fish": { "weight": 1.6, "language": "fish" }, "gd": { "weight": 1.5, "language": "gdscript" }, "gitattributes": { "weight": 0.25 }, "gitignore": { "weight": 0.5 }, @@ -46,42 +46,42 @@ "gradle": { "weight": 1.0, "language": "groovy" }, "graphql": { "weight": 1.0 }, "groovy": { "weight": 1.0, "language": "groovy" }, - "h": { "weight": 1.5, "language": "c" }, + "h": { "weight": 1.8, "language": "c" }, "hcl": { "weight": 1.0, "language": "hcl" }, "heex": { "weight": 1.25, "language": "heex" }, - "hh": { "weight": 1.5, "language": "cpp" }, + "hh": { "weight": 1.8, "language": "cpp" }, "hlsl": { "weight": 1.5, "language": "hlsl" }, - "hpp": { "weight": 2.0, "language": "cpp" }, - "hs": { "weight": 2.0, "language": "haskell" }, + "hpp": { "weight": 1.8, "language": "cpp" }, + "hs": { "weight": 1.75, "language": "haskell" }, "htm": { "weight": 0.75, "language": "html" }, "html": { "weight": 0.75, "language": "html" }, - "hxx": { "weight": 1.5, "language": "cpp" }, + "hxx": { "weight": 1.8, "language": "cpp" }, "ini": { "weight": 0.5 }, "ino": { "weight": 1.75, "language": "cpp" }, "ipynb": { "weight": 0.3 }, - "java": { "weight": 1.75, "language": "java" }, + "java": { "weight": 2.0, "language": "java" }, "jl": { "weight": 1.0, "language": "julia" }, - "js": { "weight": 1.05, "language": "javascript" }, + "js": { "weight": 1.15, "language": "javascript" }, "json": { "weight": 0.1 }, "jsonc": { "weight": 0.1 }, - "jsx": { "weight": 1.1, "language": "javascript" }, + "jsx": { "weight": 1.20, "language": "javascript" }, "kt": { "weight": 1.75, "language": "kotlin" }, "kts": { "weight": 1.75, "language": "kotlin" }, "less": { "weight": 0.95, "language": "css" }, - "lhs": { "weight": 2.0, "language": "haskell" }, - "lua": { "weight": 1.75, "language": "lua" }, + "lhs": { "weight": 1.75, "language": "haskell" }, + "lua": { "weight": 1.5, "language": "lua" }, "m": { "weight": 1.25, "language": "objc" }, "makefile": { "weight": 1.0, "language": "make" }, "markdown": { "weight": 0.08 }, "md": { "weight": 0.08 }, "mdx": { "weight": 0.08 }, - "mjs": { "weight": 1.3, "language": "javascript" }, + "mjs": { "weight": 1.15, "language": "javascript" }, "mk": { "weight": 1.0, "language": "make" }, "ml": { "weight": 1.75, "language": "ocaml" }, "mli": { "weight": 1.75, "language": "ocaml" }, "mm": { "weight": 1.75, "language": "objc" }, "move": { "weight": 1.0 }, - "mts": { "weight": 1.05, "language": "typescript" }, + "mts": { "weight": 1.20, "language": "typescript" }, "nim": { "weight": 1.5 }, "nix": { "weight": 1.0, "language": "nix" }, "pas": { "weight": 1.5, "language": "pascal" }, @@ -94,21 +94,21 @@ "prisma": { "weight": 1.25, "language": "prisma" }, "properties": { "weight": 0.5 }, "proto": { "weight": 1.0, "language": "proto" }, - "ps1": { "weight": 1.5, "language": "powershell" }, + "ps1": { "weight": 1.6, "language": "powershell" }, "puml": { "weight": 0.1 }, "purs": { "weight": 1.75, "language": "purescript" }, - "py": { "weight": 1.75, "language": "python" }, + "py": { "weight": 1.5, "language": "python" }, "pyi": { "weight": 1.5, "language": "python" }, "r": { "weight": 1.5, "language": "r" }, - "rb": { "weight": 1.75, "language": "ruby" }, - "rkt": { "weight": 1.75, "language": "racket" }, + "rb": { "weight": 1.5, "language": "ruby" }, + "rkt": { "weight": 1.5, "language": "racket" }, "rs": { "weight": 2.0, "language": "rust" }, "rst": { "weight": 0.1 }, "s": { "weight": 1.25, "language": "asm" }, "scala": { "weight": 1.2, "language": "scala" }, - "scm": { "weight": 1.75, "language": "scheme" }, + "scm": { "weight": 1.5, "language": "scheme" }, "scss": { "weight": 1.0, "language": "scss" }, - "sh": { "weight": 1.75, "language": "bash" }, + "sh": { "weight": 1.6, "language": "bash" }, "sol": { "weight": 1.5, "language": "solidity" }, "sql": { "weight": 1.5, "language": "sql" }, "sv": { "weight": 1.75, "language": "verilog" }, @@ -119,9 +119,9 @@ "text": { "weight": 0.08 }, "tf": { "weight": 1.0, "language": "hcl" }, "toml": { "weight": 0.5 }, - "ts": { "weight": 1.05, "language": "typescript" }, + "ts": { "weight": 1.20, "language": "typescript" }, "tsv": { "weight": 0.1 }, - "tsx": { "weight": 1.1, "language": "tsx" }, + "tsx": { "weight": 1.25, "language": "tsx" }, "txt": { "weight": 0.08 }, "v": { "weight": 1.5, "language": "v" }, "vhd": { "weight": 1.75, "language": "vhdl" }, @@ -133,5 +133,5 @@ "yaml": { "weight": 1.0 }, "yml": { "weight": 1.0 }, "zig": { "weight": 1.0, "language": "zig" }, - "zsh": { "weight": 1.75, "language": "bash" } + "zsh": { "weight": 1.6, "language": "bash" } } diff --git a/gittensor/validator/weights/token_weights.json b/gittensor/validator/weights/token_weights.json index 021685da2..4e21cb81c 100644 --- a/gittensor/validator/weights/token_weights.json +++ b/gittensor/validator/weights/token_weights.json @@ -1,16 +1,16 @@ { "structural_bonus": { "function_definition": 2.0, - "function_declaration": 2.5, + "function_declaration": 2.0, "method_definition": 2.0, "method_declaration": 2.0, "class_definition": 2.5, "class_declaration": 2.5, "interface_declaration": 1.75, "struct_definition": 1.75, - "enum_definition": 1.0, + "enum_definition": 1.5, "trait_definition": 1.5, - "impl_item": 1.0, + "impl_item": 1.75, "if_statement": 0.35, "else_clause": 0.2, @@ -33,7 +33,7 @@ "raise_statement": 0.1, "throw_statement": 0.1, - "with_statement": 0.6, + "with_statement": 0.3, "async_function_definition": 1.5, "await_expression": 0.3, diff --git a/tests/validator/test_base_score.py b/tests/validator/test_base_score.py index d48bcbeff..b00af105b 100644 --- a/tests/validator/test_base_score.py +++ b/tests/validator/test_base_score.py @@ -359,7 +359,7 @@ def test_non_code_contributes_modestly( assert score_big > score_without assert score_big >= score_small # Increases are modest relative to baseline - assert (score_big - score_without) / score_without < 0.10 + assert (score_big - score_without) / score_without < 0.15 def test_source_code_scores_much_higher_than_non_code( @@ -387,7 +387,7 @@ def test_source_code_scores_much_higher_than_non_code( programming_languages, ) - assert score_as_source > (score_as_non_code * 10) + assert score_as_source > (score_as_non_code * 7) def test_non_code_does_not_bypass_threshold( @@ -422,7 +422,7 @@ def test_non_code_does_not_bypass_threshold( score_real = _score(pr_real, [source_change], [source_content], token_config, programming_languages) # Both below SOURCE threshold - much less than a real source PR - assert score_tiny_with_yaml < score_real * 0.10 + assert score_tiny_with_yaml < score_real * 0.15 assert score_tiny < score_tiny_with_yaml