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

Use agoric's synchetic chain image #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ func rawDockerfile(
case DockerfileTypeImported:
return dockerfileEmbeddedOrLocal("imported/Dockerfile", dockerfile.Imported)

case DockerfileTypeAgoric:
return dockerfileEmbeddedOrLocal("agoric/Dockerfile", dockerfile.Agoric)

case DockerfileTypeCargo:
if useBuildKit {
return dockerfileEmbeddedOrLocal("cargo/Dockerfile", dockerfile.Cargo)
Expand Down
1 change: 1 addition & 0 deletions builder/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type DockerfileType string

const (
DockerfileTypeCosmos DockerfileType = "cosmos"
DockerfileTypeAgoric DockerfileType = "agoric"
DockerfileTypeAvalanche DockerfileType = "avalanche"
DockerfileTypeCargo DockerfileType = "cargo"
DockerfileTypeImported DockerfileType = "imported"
Expand Down
73 changes: 3 additions & 70 deletions chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,76 +11,9 @@

# Agoric-sdk
- name: agoric
dockerfile: cargo
github-organization: Agoric
github-repo: agoric-sdk
build-env:
- LEDGER_ENABLED=false
build-target: |
apt update && apt install -y python3 g++

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 18
npm i -g yarn

set -eux
cd golang/cosmos
export CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} CC=${ARCH}-linux-gnu-gcc CXX=${ARCH}-linux-gnu-g++
COMMIT=$(git log -1 --format='%H')
COMMON_LDFLAGS="-X github.com/cosmos/cosmos-sdk/version.Name=agoric \
-X github.com/cosmos/cosmos-sdk/version.AppName=agd \
-X github.com/cosmos/cosmos-sdk/version.Version=$VERSION \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$BUILD_TAGS" \
-X github.com/cosmos/cosmos-sdk/version.Commit=$COMMIT"

# Build daemon lib
go build -v -mod=readonly -tags "$BUILD_TAGS" -ldflags "$COMMON_LDFLAGS" -buildmode=c-shared -o build/libagcosmosdaemon.so ./cmd/libdaemon/main.go

# Build helper
LDFLAGS_HELPER="$COMMON_LDFLAGS -X github.com/cosmos/cosmos-sdk/version.AppName=ag-cosmos-helper"
go build -v -mod=readonly -tags "$BUILD_TAGS" -ldflags "$LDFLAGS_HELPER" -o ../../bin/ag-cosmos-helper ./cmd/helper

# Build agd
go build -v -mod=readonly -tags "$BUILD_TAGS" -ldflags "$COMMON_LDFLAGS" -o ../../bin/agd ./cmd/agd

# Build nodejs swingset kernel
npm install node-addon-api --legacy-peer-deps
export CC_host=gcc CXX_host=g++
GYP_DEBUG="--arch=${TARGETARCH}" make node-compile-gyp
# cp binding.gyp.in binding.gyp
# /root/.nvm/versions/node/*/lib/node_modules/npm/bin/node-gyp-bin/node-gyp configure build --arch=${TARGETARCH}
cd ../../packages
rm -rf ui-components web-components wallet-connection wallet web-components
cd ..
npm_config_arch=${TARGETARCH} yarn
npm_config_arch=${TARGETARCH} yarn build

# Move to final location
mkdir /agoric-sdk
mv packages node_modules bin golang /agoric-sdk
directories:
- /agoric-sdk
- /root/.nvm/versions/node
libraries:
- /agoric-sdk/golang/cosmos/build/libagcosmosdaemon.so
target-libraries:
- /lib/${ARCH}-linux-gnu/libdl.so.2
- /lib/${ARCH}-linux-gnu/libm.so.6
- /usr/lib/${ARCH}-linux-gnu/libstdc++.so.6
- /usr/lib/gcc/${ARCH}-linux-gnu/10/libgcc_s.so
- /lib/${ARCH}-linux-gnu/libgcc_s.so.1
final-image: |
set -eux
ln -s /agoric-sdk/bin/agd /bin/agd
ln -s /agoric-sdk/bin/ag-cosmos-helper /bin/ag-cosmos-helper
ln -s /agoric-sdk/packages/cosmic-swingset/bin/ag-chain-cosmos /bin/ag-chain-cosmos
ln -s /agoric-sdk/packages/cosmic-swingset/bin/ag-nchainz /bin/ag-nchainz
mkdir -p /go/src/github.com/strangelove-ventures/agoric-sdk/golang/cosmos/build /build/agoric-sdk/golang/cosmos/build
mv /agoric-sdk/golang/cosmos/build/libagcosmosdaemon.so /go/src/github.com/strangelove-ventures/agoric-sdk/golang/cosmos/build/
ln -s /go/src/github.com/strangelove-ventures/agoric-sdk/golang/cosmos/build/libagcosmosdaemon.so /build/agoric-sdk/golang/cosmos/build/libagcosmosdaemon.so
ln -s /root/.nvm/versions/node/*/bin/node /bin/node
dockerfile: agoric
platforms:
- linux/amd64

# Akash
- name: akash
Expand Down
22 changes: 22 additions & 0 deletions dockerfile/agoric/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ghcr.io/strangelove-ventures/infra-toolkit:v0.1.0 AS infra-toolkit
RUN addgroup --gid 1025 -S heighliner && adduser --uid 1025 -S heighliner -G heighliner

FROM ghcr.io/agoric/agoric-3-proposals:main

LABEL org.opencontainers.image.source="https://github.com/strangelove-ventures/heighliner"

ARG FINAL_IMAGE
RUN if [ ! -z "$FINAL_IMAGE" ]; then sh -c "$FINAL_IMAGE"; fi

# Install trusted CA certificates
COPY --from=infra-toolkit /etc/ssl/cert.pem /etc/ssl/cert.pem

# Install heighliner user
COPY --from=infra-toolkit /etc/passwd /etc/passwd
COPY --from=infra-toolkit --chown=1025:1025 /home/heighliner /home/heighliner

ENTRYPOINT []
CMD []

WORKDIR /home/heighliner
USER heighliner
3 changes: 3 additions & 0 deletions dockerfile/dockerfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ var CosmosLocalCross []byte
//go:embed imported/Dockerfile
var Imported []byte

//go:embed agoric/Dockerfile
var Agoric []byte

//go:embed none/Dockerfile
var None []byte

Expand Down