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

bug: meta token census information is not properly populated when creating elections #241

Closed
elboletaire opened this issue Aug 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@elboletaire
Copy link
Member

Describe the bug

When creating an election with a token type census, into the election.meta field, there should be a token one with the information of the token used for the census creation.

Since version 0.1.0 this is no longer true if you merge any new metadata.

To Reproduce

  • You can use the esm or ts examples, but ensure you install @vocdoni/sdk >= 0.1.0
  • Create a token based census
const c3client = new VocdoniCensus3Client({
  env: EnvOptions.DEV,
});
const census = await c3client.createTokenCensus('0xa117000000f279D81A1D3cc75430fAA017FA5A2e');
  • Add some metadata to it:
const election = Election.from({
  // [...]
  maxCensusSize: 100,
  meta: {
      census: {
        type: 'token',
      },
    },
})
  • Create the election
  • After being created, do a curl request to the API and check whether the metadata.meta.token field has been set or not.

Current behavior

The metadata.meta.token comes empty

Expected behavior

To have all the meta keys properly merged, and have the token information there.

@marcvelmer
Copy link
Collaborator

I'm not able to reproduce the bug.

    const election = Election.from({
      title: 'SDK Testing - Title',
      description: 'SDK Testing - Description',
      endDate: new Date().getTime() + 10000000,
      census,
      maxCensusSize: 5000,
      meta: {
        census: {
          type: 'token',
          test: 'anothertest',
        },
        testing: [1, 2, 100, 200],
      },
    });

And the curl returns:

...
    "meta": {
      "census": {
        "test": "anothertest",
        "type": "token"
      },
      "sdk": {
        "version": "0.1.1"
      },
      "testing": [
        1,
        2,
        100,
        200
      ],
      "token": {
        "decimals": 18,
        "defaultStrategy": 1,
        "id": "0xa117000000f279D81A1D3cc75430fAA017FA5A2e",
        "name": "Aragon Network Token",
        "size": 15232,
        "startBlock": 11060110,
        "status": {
          "atBlock": 18020015,
          "progress": 100,
          "synced": true
        },
        "symbol": "ANT",
        "totalSupply": "43167628045876100925015447",
        "type": "erc20"
      }
    },
...

@elboletaire
Copy link
Member Author

True, I cannot reproduce it either now... not sure how did I end up having multiple processes without the meta token information, but it appears now when I create them.. so 🤷🏼‍♀️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants