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

Problem: selfdestruct could affect other contracts with same bytecode #618

Merged
merged 11 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## UNRELEASED
yihuang marked this conversation as resolved.
Show resolved Hide resolved

### State Machine Breaking

- [#618](https://github.com/crypto-org-chain/cronos/pull/618) selfdestruct don't delete bytecode of smart contract.

*Aug 5, 2022*

## v0.7.1

### Bug Fixes

- [#454](https://github.com/crypto-org-chain/cronos/pull/454) Add back the latest testnet upgrade handler.
Expand Down
45 changes: 1 addition & 44 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package app

import (
"io"
"math/big"
"net/http"
"os"
"path/filepath"
Expand All @@ -24,7 +23,6 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -704,52 +702,11 @@ func New(
app.SetEndBlocker(app.EndBlocker)

// upgrade handlers
plan0_7_0 := "v0.7.0"
plan_name := "v0.7.0-hotfix"
app.UpgradeKeeper.SetUpgradeHandler(plan0_7_0, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
updatedVM, err := app.mm.RunMigrations(ctx, app.configurator, fromVM)
if err != nil {
return nil, err
}
// Override feemarket parameters
initialBaseFee := int64(5000000000000)
app.FeeMarketKeeper.SetParams(ctx, feemarkettypes.Params{
NoBaseFee: false,
BaseFeeChangeDenominator: 100000000,
ElasticityMultiplier: 2,
InitialBaseFee: initialBaseFee,
EnableHeight: 0,
})
app.FeeMarketKeeper.SetBaseFee(ctx, big.NewInt(initialBaseFee))
evmParams := app.EvmKeeper.GetParams(ctx)
zeroInt := sdk.ZeroInt()
evmParams.ChainConfig.LondonBlock = &zeroInt
app.EvmKeeper.SetParams(ctx, evmParams)
return updatedVM, nil
})

// this upgrade is for breaking bug fixes on testnet
plan0_7_0Rc3HotfixTestnet := "v0.7.0-rc3-hotfix-testnet"
app.UpgradeKeeper.SetUpgradeHandler(plan0_7_0Rc3HotfixTestnet, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
cp := ctx.ConsensusParams()
cp.Block.MaxGas = 10000000
app.StoreConsensusParams(ctx, cp)
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}

if upgradeInfo.Name == plan0_7_0 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{"feemarket"},
}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(err.Error())
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
, rev ? "dirty"
}:
let
version = "v0.7.1";
version = "v0.8.0";
pname = "cronosd";
tags = [ "ledger" "netgo" network ]
++ lib.lists.optional (db_backend == "rocksdb") "rocksdb";
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ replace (

github.com/tendermint/tendermint => github.com/tendermint/tendermint v0.34.20

github.com/tharsis/ethermint => github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220719024136-4658529abbf5
github.com/tharsis/ethermint => github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220805014032-9b262150774c
tomtau marked this conversation as resolved.
Show resolved Hide resolved

google.golang.org/grpc => google.golang.org/grpc v1.33.2
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220719024136-4658529abbf5 h1:2iLYA821730/uyyrY8Rn3AXxpYNPIsdelCuYcZyJSmE=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220719024136-4658529abbf5/go.mod h1:T4f1p3L5kccbjBZMtJLKfOLiUXTO1OuS1I7FzQuJD+w=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220805014032-9b262150774c h1:yKP4nqEiFXtmTXimG+O64kQ1S9STiAEIuGD8CQPI8nk=
github.com/crypto-org-chain/ethermint v0.10.0-cronos.0.20220805014032-9b262150774c/go.mod h1:T4f1p3L5kccbjBZMtJLKfOLiUXTO1OuS1I7FzQuJD+w=
github.com/crypto-org-chain/ibc-go/v2 v2.2.0-hooks2 h1:elj+Tb/3O9GA3pv62zkc1B0P8hl1WHmF6vF8PInEJm4=
github.com/crypto-org-chain/ibc-go/v2 v2.2.0-hooks2/go.mod h1:rAHRlBcRiHPP/JszN+08SJx3pegww9bcVncIb9QLx7I=
github.com/crypto-org-chain/keyring v1.1.6-fixes h1:AUFSu56NY6XobY6XfRoDx6v3loiOrHK5MNUm32GEjwA=
Expand Down
6 changes: 3 additions & 3 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ schema = 3
version = "v0.6.7"
hash = "sha256-hl/3RrBrpkk2zA6dmrNlIYKs1/GfqegSscDSkA5Pjlo="
[mod."github.com/tharsis/ethermint"]
version = "v0.10.0-cronos.0.20220719024136-4658529abbf5"
hash = "sha256-86PPinRIfbATES4B4FLFE02GQSCBxO39Tsj/VYYhkr8="
replaced = "github.com/crypto-org-chain/ethermint"
version = "v0.10.0-cronos.0.20220805014032-9b262150774c"
hash = "sha256-vSseS5bYyHAPPqwMujTLM/h/ckh3OWXZJR572Wh3KYU="
replaced = "github.com/yihuang/ethermint"
[mod."github.com/tklauser/go-sysconf"]
version = "v0.3.10"
hash = "sha256-Zf2NsgM9+HeM949vCce4HQtSbfUiFpeiQ716yKcFyx4="
Expand Down