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

EVM support #30

Open
wants to merge 38 commits into
base: v0.50.x-inj
Choose a base branch
from
Open

EVM support #30

wants to merge 38 commits into from

Conversation

kakysha
Copy link

@kakysha kakysha commented Oct 8, 2024

No description provided.

yihuang and others added 30 commits March 22, 2024 09:14
add basic support in sdk:
- add a TxExecutor baseapp option
- add TxIndex/TxCount/MsgIndex in context

Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

fix misspell

fix lint

run gci

fix lint

gci seems not compatible with gofumpt
Solution:
- remove the api

changelog
* Revert "build(deps): Bump github.com/cosmos/iavl from 1.0.1 to 1.1.1 in store (cosmos#19770)"

This reverts commit ff30f6e.

* Problem: store package has dependency issues

Solution:
- revert the iavl bump, v1.0.2 is the version referenced by outer packages
generic interface

generic btree

generic cachekv

generic transient store

support ObjStore

changelog

Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

object store key

Apply review suggestions

fix merge conflict

fix snapshot

revert dependers
…s#237)

* Problem: no efficient way to collect fee

Solution:
- support an idea of virtual account in bank module, where the incoming
  coins are accumulated in a per-tx object store first, then accumulate
  and credit to the real account at end blocker.

  it's nesserary to support parallel tx execution, where we try not to
  access shared states.

more efficient sum

support SendCoinsFromModuleToAccountVirtual

fix test

fix test

* fix lint

* fix test

* fix test

* fix test

* fix test

* fix test

* fix mock keeper

* try fix lint

* try fix lint

* reuse code

* try fix linter

* Update x/bank/keeper/send.go

Signed-off-by: yihuang <[email protected]>

* algin panic call

* fix error handling

* try fix lint

* nolintlint generate falst postiive

---------

Signed-off-by: yihuang <[email protected]>
…s#239)

fix

Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

don't change interface
* Problem: MultiStore interface is bloated

Solution:
- Split out specialied methods from it, keeping the MultiStore generic

* Update store/CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

---------

Signed-off-by: yihuang <[email protected]>
* Problem: nested cache store not efficient

Solution:
- introduce copy-on-write btree based cache store

temp

* changelog

* rename

* Update store/cachekv/store.go

Signed-off-by: yihuang <[email protected]>

---------

Signed-off-by: yihuang <[email protected]>
Solution:
- init cachestore on cachestore lazily.
- cleanup some unused stuff.

Update store/CHANGELOG.md

Signed-off-by: yihuang <[email protected]>
* Support RunAtomic API

* add unit test
Solution:
- fix and add test to support the usage pattern in ethermint

add Discard method to CacheWrap

better testing
* feat: save some memory allocations on un-used cache store

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* Update store/internal/btree/btree.go

Signed-off-by: yihuang <[email protected]>

---------

Signed-off-by: yihuang <[email protected]>
Solution:
- fix the way context is updated
…osmos#258)

Solution:
- add API NewFromParent to cache multistore.

Update store/CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

fix test

fix lint
* mutex don't cover GetSigners

don't clone header in context

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* update comment

---------

Signed-off-by: yihuang <[email protected]>
Solution:
- add API StreamingManager to allow extending the abci listeners, mainly
  for versiondb support

Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

cleanup
* Problem: x/tx not up to date to the released version

Solution:
- reset to the x/tx/0.13.1

* fix lint
Solution:
- support bytes fields to support MsgEthereumTx

Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

fix test

