Compare commits

...

11 Commits

Author SHA1 Message Date
MiniFrenchBread
81a8d873fe chore: remove log
Some checks failed
Continuous Integration (Commit) / lint (push) Has been cancelled
2024-08-09 10:03:38 +08:00
MiniFrenchBread
9e9c384619 Merge branch 'dev' into dasigners-ut 2024-08-09 10:01:56 +08:00
0g-wh
1d2504b085
Merge pull request #58 from 0glabs/testnet/v0.3.x
Some checks are pending
Continuous Integration (Commit) / lint (push) Waiting to run
merge wasm
2024-08-09 09:47:25 +08:00
0g-wh
30728b75e9
fix wasm static link (#57)
Some checks failed
Continuous Integration (Commit) / lint (push) Has been cancelled
2024-08-05 23:11:18 +08:00
0g-wh
e822edfe8d
Merge pull request #56 from 0glabs/dev-047
Some checks are pending
Continuous Integration (Commit) / lint (push) Waiting to run
update go version of workflow to 1.21
2024-08-05 09:58:29 +08:00
0g-wh
2da75122b3
Merge pull request #54 from 0g-wh/wasm
add ibcwasmtypes to upgrades.go
2024-08-05 09:10:39 +08:00
0g-wh
ed5646b71a add ibcwasmtypes to upgrades.go 2024-08-04 19:39:00 +08:00
0g-wh
4aa67c9efb
Merge pull request #53 from 0g-wh/wasm
Some checks are pending
Continuous Integration (Commit) / lint (push) Waiting to run
feat: add 08-wasm module
2024-08-04 19:17:20 +08:00
0g-wh
bd3d947e9b clean code 2024-08-04 15:25:53 +08:00
aeryz
a8c86f7f8b feat: add 08-wasm module
Signed-off-by: aeryz <abdullaheryz@protonmail.com>
2024-08-04 15:23:35 +08:00
0g-wh
058d9f2285
Merge pull request #52 from 0glabs/dev-047
upgrade to kava 26 / cosmos v0.47
2024-08-04 14:20:12 +08:00
8 changed files with 62 additions and 4 deletions

View File

@ -14,9 +14,9 @@ jobs:
with:
go-version: '1.21'
- name: Build
run: make build
run: sudo LINK_STATICALLY=true make build-release
- name: Rename file
run: mv ./out/linux/0gchaind ./out/linux/0gchaind-linux-${{ github.ref_name }}
run: sudo mv ./out/linux/0gchaind ./out/linux/0gchaind-linux-${{ github.ref_name }}
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:

View File

@ -19,6 +19,15 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go version && go mod download
# Cosmwasm - Download correct libwasmvm version
RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed 's/.* //') && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$ARCH.a \
-O /lib/libwasmvm.$ARCH.a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm.$ARCH.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1)
# Add source files
COPY . .
@ -27,6 +36,7 @@ COPY . .
# Mount go build and mod caches as container caches, persisted between builder invocations
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
LINK_STATICALLY=true \
make install
FROM alpine:3.15

View File

@ -6,6 +6,8 @@ BINARY_NAME := 0gchaind
MAIN_ENTRY := ./cmd/$(BINARY_NAME)
DOCKER_IMAGE_NAME := 0glabs/$(PROJECT_NAME)
GO_BIN ?= go
ARCH := $(shell uname -m)
WASMVM_VERSION := $(shell $(GO_BIN) list -m github.com/CosmWasm/wasmvm | sed 's/.* //')
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GIT_COMMIT := $(shell git rev-parse HEAD)
@ -174,6 +176,10 @@ endif
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
ldflags += -w -s
endif
ifeq ($(LINK_STATICALLY),true)
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static -lm"
endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))
@ -195,6 +201,10 @@ else
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/$(BINARY_NAME) $(MAIN_ENTRY)
endif
build-release: go.sum
wget -q https://github.com/CosmWasm/wasmvm/releases/download/$(WASMVM_VERSION)/libwasmvm_muslc.$(ARCH).a -O /lib/libwasmvm.$(ARCH).a
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/$(BINARY_NAME) $(MAIN_ENTRY)
build-linux: go.sum
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build

View File

