Skip to content

Commit

Permalink
feat: V1 (#5223)
Browse files Browse the repository at this point in the history
* feat(`cheatcodes`): `1.0` cheatcode changes (#5045)

* feat(`cheatcodes`): Make expectCall only work for the next call's subcalls (#5032)

* chore: make expect call only work for the next call

* chore: make expectCall actually check only the next call's subcalls

* chore: fmt

* chore: introduce checks at the main call level, not at the subcall level

* chore: handle dangling expected calls gracefully

* chore: fix tests

* chore: fmt

* chore: forge fmt

* chore: actually exclude depth the cheatcode was called from

* chore: tests

* chore: better docs

* chore: comment out impossible to check condition on expectCall

* chore: remove unused check

* fix(cheatcodes): Correct `expectRevert` behavior (#4945)

* chore: add repro test to pass

* chore: strictly check for the depth expectRevert was called in, instead of being able to peek at function end

* chore: tests

* chore: add more repro tests

* chore: fmt

* chore: clippy

* chore: fixup problematic tests, mark them as not working properly

* chore: forge fmt

* chore: forge fmt

* Update evm/src/executor/inspector/cheatcodes/mod.rs

* chore: add more info to changelog

* chore: fmt

* chore(tests): add more cases for `expectEmit` (#5076)

* chore(tests): add more extreme cases for expectEmit

* chore(tests): add next call fail case for expectEmit

* chore(`cheatcodes`): add more edge case tests on `expect*` cheatcodes (#5135)

* chore: add edge-cases

* chore: add edge case covering foundry-rs/foundry#4920 (comment)

* feat(`cheatcodes`): disallow usage of `expectRevert` with `expectCall` and `expectEmit`  (#5144)

* feat(cheatcodes): disallow usage of expectCall/Emit with expectRevert

* chore: add tests

* chore: fmt

* chore: fmt

* `foundryup`: v1 changes (#5158)

* feat(foundryup): look for v1 tag instead of nightly for normal foundryup

* feat(foundryup): add ability to download legacy nightly binary with -L flag

* feat: use latest release for figuring out the tag name

* chore(foundryup): slightly improve stable release detection

* chore: use proper repo

* make fns async

* chore: remove prb math from integration tests

* chore: forge fmt

* chore: fix some merge leftovers

* chore: last test fixes

* chore: forge fmt

* chore: uncomment etch test

* feat(docs): add `RELEASE_PROCESS.md` (#5269)

* feat(docs): add RELEASE_PROCESS.md

* chore: not include changelog changes in step

* chore: bump crates to 1.0.0 (#5346)
  • Loading branch information
Evalir committed Jul 10, 2023
1 parent 94c6d0a commit 7208334
Showing 1 changed file with 43 additions and 12 deletions.
55 changes: 43 additions & 12 deletions foundryup
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ BASE_DIR=${XDG_CONFIG_HOME:-$HOME}
FOUNDRY_DIR=${FOUNDRY_DIR:-"$BASE_DIR/.foundry"}
FOUNDRY_BIN_DIR="$FOUNDRY_DIR/bin"
FOUNDRY_MAN_DIR="$FOUNDRY_DIR/share/man/man1"
FOUNDRYUP_LEGACY=false

BINS=(forge cast anvil chisel)

Expand All @@ -24,6 +25,7 @@ main() {
-p|--path) shift; FOUNDRYUP_LOCAL_REPO=$1;;
-P|--pr) shift; FOUNDRYUP_PR=$1;;
-C|--commit) shift; FOUNDRYUP_COMMIT=$1;;
-L|--legacy) shift; FOUNDRYUP_LEGACY=true;;
-h|--help)
usage
exit 0
Expand All @@ -38,7 +40,9 @@ main() {
# Print the banner after successfully parsing args
banner

# If the pr flag is present
if [ -n "$FOUNDRYUP_PR" ]; then
# and if the branch option is not present, then set the branch to the pr head
if [ -z "$FOUNDRYUP_BRANCH" ]; then
FOUNDRYUP_BRANCH="refs/pull/$FOUNDRYUP_PR/head"
else
Expand Down Expand Up @@ -75,25 +79,46 @@ main() {

# Install by downloading binaries
if [[ "$FOUNDRYUP_REPO" == "foundry-rs/foundry" && -z "$FOUNDRYUP_BRANCH" && -z "$FOUNDRYUP_COMMIT" ]]; then
FOUNDRYUP_VERSION=${FOUNDRYUP_VERSION:-nightly}
FOUNDRYUP_TAG=$FOUNDRYUP_VERSION

# Normalize versions (handle channels, versions without v prefix
# If the user has specified the "legacy" tag, we should install the latest nightly binary released before v1.
if [[ "$FOUNDRYUP_LEGACY" == true ]]; then
FOUNDRYUP_TAG_QUERY="nightly"
FOUNDRYUP_VERSION=${FOUNDRYUP_VERSION:-nightly}
FOUNDRYUP_TAG=$FOUNDRYUP_VERSION
# The user has not specified neither the legacy flag, nor an specific version.
# Therefore we assume they want to install the latest foundry flag.
elif [[ -z "$FOUNDRYUP_VERSION" ]]; then
FOUNDRYUP_VERSION=${FOUNDRYUP_VERSION:-latest}
FOUNDRYUP_TAG=$FOUNDRYUP_VERSION
fi

# Normalize versions (handle channels, versions without v prefix)
if [[ "$FOUNDRYUP_VERSION" == "nightly" ]]; then
# Locate real nightly tag
SHA=$(ensure curl -sSf "https://api.github.com/repos/$FOUNDRYUP_REPO/git/refs/tags/nightly" \
# Locate nightly tag
SHA=$(ensure curl -sSf "https://api.github.com/repos/$FOUNDRYUP_REPO/git/refs/tags/$FOUNDRYUP_TAG_QUERY" \
| grep -Eo '"sha"[^,]*' \
| grep -Eo '[^:]*$' \
| tr -d '"' \
| tr -d ' ' \
| cut -d ':' -f2 )
FOUNDRYUP_TAG="nightly-${SHA}"
elif [[ "$FOUNDRYUP_VERSION" == nightly* ]]; then
FOUNDRYUP_VERSION="nightly"
if [[ "$FOUNDRYUP_LEGACY" == true ]]; then
FOUNDRYUP_TAG="nightly-${SHA}"
fi

elif [[ "$FOUNDRYUP_VERSION" == latest* ]]; then
# Locate latest v1 release
FOUNDRYUP_TAG=$(ensure curl -sSf "https://api.github.com/repos/$FOUNDRYUP_REPO/releases/latest" \
| grep -Eo '"tag_name"[^,]*' \
| grep -Eo '[^:]*$' \
| tr -d '"' \
| tr -d ' ' \
| cut -d ':' -f2 )
elif [[ "$FOUNDRYUP_VERSION" == "v"* ]]; then
FOUNDRYUP_TAG="${FOUNDRYUP_VERSION}"
# Try to match an user inputting just the semver tag, without v
elif [[ "$FOUNDRYUP_VERSION" == [[:digit:]]* ]]; then
# Add v prefix
FOUNDRYUP_TAG="v${FOUNDRYUP_VERSION}"
FOUNDRYUP_VERSION="v${FOUNDRYUP_VERSION}"
FOUNDRYUP_TAG="${FOUNDRYUP_VERSION}"
fi

say "installing foundry (version ${FOUNDRYUP_VERSION}, tag ${FOUNDRYUP_TAG})"
Expand Down Expand Up @@ -132,8 +157,13 @@ main() {

# Compute the URL of the release tarball in the Foundry repository.
RELEASE_URL="https://github.com/${FOUNDRYUP_REPO}/releases/download/${FOUNDRYUP_TAG}/"
BIN_ARCHIVE_URL="${RELEASE_URL}foundry_${FOUNDRYUP_VERSION}_${PLATFORM}_${ARCHITECTURE}.$EXT"
MAN_TARBALL_URL="${RELEASE_URL}foundry_man_${FOUNDRYUP_VERSION}.tar.gz"
if [[ "$FOUNDRYUP_VERSION" == "nightly" ]]; then
BIN_ARCHIVE_URL="${RELEASE_URL}foundry_${FOUNDRYUP_VERSION}_${PLATFORM}_${ARCHITECTURE}.$EXT"
MAN_TARBALL_URL="${RELEASE_URL}foundry_man_${FOUNDRYUP_VERSION}.tar.gz"
elif [[ "$FOUNDRYUP_VERSION" == "latest" || "$FOUNDRYUP_VERSION" == "v"* ]]; then
BIN_ARCHIVE_URL="${RELEASE_URL}foundry_${FOUNDRYUP_TAG}_${PLATFORM}_${ARCHITECTURE}.$EXT"
MAN_TARBALL_URL="${RELEASE_URL}foundry_man_${FOUNDRYUP_TAG}.tar.gz"
fi

# Download and extract the binaries archive
say "downloading latest forge, cast, anvil, and chisel"
Expand Down Expand Up @@ -237,6 +267,7 @@ OPTIONS:
-b, --branch Install a specific branch
-P, --pr Install a specific Pull Request
-C, --commit Install a specific commit
-L, --legacy Install v0 (legacy) Foundry (at commit 1a1d653)
-r, --repo Install from a remote GitHub repo (uses default branch if no other options are set)
-p, --path Install a local repository
EOF
Expand Down

0 comments on commit 7208334

Please sign in to comment.