Skip to content
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

Incorrect msgpack decoding on global state delta values #724

Open
barnjamin opened this issue Dec 27, 2022 · 1 comment
Open

Incorrect msgpack decoding on global state delta values #724

barnjamin opened this issue Dec 27, 2022 · 1 comment
Labels
bug Something isn't working Team Lamprey

Comments

@barnjamin
Copy link
Contributor

barnjamin commented Dec 27, 2022

Subject of the issue

When requesting a Block from algod and decoding each transaction, the global state deltas of the apply_delta.eval_delta contain incorrect data.

using

   const block = await client.block(block_number).do();
   // ...
  block.block.txns.forEach((t) => {
    if ("dt" in t) {
      if ("gd" in t["dt"]) {
        for (const k of Object.keys(t["dt"]["gd"])) {
          console.log(t["dt"]["gd"][k]);
        }
      }
    }
  });

logs a string like

'Ibf\x88³\x13|ù򦞴GÁ֨쌥g\x00װ§࠲\x93ش\x00\x00\x00\x00\x01᫰\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.Y«A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00ÿÿþ°ݠ\x8Fက\x01O"\x9Fp\x1E\x00\x00\x03^\x04쪅\x00\x00\x00\x92I\x7Fû\x8A\x00\x00\x00\x05ő\x04뀀\x00\x01¾(\x05 \x00\x00\x00\x01

but expecting

'Ibf\x88\xb3\x13|\xf9\xf6&\x9e\xf4G\xc3\x81\xe0\x96(\xec\xcc\xa5g\x00\xd7\xf0\xa7\xe0\xe0\xf2\x93\xd8t\x00\x00\x00\x00\x01\xe1\xabp\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.Y\xabA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xfe\xb0\xdd`\x8f\xe1\x00\x00\x01O"\x9fp\x1e\x00\x00\x03^\x04\xec\xea\x05\x00\x00\x00\x92I\x7f\xfb\x8a\x00\x00\x00\x05\xc5\x11\x04\xeb\x00\x00\x00\x01\xbe(\x05\xe2\x00\x00\x00\x00\x00\x00'

This seems to be happing in the msgpack.decode call since even with the raw bytes read from disk the same result appears.

Using msgpack-lite locally and setting the codec useraw field, the data is decoded correctly:

   let rawBlock = await client.block(block_number).doRaw();
   const block = mpk.decode(rawBlock, {
     codec: mpk.createCodec({ useraw: true }),
   }) as Record<string, any>;
@barnjamin barnjamin added the new-bug Bug report that needs triage label Dec 27, 2022
@gidonkatten
Copy link

Thanks for creating @barnjamin, I think the issue is also with local state delta values (but I haven't confirmed this)

@algoanne algoanne added bug Something isn't working and removed new-bug Bug report that needs triage labels May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team Lamprey
Projects
None yet
Development

No branches or pull requests

5 participants
@winder @barnjamin @gidonkatten @algoanne and others