func DoubleCounter
crossing ActionDoubleCounter reads counter and doubles it. Used to show that if counter were silently corrupted in memory, subsequent crossing calls would act on the wrong value.
DoubleCounter reads counter and doubles it. Used to show that if counter were silently corrupted in memory, subsequent crossing calls would act on the wrong value.
MutateBytes mutates the first byte of bz to 0xff. Used to test whether a foreign realm can write to caller-allocated bytes. Under storage=authority, bz has PkgID=caller; borrow rule #1 here makes m.Realm=crossrealm_d (declaring realm); the write site (bz[0] = ...) should fire readonly because bz.PkgID != m.Realm.ID.
SetCounter: non-crossing. Calling this cross-realm triggers the readonly check because it directly assigns a package var.
SetCounterCrossing: crossing version. This works correctly cross-realm because the caller enters this realm's context.