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

doc: edit README.md for reproducible choice interactive change #265

Merged
merged 7 commits into from
Dec 11, 2024

Conversation

dj8yfo
Copy link
Collaborator

@dj8yfo dj8yfo commented Dec 10, 2024

No description provided.

@@ -210,7 +210,7 @@ const NEW_PROJECT_FILES: &[NewProjectFile] = &[
},
NewProjectFile {
file_path: "Cargo.toml",
content: include_str!("new-project-template/Cargo.toml.template"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dj8yfo dj8yfo force-pushed the doc-reproducible-interactive branch from 5b56563 to cb06e7a Compare December 10, 2024 16:45
@dj8yfo dj8yfo force-pushed the doc-reproducible-interactive branch 2 times, most recently from a716ffe to 2d7bc0a Compare December 10, 2024 17:18
@dj8yfo dj8yfo force-pushed the doc-reproducible-interactive branch from 2d7bc0a to eba71b8 Compare December 10, 2024 17:26
@dj8yfo dj8yfo mentioned this pull request Dec 10, 2024
8 tasks
README.md Outdated
Comment on lines 130 to 148
<details>
<summary>Additional (optional) details on possible <code>[package.metadata.near.reproducible_build]</code> configuration</summary><p>

1. available images can be found by this link https://hub.docker.com/r/sourcescan/cargo-near/tags
- [`image`](https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.template.toml#L18) and [`image_digest`](https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.template.toml#L19) are straightforward to configure:
![image_and_digest_pinpoint](./docs/image_and_digest_pinpoint.png)
2. build command flags can be configured, if needed, by changing [`container_build_command`](https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.template.toml#L29) field
- base `container_build_command` for images prior to **sourcescan/cargo-near:0.13.0-rust-1.83.0** is `["cargo", "near", "build"]`
- base `container_build_command` for images starting with **sourcescan/cargo-near:0.13.0-rust-1.83.0** and after it is `["cargo", "near", "build", "non-reproducible-wasm", "--locked"]`, where the `--locked` flag is required
- additional flags, if needed, can be looked up on
- `cargo near build non-reproducible-wasm --help` for newer/latest images
- `cargo near build --help` for older ones
- running `docker run -it sourcescan/cargo-near:0.11.0-rust-1.82.0` (or another specific image) and checking the `--help` message of exact `cargo-near` in container may be helpful when in doubt
3. `cargo near` allows parameterizing build with values of environment variables, present at the time of the build and not present in a contract's source code,
by specifying their names in [`passed_env`](https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.template.toml#L24) array
- supported by `sourcescan/cargo-near:0.10.1-rust-1.82.0` image or later images
- SourceScan/Nearblocks does not support verifying such contracts yet.

</p></details>
Copy link
Collaborator Author

@dj8yfo dj8yfo Dec 10, 2024

Choose a reason for hiding this comment

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

this is an openable section
image


1. runs against source code version, committed to git, ignoring any uncommitted changes
2. requires that `Cargo.lock` of project is created (e.g. via `cargo update`) and added to git.
- this enables `--locked` build by downstream `cargo` command.
3. will use configuration in [`[package.metadata.near.reproducible_build]`](https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.toml.template#L14-L25)
section of contract's `Cargo.toml` and [`package.repository`](https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.toml.template#L9) field
3. will use configuration in [`[package.metadata.near.reproducible_build]`](https://github.com/near/cargo-near/blob/main/cargo-near/src/commands/new/new-project-template/Cargo.template.toml#L14-L25)
Copy link
Collaborator Author

@dj8yfo dj8yfo Dec 10, 2024

Choose a reason for hiding this comment

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

due to rename, all of the links in README are currently broken, but point to target location in main

@dj8yfo dj8yfo force-pushed the doc-reproducible-interactive branch 3 times, most recently from fe57dd0 to 7dc1bdb Compare December 10, 2024 18:48
@dj8yfo dj8yfo force-pushed the doc-reproducible-interactive branch from 7dc1bdb to 4753446 Compare December 10, 2024 18:57
@dj8yfo
Copy link
Collaborator Author

dj8yfo commented Dec 10, 2024

referencing SourceScan/verification-guide#1

@dj8yfo
Copy link
Collaborator Author

dj8yfo commented Dec 10, 2024

@race-of-sloths include

@dj8yfo dj8yfo marked this pull request as ready for review December 10, 2024 21:06
@race-of-sloths
Copy link

race-of-sloths commented Dec 10, 2024

@dj8yfo Thank you for your contribution! Your pull request is now a part of the Race of Sloths!
Great job! Usain Bolt jealous of your results!

Shows inviting banner with latest news.

Shows profile picture for the author of the PR

Current status: waiting for finalization

The pull request is merged, you have 24 hours to finalize your scoring. The scoring ends Thu Dec 12 12:30:03 2024

Reviewer Score
@frol 5

Your contribution is much appreciated with a final score of 5!
You have received 50 Sloth points for this contribution

@frol received 25 Sloth Points for reviewing and scoring this pull request.

What is the Race of Sloths

Race of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow

For contributors:

  • Tag @race-of-sloths inside your pull requests
  • Wait for the maintainer to review and score your pull request
  • Check out your position in the Leaderboard
  • Keep weekly and monthly streaks to reach higher positions
  • Boast your contributions with a dynamic picture of your Profile

For maintainers:

  • Score pull requests that participate in the Race of Sloths and receive a reward
  • Engage contributors with fair scoring and fast responses so they keep their streaks
  • Promote the Race to the point where the Race starts promoting you
  • Grow the community of your contributors

Feel free to check our website for additional details!

Bot commands
  • For contributors
    • Include a PR: @race-of-sloths include to enter the Race with your PR
  • For maintainers:
    • Invite contributor @race-of-sloths invite to invite the contributor to participate in a race or include it, if it's already a runner.
    • Assign points: @race-of-sloths score [1/2/3/5/8/13] to award points based on your assessment.
    • Reject this PR: @race-of-sloths exclude to send this PR back to the drawing board.
    • Exclude repo: @race-of-sloths pause to stop bot activity in this repo until @race-of-sloths unpause command is called

Copy link
Contributor

@frol frol left a comment

Choose a reason for hiding this comment

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

@race-of-sloths score 5

@frol frol merged commit 2732825 into if-reproducible-interactive Dec 11, 2024
17 checks passed
@frol frol deleted the doc-reproducible-interactive branch December 11, 2024 12:30
dj8yfo added a commit that referenced this pull request Dec 17, 2024
this will look now like the following
```bash
❯ : cargo near build non-reproducible-wasm --help
Runs on current filesystem state without many restrictions
                                                                                                                                                             
Usage: cargo-near near build non-reproducible-wasm [OPTIONS]
                                                                                                                                                             
Options:
      --locked
      --no-release
      --no-abi
      --no-embed-abi
      --no-doc
      --no-wasmopt
      --out-dir <OUT_DIR>
      --manifest-path <MANIFEST_PATH>
      --features <FEATURES>
      --no-default-features
      --color <COLOR>                  [possible values: auto, always, never]
      --env <ENV>
  -h, --help                           Print help
  -V, --version                        Print version

```
```bash
❯ : cargo near build reproducible-wasm --help
Requires `docker` config added and (git)committed to Cargo.toml, runs on clean (git)working tree state
                                                                                                                                                             
Usage: cargo-near near build reproducible-wasm [OPTIONS]
                                                                                                                                                             
Options:
      --no-locked
      --out-dir <OUT_DIR>
      --manifest-path <MANIFEST_PATH>
      --color <COLOR>                  [possible values: auto, always, never]
  -h, --help                           Print help
  -V, --version                        Print version
```
---

this is pending 
- [x] deploy cmd dispatch in current pr
- [x] logic to enforce correct `container_build_command` for newer
images (ones, that will be built after release of this pr)
- [x] prettier indents in interactive help msgs in current pr
- [x] separate pr onto current pr as base branch with tests fixed as per
api change (#263)
- [x] testing of this pr on a few common cases (sample-crate,
factory-rust, neardevhub-contract) (in comment
#262 (comment))
- [x] separate pr onto current pr as base branch with
`.github/workflows` change /testing (#264)
- [x] separate pr onto current pr as base branch with docs/README update
(#265)
- [ ] merge

---------

Co-authored-by: dj8yf0μl <[email protected]>
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.

3 participants