endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
831 stars 72 forks source link

Should encodePassable format "compactOrdered" not use "~" as an encoding prefix? #2600

Open gibson042 opened 1 month ago

gibson042 commented 1 month ago

Describe the bug

As implied at https://github.com/endojs/endo/blob/b3a31b1559118dcfcd3811e9632c3f28fba99a3c/packages/marshal/src/encodePassable.js#L861-L865 and noted explicitly in https://github.com/Agoric/agoric-sdk/issues/2589#issuecomment-2427675183 , agoric-sdk liveslots expects | to be a prefix that sorts after all encoded values. But that assumption would no longer hold if ~-prefixed compactOrdered encodings were stored as-is. Here in endo, we can either assume that agoric-sdk will find a suitable workaround, or switch to a different prefix that does not suffer from this issue. The initial choice of ~ was mostly arbitrary, but did strive to avoid overloading any existing special character. Were we to stick with that goal, we'd be looking at candidates like