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

Remove references to gateway in-code #57

Merged
merged 9 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
26 changes: 7 additions & 19 deletions .github/workflows/ghcr-image.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,44 @@
name: Docker Image Build Push
insipx marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
tags:
- "*"

concurrency:
group: "docker-image"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate repository name
run: |
echo "REPOSITORY_PATH=$( echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' )" >> ${GITHUB_ENV}
echo "REPOSITORY_SHA=$( echo ${GITHUB_SHA} | cut -c 1-8 )" >> ${GITHUB_ENV}
-
name: Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and Push
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
file: ./prod/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ github.ref_name }}
CARGO_INCREMENTAL=0
build-args: "VERSION=${{ github.ref_name }}\nCARGO_INCREMENTAL=0 \n"
tags: |
ghcr.io/${{ env.REPOSITORY_PATH }}:v${{ github.ref_name }}
ghcr.io/${{ env.REPOSITORY_PATH }}:${{ env.REPOSITORY_SHA }}
ghcr.io/${{ env.REPOSITORY_PATH }}:latest
-
name: GitHub Release
- name: GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/prod-ci-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build Prod Image CI

on:
workflow_dispatch:
pull_request:
Expand All @@ -8,28 +7,23 @@ on:
push:
branches:
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Prod Image CI
uses: docker/build-push-action@v3
with:
context: .
file: prod/Dockerfile
file: prod/Dockerfile
platforms: linux/amd64
push: false
build-args: |
VERSION=latest
CARGO_INCREMENTAL=0

61 changes: 35 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[workspace]

members = [
"xps-gateway",
"xps",
"lib-xps",
"messaging",
"inbox",
"registry",
"gateway-types",
"xps-types",
]

exclude = [ ]
Expand All @@ -28,6 +29,6 @@ thiserror = "1.0"
ethers = { version = "2.0.11", features = ["abigen"] }
ctor = "0.2"
lib-didethresolver = { git = "https://github.com/xmtp/didethresolver", branch = "main" }
gateway-types = { path = "./gateway-types" }
xps-types = { path = "./xps-types" }
rustc-hex = "2.1"
hex = "0.4"
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN sudo apt update && sudo apt install -y pkg-config openssl libssl-dev

COPY --from=ghcr.io/xmtp/foundry:latest /usr/local/bin/anvil /usr/local/bin/anvil

ARG PROJECT=xps-gateway
ARG PROJECT=xps
WORKDIR /workspaces/${PROJECT}
COPY --chown=xmtp:xmtp . .

Expand All @@ -20,17 +20,17 @@ RUN cargo check
RUN cargo fmt --check
RUN cargo clippy --all-features --no-deps -- -D warnings
RUN cargo test --workspace --all-features
RUN CARGO_TARGET_DIR=/workspaces/${PROJECT}/target cargo install --path xps-gateway --bin=xps_gateway --root=~${USER}/.cargo/
RUN valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ~${USER}/.cargo/bin/xps_gateway --help
RUN CARGO_TARGET_DIR=/workspaces/${PROJECT}/target cargo install --path xps --bin=xps --root=~${USER}/.cargo/
RUN valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ~${USER}/.cargo/bin/xps --help

CMD RUST_LOG=info cargo run -- --host 0.0.0.0 --port 8080

LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="rustdev" \
org.label-schema.description="Rust Development Container" \
org.label-schema.url="https://github.com/xmtp/xps-gateway" \
org.label-schema.url="https://github.com/xmtp/xps" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="[email protected]:xmtp/xps-gateway.git" \
org.label-schema.vcs-url="[email protected]:xmtp/xps.git" \
org.label-schema.vendor="xmtp" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0" \
Expand Down
5 changes: 2 additions & 3 deletions xps-gateway/Cargo.toml → lib-xps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "xps_gateway"
name = "lib-xps"
version = "0.1.0"
edition = "2021"
resolver = "2"
Expand All @@ -19,9 +19,8 @@ thiserror.workspace = true
ethers = { workspace = true, features = ["ws"] }
ctor.workspace = true
lib-didethresolver.workspace = true
gateway-types.workspace = true
xps-types.workspace = true
hex.workspace = true
clap = { version = "4.4.18", features = ["derive"] }
rand = "0.8.5"
tokio-stream = { version = "0.1", features = ["net"] }
registry = { path = "../registry" }
Expand Down
2 changes: 1 addition & 1 deletion xps-gateway/src/lib.rs → lib-xps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ethers::{
abi::Address,
providers::{Provider, Ws},
};
use gateway_types::DID_ETH_REGISTRY;
use xps_types::DID_ETH_REGISTRY;
use jsonrpsee::server::Server;
use std::str::FromStr;

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions xps-gateway/src/rpc/api.rs → lib-xps/src/rpc/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use ethers::core::types::Signature;
use ethers::prelude::*;
use jsonrpsee::{proc_macros::rpc, types::ErrorObjectOwned};

