diff --git a/Dockerfile b/Dockerfile index ff2da14537..7162fc688a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/app/app.go b/app/app.go index cffbb25438..a3157af436 100644 --- a/app/app.go +++ b/app/app.go @@ -539,6 +539,7 @@ func NewEvmos( evmkeeper.AvailablePrecompiles( stakingKeeper, app.DistrKeeper, + app.VestingKeeper, app.AuthzKeeper, app.TransferKeeper, app.IBCKeeper.ChannelKeeper, diff --git a/go.mod b/go.mod index 63e5f17344..9acd4ffaab 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 diff --git a/go.sum b/go.sum index bf87907513..8cb40f203c 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/tests/e2e/Dockerfile.repo b/tests/e2e/Dockerfile.repo index 0a94429937..582d1881f1 100644 --- a/tests/e2e/Dockerfile.repo +++ b/tests/e2e/Dockerfile.repo @@ -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 @@ -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 \ diff --git a/x/evm/keeper/precompiles.go b/x/evm/keeper/precompiles.go index 75bc70c1bf..a4bf379c7e 100644 --- a/x/evm/keeper/precompiles.go +++ b/x/evm/keeper/precompiles.go @@ -5,7 +5,6 @@ package keeper import ( "fmt" - "golang.org/x/exp/maps" "github.com/ethereum/go-ethereum/common" @@ -16,9 +15,11 @@ 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. @@ -26,6 +27,7 @@ import ( func AvailablePrecompiles( stakingKeeper stakingkeeper.Keeper, distributionKeeper distributionkeeper.Keeper, + vestingKeeper vestingkeeper.Keeper, authzKeeper authzkeeper.Keeper, transferKeeper transferkeeper.Keeper, channelKeeper channelkeeper.Keeper, @@ -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 } diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 21e0c9640b..7c88a85bbe 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -29,6 +29,7 @@ var ( "0x0000000000000000000000000000000000000800", // Staking precompile "0x0000000000000000000000000000000000000801", // Distribution precompile "0x0000000000000000000000000000000000000802", // ICS20 transfer precompile + "0x0000000000000000000000000000000000000803", // Vesting precompile } )