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

Solang playground milestone 4 #1215

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

salaheldinsoliman
Copy link
Contributor

Milestone Delivery Checklist

  • The milestone-delivery-template.md has been copied and updated.
  • This pull request is being made by the same account as the accepted application.
  • I have disclosed any and all sources of reused code in the submitted repositories and have done my due diligence to meet its license requirements.
  • In case of acceptance, invoices must be submitted and payments will be transferred to the Polkadot AssetHub and/or fiat account provided in the application.
  • The delivery is according to the Guidelines for Milestone Deliverables.

Link to the application pull request: w3f/Grants-Program#1894

Signed-off-by: salaheldinsoliman <[email protected]>
Signed-off-by: salaheldinsoliman <[email protected]>
@semuelle semuelle requested a review from takahser October 28, 2024 12:10
@github-actions github-actions bot added the stale label Nov 12, 2024
@takahser
Copy link
Contributor

@salaheldinsoliman sry for the delay here, will give feedback by tomorrow EOD.

@takahser takahser removed the stale label Nov 18, 2024
Copy link
Contributor

@takahser takahser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salaheldinsoliman sorry for the delay here. I've finished the first iteration of the review, I had some problems with running the tests and the docker infra. For more details see my evaluation.

Additional info

Tested on: Macbook Pro, 2023, M2

@semuelle semuelle self-assigned this Nov 19, 2024
Signed-off-by: salaheldinsoliman <[email protected]>
@salaheldinsoliman
Copy link
Contributor Author

@takahser thanks!
1- I have updated the deployment link, will be a lot easier to test stuff there
2- For the docker image, please make sure you run the commands specified in the Makefile.toml. For instance, you should run the docker image you built using this command:
https://github.com/hyperledger-labs/solang-playground/blob/4949ca3cf75e59e65dc74f71821c60b9b435eace/Makefile.toml#L96

Please let me know of there are any other issues

Copy link
Contributor

@takahser takahser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salaheldinsoliman how do I install sysbox-runc? Could you add this directly to your instructions as well?

% docker run \
          --runtime=sysbox-runc \
          --name playground \
          --detach \
          --volume /tmp:/tmp \
          --publish 9000:9000 \
          solang-playground
docker: Error response from daemon: unknown or invalid runtime name: sysbox-runc.
See 'docker run --help'.

@salaheldinsoliman
Copy link
Contributor Author

salaheldinsoliman commented Dec 4, 2024

@takahser Hello,
It is specified in the README.md, where it will direct you to link where you can install it.
You can find it under Docker, Prerequisites
Please let me know if you have any difficulties installing it

@salaheldinsoliman
Copy link
Contributor Author

@takahser Hello,
Are there any updates on this one?

@takahser
Copy link
Contributor

@salaheldinsoliman sorry for the delay here, it turns out I'll need a linux machine to install sysbox-runc. And unfortunately I have lost access to the AWS, and restoring it takes longer than anticipated.

Regarding the tests, they still fail:

% cargo make test
warning: `/Users/xxx/repos/solang-playground/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
[cargo-make] INFO - cargo make 0.37.23
[cargo-make] INFO - 
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: test
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: test-backend
warning: `/Users/xxx/repos/solang-playground/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.25s
     Running unittests src/lib.rs (target/debug/deps/demo_lsp_browser-416d6ecd276daaa2)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/server_tests.rs (target/debug/deps/server_tests-a36a964e00636c53)

running 1 test
test tests::language_server_workflow ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

   Doc-tests demo-lsp-browser

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

[cargo-make] INFO - Running Task: test-app

