diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80b19f61..cf23f01c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,7 +125,7 @@ jobs: integration-test-eigenlayer: timeout-minutes: 90 - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: checkout code uses: actions/checkout@v2 @@ -142,14 +142,9 @@ jobs: - name: Forge build run: forge update && cd blueprints/incredible-squaring-eigenlayer && forge build --root ./contracts && cd ../../ - - name: Start Docker Desktop - uses: ./.github/workflows/docker-desktop - with: - docker-desktop-build-url: "https://desktop.docker.com/mac/main/arm64/122432/Docker.dmg" - username: "runner" - env: "{}" + - name: Set up Docker + uses: crazy-max/ghaction-setup-docker@v3 - # Rest of the steps remain the same - name: Run anvil in background run: anvil --version && anvil & diff --git a/.github/workflows/docker-desktop/action.yml b/.github/workflows/docker-desktop/action.yml deleted file mode 100644 index 030c7625..00000000 --- a/.github/workflows/docker-desktop/action.yml +++ /dev/null @@ -1,158 +0,0 @@ -name: "Docker Desktop action" -description: "Start Docker Desktop on a Github Action node" -inputs: - docker-desktop-build-url: - description: "Docker Desktop build url to use for installation" - required: false - default: "latest" - username: - description: "username on the node" - required: false - default: "runner" - env: - description: "env variables to pass when running Desktop, as a JSON string" - required: false - default: "{}" -runs: - using: "composite" - steps: - - name: Bloc calls to segment.io - id: redirect-segment - shell: bash - run: | - cat /etc/hosts | grep '127.0.0.2 api.segment.io' || echo '127.0.0.2 api.segment.io' | sudo tee -a /etc/hosts - cat /etc/hosts | grep '127.0.0.2 api.segment.io' # Ensure the segment line is there - - - name: Install macOS Docker Desktop dmg - if: runner.os == 'macOS' - shell: bash - env: ${{fromJson(inputs.env)}} - run: | - sw_vers - mkdir ./temp - mkdir ./mount - - buildUrl=${{ inputs.docker-desktop-build-url }} - if [[ "$buildUrl" == "latest" ]]; then - buildUrl="https://desktop.docker.com/mac/main/amd64/Docker.dmg" - fi - - curl --fail -o ./temp/DockerDesktop.dmg $buildUrl - /usr/bin/hdiutil attach -noverify ./temp/DockerDesktop.dmg -mountpoint ./mount/desktop -nobrowse - echo "dmg mounted" - sudo ./mount/desktop/Docker.app/Contents/MacOS/install --accept-license - echo "dmg installed" - - echo "ls /Library/Application Support/com.docker.docker" - ls "/Library/Application Support/com.docker.docker" || true - mkdir -p ./cache/desktopInstallSettings - cp "/Library/Application Support/com.docker.docker/"* ./cache/desktopInstallSettings/ - echo "ls ./cache/desktopInstallSettings/" - ls ./cache/desktopInstallSettings/ || true - - /usr/bin/hdiutil detach ./mount/desktop - echo "dmg unmounted" - - - name: Install macOS Docker Desktop app - if: runner.os == 'macOS' - shell: bash - env: ${{fromJson(inputs.env)}} - run: | - sudo mkdir -p /Library/PrivilegedHelperTools - sudo /Applications/Docker.app/Contents/MacOS/install config --user ${{inputs.username}} - sudo /Applications/Docker.app/Contents/MacOS/install vmnetd - echo "app installed" - /usr/bin/open /Applications/Docker.app --args --unattended --add-host-docker-internal-registry - echo "Docker starting..." - - - name: Download appcast - if: runner.os == 'Linux' - shell: bash - run: | - curl https://desktop.docker.com/linux/main/amd64/appcast.xml --fail -o appcast.xml - - - name: Get Docker Desktop latest build url - if: runner.os == 'Linux' && inputs.docker-desktop-build-url == 'latest' - uses: mavrosxristoforos/get-xml-info@1.1.1 - id: get-latest-build-url - with: - xml-file: appcast.xml - xpath: //channel/link - - - name: Define the build URL to use - if: runner.os == 'Linux' - id: get-build-url - shell: bash - run: | - buildUrl=${{ inputs.docker-desktop-build-url }} - if [[ "$buildUrl" == "latest" ]]; then - buildUrl=${{ steps.get-latest-build-url.outputs.info }} - fi - echo "build-url=$buildUrl" >> $GITHUB_OUTPUT - - - name: Cache Docker Desktop packages - if: runner.os == 'Linux' - id: cache-docker-desktop - uses: actions/cache@v3 - with: - key: "docker-desktop-4.25.0-amd64" - path: | - ~/downloads/ - - - name: Download Docker Desktop - if: runner.os == 'Linux' && steps.cache-docker-desktop.outputs.cache-hit != 'true' - shell: bash - run: | - mkdir -p ~/.downloads - curl --fail -sSL ${{ steps.get-build-url.outputs.build-url }} > ~/.downloads/docker-desktop.deb - - - name: Check for CPU with VM support - if: runner.os == 'Linux' - shell: bash - run: | - egrep '(vmx|svm)' /proc/cpuinfo - - # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ - - name: Enable KVM group perms - if: runner.os == 'Linux' - shell: bash - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: Install and Run Docker Desktop - if: runner.os == 'Linux' - shell: bash - env: ${{fromJson(inputs.env)}} - run: | - sudo add-apt-repository universe - sudo apt update -y - sudo apt-get install ca-certificates curl gnupg - sudo install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg - sudo chmod a+r /etc/apt/keyrings/docker.gpg - echo \ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - sudo apt update -y - sudo apt remove moby-cli moby-compose moby-buildx - sudo apt install qemu-kvm - sudo apt install ~/.downloads/docker-desktop.deb qemu-kvm - mkdir -p ~/.docker/desktop - echo '{"settingsVersion": 30, "licenseTermsVersion": 2}' > ~/.docker/desktop/settings.json - docker context create desktop-linux --docker host=unix://${HOME}/.docker/desktop/docker.sock --description "Docker Desktop" - docker context use desktop-linux - - /opt/docker-desktop/bin/com.docker.backend & - - - name: Wait for Docker to be up and running - shell: bash - run: | - if [[ "$RUNNER_OS" == "macOS" ]]; then - export DOCKER_HOST="unix://${HOME}/.docker/desktop/docker.sock" - fi - until docker ps; do echo "docker not ready, sleep 10 s and try again"; sleep 10; done - echo "Docker started and ready" - docker version \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 5e407891..9365d7af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -146,7 +146,7 @@ dependencies = [ "alloy-eips", "alloy-primitives 0.7.7", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.4", "c-kzg", "serde", ] @@ -195,13 +195,24 @@ checksum = "f76ecab54890cdea1e4808fc0891c7e6cfcf71fe1a9fe26810c7280ef768f4ed" dependencies = [ "alloy-primitives 0.7.7", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.4", "c-kzg", "once_cell", "serde", "sha2 0.10.8", ] +[[package]] +name = "alloy-genesis" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8429cf4554eed9b40feec7f4451113e76596086447550275e3def933faf47ce3" +dependencies = [ + "alloy-primitives 0.8.10", + "alloy-serde 0.4.2", + "serde", +] + [[package]] name = "alloy-json-abi" version = "0.7.7" @@ -252,7 +263,7 @@ dependencies = [ "alloy-json-rpc 0.1.4", "alloy-primitives 0.7.7", "alloy-rpc-types-eth", - "alloy-serde", + "alloy-serde 0.1.4", "alloy-signer", "alloy-sol-types 0.7.7", "async-trait", @@ -261,6 +272,23 @@ dependencies = [ "thiserror", ] +[[package]] +name = "alloy-node-bindings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f1334a738aa1710cb8227441b3fcc319202ce78e967ef37406940242df4a454" +dependencies = [ + "alloy-genesis", + "alloy-primitives 0.8.10", + "k256", + "rand", + "serde_json", + "tempfile", + "thiserror", + "tracing", + "url", +] + [[package]] name = "alloy-primitives" version = "0.7.7" @@ -440,7 +468,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "184a7a42c7ba9141cc9e76368356168c282c3bc3d9e5d78f3556bdfe39343447" dependencies = [ "alloy-rpc-types-eth", - "alloy-serde", + "alloy-serde 0.1.4", ] [[package]] @@ -453,7 +481,7 @@ dependencies = [ "alloy-eips", "alloy-primitives 0.7.7", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.4", "alloy-sol-types 0.7.7", "itertools 0.13.0", "serde", @@ -472,6 +500,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "alloy-serde" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dff0ab1cdd43ca001e324dc27ee0e8606bd2161d6623c63e0e0b8c4dfc13600" +dependencies = [ + "alloy-primitives 0.8.10", + "serde", + "serde_json", +] + [[package]] name = "alloy-signer" version = "0.1.4" @@ -1888,12 +1927,29 @@ version = "0.1.0" name = "blueprint-examples" version = "0.1.1" dependencies = [ + "alloy-consensus", + "alloy-contract", + "alloy-json-abi", + "alloy-network", + "alloy-node-bindings", + "alloy-primitives 0.7.7", + "alloy-provider", + "alloy-pubsub", + "alloy-rpc-client 0.4.2", + "alloy-rpc-types", + "alloy-rpc-types-eth", + "alloy-signer", + "alloy-signer-local", + "alloy-sol-types 0.7.7", + "alloy-transport 0.1.4", + "alloy-transport-http 0.1.4", "blueprint-metadata", "color-eyre", "gadget-sdk", "reqwest 0.12.9", "serde_json", "tracing", + "uuid 1.11.0", ] [[package]] diff --git a/blueprints/examples/Cargo.toml b/blueprints/examples/Cargo.toml index c57c1de3..7dd66625 100644 --- a/blueprints/examples/Cargo.toml +++ b/blueprints/examples/Cargo.toml @@ -15,7 +15,24 @@ color-eyre = { workspace = true } reqwest = { workspace = true } serde_json = { workspace = true } tracing = { workspace = true } +uuid = { workspace = true } +alloy-primitives = "0.7.2" +alloy-json-abi = "0.7.2" +alloy-sol-types = "0.7.2" +alloy-rpc-client = "0.4.2" +alloy-rpc-types = { version = "0.1" } +alloy-rpc-types-eth = { version = "0.1" } +alloy-provider = { version = "0.1", default-features = false, features = ["reqwest", "ws"] } +alloy-pubsub = { version = "0.1" } +alloy-signer = { version = "0.1" } +alloy-signer-local = { version = "0.1" } +alloy-network = { version = "0.1" } +alloy-node-bindings = "0.4.2" +alloy-contract = { version = "0.1" } +alloy-consensus = { version = "0.1" } +alloy-transport = { version = "0.1" } +alloy-transport-http = { version = "0.1" } [build-dependencies] blueprint-metadata = { workspace = true } diff --git a/blueprints/examples/src/examples/sequential_event_listener.rs b/blueprints/examples/src/examples/sequential_event_listener.rs index 016adf87..b94c41da 100644 --- a/blueprints/examples/src/examples/sequential_event_listener.rs +++ b/blueprints/examples/src/examples/sequential_event_listener.rs @@ -1,6 +1,3 @@ -use crate::event_listener::EventListener; -use crate::store::LocalDatabase; -use crate::{error, Error}; use alloy_contract::ContractInstance; use alloy_contract::Event; use alloy_provider::Provider; diff --git a/blueprints/examples/src/main.rs b/blueprints/examples/src/main.rs index aaa28a32..8dcde172 100644 --- a/blueprints/examples/src/main.rs +++ b/blueprints/examples/src/main.rs @@ -1,5 +1,5 @@ use blueprint::examples::*; -use example_blueprint as blueprint; +use blueprint_examples as blueprint; use gadget_sdk::info; use gadget_sdk::runners::{tangle::TangleConfig, BlueprintRunner};