diff --git a/.github/workflows/calimero_node_linux.yml b/.github/workflows/calimero_node_linux.yml deleted file mode 100644 index 9b27c8238..000000000 --- a/.github/workflows/calimero_node_linux.yml +++ /dev/null @@ -1,232 +0,0 @@ -name: Build and Upload Meroctl for Linux - -on: - push: - branches: - - "**" - paths: - - Cargo.toml - - Cargo.lock - - "crates/**" - pull_request: - types: [closed] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu] - - outputs: - artifact_path: ${{ steps.compress.outputs.artifact_path }} - target: ${{ matrix.target }} - version: ${{ steps.extract_version.outputs.version }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - # Install Node.js (version 20) and pnpm - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '20' - - - name: Install pnpm - run: npm install -g pnpm - - # Install and build node-ui - - name: Install node-ui dependencies with pnpm - run: pnpm install --prefix ./node-ui - - - name: Build node-ui - run: pnpm --filter ./node-ui run build - - - name: Setup rust toolchain - run: rustup toolchain install stable --profile minimal - - - name: Setup rust cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-meroctl-${{ matrix.target }} - - - name: Install target for ${{ matrix.target }} - run: rustup target add ${{ matrix.target }} - - - name: Install dependencies for cross-compilation - run: | - sudo apt-get update - sudo apt-get install -y \ - gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ - libstdc++-11-dev-arm64-cross \ - zlib1g-dev \ - libsnappy-dev \ - libbz2-dev \ - liblz4-dev \ - libzstd-dev \ - clang \ - libc6-dev-arm64-cross - - - name: Download and set up OpenSSL for cross-compilation - if: matrix.target == 'aarch64-unknown-linux-gnu' - run: | - wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz - tar -xzf openssl-1.1.1k.tar.gz - cd openssl-1.1.1k - ./Configure linux-aarch64 --prefix=$HOME/openssl-aarch64 --cross-compile-prefix=aarch64-linux-gnu- - make -j$(nproc) - make install_sw - cd .. - echo "OPENSSL_DIR=$HOME/openssl-aarch64" >> $GITHUB_ENV - echo "OPENSSL_LIB_DIR=$HOME/openssl-aarch64/lib" >> $GITHUB_ENV - echo "OPENSSL_INCLUDE_DIR=$HOME/openssl-aarch64/include" >> $GITHUB_ENV - echo "PKG_CONFIG_PATH=$HOME/openssl-aarch64/lib/pkgconfig" >> $GITHUB_ENV - echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV - echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV - echo "OPENSSL_STATIC=1" >> $GITHUB_ENV - - - name: Install and configure Zig for aarch64 cross-compilation - if: matrix.target == 'aarch64-unknown-linux-gnu' - run: | - wget https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz - tar -xf zig-linux-x86_64-0.11.0.tar.xz - echo "ZIG_PATH=$PWD/zig-linux-x86_64-0.11.0/zig" >> $GITHUB_ENV - echo "$PWD/zig-linux-x86_64-0.11.0" >> $GITHUB_PATH - zig-linux-x86_64-0.11.0/zig version - echo "CARGO_ZIGBUILD_ZIG=$PWD/zig-linux-x86_64-0.11.0/zig" >> $GITHUB_ENV - cargo install cargo-zigbuild - - - name: Build meroctl for AArch64 - if: matrix.target == 'aarch64-unknown-linux-gnu' - env: - C_INCLUDE_PATH: /usr/lib/gcc-cross/aarch64-linux-gnu/11/include - CXX_INCLUDE_PATH: /usr/lib/gcc-cross/aarch64-linux-gnu/11/include/c++ - OPENSSL_DIR: ${{ env.OPENSSL_DIR }} - OPENSSL_LIB_DIR: ${{ env.OPENSSL_LIB_DIR }} - OPENSSL_INCLUDE_DIR: ${{ env.OPENSSL_INCLUDE_DIR }} - PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }} - PKG_CONFIG_ALLOW_CROSS: ${{ env.PKG_CONFIG_ALLOW_CROSS }} - PKG_CONFIG_SYSROOT_DIR: ${{ env.PKG_CONFIG_SYSROOT_DIR }} - OPENSSL_STATIC: ${{ env.OPENSSL_STATIC }} - RUSTFLAGS: "-C link-arg=-lstdc++ -C link-arg=-lpthread -C link-arg=-lc" - run: cargo zigbuild -p meroctl --release --target ${{ matrix.target }} - - - name: Build meroctl for x86_64 - if: matrix.target == 'x86_64-unknown-linux-gnu' - run: cargo build -p meroctl --release --target ${{ matrix.target }} - - - name: Extract version - id: extract_version - run: | - VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "meroctl") | .version') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Compress artifact using gzip - id: compress - run: | - tar -czf meroctl_${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release meroctl - echo "artifact_path=meroctl_${{ matrix.target }}.tar.gz" >> $GITHUB_OUTPUT - echo "target=${{ matrix.target }}" >> $GITHUB_OUTPUT - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: meroctl_${{ matrix.target }}.tar.gz - path: meroctl_${{ matrix.target }}.tar.gz - retention-days: 2 - - upload_branch_artifact: - runs-on: ubuntu-latest - needs: build - strategy: - matrix: - target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu] - if: ${{ github.ref != 'refs/heads/master' }} - - steps: - - name: Download Artifact - uses: actions/download-artifact@v4 - with: - name: meroctl_${{ matrix.target }}.tar.gz - - - name: Sanitize ref name - id: sanitize - run: | - sanitized_ref_name=$(echo "${GITHUB_REF_NAME}" | sed 's/[^a-zA-Z0-9_-]/-/g; s/^-*//; s/-*$//') - echo "sanitized_ref_name=${sanitized_ref_name}" >> $GITHUB_OUTPUT - - create_release: - runs-on: ubuntu-latest - needs: build - if: ${{ github.ref == 'refs/heads/master' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') }} - outputs: - release_exists: ${{ steps.check_release.outputs.release_exists }} - version: ${{ needs.build.outputs.version }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Check if release exists - id: check_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - if gh release view "v$VERSION" >/dev/null 2>&1; then - echo "release_exists=true" >> $GITHUB_OUTPUT - else - echo "release_exists=false" >> $GITHUB_OUTPUT - fi - - - name: Create release if it does not exist - if: steps.check_release.outputs.release_exists == 'false' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - gh release create "v$VERSION" --title "Release v$VERSION" --notes "Release for version $VERSION" - - upload_release_artifact: - runs-on: ubuntu-latest - needs: [build, create_release] - strategy: - matrix: - target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu] - if: ${{ github.ref == 'refs/heads/master' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Download Artifact - uses: actions/download-artifact@v4 - with: - name: meroctl_${{ matrix.target }}.tar.gz - - - name: Check if artifact exists in release - id: check_artifact - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - TARGET=${{ matrix.target }} - ARTIFACT_NAME="meroctl_${TARGET}.tar.gz" - ASSET_ID=$(gh api \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - /repos/${{ github.repository }}/releases/tags/v$VERSION \ - | jq -r ".assets[] | select(.name == \"$ARTIFACT_NAME\") | .id") - if [[ -n "$ASSET_ID" ]]; then - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "exists=false" >> $GITHUB_OUTPUT - fi - - - name: Upload artifact to release - if: steps.check_artifact.outputs.exists == 'false' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - TARGET=${{ matrix.target }} - gh release upload "v$VERSION" meroctl_${TARGET}.tar.gz diff --git a/.github/workflows/calimero_node_macos.yml b/.github/workflows/calimero_node_macos.yml deleted file mode 100644 index 8a3986adf..000000000 --- a/.github/workflows/calimero_node_macos.yml +++ /dev/null @@ -1,184 +0,0 @@ -name: Build and Upload Meroctl for MacOS - -on: - push: - branches: - - "**" - paths: - - Cargo.toml - - Cargo.lock - - "crates/**" - pull_request: - types: [closed] - -jobs: - build: - runs-on: macos-latest - strategy: - matrix: - target: [x86_64-apple-darwin, aarch64-apple-darwin] - - outputs: - artifact_path: ${{ steps.compress.outputs.artifact_path }} - target: ${{ matrix.target }} - version: ${{ steps.extract_version.outputs.version }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - # Install Node.js (version 20) and pnpm - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '20' - - - name: Install pnpm - run: npm install -g pnpm - - # Install and build node-ui - - name: Install node-ui dependencies with pnpm - run: pnpm install --prefix ./node-ui - - - name: Build node-ui - run: pnpm --filter ./node-ui run build - - - name: Install rustup and Rust toolchain - run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - source $HOME/.cargo/env - rustup toolchain install stable - rustup default stable - - - name: Setup rust toolchain - run: rustup toolchain install stable --profile minimal - - - name: Setup rust cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-meroctl-${{ matrix.target }} - - - name: Install target for ${{ matrix.target }} - run: rustup target add ${{ matrix.target }} - - - name: Build meroctl binary - run: cargo build -p meroctl --release --target ${{ matrix.target }} - - - name: Extract version - id: extract_version - run: | - VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "meroctl") | .version') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Compress artifact using gzip - id: compress - run: | - mkdir -p release - cp target/${{ matrix.target }}/release/meroctl release/ - tar -czf meroctl_${{ matrix.target }}.tar.gz -C release meroctl - echo "artifact_path=meroctl_${{ matrix.target }}.tar.gz" >> $GITHUB_OUTPUT - echo "target=${{ matrix.target }}" >> $GITHUB_OUTPUT - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: meroctl_${{ matrix.target }}.tar.gz - path: meroctl_${{ matrix.target }}.tar.gz - retention-days: 2 - - upload_branch_artifact: - runs-on: ubuntu-latest - needs: build - strategy: - matrix: - target: [x86_64-apple-darwin, aarch64-apple-darwin] - if: ${{ github.ref != 'refs/heads/master' }} - - steps: - - name: Download Artifact - uses: actions/download-artifact@v4 - with: - name: meroctl_${{ matrix.target }}.tar.gz - - - name: Sanitize ref name - id: sanitize - run: | - sanitized_ref_name=$(echo "${GITHUB_REF_NAME}" | sed 's/[^a-zA-Z0-9_-]/-/g; s/^-*//; s/-*$//') - echo "sanitized_ref_name=${sanitized_ref_name}" >> $GITHUB_OUTPUT - - create_release: - runs-on: ubuntu-latest - needs: build - strategy: - matrix: - target: [x86_64-apple-darwin, aarch64-apple-darwin] - if: ${{ github.ref == 'refs/heads/master' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Check if release exists - id: check_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - if gh release view "v$VERSION" >/dev/null 2>&1; then - echo "release_exists=true" >> $GITHUB_ENV - else - echo "release_exists=false" >> $GITHUB_ENV - fi - - - name: Create release if it does not exist - if: env.release_exists == 'false' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - gh release create "v$VERSION" --title "Release v$VERSION" --notes "Release for version $VERSION" - - upload_release_artifact: - runs-on: ubuntu-latest - needs: [build, create_release] - strategy: - matrix: - target: [x86_64-apple-darwin, aarch64-apple-darwin] - if: ${{ github.ref == 'refs/heads/master' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master') }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Download Artifact - uses: actions/download-artifact@v4 - with: - name: meroctl_${{ matrix.target }}.tar.gz - - - name: Check if artifact exists in release - id: check_artifact - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - TARGET=${{ matrix.target }} - ARTIFACT_NAME="meroctl_${TARGET}.tar.gz" - ASSET_ID=$(gh api \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - /repos/${{ github.repository }}/releases/tags/v$VERSION \ - | jq -r ".assets[] | select(.name == \"$ARTIFACT_NAME\") | .id") - echo "ASSET_ID=$ASSET_ID" - if [[ -n "$ASSET_ID" ]]; then - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "exists=false" >> $GITHUB_OUTPUT - fi - - - name: Upload artifact to release - if: steps.check_artifact.outputs.exists == 'false' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION=${{ needs.build.outputs.version }} - TARGET=${{ matrix.target }} - gh release upload "v$VERSION" meroctl_${TARGET}.tar.gz diff --git a/.github/workflows/rust_binaries_release.yml b/.github/workflows/rust_binaries_release.yml new file mode 100644 index 000000000..9350a3a2c --- /dev/null +++ b/.github/workflows/rust_binaries_release.yml @@ -0,0 +1,212 @@ +name: Rust binaries release + +on: + push: + branches: + - master + - 'releases/**' + - 'hotfix/**' + pull_request: + types: [opened, synchronize, reopened] + branches: + - master + +jobs: + binary_matrix: + runs-on: ubuntu-latest + outputs: + binaries: ${{ steps.setup_matrix.outputs.binaries }} + steps: + - name: Setup matrix + id: setup_matrix + run: | + echo 'binaries=["merod", "meroctl"]' >> "$GITHUB_OUTPUT" + + build: + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + - os: macos-latest + target: x86_64-apple-darwin + - os: macos-latest + target: aarch64-apple-darwin + runs-on: ${{ matrix.os }} + needs: binary_matrix + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Craft cargo arguments + id: cargo_args + run: | + binaries=$(echo '${{ needs.binary_matrix.outputs.binaries }}' | jq -r 'join(" ") | split(" ") | map("-p " + .) | join(" ")') + args="$binaries --release --target ${{ matrix.target }}" + echo "Cargo build arguments: $args" + echo args="$args" >> "$GITHUB_OUTPUT" + + - name: Install rustup and Rust toolchain + if: matrix.os == 'macos-latest' + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source $HOME/.cargo/env + rustup toolchain install stable + rustup default stable + + - name: Setup rust toolchain + run: rustup toolchain install stable --profile minimal + + - name: Setup rust cache + uses: Swatinem/rust-cache@v2 + with: + key: rust-binaries-${{ runner.os }}-${{ matrix.target }} + + - name: Install target for ${{ matrix.target }} + run: rustup target add ${{ matrix.target }} + + - name: Install dependencies for cross-compilation + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y \ + gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ + libstdc++-11-dev-arm64-cross \ + zlib1g-dev \ + libsnappy-dev \ + libbz2-dev \ + liblz4-dev \ + libzstd-dev \ + clang \ + libc6-dev-arm64-cross + + - name: Download and set up OpenSSL for cross-compilation + if: matrix.target == 'aarch64-unknown-linux-gnu' + run: | + wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz + tar -xzf openssl-1.1.1k.tar.gz + cd openssl-1.1.1k + ./Configure linux-aarch64 --prefix=$HOME/openssl-aarch64 --cross-compile-prefix=aarch64-linux-gnu- + make -j$(nproc) + make install_sw + cd .. + echo "OPENSSL_DIR=$HOME/openssl-aarch64" >> $GITHUB_ENV + echo "OPENSSL_LIB_DIR=$HOME/openssl-aarch64/lib" >> $GITHUB_ENV + echo "OPENSSL_INCLUDE_DIR=$HOME/openssl-aarch64/include" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=$HOME/openssl-aarch64/lib/pkgconfig" >> $GITHUB_ENV + echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV + echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV + echo "OPENSSL_STATIC=1" >> $GITHUB_ENV + + - name: Install and configure Zig for aarch64 cross-compilation + if: matrix.target == 'aarch64-unknown-linux-gnu' + run: | + wget https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz + tar -xf zig-linux-x86_64-0.11.0.tar.xz + echo "ZIG_PATH=$PWD/zig-linux-x86_64-0.11.0/zig" >> $GITHUB_ENV + echo "$PWD/zig-linux-x86_64-0.11.0" >> $GITHUB_PATH + zig-linux-x86_64-0.11.0/zig version + echo "CARGO_ZIGBUILD_ZIG=$PWD/zig-linux-x86_64-0.11.0/zig" >> $GITHUB_ENV + cargo install cargo-zigbuild + + - name: Build binaries + if: matrix.target == 'aarch64-unknown-linux-gnu' + env: + C_INCLUDE_PATH: /usr/lib/gcc-cross/aarch64-linux-gnu/11/include + CXX_INCLUDE_PATH: /usr/lib/gcc-cross/aarch64-linux-gnu/11/include/c++ + OPENSSL_DIR: ${{ env.OPENSSL_DIR }} + OPENSSL_LIB_DIR: ${{ env.OPENSSL_LIB_DIR }} + OPENSSL_INCLUDE_DIR: ${{ env.OPENSSL_INCLUDE_DIR }} + PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }} + PKG_CONFIG_ALLOW_CROSS: ${{ env.PKG_CONFIG_ALLOW_CROSS }} + PKG_CONFIG_SYSROOT_DIR: ${{ env.PKG_CONFIG_SYSROOT_DIR }} + OPENSSL_STATIC: ${{ env.OPENSSL_STATIC }} + RUSTFLAGS: '-C link-arg=-lstdc++ -C link-arg=-lpthread -C link-arg=-lc' + run: cargo zigbuild ${{ steps.cargo_args.outputs.args }} + + - name: Build binaries + if: matrix.target != 'aarch64-unknown-linux-gnu' + run: cargo build ${{ steps.cargo_args.outputs.args }} + + - name: Compress artifacts using gzip + run: | + mkdir -p artifacts + echo '${{ needs.binary_matrix.outputs.binaries }}' | jq -r '.[]' | while read binary; do + tar -czf artifacts/"$binary"_${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release "$binary" + done + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: artifacts-${{ matrix.target }} + path: artifacts/* + retention-days: 2 + + release: + runs-on: ubuntu-latest + needs: [binary_matrix, build] + strategy: + matrix: + binary: ${{ fromJSON(needs.binary_matrix.outputs.binaries) }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + path: artifacts/ + merge-multiple: true + + - name: Get version info + id: version_info + shell: bash + run: | + if [ "${{ github.ref }}" == "refs/heads/master" ]; then + version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "${{ matrix.binary }}") | .version') + version="${{ matrix.binary }}-$version" + echo "Master version: $version" + + if gh release view "v$VERSION" >/dev/null 2>&1; then + echo "Master release for this version already exists" + echo "release_required=false" >> $GITHUB_OUTPUT + else + echo "New master release required" + echo "release_required=true" >> $GITHUB_OUTPUT + fi + echo "prerelease=false" >> $GITHUB_OUTPUT + echo "overwrite=false">> $GITHUB_OUTPUT + echo "version=$version" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" == "pull_request" ] && [[ "${{ github.ref }}" == refs/heads/prerelease/* ]]; then + version="prerelease-${{ github.event.number }}" + echo "Prerelease version: $version" + + echo "release_required=true" >> $GITHUB_OUTPUT + echo "prerelease=true" >> $GITHUB_OUTPUT + echo "overwrite=true">> $GITHUB_OUTPUT + echo "version=$version" >> $GITHUB_OUTPUT + else + echo "This is not a master branch or a prerelease PR" + echo "release_required=false" >> $GITHUB_OUTPUT + fi + + - name: Remove other binaries from artifacts + if: steps.version_info.outputs.release_required == 'true' + run: | + ls -al artifacts/ + find artifacts/ -type f ! -name '${{ matrix.binary }}*' -exec rm {} + + ls -al artifacts/ + + - name: Upload binaries to release + if: steps.version_info.outputs.release_required == 'true' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: artifacts/* + file_glob: true + tag: ${{ steps.version_info.outputs.version }} + prerelease: ${{ steps.version_info.outputs.prerelease }} + overwrite: ${{ steps.version_info.outputs.overwrite }} diff --git a/crates/context/config/src/client/env/proxy/types/starknet.rs b/crates/context/config/src/client/env/proxy/types/starknet.rs index 28672c1c7..8eec5bfda 100644 --- a/crates/context/config/src/client/env/proxy/types/starknet.rs +++ b/crates/context/config/src/client/env/proxy/types/starknet.rs @@ -7,19 +7,19 @@ use crate::{ Proposal, ProposalAction, ProposalApprovalWithSigner, ProposalWithApprovals, ProxyMutateRequest, }; -#[derive(Debug, Encode, Decode)] +#[derive(Clone, Copy, Debug, Encode, Decode)] pub struct FeltPair { pub high: Felt, pub low: Felt, } -#[derive(Debug, Encode, Decode)] +#[derive(Clone, Copy, Debug, Encode, Decode)] pub struct StarknetIdentity(pub FeltPair); -#[derive(Debug, Encode, Decode)] +#[derive(Clone, Copy, Debug, Encode, Decode)] pub struct StarknetProposalId(pub FeltPair); -#[derive(Debug, Encode, Decode)] +#[derive(Clone, Copy, Debug, Encode, Decode)] pub struct StarknetU256(pub FeltPair); #[derive(Debug, Encode, Decode)] @@ -29,7 +29,7 @@ pub struct StarknetProposal { pub actions: StarknetProposalActionWithArgs, } -#[derive(Debug, Encode, Decode)] +#[derive(Clone, Copy, Debug, Encode, Decode)] pub struct StarknetConfirmationRequest { pub proposal_id: StarknetProposalId, pub signer_id: StarknetIdentity, @@ -64,7 +64,7 @@ pub struct StarknetSignedRequest { pub signature_s: Felt, } -#[derive(Debug, Decode)] +#[derive(Clone, Copy, Debug, Decode)] pub struct StarknetProposalWithApprovals { pub proposal_id: StarknetProposalId, pub num_approvals: Felt, @@ -368,7 +368,7 @@ impl FeltWriter for CallData { } } -#[derive(Debug, Encode)] +#[derive(Clone, Copy, Debug, Encode)] pub struct StarknetProposalsRequest { pub offset: Felt, pub length: Felt, diff --git a/crates/server/src/admin/handlers/proposals.rs b/crates/server/src/admin/handlers/proposals.rs index 2b81080a1..a150e3895 100644 --- a/crates/server/src/admin/handlers/proposals.rs +++ b/crates/server/src/admin/handlers/proposals.rs @@ -51,13 +51,13 @@ pub struct Transfer { pub(crate) amount: String, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SetNumApprovals { pub(crate) num_of_approvals: u32, } -#[derive(Debug, Deserialize, Serialize)] +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] pub struct SetActiveProposalsLimit { pub(crate) active_proposals_limit: u32, }