@@ -158,8 +158,9 @@ func TestVTP_PartialSettlement(t *testing.T) {
158158 TaskID : spec .TaskID ,
159159 Verdict : "PARTIAL" ,
160160 Basis : "CONTAMINATION_GAME_THEORY" ,
161- EvidenceSHA256 : "evidence_partial_hash" ,
162- IsDisjointSeat : true ,
161+ EvidenceSHA256 : "evidence_partial_hash" ,
162+ DistinctAccountIDs : true ,
163+ IsDisjointSeat : true ,
163164 }
164165
165166 settle , err := SettleTask (spec , verify , "payer-node" , "worker-node" , 15000 )
@@ -211,3 +212,71 @@ func TestVTP_DeriveDisjointSeat(t *testing.T) {
211212 }
212213}
213214
215+ func TestVTP_SettlementInconsistencyBypass (t * testing.T ) {
216+ spec := & TaskSpec {
217+ Protocol : ProtocolVersion ,
218+ TaskID : "task-vtp-bypass" ,
219+ Bounty : BountySpec {Currency : "GRN" , Amount : 10 },
220+ }
221+
222+ cases := []struct {
223+ name string
224+ distinctAccountIDs bool
225+ isDisjointSeat bool
226+ shouldPass bool
227+ }{
228+ {
229+ name : "switchboard bypass attempt (distinct=false, disjoint=true)" ,
230+ distinctAccountIDs : false ,
231+ isDisjointSeat : true ,
232+ shouldPass : false ,
233+ },
234+ {
235+ name : "both false" ,
236+ distinctAccountIDs : false ,
237+ isDisjointSeat : false ,
238+ shouldPass : false ,
239+ },
240+ {
241+ name : "inconsistent state (distinct=true, disjoint=false)" ,
242+ distinctAccountIDs : true ,
243+ isDisjointSeat : false ,
244+ shouldPass : false ,
245+ },
246+ {
247+ name : "consistent valid state (distinct=true, disjoint=true)" ,
248+ distinctAccountIDs : true ,
249+ isDisjointSeat : true ,
250+ shouldPass : true ,
251+ },
252+ }
253+
254+ for _ , tc := range cases {
255+ t .Run (tc .name , func (t * testing.T ) {
256+ verify := & TaskVerify {
257+ Protocol : ProtocolVersion ,
258+ Type : "VERIFY" ,
259+ TaskID : spec .TaskID ,
260+ Verdict : "PASS" ,
261+ Basis : "FACT_CONSISTENT" ,
262+ DistinctAccountIDs : tc .distinctAccountIDs ,
263+ IsDisjointSeat : tc .isDisjointSeat ,
264+ }
265+ settle , err := SettleTask (spec , verify , "payer-01" , "worker-01" , 20000 )
266+ if tc .shouldPass {
267+ if err != nil {
268+ t .Fatalf ("expected settlement to pass, got: %v" , err )
269+ }
270+ if settle == nil || settle .Amount != 10 {
271+ t .Fatalf ("expected settlement amount 10, got: %v" , settle )
272+ }
273+ } else {
274+ if err == nil {
275+ t .Fatalf ("expected settlement to FAIL, but passed: %v" , settle )
276+ }
277+ }
278+ })
279+ }
280+ }
281+
282+
0 commit comments