GithubHelp home page GithubHelp logo

Comments (6)

joe-p avatar joe-p commented on June 29, 2024 1

I talked about this with @winder and it seems like this issue should be fixed once algorand/go-codec#4 is merged and available in the sdk

from go-algorand-sdk.

algochoi avatar algochoi commented on June 29, 2024

I'm not sure if this is strictly a bug. The SDK copies over the type definitions from go-algorand, which defines a couple fields as map[uint64], e.g. StateProofTracking and LocalDeltas. If we change these to a map[string], we'd deviate from the go-algorand source code and trigger errors in cross-repo consistency checkers.

The other solution is to leave this part of the SDK as-is and defer struct parsing/JSON conversion to the client by letting them convert these two fields before using a json encoder. Interested to hear your thoughts as well.

from go-algorand-sdk.

algochoi avatar algochoi commented on June 29, 2024

That sounds good, I forgot that our codec repo was mega out of date.

from go-algorand-sdk.

joe-p avatar joe-p commented on June 29, 2024

Different flavor of the same issue but posting here for clarity and posterity's sake... basically any map that has a non-string key type will not get properly encoded. This affects other maps with integer keys like local deltas, but also more complex keys. For example, Txleases:

  "Txleases": {
      {
  "Lease": "PwvoKrpv440AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
  "Sender": "pFRedFkfkmKiIT+/WF/OEujrmHGIhB3HTP0uXHCPdKE="
}: 29701261
    }

from go-algorand-sdk.

joe-p avatar joe-p commented on June 29, 2024

After looking into it a bit more algorand/go-codec#4 will fix the encoding for numeric keys, so local deltas, createables, and spt, but there will still be a problem with encoding LedgerStateDelta.Txleases because the key is Txlease.

From the ecnoding/json docs:

Map values encode as JSON objects. The map's key type must either be a string, an integer type, or implement encoding.TextMarshaler.

This means Txlease will need to implement TextMarshaler and TextUnmarshaler

from go-algorand-sdk.

jasonpaulos avatar jasonpaulos commented on June 29, 2024

cc @Eric-Warehime about the txlease issue

from go-algorand-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.