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

Add scrypto dev container target #2004

Open
wants to merge 5 commits into
base: release/cuttlefish
Choose a base branch
from

Conversation

azizi-a
Copy link
Contributor

@azizi-a azizi-a commented Nov 15, 2024

Summary

  • Add new target in Docker file: scrypto-dev-container
  • Define old Docker file target: scrypto-builder

@azizi-a azizi-a changed the base branch from main to develop November 15, 2024 15:39
Copy link

github-actions bot commented Nov 15, 2024

Docker tags
docker.io/radixdlt/private-scrypto-builder:0696ac2b72

Copy link

github-actions bot commented Nov 15, 2024

Benchmark for 0696ac2

Click to view benchmark
Test Base PR %
costing::bench_prepare_wasm 44.1±0.06ms 44.5±0.22ms +0.91%
costing::decode_encoded_i8_array_to_manifest_raw_value 19.3±0.01ms 19.3±0.01ms 0.00%
costing::decode_encoded_i8_array_to_manifest_value 41.3±0.04ms 41.6±0.08ms +0.73%
costing::decode_encoded_tuple_array_to_manifest_raw_value 72.2±0.15ms 70.5±0.09ms -2.35%
costing::decode_encoded_tuple_array_to_manifest_value 98.8±0.19ms 98.2±0.13ms -0.61%
costing::decode_encoded_u8_array_to_manifest_raw_value 31.8±0.06µs 26.0±0.08µs -18.24%
costing::decode_encoded_u8_array_to_manifest_value 41.4±0.03ms 41.5±0.04ms +0.24%
costing::decode_rpd_to_manifest_raw_value 14.7±0.05µs 14.7±0.02µs 0.00%
costing::decode_rpd_to_manifest_value 10.8±0.02µs 10.8±0.08µs 0.00%
costing::deserialize_wasm 1218.4±4.60µs 1202.0±5.14µs -1.35%
costing::execute_transaction_creating_big_vec_substates 691.6±2.14ms 700.0±8.57ms +1.21%
costing::execute_transaction_reading_big_vec_substates 665.4±1.07ms 579.5±1.37ms -12.91%
costing::instantiate_flash_loan 806.1±108.00µs 902.4±593.30µs +11.95%
costing::instantiate_radiswap 891.8±639.14µs 844.4±272.21µs -5.32%
costing::scrypto_malloc 695.9±2.45ms 667.8±1.44ms -4.04%
costing::scrypto_sbor_decode 655.9±1.36ms 658.0±1.13ms +0.32%
costing::scrypto_sha256 577.9±1.39ms 579.6±1.22ms +0.29%
costing::spin_loop_v1 510.9±0.55ms 514.6±0.52ms +0.72%
costing::spin_loop_v2 604.4±5.26ms 607.1±12.43ms +0.45%
costing::validate_sbor_payload 30.8±0.09µs 29.6±0.15µs -3.90%
costing::validate_sbor_payload_bytes 251.8±1.05ns 251.5±0.68ns -0.12%
costing::validate_secp256k1 76.4±0.11µs 76.5±0.06µs +0.13%
costing::validate_wasm 33.5±0.03ms 33.5±0.03ms 0.00%
decimal::add/0 8.4±0.00ns 8.4±0.00ns 0.00%
decimal::add/rust-native 9.8±0.00ns 9.8±0.00ns 0.00%
decimal::add/wasmi 316.0±1.17ns 314.8±1.24ns -0.38%
decimal::add/wasmi-call-native 2.9±0.01µs 2.9±0.00µs 0.00%
decimal::div/0 168.9±0.92ns 168.7±0.18ns -0.12%
decimal::from_string/0 156.3±0.13ns 156.2±0.23ns -0.06%
decimal::mul/0 128.3±0.08ns 129.4±0.07ns +0.86%
decimal::mul/rust-native 126.6±0.15ns 126.5±0.13ns -0.08%
decimal::mul/wasmi 19.2±0.02µs 19.2±0.04µs 0.00%
decimal::mul/wasmi-call-native 3.1±0.01µs 3.1±0.01µs 0.00%
decimal::pow/0 592.1±0.55ns 591.7±0.23ns -0.07%
decimal::pow/rust-native 590.3±0.52ns 590.8±0.29ns +0.08%
decimal::pow/wasmi 93.4±0.80µs 91.6±0.22µs -1.93%
decimal::pow/wasmi-call-native 4.9±0.01µs 4.9±0.03µs 0.00%
decimal::root/0 8.2±0.01µs 8.0±0.01µs -2.44%
decimal::sub/0 8.4±0.01ns 8.4±0.01ns 0.00%
decimal::to_string/0 443.3±0.34ns 441.3±0.28ns -0.45%
large_transaction_processing::prepare 2.5±0.00ms 2.5±0.00ms 0.00%
large_transaction_processing::prepare_and_decompile 6.3±0.01ms 6.4±0.01ms +1.59%
large_transaction_processing::prepare_and_decompile_and_recompile 31.8±0.33ms 31.6±0.29ms -0.63%
metadata_validation::validate_urls 4.8±0.06µs 4.7±0.04µs -2.08%
precise_decimal::add/0 8.9±0.00ns 8.6±0.00ns -3.37%
precise_decimal::add/rust-native 10.7±0.07ns 10.8±0.08ns +0.93%
precise_decimal::add/wasmi 413.1±2.74ns 414.8±2.59ns +0.41%
precise_decimal::add/wasmi-call-native 3.7±0.00µs 3.8±0.01µs +2.70%
precise_decimal::div/0 308.9±1.21ns 312.6±2.06ns +1.20%
precise_decimal::from_string/0 201.0±0.32ns 203.7±0.25ns +1.34%
precise_decimal::mul/0 351.5±3.03ns 362.9±5.27ns +3.24%
precise_decimal::mul/rust-native 316.1±0.80ns 316.4±0.82ns +0.09%
precise_decimal::mul/wasmi 48.4±0.09µs 48.3±0.07µs -0.21%
precise_decimal::mul/wasmi-call-native 4.2±0.01µs 4.2±0.01µs 0.00%
precise_decimal::pow/0 1761.9±4.14ns 1748.1±3.76ns -0.78%
precise_decimal::pow/rust-native 1355.1±1.76ns 1354.2±0.85ns -0.07%
precise_decimal::pow/wasmi 229.9±1.45µs 230.3±0.36µs +0.17%
precise_decimal::pow/wasmi-call-native 7.5±0.01µs 7.6±0.02µs +1.33%
precise_decimal::root/0 58.6±0.03µs 58.1±0.03µs -0.85%
precise_decimal::sub/0 9.2±0.02ns 9.1±0.14ns -1.09%
precise_decimal::to_string/0 692.0±0.89ns 702.2±0.41ns +1.47%
schema::validate_payload 386.0±0.70µs 394.1±1.11µs +2.10%
transaction::radiswap 4.9±0.02ms 4.9±0.02ms 0.00%
transaction::transfer 1824.9±4.81µs 1813.5±3.65µs -0.62%
transaction_validation::validate_manifest 43.1±0.13µs 43.1±0.04µs 0.00%
transaction_validation::verify_bls_2KB 975.5±11.98µs 972.4±9.18µs -0.32%
transaction_validation::verify_bls_32B 1015.2±18.13µs 978.6±11.42µs -3.61%
transaction_validation::verify_ecdsa 74.5±0.07µs 74.4±0.12µs -0.13%
transaction_validation::verify_ed25519 42.4±0.16µs 42.4±0.09µs 0.00%

