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

platform bump [SLT-452] #3365

Merged
merged 5 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ If you need to make a new go module, here are the steps to follow:

For the most part, we follow the [uber style guide](https://github.com/uber-go/guide/blob/master/style.md).

### macOS and Docker-based Tools

If you're using a Mac with Apple Silicon (M1/M2/M3), you might encounter issues with Docker-based tools that use AMD64 images. This is particularly relevant for tools like our `abigen` utility. Please see our [abigen README](./tools/abigen/README.md#note-on-macos-and-rosetta) for details on how to resolve Rosetta-related issues and our plans for future improvements.

### Testing

We often use the [testsuite](https://pkg.go.dev/github.com/synapsecns/sanguine/core/testsuite) lib to create a test suite. You don't need this, as it adds a lot of overhead, but if you need a context you should us it. This library contains two methods:
Expand Down
23 changes: 23 additions & 0 deletions tools/abigen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package generate

```



### Note:

Using abigen this way can occasionally cause you to run into the following error string: `missing go.sum entry for module providing package`. This is well documented in [several](https://github.com/99designs/gqlgen/issues/1483) projects made to be run from go-generate. If this is the case, you can create a package exclusively for updating the go.mod.
Expand Down Expand Up @@ -123,3 +125,24 @@ func init() {
5. Golang native `sol-merger`. Currently, this package relies on [`sol-merger`](https://github.com/RyuuGan/sol-merger). This package handles C3 linearization (removing duplicate abstracts, etc) and dependency resolution in the way that go native solidity flatteners (e.g. [flattener](https://github.com/DaveAppleton/SolidityFlattery/blob/master/flat.go)) don't yet. It'd be nice to be able to do this in `abigen` so we could skip the merge step.
6. Consider generating a `doc.go` if one doesn't exist documenting the package
7. Better vyper support

### Note on macOS and Rosetta

If you are using a Mac with Apple Silicon, you might encounter issues running AMD64 Docker images due to the Rosetta translation layer. Rosetta is a dynamic binary translator that allows applications compiled for Intel processors to run on Apple Silicon. However, it may not always work seamlessly with Docker images designed for AMD64 architecture.

To resolve this issue, you can:

1. **Install Rosetta**: If not already installed, run the following command in your terminal:
```shell
softwareupdate --install-rosetta
```

2. **Update Docker**: Ensure your Docker Desktop is up-to-date by navigating to **Settings** > **Software Update** > **Check for Updates**.

3. **Disable x86_64/amd64 Emulation**: In Docker Desktop, go to **General settings** and disable the x86_64/amd64 emulation using Rosetta.

For a detailed guide on fixing this issue, refer to [this blog post](https://romanzipp.com/blog/maocs-sequoia-docker-resetta-is-only-intended-to-run-silicon).

### Future Plans

To mitigate these issues, we plan to implement a fallback mechanism that downloads `solc` directly, bypassing the need for Docker-based solutions on incompatible architectures. For more details on this planned improvement, see [issue #3366](https://github.com/synapsecns/sanguine/issues/3366).
2 changes: 1 addition & 1 deletion tools/abigen/internal/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func createRunFile(version string) (runFile *os.File, err error) {
}

// create a bash file that runs solidity with args passed to the run file
_, err = runFile.WriteString(fmt.Sprintf("#!/bin/bash -e \n$(which docker) run -v $(pwd):/solidity ethereum/solc:%s \"$@\"", version))
_, err = runFile.WriteString(fmt.Sprintf("#!/bin/bash -e \n$(which docker) run --platform linux/amd64 -v $(pwd):/solidity ethereum/solc:%s \"$@\"", version))
if err != nil {
return nil, fmt.Errorf("could not create temp file: %w", err)
}
Expand Down
Loading