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

Compilation on M1 #130

Open
wants to merge 8 commits into
base: master
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
34 changes: 17 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ FROM golang

# doing all updates and installs in a single step and removing the apt cache helps reduce the image size
RUN apt-get update && \
apt-get install -y \
mesa-opencl-icd \
ocl-icd-opencl-dev \
libssl-dev \
libudev-dev \
hwloc \
libhwloc-dev \
gcc \
git \
bzr \
jq \
pkg-config \
curl \
wget && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*
apt-get install -y \
mesa-opencl-icd \
ocl-icd-opencl-dev \
libssl-dev \
libudev-dev \
hwloc \
libhwloc-dev \
gcc \
git \
bzr \
jq \
pkg-config \
curl \
wget && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*

ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.org
Expand All @@ -35,7 +35,7 @@ RUN mkdir -p src/github.com/filecoin-project
WORKDIR $GOPATH/src/github.com/filecoin-project
RUN git clone https://github.com/filecoin-project/filecoin-ffi
WORKDIR $GOPATH/src/github.com/filecoin-project/filecoin-ffi
RUN git checkout 8b97bd8230b77bd32f4f27e4766a6d8a03b4e801
RUN git checkout 7912389334e347bbb2eac0520c836830875c39de
RUN make
RUN go install

Expand Down
30 changes: 27 additions & 3 deletions chain/terra/terra.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package terra

import (
"github.com/cosmos/cosmos-sdk/codec"
codecTypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/chain/cosmos"
"github.com/terra-money/core/app"
)

type (
Expand Down Expand Up @@ -44,8 +50,21 @@ func init() {

// NewClient returns returns a new Client with Terra codec.
func NewClient(opts ClientOptions) *Client {
cfg := app.MakeEncodingConfig()
return cosmos.NewClient(opts, cfg.Marshaler, cfg.TxConfig, cfg.InterfaceRegistry, cfg.Amino, "terra")
// This config construction is based on app.MakeEncodingConfig in
// https://github.com/terra-money/core. We do not import this method
// directly as the repo is dependent on CosmWasm which fails to compile on
// M1 architecture.
amino := codec.NewLegacyAmino()
interfaceRegistry := codecTypes.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
txConfig := tx.NewTxConfig(marshaler, tx.DefaultSignModes)

std.RegisterLegacyAminoCodec(amino)
std.RegisterInterfaces(interfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(amino)
ModuleBasics.RegisterInterfaces(interfaceRegistry)

return cosmos.NewClient(opts, marshaler, txConfig, interfaceRegistry, amino, "terra")
}

// NewTxBuilder returns an implementation of the transaction builder interface
Expand All @@ -54,3 +73,8 @@ func NewClient(opts ClientOptions) *Client {
func NewTxBuilder(opts TxBuilderOptions, client *Client) account.TxBuilder {
return cosmos.NewTxBuilder(opts, client)
}

var ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
bank.AppModuleBasic{},
)
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ require (
github.com/renproject/solana-ffi v0.1.2
github.com/renproject/surge v1.2.6
github.com/tendermint/tendermint v0.34.12
github.com/terra-money/core v0.5.5
github.com/tyler-smith/go-bip39 v1.1.0
go.uber.org/zap v1.17.0
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/CosmWasm/wasmvm v0.16.0 h1:87jyCTcCpuSx7a8s5ed9N/E/XV13XZflxa0/OplwSmA=
github.com/CosmWasm/wasmvm v0.16.0/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
Expand Down Expand Up @@ -267,8 +265,6 @@ github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7u
github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4=
github.com/cosmos/iavl v0.16.0 h1:ICIOB8xysirTX27GmVAaoeSpeozzgSu9d49w36xkVJA=
github.com/cosmos/iavl v0.16.0/go.mod h1:2A8O/Jz9YwtjqXMO0CjnnbTYEEaovE8jWcwrakH3PoE=
github.com/cosmos/ibc-go v1.1.0 h1:qtiBbiFR1hbxQ0h66FbjTZnzUjZNpndHghl9gZcoZjY=
github.com/cosmos/ibc-go v1.1.0/go.mod h1:1y0rXG5xsOIrmVGb0pv1poYbiTW+1cz4GX0VGDwJAgA=
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI=
Expand Down Expand Up @@ -1839,7 +1835,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM=
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs=
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM=
Expand All @@ -1858,13 +1853,10 @@ github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESx
github.com/tendermint/tendermint v0.34.10/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0=
github.com/tendermint/tendermint v0.34.12 h1:m+kUYNhONedhJfHmHG8lqsdZvbR5t6vmhaok1yXjpKg=
github.com/tendermint/tendermint v0.34.12/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0=
github.com/tendermint/tm-db v0.5.1/go.mod h1:g92zWjHpCYlEvQXvy9M168Su8V1IBEeawpXVVBaK4f4=
github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI=
github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8=
github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ=
github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw=
github.com/terra-money/core v0.5.5 h1:wgNUa0yNHkhtECF7w45uOvlzWMeKuefmE/fW0imM4Qc=
github.com/terra-money/core v0.5.5/go.mod h1:hC15x6CgPCbV6b8NQybzaPTq2gy0MYMbcm4oQON1T9w=
github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g=
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
Expand Down
2 changes: 1 addition & 1 deletion infra/ethereum/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:alpine
FROM node:16-alpine

WORKDIR /root/app

Expand Down
2 changes: 1 addition & 1 deletion infra/filecoin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ENV PATH=$PATH:/usr/local/go/bin
WORKDIR /app

RUN git clone https://github.com/filecoin-project/lotus .
RUN git checkout d4cdc6d3340b8496c9f98e2d0daed8d1bd9b271e
RUN git checkout 7912389334e347bbb2eac0520c836830875c39de
RUN make 2k
RUN ./lotus fetch-params 2048
RUN ./lotus-seed pre-seal --sector-size 2KiB --num-sectors 2
Expand Down