@azizi-a azizi-a marked this pull request as ready for review November 18, 2024 08:53
@azizi-a azizi-a requested a review from dhedey November 21, 2024 11:02
Copy link
Contributor

@dhedey dhedey left a comment

Choose a reason for hiding this comment

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

Really nice!

Out of interest:

  • How is this supposed to be used?
    • Do people add some kind of devcontainer file to their repo?
  • How can this be tested locally during development?
    • How have you been testing it?
    • Might we want some script to build the dev container locally, possibly commented in the Dockerfile to help future people to tweak it?
  • Perhaps we need something in CI to test the building of this target? Like the dev-container equivalent of ci-scrypto-builder.yml and publish-scrypto-builder.yml

Dockerfile Outdated
@@ -50,6 +50,13 @@ WORKDIR /app

RUN cargo install --path ./radix-clis

FROM base-image as dev-container
RUN apt install -y bash-completion powerline
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth a quick comment explaining that this installs a better prompt for a better dev experience (with maybe a link to the powerline website?)

Dockerfile Show resolved Hide resolved
RUN echo 'powerline-daemon -q; POWERLINE_BASH_CONTINUATION=1; POWERLINE_BASH_SELECT=1; . /usr/share/powerline/bindings/bash/powerline.sh; . /etc/bash_completion' >> ~/.bashrc
COPY --from=builder /app/target/release/scrypto /usr/local/bin/scrypto
COPY --from=builder /app/target/release/resim /usr/local/bin/resim
RUN rustup target add wasm32-unknown-unknown
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we want some kind of ENTRYPOINT line? Possibly not! What's standard for dev containers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The documentation shows no examples with an ENTRYPOINT

Dockerfile Outdated Show resolved Hide resolved
@azizi-a
Copy link
Contributor Author

azizi-a commented Nov 21, 2024

  • How is this supposed to be used?

    • Do people add some kind of devcontainer file to their repo?

My intention is to create another repo with the Hello template in and that uses this image as it's dev container

  • How can this be tested locally during development?

    • How have you been testing it?

Build the image with docker build . --target=dev-container -t scrypto-dev-container then opened a new VS Code instance with .devcontainer/devcontainer.json containing the following.

{
  "name": "Radix Scrypto",
  "image": "scrypto-dev-container",
  "customizations": {
    "vscode": {
      "extensions": [
        "rust-lang.rust-analyzer",
        "tamasfe.even-better-toml",
        "radixpublishing.radix-developer-tools"
      ]
    }
  } 
}

That would be the same for the new repo also containing a Hello template

  • Might we want some script to build the dev container locally, possibly commented in the Dockerfile to help future people to tweak it?

Will add this

  • Perhaps we need something in CI to test the building of this target? Like the dev-container equivalent of ci-scrypto-builder.yml and publish-scrypto-builder.yml

Will add this too

@azizi-a azizi-a requested a review from dhedey November 22, 2024 14:14
@azizi-a azizi-a changed the base branch from develop to release/cuttlefish November 27, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants