hyperledger / solang

Solidity Compiler for Solana and Polkadot
https://solang.readthedocs.io/
Apache License 2.0
1.25k stars 211 forks source link

Implement Solang Projects #1084

Closed xermicus closed 1 year ago

xermicus commented 1 year ago

Problem statement

It came to our attention that the compiler needs a lot of information that is not available in the source code. E.g.:

This is getting cumbersome. The idea we had is to have a simple "project configuration" TOML file for solang, similar to what the Cargo.toml file does. It could even be name Solang.toml. Next to what we require to compile the contract it could contain some more information, e.g. which version of solang is required, license, ...

Deliverables

seanyoung commented 1 year ago

This should also include:

seanyoung commented 1 year ago

Solang.toml is not a bad idea. Foundry uses foundry.toml, we should also look at what Foundy/Truffle/Anvil offer. Ideally we would have some more subcommands like solang test at some point in the future.

xermicus commented 1 year ago

Another configuration possibility: Initial and max heap size

salaheldinsoliman commented 1 year ago

Regarding the substrate target configuration, @xermicus and I reached the conclusion that it would be best to leave the current configuration options as is. What a user currently can do is specify address-length and value-length in bytes and the compiler would generate wasm code accordingly.

The reason we reached that conclusion is that all parachains we know of using the ink contracts pallet use the same configurations of AccountID32 and balance = u128. Here are some famous examples:

Acala: source code defining address length balance as u128 (16 bytes)

Astar: address length Balance length

Phala: Address length Balance length

More than the address length and value length, we also thought of another configuration: hash length. After a bit of research, we also found that to be constant across all chains as defined in contract_metadata