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

Seiv2 #475

Closed
wants to merge 32 commits into from
Closed

Seiv2 #475

wants to merge 32 commits into from

Conversation

udpatil
Copy link
Contributor

@udpatil udpatil commented Mar 26, 2024

Describe your changes and provide context

Testing performed to validate your change

@codecov-commenter
Copy link

codecov-commenter commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 51.56538% with 263 lines in your changes are missing coverage. Please review.

Project coverage is 55.37%. Comparing base (4e37eb4) to head (a5ae55f).

❗ Current head a5ae55f differs from pull request most recent head 6f71ccb. Consider uploading reports for the commit 6f71ccb to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #475      +/-   ##
==========================================
- Coverage   55.46%   55.37%   -0.10%     
==========================================
  Files         629      629              
  Lines       53549    53964     +415     
==========================================
+ Hits        29703    29882     +179     
- Misses      21734    21949     +215     
- Partials     2112     2133      +21     
Files Coverage Δ
store/types/store.go 68.75% <ø> (ø)
types/accesscontrol/resource.go 0.00% <ø> (ø)
types/errors/errors.go 85.04% <ø> (ø)
x/auth/ante/validator_tx_fee.go 94.23% <100.00%> (+0.75%) ⬆️
x/bank/types/key.go 35.13% <ø> (ø)
x/genutil/gentx.go 77.46% <100.00%> (ø)
storev2/rootmulti/store.go 3.00% <0.00%> (ø)
client/keys/utils.go 43.75% <33.33%> (-1.08%) ⬇️
store/multiversion/mvkv.go 93.20% <85.71%> (-0.45%) ⬇️
tasks/scheduler.go 91.62% <96.77%> (-0.07%) ⬇️
... and 23 more

... and 1 file with indirect coverage changes

@udpatil udpatil force-pushed the seiv2 branch 2 times, most recently from 20e0b67 to ed1bd73 Compare March 27, 2024 14:15
codchen and others added 27 commits April 16, 2024 17:44
## Describe your changes and provide context
For EVM getProof endpoint, we'd need to call functions on the underlying
iavl store, so we'd need a way to expose the parent store from a cachekv

## Testing performed to validate your change
## Describe your changes and provide context
We need to make `TxIndex` available during dependency generation so that
we can derive the corresponding temporary intermediate account and
coinbase account for the message

## Testing performed to validate your change
- To avoid multiple deserialization, as well as adding cached values to
sdk.Tx
- Add new acl constants for evm subprefixes
- Add a new bank send method that doesn't automatically create accounts
unit tests & local sei integration
Integrate with pending txs:
- return `ResponseCheckTxV2`
- add a new field `PendingTxChecker` field in Context

integration with local sei
## Describe your changes and provide context

## Testing performed to validate your change
## Describe your changes and provide context
Add two new bank keeper functions that allow sub-usei (i.e. wei)
sending, where 1 usei = 10^12 wei:
```
SendCoinsAndWei(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, customEscrow sdk.AccAddress, denom string, amt sdk.Int, wei sdk.Int) error
GetWeiBalance(ctx sdk.Context, addr sdk.AccAddress) sdk.Int
```
Any usei that is split as a result of wei sending will be stored in an
escrow account, which can either be one that's specified by the caller
or a default global escrow module account.

## Testing performed to validate your change
unit test & local integration with sei-chain
- Adding an expiration handler callback that lets the mempool

- sei-protocol/sei-tendermint#179

- e2e testing with hardhat tests
- needs tendermint pr and go.mod update
- adds evm properties to the `ResponseCheckTxV2`
- adds evm properties to context

- hardhat tests on sei-chain repo
- unit tests on tendermint repo
Add an interface function `VersionExists` to store types

local sei integration
## Describe your changes and provide context
Iterating with mergeiterator to get all keys and then deleting is
extremely slow when there are >10 layers of `cachekv`. This PR adds a
more efficient function to delete all keys within a range, without
having to make recursive calls like mergeiterator.

## Testing performed to validate your change
unit test on cachekv

---------

