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: latest memiavl is not integrated #1127

Merged
merged 1 commit into from
Aug 9, 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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changelog

*Jul 4, 2023*
*Aug 10, 2023*

## v1.0.10
## v1.0.12

- [#986](https://github.com/crypto-org-chain/cronos/pull/986) Use go 1.20.
- [#984](https://github.com/crypto-org-chain/cronos/pull/984) experimental integration of memiavl.
Expand Down
13 changes: 11 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ const (
//
// NOTE: In the SDK, the default value is 255.
AddrLen = 20

FlagBlockedAddresses = "blocked-addresses"
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
Expand Down Expand Up @@ -753,7 +755,13 @@ func New(
app.SetInitChainer(app.InitChainer)
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)
app.setAnteHandler(encodingConfig.TxConfig, cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)))

app.setAnteHandler(
encodingConfig.TxConfig,
cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)),
cast.ToStringSlice(appOpts.Get(FlagBlockedAddresses)),
)

// In v0.46, the SDK introduces _postHandlers_. PostHandlers are like
// antehandlers, but are run _after_ the `runMsgs` execution. They are also
// defined as a chain, and have the same signature as antehandlers.
Expand Down Expand Up @@ -791,7 +799,7 @@ func New(
}

// use Ethermint's custom AnteHandler
func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64, blacklist []string) {
anteHandler, err := evmante.NewAnteHandler(evmante.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
Expand All @@ -804,6 +812,7 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
MaxTxGasWanted: maxGasWanted,
ExtensionOptionChecker: ethermint.HasDynamicFeeExtensionOption,
TxFeeChecker: evmante.NewDynamicFeeChecker(app.EvmKeeper),
Blacklist: blacklist,
})
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
, nativeByteOrder ? true # nativeByteOrder mode will panic on big endian machines
}:
let
version = "v1.0.10";
version = "v1.0.12";
pname = "cronosd";
tags = [ "ledger" "netgo" network "rocksdb" "grocksdb_no_link" ]
++ lib.optionals nativeByteOrder [ "nativebyteorder" ];
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/armon/go-metrics v0.4.1
github.com/cosmos/cosmos-sdk v0.46.14
github.com/cosmos/ibc-go/v5 v5.2.1
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230726092142-d7d9101ad0e8
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230726092142-d7d9101ad0e8
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230809065519-af389f66015a
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230809065519-af389f66015a
github.com/ethereum/go-ethereum v1.10.26
github.com/evmos/ethermint v0.0.0-00010101000000-000000000000
github.com/gogo/protobuf v1.3.3
Expand Down Expand Up @@ -78,7 +78,7 @@ require (
github.com/cosmos/iavl v0.19.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230726092142-d7d9101ad0e8 // indirect
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230809065519-af389f66015a // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
Expand Down Expand Up @@ -221,7 +221,7 @@ replace (
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.19-deepcopy-jumptable
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20230623034002-4774460b6dd7
github.com/evmos/ethermint => github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20230809091211-3fdb18b1c2d9
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1045,14 +1045,14 @@ github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ
github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ=
github.com/crypto-org-chain/cometbft-db v0.0.0-20230412133340-ac70df4b45f6 h1:d4h4Ki1UE/LF6CKwYEm3OZ+HIBCrzSmOokG1vce0O98=
github.com/crypto-org-chain/cometbft-db v0.0.0-20230412133340-ac70df4b45f6/go.mod h1:hF5aclS++7WrW8USOA3zPeKI0CuzwUD2TPYug25ANlQ=
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230726092142-d7d9101ad0e8 h1:rVPW0rjTZ7gblZxO+fWhIjjfAI9VmVN5xT4JQspSjE8=
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230726092142-d7d9101ad0e8/go.mod h1:jNT8/Mrx+B0dXBmodB5spDBSp/mEQqgX3oPclWve4dQ=
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230726092142-d7d9101ad0e8 h1:PUYOo5UF8QGD/yUd0kVKpOLsu3BLy/LK4q6M6yJqBxg=
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230726092142-d7d9101ad0e8/go.mod h1:LVocDb5u3bTS1c5IWvjp0Mgn9iQ66Jt5N4osvizpkpY=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230726092142-d7d9101ad0e8 h1:OTsZOJXWWVuXWiqexEC3whjXZMGyqDbV59hdFdg6cyg=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230726092142-d7d9101ad0e8/go.mod h1:i9e8vrU54C/JvSM+rX/jUidFRBcyXZ8FgNX+EvrasQc=
github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20230623034002-4774460b6dd7 h1:XrvzFooIySR9ggIUVI6PB+O9DdL7/lJLwv4RsCTSPuI=
github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20230623034002-4774460b6dd7/go.mod h1:EDjmywAw/EMpMufJA2Q+E9pNHAB00Dt5siQanMOZC88=
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230809065519-af389f66015a h1:TXGKBsh4GbJFt6Ae6YOgaVR7pPJ+5GoAgFQTL+1zuX4=
github.com/crypto-org-chain/cronos/memiavl v0.0.4-0.20230809065519-af389f66015a/go.mod h1:sCbJoEppeM3/7+Ox1heGlbVt+eWBcTmLb9UEjuotXIc=
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230809065519-af389f66015a h1:eEncVCIM858efVMOlv3LTPD/WLteoMHmxLFd2hxZAJc=
github.com/crypto-org-chain/cronos/store v0.0.4-0.20230809065519-af389f66015a/go.mod h1:LVocDb5u3bTS1c5IWvjp0Mgn9iQ66Jt5N4osvizpkpY=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230809065519-af389f66015a h1:NUlWNavUQrx5V2YW2bwV64utaDrCf5eoK45vIgW2kWc=
github.com/crypto-org-chain/cronos/versiondb v0.0.0-20230809065519-af389f66015a/go.mod h1:i9e8vrU54C/JvSM+rX/jUidFRBcyXZ8FgNX+EvrasQc=
github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20230809091211-3fdb18b1c2d9 h1:c1KS8c8epruyUAonKBYHDCrCSCsSmGIIPXA/49505dE=
github.com/crypto-org-chain/ethermint v0.20.11-cronos.0.20230809091211-3fdb18b1c2d9/go.mod h1:EDjmywAw/EMpMufJA2Q+E9pNHAB00Dt5siQanMOZC88=
github.com/crypto-org-chain/go-ethereum v1.10.19-deepcopy-jumptable h1:VQLW0R8t9DcC/HvQZO1i0mIWjJfAezhI8lLUCholP0M=
github.com/crypto-org-chain/go-ethereum v1.10.19-deepcopy-jumptable/go.mod h1:IJBNMtzKcNHPtllYihy6BL2IgK1u+32JriaTbdt4v+w=
github.com/crypto-org-chain/go-ethereum-hdwallet v0.1.2 h1:Qu2GMavGHCcomdVWmZej76JpOO6uvII6IpPDdJUG+Qo=
Expand Down
16 changes: 8 additions & 8 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ schema = 3
version = "v0.3.2"
hash = "sha256-Y261IO/d9xjV0UScqHvo31broxvnKn4IQQC9Mu6jNkE="
[mod."github.com/crypto-org-chain/cronos/memiavl"]
version = "v0.0.4-0.20230726092142-d7d9101ad0e8"
hash = "sha256-qzlwxs0N/CYtLCfBLmbe8H3Q9ZxZyXXFmNIKKwhnnpk="
version = "v0.0.4-0.20230809065519-af389f66015a"
hash = "sha256-f+naUXVdUXP4PmJi5R5pHTDpuhXE8zwmxQrjW7LkNF8="
[mod."github.com/crypto-org-chain/cronos/store"]
version = "v0.0.4-0.20230726092142-d7d9101ad0e8"
hash = "sha256-mKtxQvCNjF9kn2X6i7yV2AbVtSvB50zIxBq3pZo/NVM="
version = "v0.0.4-0.20230809065519-af389f66015a"
hash = "sha256-lg6FsKzeew4f3EYfSZZd/AcmvzbBQNrkvxt+bid/hK0="
[mod."github.com/crypto-org-chain/cronos/versiondb"]
version = "v0.0.0-20230726092142-d7d9101ad0e8"
hash = "sha256-97vd4jYtV/ZTsA3hF0bznmYjRXwQILxLjPn7EMUgg5g="
version = "v0.0.0-20230809065519-af389f66015a"
hash = "sha256-GFaIoluOc2TFZlLOwwYy7oKHX1dWk0QhvvP7iXsl2aw="
[mod."github.com/danieljoos/wincred"]
version = "v1.1.2"
hash = "sha256-Nnklfg12vmWCOhELGyoRqEF4w4srp0WbPwreaChYLKs="
Expand Down Expand Up @@ -205,8 +205,8 @@ schema = 3
hash = "sha256-QKuYnEXXrnHPPHk/Xc9ocez2Jheo/0IOOa1IQaMH61c="
replaced = "github.com/crypto-org-chain/go-ethereum"
[mod."github.com/evmos/ethermint"]
version = "v0.20.11-cronos.0.20230623034002-4774460b6dd7"
hash = "sha256-85nCdNbzvWBi/HdE1PQ5Fu7PfozOAVOfjCKJbFkR1ow="
version = "v0.20.11-cronos.0.20230809091211-3fdb18b1c2d9"
hash = "sha256-cm3AZsL45+jnOH5+XCUSVzhAN0cuav0gn+dm+1nxJow="
replaced = "github.com/crypto-org-chain/ethermint"
[mod."github.com/felixge/httpsnoop"]
version = "v1.0.2"
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/configs/long_timeout_commit.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ default {
timeout_commit: '15s',
},
},
'app-config'+: {
'blocked-addresses': ['crc16z0herz998946wr659lr84c8c556da55dc34hh'],
},
},
}
11 changes: 10 additions & 1 deletion integration_tests/test_mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def test_mempool(cronos_mempool):