use gateway_types::Message;
use gateway_types::{GrantInstallationResult, KeyPackageResult};
use xps_types::Message;
use xps_types::{GrantInstallationResult, KeyPackageResult};
use lib_didethresolver::types::XmtpAttribute;

/// XPS JSON-RPC Interface Methods
Expand Down
4 changes: 2 additions & 2 deletions xps-gateway/src/rpc/methods.rs → lib-xps/src/rpc/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use jsonrpsee::types::error::ErrorCode;
use async_trait::async_trait;
use ethers::prelude::*;
use ethers::{core::types::Signature, providers::Middleware};
use gateway_types::{GrantInstallationResult, KeyPackageResult};
use xps_types::{GrantInstallationResult, KeyPackageResult};
use jsonrpsee::types::ErrorObjectOwned;
use lib_didethresolver::types::XmtpAttribute;
use rand::{rngs::StdRng, SeedableRng};
use std::sync::Arc;
use thiserror::Error;

use gateway_types::Message;
use xps_types::Message;
use registry::{error::ContactOperationError, ContactOperations};

// DEFAULT_ATTRIBUTE_VALIDITY is the hard-coded value we use for the validity of the attributes we set.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use lib_didethresolver::{
did_registry::RegistrySignerExt,
types::{DidUrl, KeyEncoding, XmtpAttribute, XmtpKeyPurpose, NULL_ADDRESS},
};
use xps_gateway::rpc::*;
use lib_xps::rpc::*;

use ethers::types::{Address, U256};
use gateway_types::{Message, Status};
use xps_types::{Message, Status};

use integration_util::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use std::{
use tokio::time::timeout as timeout_tokio;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Registry};

use xps_gateway::{
use lib_xps::{
types::{GatewayContext, GatewaySigner},
XpsMethods, XpsServer,
};
Expand Down
10 changes: 5 additions & 5 deletions prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ RUN cargo clippy --all-features --no-deps -- -D warnings
RUN cargo test --lib
RUN cargo test --doc
RUN cargo build --release
RUN CARGO_TARGET_DIR=/build/target cargo install --root /xmtp --path xps-gateway --bin=xps_gateway
RUN strip /xmtp/bin/xps_gateway
RUN CARGO_TARGET_DIR=/build/target cargo install --root /xmtp --path xps --bin=xps
RUN strip /xmtp/bin/xps
RUN cp CHANGELOG.md /xmtp/
RUN cp LICENSE /xmtp/

Expand All @@ -44,11 +44,11 @@ EXPOSE 8080
ENV USER=none
USER none

CMD ["/xmtp/bin/xps_gateway", "--host", "0.0.0.0", "--port", "8080"]
CMD ["/xmtp/bin/xps", "--host", "0.0.0.0", "--port", "8080"]

LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="xps-gateway" \
org.label-schema.description="xps-gateway" \
org.label-schema.name="xps" \
org.label-schema.description="xps" \
org.label-schema.url="https://github.com/xmtp/xps-gateway" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="[email protected]:xmtp/xps-gateway.git" \
Expand Down
2 changes: 1 addition & 1 deletion registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tracing.workspace = true
tokio.workspace = true
async-trait.workspace = true
ethers = { workspace = true, features = ["ws"] }
gateway-types.workspace = true
xps-types.workspace = true
lib-didethresolver.workspace = true
rustc-hex.workspace = true
thiserror.workspace = true
2 changes: 1 addition & 1 deletion registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::str::FromStr;
use error::ContactOperationError;
use ethers::types::{H160, U256};
use ethers::{core::types::Signature, providers::Middleware, types::Address};
use gateway_types::{GrantInstallationResult, KeyPackageResult, Status};
use xps_types::{GrantInstallationResult, KeyPackageResult, Status};
use lib_didethresolver::types::VerificationMethodProperties;
use lib_didethresolver::Resolver;
use lib_didethresolver::{did_registry::DIDRegistry, types::XmtpAttribute};
Expand Down
2 changes: 1 addition & 1 deletion gateway-types/Cargo.toml → xps-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "gateway-types"
name = "xps-types"
version = "0.1.0"
edition = "2021"

Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions xps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "xps"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow.workspace = true
tokio.workspace = true
lib-xps = { path = "../lib-xps" }
clap = { version = "4.4.18", features = ["derive"] }
Loading
Loading