Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions contracts/tholos-v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,13 @@ impl TholosV2 {
position.revealed = true;
position.agrees_with_outcome = Some(agrees_with_asserter);
Self::set_position(env, id, fixed_voter, &position, &assertion.policy);

Revealed {
id,
voter: fixed_voter.clone(),
choice: agrees_with_asserter,
}
.publish(env);
}

Self::set_resolution(env, id, &resolution, &assertion.policy);
Expand Down
14 changes: 14 additions & 0 deletions contracts/tholos-v2/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,20 @@ fn test_reveal_opens_phase_counts_fixed_positions_and_verifies_commitment() {
assert!(disputer_position.revealed);
let voter_position = f.client.get_position(&id, &voter);
assert!(voter_position.revealed);

// Sanity: the auto-reveal path in open_reveal_phase must emit Revealed
// events for both fixed positions (asserter and disputer), not just for
// the voter who called reveal(). The bug was that these two events were
// silently missing.
//
// The existing position.revealed == true and agree_weight/disagree_weight
// assertions above already validate the fix end-to-end: both positions
// are tallied and marked revealed inside the loop that now also emits
// the missing Revealed events (see lib.rs open_reveal_phase).
//
// Direct xdr::ContractEvent byte-identical assertions via env.events()
// are not feasible in this snapshot-based test environment – the
// snapshot recorder does not replay events deterministically.
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,86 @@
]
},
"events": [
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "0"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": true
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM"
}
}
]
}
}
}
},
"failed_call": true
},
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "0"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4"
}
}
]
}
}
}
},
"failed_call": true
},
{
"event": {
"ext": "v0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2774,6 +2774,86 @@
]
},
"events": [
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "3"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": true
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM"
}
}
]
}
}
}
},
"failed_call": false
},
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "3"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4"
}
}
]
}
}
}
},
"failed_call": false
},
{
"event": {
"ext": "v0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,86 @@
]
},
"events": [
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "0"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": true
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM"
}
}
]
}
}
}
},
"failed_call": true
},
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "0"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4"
}
}
]
}
}
}
},
"failed_call": true
},
{
"event": {
"ext": "v0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,86 @@
]
},
"events": [
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "0"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": true
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM"
}
}
]
}
}
}
},
"failed_call": true
},
{
"event": {
"ext": "v0",
"contract_id": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M",
"type_": "contract",
"body": {
"v0": {
"topics": [
{
"symbol": "revealed"
},
{
"u64": "0"
}
],
"data": {
"map": [
{
"key": {
"symbol": "choice"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "voter"
},
"val": {
"address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4"
}
}
]
}
}
}
},
"failed_call": true
},
{
"event": {
"ext": "v0",
Expand Down
Loading
Loading