Skip to content

Commit

Permalink
tweak: Fix old lock file for test-environment
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedey committed Jan 13, 2025
1 parent 2c5458f commit b7d7c61
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 912 deletions.
53 changes: 13 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,22 @@
target/
**/*.rs.bk

# CARGO.LOCK - Source controlling strategy
# Lock files...
#
# We have multiple workspaces/crates in this repository, with different Cargo.lock strategies.
# As of August 2024, and a change in the Rust guidance around lock files for libraries
# (see https://blog.rust-lang.org/2023/08/29/committing-lockfiles.html), we now source control our
# Cargo.lock file.
#
# First off - let's blanket ignore all Cargo.lock files, so any old/historic ones stay ignored,
# to try to limit the amount of git breakage which will occur when we start to source control
# these
!Cargo.lock

# TYPE 1:
# - The root workspace of libraries.
# As of August 2024, and a change in the Rust guidance around lock files for libraries
# (see https://blog.rust-lang.org/2023/08/29/committing-lockfiles.html), we now source control our
# Cargo.lock file.
# This allows our builds to be more reducible, and is a partial mitigation against supply chain attacks.
# However, this is possibly at the expense of Scrypto users who will have their own Cargo.locks.
# So we may wish to add a CI job to build against the latest versions, as per:
# https://doc.rust-lang.org/cargo/guide/continuous-integration.html#verifying-latest-dependencies
!/Cargo.lock

# TYPE 3:
# - Examples should have their own Cargo.lock files to show good practice
!examples/**/Cargo.lock

# TYPE 4:
# - The asset scrypto packages. These need to be built deterministically, so include a Cargo.lock (at a shared workspace layer)
!radix-engine/assets/blueprints/Cargo.lock
!radix-transaction-scenarios/assets/blueprints/Cargo.lock

# TYPE 5:
# - Various test scrypto packages. We don't care too much about either way - but we do want CI to run without a lock, so let's git ignore these.
# Also make sure to blanket ignore all the old Cargo.locks before they moved to blueprints, to avoid developer git issues
!scrypto-test/assets/blueprints/Cargo.lock
!scrypto-test/tests/blueprints/Cargo.lock
!radix-engine-tests/assets/blueprints/Cargo.lock
!radix-clis/tests/blueprints/Cargo.lock

# FURTHER DETAILS:
# Our CI tests ensure that libraries can build and have their tests run with an empty lock file (ie, with the latest semver
# crates available on crates.io).
# This allows our builds to be more reducible, and is a partial mitigation against supply chain attacks.
#
# We also use --locked for all CI builds to ensure these lock files are actually used.
#
# In the future, we leave the option open to including more Cargo.locks for more of the repository, to speed up our local
# builds and provide a consistent set of dependencies developers can use to get-up-and-running.
# However, this is possibly at the expense of Scrypto users who will have their own Cargo.locks...
# But our Scrypto template now comes with a Cargo.lock template, which should mitigate thi need.
#
# In future, we may wish to add a CI job to build against the latest versions, as per:
# https://doc.rust-lang.org/cargo/guide/continuous-integration.html#verifying-latest-dependencies
!Cargo.lock

# Flamegraph profiles
flamegraph.svg
Expand Down
64 changes: 64 additions & 0 deletions scrypto-test/assets/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## Radix Engine - Scrypto Assets

The Test Environment is an empty scrypto component which acts as the root call-frame in the
Scrypto test runner; and we hook into it to call other things.

It could probably be removed / replaced with something else in future.

## Test environment assets

The Test Environment was compiled with the v1.1.1 deterministic scrypto builder, and deployed
as part of genesis to the ledger:

```rust
use scrypto::prelude::*;

#[blueprint]
mod test_environment {
struct TestEnvironment {}

impl TestEnvironment {
pub fn run() {}
}
}
```

The exact assets can can rebuilt with the following script, checked out against the bottlenose
version of the ledger: https://github.com/radixdlt/radixdlt-scrypto/tree/release/bottlenose

For now, to avoid confusing automated tooling, we have deleted the `Cargo.toml` files and the
`Cargo.lock` file for these genesis assets, and just kept the `lib.rs` source files around for
reference.

```bash
#!/bin/bash
set -e

cd "$(dirname "$0")"

IMAGE_NAME="radixdlt/scrypto-builder"
IMAGE_TAG="v1.1.1"
WORKSPACE_DIR="blueprints"
DESTINATION_DIR="."
for PACKAGE_NAME in "test_environment"
do
# Run scrypto build
docker run \
--platform=linux/amd64 \
--entrypoint=scrypto \
-v $(realpath $WORKSPACE_DIR):/src/$WORKSPACE_DIR \
$IMAGE_NAME:$IMAGE_TAG \
build --path /src/$WORKSPACE_DIR/$PACKAGE_NAME

# Copy artifacts
cp \
$WORKSPACE_DIR/target/wasm32-unknown-unknown/release/$PACKAGE_NAME.{wasm,rpd} \
$DESTINATION_DIR/
done

sha256sum *.{wasm,rpd}

# SHA256
# db170d2f731cf1bb391576281e7f43629d156dbd97126d9e07e990b234f42f50 test_environment.wasm
# 481b8d309110613576be6298d3126200f470a1153dbf867193bba02a49814b66 test_environment.rpd
```
Loading

0 comments on commit b7d7c61

Please sign in to comment.