solang
solang copied to clipboard
solang needs to accept solidity standard json as input
When solang --standard-json
is run, the output from the compiler is in the standard json format. However, the input is not.
- Parse input on stdin as json using the standard json format
- Make sure the input described in 1) is compiled and result is printed using standard json (that last part is already implemented).
- Write tests for this feature
Note that changing this feature will break the burrow tests. The burrow tests can be disabled for now, since burrow is a dead project.
This feature is needed for #715 so that the json input can be used from javascript.
@seanyoung I will like to take this issue so what exactly I need to do can you guide me as it is my first time
The json format is described in the solc documentation.
The output format is already implemented. The input format needs implementing.
The output format is described here: https://github.com/hyperledger-labs/solang/blob/main/src/bin/solang.rs#L20-L41
There will need to be an a similar definition of the input format, but with #[derive(Deserialize)]
rather than #[derive(Serialize)]
because we will be decoding it.
Maybe it's time to put both definitions of the json format in its own rust file/module and then import it.
Once the definition is written, then the command line of solang must be modified. If the option --standard-json
is specified, which you can check with matches.is_present("STD-JSON"
then read the input from stdin to the end, then the deserialize it using serde using the json definitions you've written. This should be described in https://serde.rs/derive.html
Then process the files in the json, just like it is done now for files which are specified on the command line. So, call fn process_file()
for each file in the json. Note! The contents of the file may be specified in the json itself, so fn process_file()
needs to be updated to not read the file if the contents is given in the json.
Once that is done, some tests need to be written, and a PR opened. Please let me us know how you get on, we're always here to help. Also find us on discord.
Thank you @devratapuri
@devratapuri are you still doing this? If not I would love to take it out.
Hi @Genysys, are you still on it?
@xermicus Should I get on it?
Just let me know where in the repository we can do these changes (sorry I am a first time contributor here)
@xermicus Should I get on it?
Just let me know where in the repository we can do these changes (sorry I am a first time contributor here)
He has linked it in his ans
@devratapuri are you still working on this?
If not, @5hv5hvnk feel free to tackle this issue
@devratapuri are you still working on this?
Nope sry i almost forgot about it .
As far as I understand the test it is to go through output format here and create similar input format. So the changes have to be made here right? Sorry took me so many days I was just brushing up my rust skills
@5hv5hvnk the json input format needs to defined in this file https://github.com/hyperledger/solang/blob/main/src/standard_json.rs Then this file https://github.com/hyperledger/solang/blob/main/src/lib.rs needs a function which takes this format and process it. It should be called from https://github.com/hyperledger/solang/blob/a371ea21bde8278c9c967a27251abcf5aa2712f2/src/bin/solang.rs#LL45C25-L49C43
I am facing some issues with adding a function in lib.rs should I raise a PR and discuss there or you can check my recent commit here
I am facing some issues with adding a function in lib.rs should I raise a PR and discuss there or you can check my recent commit here
What's the problem?
I am not very clear how the function should process the data. (I even couldn't find analogous function for output.josn
)
solang should compile the source files provided in json in the format described here: https://docs.soliditylang.org/en/v0.8.13/using-tthe-compiler.html#compiler-input-and-output-json-description rather than files provided on the command line.
See section Input Description
.