> [email protected] test
> jest

 FAIL  tests/api.test.ts
  Ensuring the server serves the built frontend
    ✕ Verifying a successful response upon making a request (52 ms)
  Ensuring the server’s compile endpoint is operational
    ✕ Verifying a successful compile request (3 ms)

  ● Ensuring the server serves the built frontend › Verifying a successful response upon making a request

    expect(received).resolves.toHaveProperty()

    Received promise rejected instead of resolved
    Rejected to value: [AggregateError]

       9 | describe('Ensuring the server serves the built frontend', () => {
      10 |   test('Verifying a successful response upon making a request', async () => {
    > 11 |     await expect(axios.get(`${BACKEND_URL}/`)).resolves.toHaveProperty('status', 200);
         |           ^
      12 |   });
      13 | });
      14 |

      at expect (../../node_modules/expect/build/index.js:113:15)
      at Object.<anonymous> (tests/api.test.ts:11:11)

  ● Ensuring the server’s compile endpoint is operational › Verifying a successful compile request

    expect(received).resolves.toMatchObject()

    Received promise rejected instead of resolved
    Rejected to value: [AggregateError]

      19 |       .toString();
      20 |
    > 21 |     await expect(
         |           ^
      22 |       axios.post(`${BACKEND_URL}/compile`, {
      23 |         source,
      24 |       })

      at expect (../../node_modules/expect/build/index.js:113:15)
      at Object.<anonymous> (tests/api.test.ts:21:11)

Test Suites: 1 failed, 1 total
Tests:       2 failed, 2 total
Snapshots:   0 total
Time:        1.657 s
Ran all test suites.
npm ERR! Lifecycle script `test` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: [email protected] 
npm ERR!   at location: /Users/xxx/repos/solang-playground/packages/app 
Error while executing command, exit code: 1

Do you have any idea why that is?

@takahser
Copy link
Contributor

takahser commented Dec 19, 2024

@salaheldinsoliman I was finally able to run it on a linux (ubuntu) machine. Unfortunately, the tests are failing here as well:

$ cargo make test
warning: `/home/ubuntu/solang-playground/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
[cargo-make] INFO - cargo make 0.37.23
[cargo-make] INFO - 
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: test
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: test-backend
warning: `/home/ubuntu/solang-playground/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
warning: unexpected `cfg` condition value: `wasm_opt`
  --> crates/solang/src/codegen/mod.rs:46:7
   |
46 | #[cfg(feature = "wasm_opt")]
   |       ^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `contract-build`, `default`, `language_server`, `libc`, and `rust-lapper`
   = help: consider adding `wasm_opt` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition value: `llvm`
  --> crates/solang/src/codegen/mod.rs:72:7
   |
72 | #[cfg(feature = "llvm")]
   |       ^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `contract-build`, `default`, `language_server`, `libc`, and `rust-lapper`
   = help: consider adding `llvm` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `llvm`
  --> crates/solang/src/codegen/mod.rs:84:7
   |
84 | #[cfg(feature = "llvm")]
   |       ^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `contract-build`, `default`, `language_server`, `libc`, and `rust-lapper`
   = help: consider adding `llvm` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `wasm_opt`
   --> crates/solang/src/codegen/mod.rs:108:11
    |
108 |     #[cfg(feature = "wasm_opt")]
    |           ^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `contract-build`, `default`, `language_server`, `libc`, and `rust-lapper`
    = help: consider adding `wasm_opt` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `wasm_opt`
   --> crates/solang/src/codegen/mod.rs:125:19
    |
125 |             #[cfg(feature = "wasm_opt")]
    |                   ^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `contract-build`, `default`, `language_server`, `libc`, and `rust-lapper`
    = help: consider adding `wasm_opt` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: elided lifetime has a name
   --> crates/solang/src/sema/builtin_structs.rs:243:59
    |
243 |     pub fn definition<'a>(&'a self, ns: &'a Namespace) -> &StructDecl {
    |                       -- lifetime `'a` declared here      ^ this elided lifetime gets resolved as `'a`
    |
    = note: `#[warn(elided_named_lifetimes)]` on by default

warning: fields `doc` and `ty` are never read
  --> crates/solang/src/sema/yul/builtin.rs:10:9
   |
6  | pub struct YulBuiltinPrototype {
   |            ------------------- fields in this struct
...
10 |     pub doc: &'static str,
   |         ^^^
11 |     pub ty: YulBuiltInFunction,
   |         ^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: for loop over a `&Option`. This is more readably written as an `if let` statement
   --> crates/solang/src/codegen/external_functions.rs:159:22
    |
159 |             for e in exprs {
    |                      ^^^^^
    |
    = note: `#[warn(for_loops_over_fallibles)]` on by default
help: to check pattern in a loop use `while let`
    |
159 |             while let Some(e) = exprs {
    |             ~~~~~~~~~~~~~~~ ~~~
help: consider using `if let` to clear intent
    |
159 |             if let Some(e) = exprs {
    |             ~~~~~~~~~~~~ ~~~

warning: `solang` (lib) generated 8 warnings
   Compiling demo-lsp-browser v0.0.0 (/home/ubuntu/solang-playground/crates/browser)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-......,relro,-z,now" "-nodefaultlibs"
  = note: collect2: fatal error: ld terminated with signal 9 [Killed]
          compilation terminated.
          

error: could not compile `demo-lsp-browser` (test "server_tests") due to 1 previous error
Error while executing command, exit code: 101

Any idea, why this happens?

In addition to that, docker still fails - even after installing sysbox:

ubuntu@ip-172-31-32-82:~/solang-playground$ sudo systemctl status sysbox -n20
● sysbox.service - Sysbox container runtime
     Loaded: loaded (/usr/lib/systemd/system/sysbox.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-12-19 16:39:36 UTC; 1min 13s ago
       Docs: https://github.com/nestybox/sysbox
   Main PID: 13969 (sh)
      Tasks: 2 (limit: 1130)
     Memory: 432.0K (peak: 3.1M)
        CPU: 23ms
     CGroup: /system.slice/sysbox.service
             ├─13969 /bin/sh -c "/usr/bin/sysbox-runc --version && /usr/bin/sysbox-mgr --version && /usr/bin/sysbox-fs --versio>
             └─13983 /bin/sleep infinity

Dec 19 16:39:36 ip-172-31-32-82 systemd[1]: Started sysbox.service - Sysbox container runtime.
Dec 19 16:39:36 ip-172-31-32-82 sh[13970]: sysbox-runc
Dec 19 16:39:36 ip-172-31-32-82 sh[13970]:         edition:         Community Edition (CE)
Dec 19 16:39:36 ip-172-31-32-82 sh[13970]:         version:         0.6.5
Dec 19 16:39:36 ip-172-31-32-82 sh[13970]:         commit:         1b440ff266841f3d2d296e664122a9e29ceb9fd8
Dec 19 16:39:36 ip-172-31-32-82 sh[13970]:         built at:         Sat Nov  9 06:09:34 UTC 2024
Dec 19 16:39:36 ip-172-31-32-82 sh[13970]:         built by:         Rodny Molina
Dec 19 16:39:36 ip-172-31-32-82 sh[13970]:         oci-specs:         1.1.0+dev
Dec 19 16:39:36 ip-172-31-32-82 sh[13975]: sysbox-mgr
Dec 19 16:39:36 ip-172-31-32-82 sh[13975]:         edition:         Community Edition (CE)
Dec 19 16:39:36 ip-172-31-32-82 sh[13975]:         version:         0.6.5
Dec 19 16:39:36 ip-172-31-32-82 sh[13975]:         commit:         1159d228eac8402efa63bd2cb18cdf9e404ea130
Dec 19 16:39:36 ip-172-31-32-82 sh[13975]:         built at:         Sat Nov  9 06:10:05 UTC 2024
Dec 19 16:39:36 ip-172-31-32-82 sh[13975]:         built by:         Rodny Molina
Dec 19 16:39:36 ip-172-31-32-82 sh[13979]: sysbox-fs
Dec 19 16:39:36 ip-172-31-32-82 sh[13979]:         edition:         Community Edition (CE)
Dec 19 16:39:36 ip-172-31-32-82 sh[13979]:         version:         0.6.5
Dec 19 16:39:36 ip-172-31-32-82 sh[13979]:         commit:         aeba775e52cc6385fa4807c594fc7ee164ad624c
Dec 19 16:39:36 ip-172-31-32-82 sh[13979]:         built at:         Sat Nov  9 06:10:01 UTC 2024
Dec 19 16:39:36 ip-172-31-32-82 sh[13979]:         built by:         Rodny Molina
ubuntu@ip-172-31-32-82:~/solang-playground$ docker run \
          --runtime=sysbox-runc \
          --name playground \
          --detach \
          --volume /tmp:/tmp \
          --publish 9000:9000 \
          solang-playground
docker: Error response from daemon: unknown or invalid runtime name: sysbox-runc.
See 'docker run --help'.
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
Command 'docker:' not found, did you mean:
  command 'docker' from snap docker (27.2.0)
  command 'docker' from deb docker.io (24.0.7-0ubuntu4.1)
  command 'docker' from deb podman-docker (4.9.3+ds1-1ubuntu0.2)
  command 'dockerd' from deb docker.io (24.0.7-0ubuntu4.1)
See 'snap info <snapname>' for additional versions.
Command 'See' not found, did you mean:
  command 'ree' from deb ree (1.4.1-2)
  command 'pee' from deb moreutils (0.67-1)
  command 'see' from deb mailcap (3.70+nmu1ubuntu1)
  command 'tee' from deb coreutils (9.4-2ubuntu2)
Try: sudo apt install <deb name>

Somehow there seems to be a problem with how docker interacts with sysbox:

docker: Error response from daemon: unknown or invalid runtime name: sysbox-runc.

@salaheldinsoliman
Copy link
Contributor Author

Hello @takahser
1- Windows problem:
For cargo make test to work, you have to run cargo make run in separate terminal as stated in the README, this is likely the cause of the problem (on the windows machine)

For the problem on the ubuntu machine however, the build process gets killed with signal 9, this is most likely a memory error. If you run vbox, you can try allocating more memory for it to work, also don't forget to cargo make deps.

2- For the docker problem, you have to add docker to the sudoers file, please check:
https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket

Please let me know if you encounter other issues

@takahser
Copy link
Contributor

@salaheldinsoliman thanks for your feedback.

Windows problem

I'm not using Windows :)

Maybe it's easier to schedule a call. If you're able to demonstrate the failing deliverables on your machine, I'd be fine accepting them, even if they fail on both my physical MacBook and virtual Ubuntu machine.
I'll reach out via mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants