-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Make Swingset use Nat 4.0.0 #2420
Conversation
See #2425 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly OK, but a couple of issues. (1) If we've updated our toolchain to cope with BigInt literals I'd prefer to use them for the numeric literals. (2) The getAllIds
thing in the counter won't work at scale, as it is not iterating out of secondary storage. (1) is mainly cosmetic, but (2) needs to be fixed before this can land.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one question for my edification.
The changes to TimerService seem fine.
I haven't been able to look deeply at this yet (I'll keep trying), but my two cents so far:
|
6acf1b2
to
6c3c656
Compare
This PR is erroring in cosmic-swingset due to the use of JSON.stringify there. The errors are:
And
Handing over to @warner to fix the cosmic-swingset issues. |
There is another Swingset error when trying to run the Swingset tests in ERTP: TypeError#1: Do not know how to serialize a BigInt
at JSON.stringify (<anonymous>)
at eval (packages/SwingSet/src/kernel/kernel.js:141:42) |
This one is the test logger, which uses |
Assuming that I keep my promise from the meeting this morning, and have a |
Will |
No. Does this test case use a replacer? |
Yes. In this case we're using |
Earlier, did you mean replacer when you said reviver? |
Yes. The code erroneously says reviver when it means replacer and I was unwittingly propagating the mistake. |
Gotcha. That is indeed a good reason not a use a marshal-based stringify. So don't wait for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The cosmic-swingset test failure looks due to the swingset Mailbox device using In the cosmic-swingset (chain) case, it is recorded in the chain's state vector, which is a key-value store whose values are strings (bytes, really). The "peer" is a client which queries the chain for this small portion of its state vector, verifies the inclusion proofs, then unpacks the string into data that can be submitted into another mailbox device. The host application (cosmic-swingset) uses JSON.stringify to do the packing, and the client (our ag-solo chain-follower library, in this case, although we should anticipate others) uses JSON.parse to do the unpacking. In the (future) solo-to-solo comms protocol, this will run over an encrypted TCP socket, so we'll have the same need for a packed single-string representation of the mailbox data, and JSON.stringify would be an eminently reasonable thing to use there. The mailbox data contains:
I don't think we need BigInts for these. Using a plain JSON So I'm inclined to think the solution is to change our |
I'm working on a patch to make those mailbox changes now. |
…nums Host applications call `exportMailbox()`, and are then responsible for conveying that data to a peer application. We can make their lives more convenient by returning something that can be serialized with a plain JSON.stringify. This changes `exportMailbox()` to emit plain Numbers for the sequence numbers, even though we store them internally as BigInts (validated with `Nat`). Likewise we accept Numbers from the host but convert them (with Nat) into BigInts for local processing. refs #2420
That patch appears to fix the cosmic-swingset tests, but I still see non-fatal errors that seem to be coming from CapTP, so I'd like @michaelfig to weigh in on whether they're relevant or not:
We landed #2429 (stop including |
…nums Host applications call `exportMailbox()`, and are then responsible for conveying that data to a peer application. We can make their lives more convenient by returning something that can be serialized with a plain JSON.stringify. This changes `exportMailbox()` to emit plain Numbers for the sequence numbers, even though we store them internally as BigInts (validated with `Nat`). Likewise we accept Numbers from the host but convert them (with Nat) into BigInts for local processing. refs #2420
db2bdc7
to
fecb32c
Compare
Those are totally expected. Non-fatal errors are not test failures in any of our tests, IIUC. |
fecb32c
to
a10c1ec
Compare
@FUDCo said this didn't address the |
In the mailbox device, we use a plain Number, not BigInt, for external mailbox seqnums. Host applications call `exportMailbox()`, and are then responsible for conveying that data to a peer application. We can make their lives more convenient by returning something that can be serialized with a plain JSON.stringify. We make `exportMailbox()` emit plain Numbers for the sequence numbers, even though we store them internally as BigInts (validated with `Nat`). Likewise we accept Numbers from the host but convert them (with Nat) into BigInts for local processing.
a10c1ec
to
ce6fb23
Compare
Chip said it was ready to go except for the testLogger problem, which seems to no longer be a problem
Yuck. If you're gonna do something that violent, replace it with the string of digits. |
This PR changes Swingset to use Nat 4.0.0.
Closes #2400