Skip to content

Commit c8c05cd

Browse files
rekmarksclaude
andcommitted
fix(ocap-kernel): validate RRef in translateRefKtoE instead of casting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent de7c03a commit c8c05cd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/ocap-kernel/src/store/methods/translators.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import type { VatSyscallObject } from '@agoric/swingset-liveslots';
22
import type { CapData } from '@endo/marshal';
33

4-
import { coerceEndpointMessage, isRemoteId, insistERef } from '../../types.ts';
4+
import {
5+
coerceEndpointMessage,
6+
isRemoteId,
7+
insistERef,
8+
insistRRef,
9+
} from '../../types.ts';
510
import type {
611
KernelMessage,
712
KernelSyscallObject,
@@ -90,7 +95,8 @@ export function getTranslators(ctx: StoreContext) {
9095
// whereas for a VRef the functional composition KtoE(EtoK(ref)) is an
9196
// identity function, for an RRef it is not, because KtoE reverses the
9297
// polarity of the RRef but EtoK doesn't.
93-
eref = invertRRef(eref as RRef);
98+
insistRRef(eref);
99+
eref = invertRRef(eref);
94100
}
95101
return eref;
96102
}

0 commit comments

Comments
 (0)