Sync from fork #74
28
.github/workflows/dependencies.yml
vendored
Normal file
28
.github/workflows/dependencies.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: "Dependency Review"
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dependency-review:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: 1.19
|
||||||
|
check-latest: true
|
||||||
|
- name: "Checkout Repository"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: technote-space/get-diff-action@v6.1.1
|
||||||
|
with:
|
||||||
|
PATTERNS: |
|
||||||
|
**/**.go
|
||||||
|
go.mod
|
||||||
|
go.sum
|
||||||
|
- name: "Dependency Review"
|
||||||
|
uses: actions/dependency-review-action@v3
|
||||||
|
if: env.GIT_DIFF
|
||||||
|
- name: "Go vulnerability check"
|
||||||
|
run: make vulncheck
|
||||||
|
if: env.GIT_DIFF
|
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
args: --timeout 10m
|
args: --timeout 10m
|
||||||
github-token: ${{ secrets.github_token }}
|
github-token: ${{ secrets.github_token }}
|
||||||
# Check only if there are differences in the source code
|
# Check only if there are differences in the source code
|
||||||
if: "env.GIT_DIFF"
|
if: env.GIT_DIFF
|
||||||
markdown-lint:
|
markdown-lint:
|
||||||
name: Run markdown-lint
|
name: Run markdown-lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -36,11 +36,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [v0.20.0-rc3] - 2022-11-30
|
## [v0.20.0-rc3] - 2022-12-02
|
||||||
|
|
||||||
### State Machine Breaking
|
### State Machine Breaking
|
||||||
|
|
||||||
* (deps) [#1419](https://github.com/evmos/ethermint/pull/1419) Add ics23 patch for dragonberry and bump iavl to v0.19.4
|
|
||||||
* (deps) [#1361](https://github.com/evmos/ethermint/pull/1361) Bump ibc-go to [`v5.1.0`](https://github.com/cosmos/ibc-go/releases/tag/v5.1.0)
|
* (deps) [#1361](https://github.com/evmos/ethermint/pull/1361) Bump ibc-go to [`v5.1.0`](https://github.com/cosmos/ibc-go/releases/tag/v5.1.0)
|
||||||
* (evm) [\#1272](https://github.com/evmos/ethermint/pull/1272) Implement modular interface for the EVM.
|
* (evm) [\#1272](https://github.com/evmos/ethermint/pull/1272) Implement modular interface for the EVM.
|
||||||
* (deps) [#1168](https://github.com/evmos/ethermint/pull/1168) Upgrade Cosmos SDK to [`v0.46.6`](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.6).
|
* (deps) [#1168](https://github.com/evmos/ethermint/pull/1168) Upgrade Cosmos SDK to [`v0.46.6`](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.6).
|
||||||
@ -51,15 +50,18 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
* (ante) [1460](https://github.com/evmos/ethermint/pull/1460) Add KV Gas config on ethereum Txs.
|
* (ante) [1460](https://github.com/evmos/ethermint/pull/1460) Add KV Gas config on ethereum Txs.
|
||||||
* (eth) [#1459](https://github.com/evmos/ethermint/pull/1459) Added support for messages with optional types omitted on eip712.
|
* (eth) [#1459](https://github.com/evmos/ethermint/pull/1459) Added support for messages with optional types omitted on eip712.
|
||||||
* (geth) [#1413](https://github.com/evmos/ethermint/pull/1413) Update go-ethereum version to [`v1.10.26`](https://github.com/ethereum/go-ethereum/releases/tag/v1.10.26).
|
* (geth) [#1413](https://github.com/evmos/ethermint/pull/1413) Update go-ethereum version to [`v1.10.26`](https://github.com/ethereum/go-ethereum/releases/tag/v1.10.26).
|
||||||
|
* (deps) [#1419](https://github.com/evmos/ethermint/pull/1419) Add ics23 patch for dragonberry and bump iavl to v0.19.4
|
||||||
|
|
||||||
### API Breaking
|
### API Breaking
|
||||||
|
|
||||||
|
* (ante) [#1521](https://github.com/evmos/ethermint/pull/1521) Deprecate support for legacy EIP-712 signature verification implementation via AnteHandler decorator.
|
||||||
* (ante) [#1214](https://github.com/evmos/ethermint/pull/1214) Set mempool priority to EVM transactions.
|
* (ante) [#1214](https://github.com/evmos/ethermint/pull/1214) Set mempool priority to EVM transactions.
|
||||||
* (evm) [#1405](https://github.com/evmos/ethermint/pull/1405) Add parameter `chainID` to evm keeper's `EVMConfig` method, so caller can choose to not use the cached `eip155ChainID`.
|
* (evm) [#1405](https://github.com/evmos/ethermint/pull/1405) Add parameter `chainID` to evm keeper's `EVMConfig` method, so caller can choose to not use the cached `eip155ChainID`.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- (app) [#1501](https://github.com/evmos/ethermint/pull/1501) Set default File store listener for application from [ADR38](https://docs.cosmos.network/v0.47/architecture/adr-038-state-listening)
|
* (ci) [#1528](https://github.com/evmos/ethermint/pull/1528) Add Golang dependency vulnerability checker.
|
||||||
|
* (app) [#1501](https://github.com/evmos/ethermint/pull/1501) Set default File store listener for application from [ADR38](https://docs.cosmos.network/v0.47/architecture/adr-038-state-listening)
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
|
6
Makefile
6
Makefile
@ -155,7 +155,7 @@ clean:
|
|||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
build-all: tools build lint test
|
build-all: tools build lint test vulncheck
|
||||||
|
|
||||||
.PHONY: distclean clean build-all
|
.PHONY: distclean clean build-all
|
||||||
|
|
||||||
@ -273,6 +273,10 @@ go.sum: go.mod
|
|||||||
go mod verify
|
go mod verify
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
|
||||||
|
vulncheck: $(BUILDDIR)/
|
||||||
|
GOBIN=$(BUILDDIR) go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
|
$(BUILDDIR)/govulncheck ./...
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
### Documentation ###
|
### Documentation ###
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -46,8 +46,8 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
|
|||||||
// handle as *evmtypes.MsgEthereumTx
|
// handle as *evmtypes.MsgEthereumTx
|
||||||
anteHandler = newEthAnteHandler(options)
|
anteHandler = newEthAnteHandler(options)
|
||||||
case "/ethermint.types.v1.ExtensionOptionsWeb3Tx":
|
case "/ethermint.types.v1.ExtensionOptionsWeb3Tx":
|
||||||
// handle as normal Cosmos SDK tx, except signature is checked for EIP712 representation
|
// Deprecated: Handle as normal Cosmos SDK tx, except signature is checked for Legacy EIP712 representation
|
||||||
anteHandler = newCosmosAnteHandlerEip712(options)
|
anteHandler = NewLegacyCosmosAnteHandlerEip712(options)
|
||||||
case "/ethermint.types.v1.ExtensionOptionDynamicFeeTx":
|
case "/ethermint.types.v1.ExtensionOptionDynamicFeeTx":
|
||||||
// cosmos-sdk tx with dynamic fee extension
|
// cosmos-sdk tx with dynamic fee extension
|
||||||
anteHandler = newCosmosAnteHandler(options)
|
anteHandler = newCosmosAnteHandler(options)
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
|
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
||||||
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
|
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||||
|
ibcante "github.com/cosmos/ibc-go/v5/modules/core/ante"
|
||||||
|
|
||||||
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/crypto/secp256k1"
|
"github.com/ethereum/go-ethereum/crypto/secp256k1"
|
||||||
@ -32,19 +33,47 @@ func init() {
|
|||||||
ethermintCodec = codec.NewProtoCodec(registry)
|
ethermintCodec = codec.NewProtoCodec(registry)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eip712SigVerificationDecorator Verify all signatures for a tx and return an error if any are invalid. Note,
|
// Deprecated: NewLegacyCosmosAnteHandlerEip712 creates an AnteHandler to process legacy EIP-712
|
||||||
// the Eip712SigVerificationDecorator decorator will not get executed on ReCheck.
|
// transactions, as defined by the presence of an ExtensionOptionsWeb3Tx extension.
|
||||||
|
func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
|
||||||
|
return sdk.ChainAnteDecorators(
|
||||||
|
RejectMessagesDecorator{}, // reject MsgEthereumTxs
|
||||||
|
authante.NewSetUpContextDecorator(),
|
||||||
|
authante.NewValidateBasicDecorator(),
|
||||||
|
authante.NewTxTimeoutHeightDecorator(),
|
||||||
|
NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
|
||||||
|
authante.NewValidateMemoDecorator(options.AccountKeeper),
|
||||||
|
authante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
|
||||||
|
authante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
|
||||||
|
// SetPubKeyDecorator must be called before all signature verification decorators
|
||||||
|
authante.NewSetPubKeyDecorator(options.AccountKeeper),
|
||||||
|
authante.NewValidateSigCountDecorator(options.AccountKeeper),
|
||||||
|
authante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
|
||||||
|
// Note: signature verification uses EIP instead of the cosmos signature validator
|
||||||
|
NewLegacyEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
|
||||||
|
authante.NewIncrementSequenceDecorator(options.AccountKeeper),
|
||||||
|
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
|
||||||
|
NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: LegacyEip712SigVerificationDecorator Verify all signatures for a tx and return an error if any are invalid. Note,
|
||||||
|
// the LegacyEip712SigVerificationDecorator decorator will not get executed on ReCheck.
|
||||||
|
// NOTE: As of v0.20.0, EIP-712 signature verification is handled by the ethsecp256k1 public key (see ethsecp256k1.go)
|
||||||
//
|
//
|
||||||
// CONTRACT: Pubkeys are set in context for all signers before this decorator runs
|
// CONTRACT: Pubkeys are set in context for all signers before this decorator runs
|
||||||
// CONTRACT: Tx must implement SigVerifiableTx interface
|
// CONTRACT: Tx must implement SigVerifiableTx interface
|
||||||
type Eip712SigVerificationDecorator struct {
|
type LegacyEip712SigVerificationDecorator struct {
|
||||||
ak evmtypes.AccountKeeper
|
ak evmtypes.AccountKeeper
|
||||||
signModeHandler authsigning.SignModeHandler
|
signModeHandler authsigning.SignModeHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEip712SigVerificationDecorator creates a new Eip712SigVerificationDecorator
|
// Deprecated: NewLegacyEip712SigVerificationDecorator creates a new LegacyEip712SigVerificationDecorator
|
||||||
func NewEip712SigVerificationDecorator(ak evmtypes.AccountKeeper, signModeHandler authsigning.SignModeHandler) Eip712SigVerificationDecorator {
|
func NewLegacyEip712SigVerificationDecorator(
|
||||||
return Eip712SigVerificationDecorator{
|
ak evmtypes.AccountKeeper,
|
||||||
|
signModeHandler authsigning.SignModeHandler,
|
||||||
|
) LegacyEip712SigVerificationDecorator {
|
||||||
|
return LegacyEip712SigVerificationDecorator{
|
||||||
ak: ak,
|
ak: ak,
|
||||||
signModeHandler: signModeHandler,
|
signModeHandler: signModeHandler,
|
||||||
}
|
}
|
||||||
@ -52,7 +81,7 @@ func NewEip712SigVerificationDecorator(ak evmtypes.AccountKeeper, signModeHandle
|
|||||||
|
|
||||||
// AnteHandle handles validation of EIP712 signed cosmos txs.
|
// AnteHandle handles validation of EIP712 signed cosmos txs.
|
||||||
// it is not run on RecheckTx
|
// it is not run on RecheckTx
|
||||||
func (svd Eip712SigVerificationDecorator) AnteHandle(ctx sdk.Context,
|
func (svd LegacyEip712SigVerificationDecorator) AnteHandle(ctx sdk.Context,
|
||||||
tx sdk.Tx,
|
tx sdk.Tx,
|
||||||
simulate bool,
|
simulate bool,
|
||||||
next sdk.AnteHandler,
|
next sdk.AnteHandler,
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/evmos/ethermint/app/ante"
|
"github.com/evmos/ethermint/app/ante"
|
||||||
"github.com/evmos/ethermint/server/config"
|
"github.com/evmos/ethermint/server/config"
|
||||||
"github.com/evmos/ethermint/tests"
|
"github.com/evmos/ethermint/tests"
|
||||||
|
ethermint "github.com/evmos/ethermint/types"
|
||||||
"github.com/evmos/ethermint/x/evm/statedb"
|
"github.com/evmos/ethermint/x/evm/statedb"
|
||||||
evmtypes "github.com/evmos/ethermint/x/evm/types"
|
evmtypes "github.com/evmos/ethermint/x/evm/types"
|
||||||
|
|
||||||
@ -180,6 +181,9 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() {
|
|||||||
tx2.From = addr.Hex()
|
tx2.From = addr.Hex()
|
||||||
tx2Priority := int64(1)
|
tx2Priority := int64(1)
|
||||||
|
|
||||||
|
tx3GasLimit := ethermint.BlockGasLimit(suite.ctx) + uint64(1)
|
||||||
|
tx3 := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), tx3GasLimit, gasPrice, nil, nil, nil, ðtypes.AccessList{{Address: addr, StorageKeys: nil}})
|
||||||
|
|
||||||
dynamicFeeTx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), tx2GasLimit,
|
dynamicFeeTx := evmtypes.NewTxContract(suite.app.EvmKeeper.ChainID(), 1, big.NewInt(10), tx2GasLimit,
|
||||||
nil, // gasPrice
|
nil, // gasPrice
|
||||||
new(big.Int).Add(baseFee, big.NewInt(evmtypes.DefaultPriorityReduction.Int64()*2)), // gasFeeCap
|
new(big.Int).Add(baseFee, big.NewInt(evmtypes.DefaultPriorityReduction.Int64()*2)), // gasFeeCap
|
||||||
@ -216,6 +220,14 @@ func (suite AnteTestSuite) TestEthGasConsumeDecorator() {
|
|||||||
false, false,
|
false, false,
|
||||||
0,
|
0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"gas limit above block gas limit",
|
||||||
|
tx3,
|
||||||
|
math.MaxUint64,
|
||||||
|
func() {},
|
||||||
|
false, false,
|
||||||
|
0,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"not enough balance for fees",
|
"not enough balance for fees",
|
||||||
tx2,
|
tx2,
|
||||||
|
@ -87,27 +87,3 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
|
|||||||
NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
|
NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
|
|
||||||
return sdk.ChainAnteDecorators(
|
|
||||||
RejectMessagesDecorator{}, // reject MsgEthereumTxs
|
|
||||||
ante.NewSetUpContextDecorator(),
|
|
||||||
// NOTE: extensions option decorator removed
|
|
||||||
// ante.NewRejectExtensionOptionsDecorator(),
|
|
||||||
ante.NewValidateBasicDecorator(),
|
|
||||||
ante.NewTxTimeoutHeightDecorator(),
|
|
||||||
NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
|
|
||||||
ante.NewValidateMemoDecorator(options.AccountKeeper),
|
|
||||||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
|
|
||||||
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
|
|
||||||
// SetPubKeyDecorator must be called before all signature verification decorators
|
|
||||||
ante.NewSetPubKeyDecorator(options.AccountKeeper),
|
|
||||||
ante.NewValidateSigCountDecorator(options.AccountKeeper),
|
|
||||||
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
|
|
||||||
// Note: signature verification uses EIP instead of the cosmos signature validator
|
|
||||||
NewEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
|
|
||||||
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
|
|
||||||
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
|
|
||||||
NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
@ -8,9 +8,7 @@ import (
|
|||||||
"github.com/evmos/ethermint/version"
|
"github.com/evmos/ethermint/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const flagLong = "long"
|
||||||
flagLong = "long"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
infoCmd.Flags().Bool(flagLong, false, "Print full information")
|
infoCmd.Flags().Bool(flagLong, false, "Print full information")
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
, rev ? "dirty"
|
, rev ? "dirty"
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
version = "v0.17.1";
|
version = "v0.20.0-rc2";
|
||||||
pname = "ethermintd";
|
pname = "ethermintd";
|
||||||
tags = [ "netgo" ];
|
tags = [ "netgo" ];
|
||||||
ldflags = lib.concatStringsSep "\n" ([
|
ldflags = lib.concatStringsSep "\n" ([
|
||||||
|
2
go.mod
2
go.mod
@ -8,7 +8,7 @@ require (
|
|||||||
github.com/armon/go-metrics v0.4.1
|
github.com/armon/go-metrics v0.4.1
|
||||||
github.com/btcsuite/btcd v0.22.1
|
github.com/btcsuite/btcd v0.22.1
|
||||||
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
|
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
|
||||||
github.com/cosmos/cosmos-proto v1.0.0-alpha8
|
github.com/cosmos/cosmos-proto v1.0.0-beta.1
|
||||||
github.com/cosmos/cosmos-sdk v0.46.6
|
github.com/cosmos/cosmos-sdk v0.46.6
|
||||||
github.com/cosmos/go-bip39 v1.0.0
|
github.com/cosmos/go-bip39 v1.0.0
|
||||||
github.com/cosmos/gogoproto v1.4.3
|
github.com/cosmos/gogoproto v1.4.3
|
||||||
|
4
go.sum
4
go.sum
@ -226,8 +226,8 @@ github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1
|
|||||||
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||||
github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44=
|
github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44=
|
||||||
github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU=
|
github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU=
|
||||||
github.com/cosmos/cosmos-proto v1.0.0-alpha8 h1:d3pCRuMYYvGA5bM0ZbbjKn+AoQD4A7dyNG2wzwWalUw=
|
github.com/cosmos/cosmos-proto v1.0.0-beta.1 h1:iDL5qh++NoXxG8hSy93FdYJut4XfgbShIocllGaXx/0=
|
||||||
github.com/cosmos/cosmos-proto v1.0.0-alpha8/go.mod h1:6/p+Bc4O8JKeZqe0VqUGTX31eoYqemTT4C1hLCWsO7I=
|
github.com/cosmos/cosmos-proto v1.0.0-beta.1/go.mod h1:8k2GNZghi5sDRFw/scPL8gMSowT1vDA+5ouxL8GjaUE=
|
||||||
github.com/cosmos/cosmos-sdk v0.46.6 h1:K9EZsqOZ2jQX3bIQUpn7Hk/YCoaJWRLU56PzvpX8INk=
|
github.com/cosmos/cosmos-sdk v0.46.6 h1:K9EZsqOZ2jQX3bIQUpn7Hk/YCoaJWRLU56PzvpX8INk=
|
||||||
github.com/cosmos/cosmos-sdk v0.46.6/go.mod h1:JNklMfXo7MhDF1j/jxZCmDyOYyqhVoKB22e8p1ATEqA=
|
github.com/cosmos/cosmos-sdk v0.46.6/go.mod h1:JNklMfXo7MhDF1j/jxZCmDyOYyqhVoKB22e8p1ATEqA=
|
||||||
github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 h1:iKclrn3YEOwk4jQHT2ulgzuXyxmzmPczUalMwW4XH9k=
|
github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 h1:iKclrn3YEOwk4jQHT2ulgzuXyxmzmPczUalMwW4XH9k=
|
||||||
|
@ -94,8 +94,8 @@ schema = 3
|
|||||||
version = "v1.0.4"
|
version = "v1.0.4"
|
||||||
hash = "sha256-JvcBXBdjdmnaW/nyf/tw/uaOAGn1b78yxrtl2/Rs3kA="
|
hash = "sha256-JvcBXBdjdmnaW/nyf/tw/uaOAGn1b78yxrtl2/Rs3kA="
|
||||||
[mod."github.com/cosmos/cosmos-proto"]
|
[mod."github.com/cosmos/cosmos-proto"]
|
||||||
version = "v1.0.0-alpha8"
|
version = "v1.0.0-beta.1"
|
||||||
hash = "sha256-iXzXoS5Kfh5DBy+PhdFWraDWXda/3M4j7j4VECjv4CA="
|
hash = "sha256-oATkuj+fM5eBn+ywO+w/tL0AFSIEkx0J3Yz+VhVe0QA="
|
||||||
[mod."github.com/cosmos/cosmos-sdk"]
|
[mod."github.com/cosmos/cosmos-sdk"]
|
||||||
version = "v0.46.6"
|
version = "v0.46.6"
|
||||||
hash = "sha256-H1VZxZUWXhpXiY3A9smLp09MEGpXmh+XvX6YUiXPcpQ="
|
hash = "sha256-H1VZxZUWXhpXiY3A9smLp09MEGpXmh+XvX6YUiXPcpQ="
|
||||||
|
@ -44,12 +44,11 @@ pytest -s -vv
|
|||||||
|
|
||||||
If you're changing anything on the ethermint rpc, rerun the first command.
|
If you're changing anything on the ethermint rpc, rerun the first command.
|
||||||
|
|
||||||
|
|
||||||
## Caching
|
## Caching
|
||||||
|
|
||||||
You can enable Binary Cache to speed up the tests:
|
You can enable Binary Cache to speed up the tests:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ nix-env -iA cachix -f https://cachix.org/api/v1/install
|
nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||||
$ cachix use ethermint
|
cachix use ethermint
|
||||||
```
|
```
|
15
tests/integration_tests/hardhat/package-lock.json
generated
15
tests/integration_tests/hardhat/package-lock.json
generated
@ -13491,9 +13491,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimist": {
|
"node_modules/minimist": {
|
||||||
"version": "1.2.6",
|
"version": "1.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
||||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
|
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mkdirp": {
|
"node_modules/mkdirp": {
|
||||||
"version": "0.5.6",
|
"version": "0.5.6",
|
||||||
@ -25791,9 +25794,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.6",
|
"version": "1.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
||||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
|
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g=="
|
||||||
},
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.6",
|
"version": "0.5.6",
|
||||||
|
@ -9,6 +9,7 @@ from .utils import (
|
|||||||
deploy_contract,
|
deploy_contract,
|
||||||
send_successful_transaction,
|
send_successful_transaction,
|
||||||
send_transaction,
|
send_transaction,
|
||||||
|
w3_wait_for_new_blocks,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Smart contract names
|
# Smart contract names
|
||||||
@ -21,6 +22,35 @@ CHANGE_GREETING_TOPIC = Web3.keccak(text="ChangeGreeting(address,string)")
|
|||||||
TRANSFER_TOPIC = Web3.keccak(text="Transfer(address,address,uint256)")
|
TRANSFER_TOPIC = Web3.keccak(text="Transfer(address,address,uint256)")
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_logs_by_topic(cluster):
|
||||||
|
w3: Web3 = cluster.w3
|
||||||
|
|
||||||
|
contract, _ = deploy_contract(w3, CONTRACTS["Greeter"])
|
||||||
|
|
||||||
|
topic = Web3.keccak(text="ChangeGreeting(address,string)")
|
||||||
|
|
||||||
|
# with tx
|
||||||
|
tx = contract.functions.setGreeting("world").build_transaction()
|
||||||
|
receipt = send_transaction(w3, tx)
|
||||||
|
assert receipt.status == 1
|
||||||
|
|
||||||
|
# The getLogs method under the hood works as a filter
|
||||||
|
# with the specified topics and a block range.
|
||||||
|
# If the block range is not specified, it defaults
|
||||||
|
# to fromBlock: "latest", toBlock: "latest".
|
||||||
|
# Then, if we make a getLogs call within the same block that the tx
|
||||||
|
# happened, we will get a log in the result. However, if we make the call
|
||||||
|
# one or more blocks later, the result will be an empty array.
|
||||||
|
logs = w3.eth.get_logs({"topics": [topic.hex()]})
|
||||||
|
|
||||||
|
assert len(logs) == 1
|
||||||
|
assert logs[0]["address"] == contract.address
|
||||||
|
|
||||||
|
w3_wait_for_new_blocks(w3, 2)
|
||||||
|
logs = w3.eth.get_logs({"topics": [topic.hex()]})
|
||||||
|
assert len(logs) == 0
|
||||||
|
|
||||||
|
|
||||||
def test_pending_transaction_filter(cluster):
|
def test_pending_transaction_filter(cluster):
|
||||||
w3: Web3 = cluster.w3
|
w3: Web3 = cluster.w3
|
||||||
flt = w3.eth.filter("pending")
|
flt = w3.eth.filter("pending")
|
||||||
|
86
tests/integration_tests/test_gas.py
Executable file → Normal file
86
tests/integration_tests/test_gas.py
Executable file → Normal file
@ -1,4 +1,13 @@
|
|||||||
from .utils import ADDRS, CONTRACTS, KEYS, deploy_contract, send_transaction
|
import pytest
|
||||||
|
|
||||||
|
from .utils import (
|
||||||
|
ADDRS,
|
||||||
|
CONTRACTS,
|
||||||
|
KEYS,
|
||||||
|
deploy_contract,
|
||||||
|
send_transaction,
|
||||||
|
w3_wait_for_new_blocks,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_gas_eth_tx(geth, ethermint):
|
def test_gas_eth_tx(geth, ethermint):
|
||||||
@ -21,12 +30,10 @@ def test_gas_eth_tx(geth, ethermint):
|
|||||||
def test_gas_deployment(geth, ethermint):
|
def test_gas_deployment(geth, ethermint):
|
||||||
# deploy an identical contract on geth and ethermint
|
# deploy an identical contract on geth and ethermint
|
||||||
# ensure that the gasUsed is equivalent
|
# ensure that the gasUsed is equivalent
|
||||||
_, geth_contract_receipt = deploy_contract(
|
_, geth_contract_receipt = deploy_contract(geth.w3, CONTRACTS["TestERC20A"])
|
||||||
geth.w3,
|
|
||||||
CONTRACTS["TestERC20A"])
|
|
||||||
_, ethermint_contract_receipt = deploy_contract(
|
_, ethermint_contract_receipt = deploy_contract(
|
||||||
ethermint.w3,
|
ethermint.w3, CONTRACTS["TestERC20A"]
|
||||||
CONTRACTS["TestERC20A"])
|
)
|
||||||
assert geth_contract_receipt.gasUsed == ethermint_contract_receipt.gasUsed
|
assert geth_contract_receipt.gasUsed == ethermint_contract_receipt.gasUsed
|
||||||
|
|
||||||
|
|
||||||
@ -35,28 +42,65 @@ def test_gas_call(geth, ethermint):
|
|||||||
|
|
||||||
# deploy an identical contract on geth and ethermint
|
# deploy an identical contract on geth and ethermint
|
||||||
# ensure that the contract has a function which consumes non-trivial gas
|
# ensure that the contract has a function which consumes non-trivial gas
|
||||||
geth_contract, _ = deploy_contract(
|
geth_contract, _ = deploy_contract(geth.w3, CONTRACTS["BurnGas"])
|
||||||
geth.w3,
|
ethermint_contract, _ = deploy_contract(ethermint.w3, CONTRACTS["BurnGas"])
|
||||||
CONTRACTS["BurnGas"])
|
|
||||||
ethermint_contract, _ = deploy_contract(
|
|
||||||
ethermint.w3,
|
|
||||||
CONTRACTS["BurnGas"])
|
|
||||||
|
|
||||||
# call the contract and get tx receipt for geth
|
# call the contract and get tx receipt for geth
|
||||||
geth_gas_price = geth.w3.eth.gas_price
|
geth_gas_price = geth.w3.eth.gas_price
|
||||||
geth_txhash = (geth_contract.functions
|
geth_txhash = geth_contract.functions.burnGas(function_input).transact(
|
||||||
.burnGas(function_input)
|
{"from": ADDRS["validator"], "gasPrice": geth_gas_price}
|
||||||
.transact({'from': ADDRS["validator"], "gasPrice": geth_gas_price}))
|
)
|
||||||
geth_call_receipt = geth.w3.eth.wait_for_transaction_receipt(geth_txhash)
|
geth_call_receipt = geth.w3.eth.wait_for_transaction_receipt(geth_txhash)
|
||||||
|
|
||||||
# repeat the above for ethermint
|
# repeat the above for ethermint
|
||||||
ethermint_gas_price = ethermint.w3.eth.gas_price
|
ethermint_gas_price = ethermint.w3.eth.gas_price
|
||||||
ethermint_txhash = (ethermint_contract.functions
|
ethermint_txhash = ethermint_contract.functions.burnGas(function_input).transact(
|
||||||
.burnGas(function_input)
|
{"from": ADDRS["validator"], "gasPrice": ethermint_gas_price}
|
||||||
.transact({'from': ADDRS["validator"],
|
)
|
||||||
"gasPrice": ethermint_gas_price}))
|
ethermint_call_receipt = ethermint.w3.eth.wait_for_transaction_receipt(
|
||||||
ethermint_call_receipt = (ethermint.w3.
|
ethermint_txhash
|
||||||
eth.wait_for_transaction_receipt(ethermint_txhash))
|
)
|
||||||
|
|
||||||
# ensure that the gasUsed is equivalent
|
# ensure that the gasUsed is equivalent
|
||||||
assert geth_call_receipt.gasUsed == ethermint_call_receipt.gasUsed
|
assert geth_call_receipt.gasUsed == ethermint_call_receipt.gasUsed
|
||||||
|
|
||||||
|
|
||||||
|
def test_block_gas_limit(ethermint):
|
||||||
|
tx_value = 10
|
||||||
|
|
||||||
|
# get the block gas limit from the latest block
|
||||||
|
w3_wait_for_new_blocks(ethermint.w3, 5)
|
||||||
|
block = ethermint.w3.eth.get_block("latest")
|
||||||
|
exceeded_gas_limit = block.gasLimit + 100
|
||||||
|
|
||||||
|
# send a transaction exceeding the block gas limit
|
||||||
|
ethermint_gas_price = ethermint.w3.eth.gas_price
|
||||||
|
tx = {
|
||||||
|
"to": ADDRS["community"],
|
||||||
|
"value": tx_value,
|
||||||
|
"gas": exceeded_gas_limit,
|
||||||
|
"gasPrice": ethermint_gas_price,
|
||||||
|
}
|
||||||
|
|
||||||
|
# expect an error due to the block gas limit
|
||||||
|
with pytest.raises(Exception):
|
||||||
|
send_transaction(ethermint.w3, tx, KEYS["validator"])
|
||||||
|
|
||||||
|
# deploy a contract on ethermint
|
||||||
|
ethermint_contract, _ = deploy_contract(ethermint.w3, CONTRACTS["BurnGas"])
|
||||||
|
|
||||||
|
# expect an error on contract call due to block gas limit
|
||||||
|
with pytest.raises(Exception):
|
||||||
|
ethermint_txhash = ethermint_contract.functions.burnGas(
|
||||||
|
exceeded_gas_limit
|
||||||
|
).transact(
|
||||||
|
{
|
||||||
|
"from": ADDRS["validator"],
|
||||||
|
"gas": exceeded_gas_limit,
|
||||||
|
"gasPrice": ethermint_gas_price,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
(ethermint.w3.eth.wait_for_transaction_receipt(ethermint_txhash))
|
||||||
|
|
||||||
|
|
||||||
|
return
|
||||||
|
@ -6255,9 +6255,9 @@ decamelize@^4.0.0:
|
|||||||
integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
|
integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
|
||||||
|
|
||||||
decode-uri-component@^0.2.0:
|
decode-uri-component@^0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
|
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9"
|
||||||
integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=
|
integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==
|
||||||
|
|
||||||
decompress-response@^3.2.0, decompress-response@^3.3.0:
|
decompress-response@^3.2.0, decompress-response@^3.3.0:
|
||||||
version "3.3.0"
|
version "3.3.0"
|
||||||
|
@ -72,6 +72,11 @@ func (k *Keeper) TxConfig(ctx sdk.Context, txHash common.Hash) statedb.TxConfig
|
|||||||
// (ChainConfig and module Params). It additionally sets the validator operator address as the
|
// (ChainConfig and module Params). It additionally sets the validator operator address as the
|
||||||
// coinbase address to make it available for the COINBASE opcode, even though there is no
|
// coinbase address to make it available for the COINBASE opcode, even though there is no
|
||||||
// beneficiary of the coinbase transaction (since we're not mining).
|
// beneficiary of the coinbase transaction (since we're not mining).
|
||||||
|
//
|
||||||
|
// NOTE: the RANDOM opcode is currently not supported since it requires
|
||||||
|
// RANDAO implementation. See https://github.com/evmos/ethermint/pull/1520#pullrequestreview-1200504697
|
||||||
|
// for more information.
|
||||||
|
|
||||||
func (k *Keeper) NewEVM(
|
func (k *Keeper) NewEVM(
|
||||||
ctx sdk.Context,
|
ctx sdk.Context,
|
||||||
msg core.Message,
|
msg core.Message,
|
||||||
@ -89,6 +94,7 @@ func (k *Keeper) NewEVM(
|
|||||||
Time: big.NewInt(ctx.BlockHeader().Time.Unix()),
|
Time: big.NewInt(ctx.BlockHeader().Time.Unix()),
|
||||||
Difficulty: big.NewInt(0), // unused. Only required in PoW context
|
Difficulty: big.NewInt(0), // unused. Only required in PoW context
|
||||||
BaseFee: cfg.BaseFee,
|
BaseFee: cfg.BaseFee,
|
||||||
|
Random: nil, // not supported
|
||||||
}
|
}
|
||||||
|
|
||||||
txCtx := core.NewEVMTxContext(msg)
|
txCtx := core.NewEVMTxContext(msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user