to = ADDRS["community"]
params = {"gasPrice": w3.eth.gas_price}
block_num_0, sended_hash_set = send_txs(w3, cli, to, KEYS.values(), params)
block_num_0, sended_hash_set = send_txs(
w3, cli, to, [v for k, v in KEYS.items() if k != "signer1"], params
)
print(f"all send tx hash: {sended_hash_set} at {block_num_0}")

all_pending = w3.eth.get_filter_changes(filter.filter_id)
Expand All @@ -72,3 +74,10 @@ def test_mempool(cronos_mempool):
break
wait_for_new_blocks(cli, 1, sleep=0.1)
assert len(sended_hash_set) == 0


def test_blocked_address(cronos_mempool):
cli = cronos_mempool.cosmos_cli(0)
rsp = cli.transfer("signer1", cli.address("validator"), "1basecro")
assert rsp["code"] != 0
assert "signer is blocked" in rsp["raw_log"]
5 changes: 2 additions & 3 deletions integration_tests/test_vesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ def test_create_account(cronos):
end_time = int(time.time()) + 3000
fees = f"{fee}{denom}"
res = cli.create_vesting_account(addr, amt, end_time, from_="validator", fees=fees)
assert res["code"] == 0, res["raw_log"]
balance = cli.balance(addr, denom)
assert balance == amount
assert res["code"] != 0
assert "vesting messages are not supported" in res["raw_log"]