Skip to content

Commit 2513e49

Browse files
committed
fix: default mechanism_id to 0 and handle Invalid Transaction 1010
- ChallengeConfig default mechanism_id was 1 but should be 0 (main mechanism). The old code masked this by always using mechanism_configs.keys().next()=0. - Handle 'Invalid Transaction (1010)' same as Priority too low: mark epoch as submitted to prevent infinite retry loops.
1 parent 0399af2 commit 2513e49

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bins/validator-node/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,10 +3929,10 @@ async fn handle_block_event(
39293929
}
39303930
Err(e) => {
39313931
let err_str = format!("{}", e);
3932-
if err_str.contains("Priority is too low") {
3932+
if err_str.contains("Priority is too low") || err_str.contains("1010") {
39333933
warn!(
3934-
"Mechanism {}: transaction already in mempool (Priority too low) - treating as submitted",
3935-
mechanism_id
3934+
"Mechanism {}: transaction rejected ({}) - marking epoch as submitted to avoid retry loop",
3935+
mechanism_id, err_str
39363936
);
39373937
*last_weight_submission_epoch = epoch;
39383938
} else {

crates/core/src/challenge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub struct ChallengeConfig {
118118
impl Default for ChallengeConfig {
119119
fn default() -> Self {
120120
Self {
121-
mechanism_id: 1, // Default to mechanism 1
121+
mechanism_id: 0, // Default to mechanism 0 (main mechanism)
122122
timeout_secs: 300,
123123
max_memory_mb: 512,
124124
max_cpu_secs: 60,
@@ -381,7 +381,7 @@ mod tests {
381381
#[test]
382382
fn test_challenge_config_default() {
383383
let config = ChallengeConfig::default();
384-
assert_eq!(config.mechanism_id, 1);
384+
assert_eq!(config.mechanism_id, 0);
385385
assert_eq!(config.timeout_secs, 300);
386386
assert_eq!(config.max_memory_mb, 512);
387387
assert_eq!(config.max_cpu_secs, 60);

0 commit comments

Comments
 (0)