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

Add support for Apple ARM64 and Linux ARM64 #6013

Merged
merged 45 commits into from
Mar 12, 2024
Merged

Conversation

andreibancioiu
Copy link
Collaborator

@andreibancioiu andreibancioiu commented Mar 5, 2024

Reasoning behind the pull request

  • Node, Seednode, Chain Simulator etc. cannot be compiled using Go for ARM64, due to their dependency of legacy Wasmer (1 & pre-1).

Proposed changes

Limitations

  • On ARM64, the node has to be started with --disable-consensus-watchdog. Otherwise, at times, the watchdog will raise a fatal error. Investigation will follow on this topic.

Testing procedure

  • Standard testing (internal testnets) ☑️
  • Run on MacOS ARM64 ☑️
  • Run on Linux ARM64 ☑️

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@andreibancioiu andreibancioiu changed the base branch from master to rc/v1.7.0 March 5, 2024 10:13
@andreibancioiu andreibancioiu self-assigned this Mar 5, 2024
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.17%. Comparing base (a857a9a) to head (f2af5c6).

Additional details and impacted files
@@            Coverage Diff             @@
##           rc/v1.7.0    #6013   +/-   ##
==========================================
  Coverage      80.17%   80.17%           
==========================================
  Files            751      752    +1     
  Lines          97895    97899    +4     
==========================================
+ Hits           78487    78491    +4     
  Misses         14038    14038           
  Partials        5370     5370           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

iulianpascalau
iulianpascalau previously approved these changes Mar 5, 2024
@andreibancioiu andreibancioiu marked this pull request as ready for review March 5, 2024 12:02
miiu96
miiu96 previously approved these changes Mar 5, 2024
@andreibancioiu andreibancioiu dismissed stale reviews from miiu96 and iulianpascalau via 34badde March 5, 2024 14:42
@andreibancioiu andreibancioiu changed the title Add support for Apple ARM64 Add support for Apple ARM64 and Linux ARM64 Mar 6, 2024
GOARCH=$(go env GOARCH)
GOPATH=$(go env GOPATH)

# "libwasmer_darwin_amd64.dylib" was built with an unfortunate identifier (in the past), so we need to fix it:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunate. Easily fixable with additional commits in all VM repositories (patching the legacy dylib).

Comment on lines +50 to +51
VM_GO_VERSION=$(cat go.mod | grep mx-chain-vm-go | sort -n | tail -n -1| awk -F '/' '{print$3}'| sed 's/ /@/g')
VM_GO_DIR=${GOPATH}/pkg/mod/github.com/multiversx/${VM_GO_VERSION}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated with respect to Sirius (VM 1.5).

Comment on lines +115 to +122
# Test binaries in different current directories.
cd ${BUILD_DIR} && ./node --version
cd ${GITHUB_WORKSPACE} && ${BUILD_DIR}/node --version
cd / && ${BUILD_DIR}/node --version

cd ${BUILD_DIR} && ./seednode --version
cd ${GITHUB_WORKSPACE} && ${BUILD_DIR}/seednode --version
cd / && ${BUILD_DIR}/seednode --version
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The binaries are downloadable & runnable anywhere. Of course, these binaries must not be used for real-world observers and validators.

- name: Smoke test
run: |
# Remove all downloaded Go packages, so that we can test the binary's independence from them (think of Wasmer libraries).
sudo rm -rf ${GOPATH}/pkg/mod
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Libraries should be near the binary. But the binary is independent from otherwise-placed-wasmer libraries.

@@ -905,6 +906,10 @@ func TestManagedPeersHolder_IsKeyValidator(t *testing.T) {
}

func TestManagedPeersHolder_GetNextPeerAuthenticationTime(t *testing.T) {
if runtime.GOOS == "darwin" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interesting, should be further investigated.

sasurobert
sasurobert previously approved these changes Mar 8, 2024
iulianpascalau
iulianpascalau previously approved these changes Mar 8, 2024
Copy link
Contributor

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

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

Normal allin test: v1.6.15-dev-config-eb2e06c06d -> apple-arm64-16504d47d3

--- Specific errors ---

block hash does not match 496
wrong nonce in block 256
miniblocks does not match 0
num miniblocks does not match 0
miniblock hash does not match 0
block bodies does not match 0
receipts hash missmatch 0

/------/

--- Statistics ---

Nr. of all ERRORS: 0
Nr. of all WARNS: 388
Nr. of new ERRORS: 0
Nr. of new WARNS: 116
Nr. of PANICS: 0

/------/

--- ERRORS ---

/------/

--- WARNINGS ---

/------/

@andreibancioiu andreibancioiu merged commit 8e78d24 into rc/v1.7.0 Mar 12, 2024
11 checks passed
@andreibancioiu andreibancioiu deleted the apple-arm64 branch March 12, 2024 09:11
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.

6 participants