@ -80,6 +80,9 @@ import (
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
ibcwasm "github.com/cosmos/ibc-go/modules/light-clients/08-wasm"
ibcwasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
@ -178,6 +181,7 @@ var (
council.AppModuleBasic{},
dasigners.AppModuleBasic{},
consensus.AppModuleBasic{},
ibcwasm.AppModuleBasic{},
)
// module account permissions
@ -246,6 +250,7 @@ type App struct {
authzKeeper authzkeeper.Keeper
crisisKeeper crisiskeeper.Keeper
slashingKeeper slashingkeeper.Keeper
ibcWasmClientKeeper ibcwasmkeeper.Keeper
ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
packetForwardKeeper *packetforwardkeeper.Keeper
evmKeeper *evmkeeper.Keeper
@ -314,6 +319,7 @@ func NewApp(
dasignerstypes.StoreKey,
vestingtypes.StoreKey,
consensusparamtypes.StoreKey, crisistypes.StoreKey,
ibcwasmtypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
@ -446,6 +452,19 @@ func NewApp(
scopedIBCKeeper,
)
app.ibcWasmClientKeeper = ibcwasmkeeper.NewKeeperWithConfig(
appCodec,
keys[ibcwasmtypes.StoreKey],
app.ibcKeeper.ClientKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
ibcwasmtypes.WasmConfig{
DataDir: "ibc_08-wasm",
SupportedCapabilities: "iterator,stargate",
ContractDebugMode: false,
},
app.GRPCQueryRouter(),
)
// Create Ethermint keepers
app.feeMarketKeeper = feemarketkeeper.NewKeeper(
appCodec,
@ -650,6 +669,7 @@ func NewApp(
evmutil.NewAppModule(app.evmutilKeeper, app.bankKeeper, app.accountKeeper),
// nil InflationCalculationFn, use SDK's default inflation function
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, nil, mintSubspace),
ibcwasm.NewAppModule(app.ibcWasmClientKeeper),
)
// Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list.
@ -693,6 +713,7 @@ func NewApp(
evmutiltypes.ModuleName,
consensusparamtypes.ModuleName,
packetforwardtypes.ModuleName,
ibcwasmtypes.ModuleName,
)
// Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list.
@ -726,6 +747,7 @@ func NewApp(
minttypes.ModuleName,
consensusparamtypes.ModuleName,
packetforwardtypes.ModuleName,
ibcwasmtypes.ModuleName,
)
// Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list
@ -758,6 +780,7 @@ func NewApp(
consensusparamtypes.ModuleName,
packetforwardtypes.ModuleName,
crisistypes.ModuleName, // runs the invariants at genesis, should run after other modules
ibcwasmtypes.ModuleName,
)
app.mm.RegisterInvariants(&app.crisisKeeper)
@ -832,6 +855,15 @@ func NewApp(
}
}
if manager := app.SnapshotManager(); manager != nil {
err := manager.RegisterExtensions(
ibcwasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.ibcWasmClientKeeper),
)
if err != nil {
panic(fmt.Errorf("failed to register snapshot extension: %s", err))
}
}
app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper

View File

@ -20,6 +20,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations"
)
@ -50,6 +51,7 @@ func (app App) RegisterUpgradeHandlers() {
crisistypes.ModuleName,
consensustypes.ModuleName,
packetforwardtypes.ModuleName,
ibcwasmtypes.ModuleName,
},
}

2
go.mod
View File

@ -16,6 +16,7 @@ require (
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/iavl v0.20.1
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3
github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-ibc-go-v7.3-wasmvm-v1.5
github.com/cosmos/ibc-go/v7 v7.4.0
github.com/ethereum/go-ethereum v1.10.26
github.com/evmos/ethermint v0.21.0
@ -57,6 +58,7 @@ require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect
github.com/CosmWasm/wasmvm v1.5.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect

4
go.sum
View File

@ -224,6 +224,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM=
github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4=
github.com/CosmWasm/wasmvm v1.5.2 h1:+pKB1Mz9GZVt1vadxB+EDdD1FOz3dMNjIKq/58/lrag=
github.com/CosmWasm/wasmvm v1.5.2/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys=
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.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
@ -425,6 +427,8 @@ github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg=
github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 h1:MZGDMETv72suFpTAD6VPGqSIm1FJcChtk2HmVh9D+Bo=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s=
github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-ibc-go-v7.3-wasmvm-v1.5 h1:sMoHjep+KInjMrppNCEutMVm1p8nI9WhKCuMQ+EcUHw=
github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-ibc-go-v7.3-wasmvm-v1.5/go.mod h1:VR2Hg2i/X1bafbmmNsV2Khwsg0PzNeuWoVKmSN5dAwo=
github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M=
github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=

View File

@ -1,7 +1,6 @@
package dasigners_test
import (
"fmt"
"math/big"
"strings"
"testing"
@ -291,7 +290,6 @@ func (suite *DASignersTestSuite) queryGetAggPkG1(testSigner *testutil.TestSigner
suite.Assert().NoError(err)
out, err := suite.abi.Methods["getAggPkG1"].Outputs.Unpack(bz)
suite.Assert().NoError(err)
fmt.Printf("%v\n", out[0])
return struct {
AggPkG1 dasignersprecompile.BN254G1Point
Total *big.Int