Skip to content

lang: Fix parsing for bytes literals in the IDL#2261

Merged
Henry-E merged 2 commits into
otter-sec:masterfrom
Aursen:master
Nov 16, 2022
Merged

lang: Fix parsing for bytes literals in the IDL#2261
Henry-E merged 2 commits into
otter-sec:masterfrom
Aursen:master

Conversation

@Aursen

@Aursen Aursen commented Nov 15, 2022

Copy link
Copy Markdown
Contributor

This is just a small correction for the generation of idl constants.

For example:

#[constant]
pub const BYTES_STR: &[u8] = b"test";

#[constant]
pub const BYTE_STR: u8 = b't';

It was generated like that before:

{
  "name": "BYTES_STR",
  "type": {
    "defined": "&[u8]"
  },
  "value": "b\"test\""
},
{
  "name": "BYTE_STR",
  "type": "u8",
  "value": "b't'"
}

Now:

{
  "name": "BYTES_STR",
  "type": "bytes",
  "value": "[116, 101, 115, 116]"
},
{
  "name": "BYTE_STR",
  "type": "u8",
  "value": "116"
}

Feel free to make comments especially on the quality of the code

@vercel

vercel Bot commented Nov 15, 2022

Copy link
Copy Markdown

@Aursen is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@Aursen Aursen changed the title lang: Fix parsing of some constants lang: Fix parsing of some constants (WIP) Nov 15, 2022
@Aursen Aursen changed the title lang: Fix parsing of some constants (WIP) lang: Fix parsing for bytes literals in the IDL Nov 15, 2022
@Henry-E

Henry-E commented Nov 16, 2022

Copy link
Copy Markdown
  • it adds functionality that fixes some kind of small issue
  • it adds a test to confirm this new functionality works
    Looks like a merge to me

@Henry-E Henry-E merged commit b107cbe into otter-sec:master Nov 16, 2022
Henry-E pushed a commit to Henry-E/anchor that referenced this pull request Dec 6, 2022
* lang: Fix parsing of some constants

* Fix lint + changelog
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
* lang: Fix parsing of some constants

* Fix lint + changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants