8000 feat(vesting): Add precompile support by Vvaradinov · Pull Request #1667 · evmos/evmos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(vesting): Add precompile support #1667

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

Merged
merged 8 commits into from
Aug 1, 2023
Merged
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ WORKDIR /root
COPY --from=build-env /go/src/github.com/evmos/evmos/build/evmosd /usr/bin/evmosd
COPY --from=build-env /go/bin/toml-cli /usr/bin/toml-cli

RUN apk add --no-cache ca-certificates=20230506-r0 jq=1.6-r3 curl=8.1.2-r0 bash=5.2.15-r5 vim=9.0.1568-r0 lz4=1.9.4-r4 \
RUN apk add --no-cache ca-certificates=20230506-r0 jq=1.6-r3 curl=8.2.1-r0 bash=5.2.15-r5 vim=9.0.1568-r0 lz4=1.9.4-r4 \
&& addgroup -g 1000 evmos \
&& adduser -S -h /home/evmos -D evmos -u 1000 -G evmos

Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ func NewEvmos(
evmkeeper.AvailablePrecompiles(
stakingKeeper,
app.DistrKeeper,
app.VestingKeeper,
app.AuthzKeeper,
app.TransferKeeper,
app.IBCKeeper.ChannelKeeper,
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/davecgh/go-spew v1.1.1
github.com/ethereum/go-ethereum v1.11.5
github.com/evmos/evmos-ledger-go v0.4.0
github.com/evmos/precompiles v0.0.0-00010101000000-000000000000
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0
Expand Down Expand Up @@ -224,6 +225,7 @@ replace (
github.com/cosmos/cosmos-sdk => github.com/evmos/cosmos-sdk v0.46.13-alpha.ledger.8
// use Evmos geth fork
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2
github.com/evmos/precompiles => github.com/evmos/precompiles v0.0.0-20230614144145-298e972c657e
// Security Advisory https://github.com/advisories/GHSA-h395-qcrw-5vmq
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.7
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ github.com/evmos/evmos-ledger-go v0.4.0 h1:WPa6TN9x7s/+1YCgvYGtzJrhlW/mIHtYM1DvN
github.com/evmos/evmos-ledger-go v0.4.0/go.mod h1:33X3wWcWZ68KD5Bj4aiED+/W57uO1VR+hbXBxkKDXsQ=
github.com/evmos/go-ethereum v1.10.26-evmos-rc2 h1:tYghk1ZZ8X4/OQ4YI9hvtm8aSN8OSqO0g9vo/sCMdBo=
github.com/evmos/go-ethereum v1.10.26-evmos-rc2/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/evmos/precompiles v0.0.0-20230614144145-298e972c657e h1:QyeoJxJLLpyd4InFXdk4/FQFHusjUxVh1nQDVvpVCw0=
github.com/evmos/precompiles v0.0.0-20230614144145-298e972c657e/go.mod h1:MZslgxAhNqL+g9TOhv+et+F3n61akuMb/wBzQe7eMIE=
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0=
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A=
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk=
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/Dockerfile.repo
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.3-bullseye AS build-env
FROM golang:1.20.5-bullseye AS build-env

ARG BRANCH_NAME

Expand All @@ -14,7 +14,7 @@ RUN git checkout ${BRANCH_NAME}

RUN make build

FROM golang:1.20.3-bullseye
FROM golang:1.20.5-bullseye

RUN apt-get update \
&& apt-get install jq=1.6-2.1 -y --no-install-recommends \
Expand Down
14 changes: 11 additions & 3 deletions x/evm/keeper/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package keeper

import (
"fmt"

"golang.org/x/exp/maps"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -16,16 +15,19 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
channelkeeper "github.com/cosmos/ibc-go/v6/modules/core/04-channel/keeper"
distprecompile "github.com/evmos/evmos/v13/precompiles/distribution"
ics20 "github.com/evmos/evmos/v13/precompiles/ics20"
ics20precompile "github.com/evmos/evmos/v13/precompiles/ics20"
stakingprecompile "github.com/evmos/evmos/v13/precompiles/staking"
transferkeeper "github.com/evmos/evmos/v13/x/ibc/transfer/keeper"
vestingkeeper "github.com/evmos/evmos/v13/x/vesting/keeper"
vestingprecompile "github.com/evmos/precompiles/precompiles/vesting"
)

// AvailablePrecompiles returns the list of all available precompiled contracts.
// NOTE: this should only be used during initialization of the Keeper.
func AvailablePrecompiles(
stakingKeeper stakingkeeper.Keeper,
distributionKeeper distributionkeeper.Keeper,
vestingKeeper vestingkeeper.Keeper,
authzKeeper authzkeeper.Keeper,
transferKeeper transferkeeper.Keeper,
channelKeeper channelkeeper.Keeper,
Expand All @@ -43,13 +45,19 @@ func AvailablePrecompiles(
panic(fmt.Errorf("failed to load distribution precompile: %w", err))
}

ibcTransferPrecompile, err := ics20.NewPrecompile(transferKeeper, channelKeeper, authzKeeper)
ibcTransferPrecompile, err := ics20precompile.NewPrecompile(transferKeeper, channelKeeper, authzKeeper)
if err != nil {
panic(fmt.Errorf("failed to load ICS20 precompile: %w", err))
}

vestingPrecompile, err := vestingprecompile.NewPrecompile(vestingKeeper, authzKeeper)
if err != nil {
panic(fmt.Errorf("failed to load vesting precompile: %w", err))
}

precompiles[stakingPrecompile.Address()] = stakingPrecompile
precompiles[distributionPrecompile.Address()] = distributionPrecompile
precompiles[vestingPrecompile.Address()] = vestingPrecompile
precompiles[ibcTransferPrecompile.Address()] = ibcTransferPrecompile
return precompiles
}
Expand Down
1 change: 1 addition & 0 deletions x/evm/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
"0x0000000000000000000000000000000000000800", // Staking precompile
"0x0000000000000000000000000000000000000801", // Distribution precompile
"0x0000000000000000000000000000000000000802", // ICS20 transfer precompile
"0x0000000000000000000000000000000000000803", // Vesting precompile
}
)

Expand Down
0