move changelog
* fix(x/bank): align query with multi denoms for send-enabled (cosmos#20028)

* fix(client/v2): respect output format from client ctx (cosmos#20033)
* build(deps): Bump github.com/cosmos/gogoproto from 1.4.11 to 1.4.12 (cosmos#19811)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* feat(x/gov): emit proposer address in submit proposal event (backport cosmos#19842) (cosmos#19844)

Co-authored-by: Aryan Tikarya <[email protected]>
Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: Julien Robert <[email protected]>

* feat(x/gov): emit depositor in `proposal_deposit` event (backport cosmos#19853) (cosmos#19859)

Co-authored-by: Kien <[email protected]>
Co-authored-by: Julien Robert <[email protected]>

* reuse fromAddrString (minor cleanup) (cosmos#19881)

* feat(client): replace `event-query-tx-for` with `wait-tx` (backport cosmos#19870) (cosmos#19887)

* feat(server): add custom start handler (backport cosmos#19854) (cosmos#19884)

Co-authored-by: Julien Robert <[email protected]>

* build(deps): Bump cosmossdk.io/store from 1.0.2 to 1.1.0 (cosmos#19810)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: Julien Robert <[email protected]>

* docs(x/mint): Fix inconsistency in mint docs  (backport cosmos#19915) (cosmos#19925)

* build(deps): Bump github.com/cosmos/iavl from 1.1.1 to 1.1.2 (cosmos#19985)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Julien Robert <[email protected]>

* fix(client/v2): add encoder for `cosmos.base.v1beta1.DecCoin` (backport cosmos#19976) (cosmos#20001)

Co-authored-by: Julien Robert <[email protected]>

* fix(mempool): use no-op mempool as default (backport cosmos#19970) (cosmos#20008)

Co-authored-by: Tom <[email protected]>
Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: Julien Robert <[email protected]>

* feat: Conditionally emit metrics based on enablement (backport cosmos#19903) (cosmos#20017)

Co-authored-by: Lucas Francisco López <[email protected]>
Co-authored-by: Julien Robert <[email protected]>

* fix(x/bank): align query with multi denoms for send-enabled (backport cosmos#20028) (cosmos#20029)

Co-authored-by: mmsqe <[email protected]>

* fix: Implement gogoproto customtype to secp256r1 keys (backport cosmos#20027) (cosmos#20031)

Co-authored-by: Facundo Medica <[email protected]>

* fix(client/v2): respect output format from client ctx (backport cosmos#20033) (cosmos#20046)

Co-authored-by: mmsqe <[email protected]>

* build(deps): Bump cosmossdk.io/x/tx from 0.13.1 to 0.13.2 (cosmos#20042)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Julien Robert <[email protected]>

* feat(x/bank): support depinject for send restrictions (backport cosmos#20014) (cosmos#20024)

* fix(baseapp): don't share global gas meter in tx execution (backport cosmos#19616) (cosmos#20050)

* fix: secp256r1 json missing quotes (backport cosmos#20060) (cosmos#20069)

Co-authored-by: Facundo Medica <[email protected]>

* build(deps): Bump github.com/cosmos/cosmos-proto from 1.0.0-beta.4 to 1.0.0-beta.5 (cosmos#20095)

* feat(client/v2): implement version filtering using annotation (backport cosmos#20083) (cosmos#20099)

Co-authored-by: Julien Robert <[email protected]>

* chore: prepare v0.50.6 (cosmos#19998)

* fix: use timestamp for sim log file name (backport cosmos#20108) (cosmos#20111)

Co-authored-by: mmsqe <[email protected]>

* fix(x/authz,x/feegrant): check blocked address (cosmos#20102)

* chore: update v0.50.6 release notes (cosmos#20124)

* build(deps): bump sdk in modules (cosmos#20126)

* docs(gas/fees): Update block gas documentation (backport cosmos#20128) (cosmos#20131)

Co-authored-by: samricotta <[email protected]>

* fix(baseapp): avoid header height overwrite block height (backport cosmos#20107) (cosmos#20129)

Co-authored-by: mmsqe <[email protected]>
Co-authored-by: Julien Robert <[email protected]>

* docs: fix broken link (backport cosmos#20133) (cosmos#20138)

* build(deps): bump modules in simapp (cosmos#20137)

* build(deps): Bump cosmossdk.io/x/tx from 0.13.2 to 0.13.3 (cosmos#20152)

* docs: add authz reference info in the circuit antehandler (backport cosmos#20146) (cosmos#20155)

Co-authored-by: Reece Williams <[email protected]>

* fix(testsuite/sims): set all signatures (backport cosmos#20151) (cosmos#20185)

Co-authored-by: Leon <[email protected]>

* build(deps): Bump github.com/cometbft/cometbft from 0.38.6 to 0.38.7 (cosmos#20206)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* fix(server): bootstrap-state command can't parse latest genesis format (backport cosmos#20020) (cosmos#20045)

Co-authored-by: yihuang <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
Co-authored-by: sontrinh16 <[email protected]>
Co-authored-by: marbar3778 <[email protected]>

* fix: remove txs from mempool when antehandler fails in recheck (backport cosmos#20144) (cosmos#20251)

Co-authored-by: Marko <[email protected]>

* fix resolve

* align dependencies

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Aryan Tikarya <[email protected]>
Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
Co-authored-by: Kien <[email protected]>
Co-authored-by: yihuang <[email protected]>
Co-authored-by: Tom <[email protected]>
Co-authored-by: Lucas Francisco López <[email protected]>
Co-authored-by: Facundo Medica <[email protected]>
Co-authored-by: samricotta <[email protected]>
Co-authored-by: Reece Williams <[email protected]>
Co-authored-by: Leon <[email protected]>
Co-authored-by: sontrinh16 <[email protected]>
Co-authored-by: Marko <[email protected]>
…osmos#507)

* Problem: mempool don't respect gas wanted returned by ante handler

Solution:
- support custom gas wanted in mempool

* Update CHANGELOG.md

Signed-off-by: yihuang <[email protected]>

* cleanup

* cleanup

* fix priorityIndex

* fix process proposal

* fix lint

* fix lint

---------

Signed-off-by: yihuang <[email protected]>
* Problem: redundant mutex for InsertWithGasWanted

cfg of PriorityNonceMempool remains unchanged once assigned, so no lock is required

* make mocks

* cleanup

* keep order of check MaxTx
Comment on lines +142 to +144
for _, store := range cms.stores {
store.Discard()
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
store = cms.initStore(key, cms.parentStore(key))
}
if key == nil || store == nil {
panic(fmt.Sprintf("kv store with key %v has not been registered in stores", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
panic(fmt.Sprintf("kv store with key %v has not been registered in stores", key))
store, ok := cms.getCacheWrapper(key).(types.KVStore)
if !ok {
panic(fmt.Sprintf("store with key %v is not KVStore", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
Comment on lines +231 to +236
for k, v := range cms.stores {
if _, ok := other.stores[k]; !ok {
// clear the cache store if it's not in the other
v.Discard()
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +239 to +246
for k, v := range other.stores {
store, ok := cms.stores[k]
if !ok {
store = cms.initStore(k, cms.parentStore(k))
}

store.(types.BranchStore).Restore(v.(types.BranchStore))
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
func (ts *BTreeStore[V]) ReverseIterator(start, end []byte) types.GIterator[V] {
it, err := ts.BTree.ReverseIterator(start, end)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
store := types.KVStore(s)
store, ok := s.(types.KVStore)
if !ok {
panic(fmt.Sprintf("store with key %v is not KVStore", key))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
// AssertValidValueLength checks if the value length is within length limit
func AssertValidValueLength(l int) {
if l > MaxValueLength {
panic(errors.New("value is too large"))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
Comment on lines +188 to +190
for key := range okeys {
cms.MountStoreWithDB(okeys[key], storetypes.StoreTypeObject, nil)
}

Check warning

Code scanning / CodeQL

Iteration over map Warning test

Iteration over map may be a possible source of non-determinism
@@ -8,4 +8,5 @@
// EndBlocker is called every block, emits balance event
func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
k.EmitAllTransientBalances(ctx)
k.CreditVirtualAccounts(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
baseapp/abci.go Outdated
Comment on lines 724 to 730
ProposerAddress: req.ProposerAddress,
NextValidatorsHash: req.NextValidatorsHash,
AppHash: app.LastCommitID().Hash,
LastBlockId: cmtproto.BlockID{
Hash: req.LastBlockHash,
PartSetHeader: cmtproto.PartSetHeader{
Total: uint32(req.LastBlockPartSetTotal),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).internalFinalizeBlock (baseapp/abci.go:703)
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/abci.go:876)

baseapp/abci.go Outdated
Comment on lines 723 to 730
Time: req.Time,
ProposerAddress: req.ProposerAddress,
NextValidatorsHash: req.NextValidatorsHash,
AppHash: app.LastCommitID().Hash,
AppHash: req.AppHash,
ValidatorsHash: req.ValidatorsHash,
ConsensusHash: req.ConsensusHash,
DataHash: req.DataHash,
EvidenceHash: req.EvidenceHash,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).internalFinalizeBlock (baseapp/abci.go:703)
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/abci.go:876)

@maxim-inj
Copy link

This PR must not include things that are not directly related to EVM.
We shall cherry-pick only relevent EVM changes and skip stuff related to parallel execution and multistore hacks.

@maxim-inj maxim-inj self-requested a review October 14, 2024 21:07
Copy link

@maxim-inj maxim-inj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

90f3048

We need to cut this out and all deps of it. I suggest instead cherry picking what's really relevant to EVM.

Copy link

coderabbitai bot commented Nov 6, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

baseapp/abci.go Outdated
Comment on lines 724 to 730
ProposerAddress: req.ProposerAddress,
NextValidatorsHash: req.NextValidatorsHash,
AppHash: app.LastCommitID().Hash,
ValidatorsHash: req.ValidatorsHash,
ConsensusHash: req.ConsensusHash,
DataHash: req.DataHash,
EvidenceHash: req.EvidenceHash,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).internalFinalizeBlock (baseapp/abci.go:703)
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/abci.go:876)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants