Skip to content

Commit

Permalink
fix(pg): Remove sphinx fork installation and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
RPate97 committed Feb 28, 2024
1 parent 0aa8880 commit 8f4b270
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 402 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-buttons-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sphinx-labs/plugins': patch
---

Remove requirement for Foundry fork
4 changes: 2 additions & 2 deletions docs/ci-proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Install Dependencies
run: yarn --frozen-lockfile
- name: Install Sphinx Solidity Library
run: yarn sphinx install --ci
run: yarn sphinx install
- name: Dry Run
run: npx sphinx propose <path/to/your/script.s.sol> --dry-run --networks testnets
```
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Install Dependencies
run: yarn --frozen-lockfile
- name: Install Sphinx Solidity Library
run: yarn sphinx install --ci
run: yarn sphinx install
- name: Propose
run: npx sphinx propose <path/to/your/script.s.sol> --confirm --networks testnets
```
Expand Down
8 changes: 3 additions & 5 deletions docs/cli-existing-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In this guide, you'll propose the deployment on the command line and then approv

1. [Prerequisites](#1-prerequisites)
2. [Install Sphinx CLI](#2-install-sphinx-cli)
3. [Install Sphinx Foundry library and fork](#3-install-sphinx-foundry-library-and-fork)
3. [Install Sphinx Foundry library](#3-install-sphinx-foundry-library)
4. [Update `.gitignore`](#4-update-gitignore)
5. [Add remapping](#5-add-remapping)
6. [Update your deployment script](#6-update-your-deployment-script)\
Expand Down Expand Up @@ -64,11 +64,9 @@ pnpm add -D @sphinx-labs/plugins
```


## 3. Install Sphinx Foundry Library and Fork
## 3. Install Sphinx Foundry Library

Use the `sphinx install` command to install the Sphinx Foundry library and Foundry fork.

> Sphinx requires a [fork of Foundry](https://github.com/sphinx-labs/foundry) that resolves several bugs that conflict with Sphinx. We're working on getting these fixed in the official Foundry repo, but for now, you'll have to use our fork to be able to use Sphinx. You'll be prompted to install our Foundry fork when you run the install command below.
Use the `sphinx install` command to install the Sphinx Foundry library.

Yarn:
```
Expand Down
2 changes: 0 additions & 2 deletions docs/cli-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ pnpm add -D @sphinx-labs/plugins https://github.com/foundry-rs/forge-std.git#v1.

Run one of the following commands on your command line, replacing the placeholders with your values. We've included a description of each command line argument below.

> Sphinx requires a [fork of Foundry](https://github.com/sphinx-labs/foundry) that resolves several bugs that conflict with Sphinx. We're working on getting these fixed in the official Foundry repo, but for now, you'll have to use our fork to be able to use Sphinx. You'll be prompted to install our Foundry fork when you run the init command below.
Using Yarn or npm:

```
Expand Down
1 change: 0 additions & 1 deletion docs/troubleshooting-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ This guide covers some common issues you might encounter using Sphinx. If your q

- [Slow compilation speed](#slow-compilation-speed)
- [Errors](#errors)
- [Installing Sphinx's Foundry fork](#installing-sphinxs-foundry-fork)
- [`Ineffective mark-compacts near heap limit allocation failed`](#ineffective-mark-compacts-near-heap-limit-allocation-failed)
- [`EvmError: MemoryLimitOOG`](#evmerror-memorylimitoog)

Expand Down
3 changes: 2 additions & 1 deletion packages/contracts/contracts/foundry/Sphinx.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ abstract contract Sphinx {
function sphinxValidate() external returns (string memory libraryVersion, bool forkInstalled) {
libraryVersion = sphinxUtils.sphinxLibraryVersion();

// Check that the Sphinx Foundry fork is installed.
// Check that the user has a version of Foundry that records the state diff correctly
// We don't assume this because our fixes were merged only recently (Feb 2024)
vm.startStateDiffRecording();
new SphinxForkCheck{ salt: 0 }();
Vm.AccountAccess[] memory accountAccesses = vm.stopAndReturnStateDiff();
Expand Down
46 changes: 4 additions & 42 deletions packages/plugins/src/cli/install/index.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,10 @@
import { execSync } from 'child_process'

import { CONTRACTS_LIBRARY_VERSION } from '@sphinx-labs/contracts'
import { spawnAsync, userConfirmation } from '@sphinx-labs/core'
import { spawnAsync } from '@sphinx-labs/core'
import ora from 'ora'

import { sphinxUp } from './sphinxup'

const installWithUpdate = async (
spinner: ora.Ora,
skipLibrary: boolean,
ci: boolean
) => {
if (!ci) {
if (process.env.SPHINX_INTERNAL_TEST__DEMO_TEST !== 'true') {
await userConfirmation(
'Would you like to install the Sphinx Foundry fork? This is required to use Sphinx and will replace your existing Foundry installation.\nConfirm? (y\\n):'
)
}
const foundryupStatus = await spawnAsync('/bin/bash', [
'-c',
'curl -L https://foundry.paradigm.xyz | bash',
])
if (foundryupStatus.code !== 0) {
// The `stdout` contains the trace of the error.
console.log(foundryupStatus.stdout)
// The `stderr` contains the error message.
console.log(foundryupStatus.stderr)
process.exit(1)
}

execSync(sphinxUp, { stdio: 'inherit', shell: '/bin/bash' })
}

if (skipLibrary) {
return
}

const installWithUpdate = async (spinner: ora.Ora) => {
spinner.start('Installing Sphinx Solidity library...')

const args = [
Expand Down Expand Up @@ -102,15 +71,8 @@ const installWithUpdate = async (
}
}

export const handleInstall = async (
spinner: ora.Ora,
skipLibrary: boolean,
ci: boolean
) => {
await installWithUpdate(spinner, skipLibrary, ci)
if (skipLibrary) {
return
}
export const handleInstall = async (spinner: ora.Ora) => {
await installWithUpdate(spinner)

// Foundry doesn't consistently install our subdependency, so we make sure it's installed ourselves.
// We should test this out later and remove if possible.
Expand Down
Loading

0 comments on commit 8f4b270

Please sign in to comment.