Co-authored-by: Philip Su <[email protected]>
## Describe your changes and provide context
Bypass negative check for sends involving Wei escrow accounts, since
they may temporarily go negative during tx processing (but will be
settled back to 0 in EndBlock)

## Testing performed to validate your change
tested with the corresponding sei change
## Describe your changes and provide context

## Testing performed to validate your change
## Describe your changes and provide context
Since add and sub balance are now decoupled, we no longer need an
explicit escrow account, and can implicitly represent "escrow" by direct
crediting/debiting account's usei balances. This PR removes the explicit
escrow account logic, and also added wei logic in invariant checks

## Testing performed to validate your change
unit tests
Derive evm address from private key when showing keys in `seid keys
show` and `seid keys list`. This only works for local keyring since it
would have access to the private key

<img width="1201" alt="Screen Shot 2024-02-26 at 11 18 43 AM"
src="https://github.com/sei-protocol/sei-cosmos/assets/6227889/68c9e13d-73a0-471c-b424-238c683e8ec9">
<img width="1204" alt="Screen Shot 2024-02-26 at 11 18 35 AM"
src="https://github.com/sei-protocol/sei-cosmos/assets/6227889/6a820b81-0405-42ce-9e17-40efa6c4edbc">
## Describe your changes and provide context
Since EVM transactions specify gas price in unit of wei, we have started
representing priority of EVM transactions in wei-per-gas. In order for
cosmos transactions' priority to be comparable with EVM transactions',
we would like to use the same unit for priority here as well. Hence in
this PR we amplify cosmos transaction priority by 10^12 (if the original
priority is based on the base denom aka usei)

## Testing performed to validate your change
unit test
## Describe your changes and provide context
See description in
sei-protocol/sei-tendermint#206

## Testing performed to validate your change

---------

Co-authored-by: Steven Landers <[email protected]>
Co-authored-by: Philip Su <[email protected]>
Co-authored-by: Yiming Zang <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Uday Patil <[email protected]>
…454)

This is one component that was missed when refactoring to use absolute
indices for EVM changes. This change refactors such that prefill
estimates will appropriately fill the estimates by absolute Index and
indexes validated will similarly check via absolute indices instead of
relative.

Existing unit tests + loadtesting
---------

Co-authored-by: Steven Landers <[email protected]>
## Describe your changes and provide context
- avoids scheduler if no txs (mainly for gassless situations)
- limits tasks to the min(task count, workers)

## Testing performed to validate your change
- unit tests and load testing
codchen and others added 5 commits April 16, 2024 17:44
…y deleted (#464)

## Describe your changes and provide context
If we have a cacheKV that has a dirty cache of 1->a and a parent with an
entry 2->b, the previous implementation of `DeleteAll` would only call
cacheKV.Delete on key 1 but not affecting 2 at all (i.e. if someone
queries key 2 on the cacheKV they would still get `b`, but the
expectation is for 2 to be deleted as appearing on the cacheKV level).
This PR fixes that by first getting all the keys to be (marked as)
deleted recursively and then delete all those keys one-by-one; note that
this recursion should be fairly efficient since it's not subject to the
exponential latency that merge iterators have.

This PR also fixed DeleteAll for `mvkv` so that it doesn't actually
touch parent store's value but only change the writeset (as a single
`Delete` would have done).

## Testing performed to validate your change
unit test
## Describe your changes and provide context
Previously when getting keys from local cache the `start`/`end` boundary
was not respected

## Testing performed to validate your change
unit test that includes keys outside of the requested range
…rt tracing when using OCC (#478)

## Describe your changes and provide context

This brings in an interface that can be set on `DeliverTxEntry` and
hooks into the `scheduler` so it call's the necessary tracer callbacks
when required.

Refer to `types/tx_tracer.go` for extra details about the patch.

## Testing performed to validate your change

---------

Co-authored-by: Steven Landers <[email protected]>
## Describe your changes and provide context
- adds new error 

## Testing performed to validate your change
- unit on sei-chain
## Describe your changes and provide context
- Checks for err before `defer`
- Without this, if there is a err, the node will panic on the `defer`
because `scStore` is `nil`

## Testing performed to validate your change
- Verified on node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants