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

[OCC] add async scheduler to seiv2 (unused) #462

Open
wants to merge 39 commits into
base: seiv2
Choose a base branch
from

Conversation

stevenlanders
Copy link
Contributor

@stevenlanders stevenlanders commented Mar 15, 2024

Describe your changes and provide context

  • adds tasksv2 package
  • package is gated by occ-aync boolean setting

Testing performed to validate your change

  • unit tests

codchen and others added 27 commits March 14, 2024 10:03
## 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]>
@stevenlanders stevenlanders changed the title [OCC] add async scheduler to seiv2 [OCC] add async scheduler to seiv2 (unused) Mar 15, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2024

Codecov Report

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

Project coverage is 55.56%. Comparing base (7f668bd) to head (0cc2a9b).
Report is 29 commits behind head on seiv2.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##            seiv2     #462      +/-   ##
==========================================
+ Coverage   55.36%   55.56%   +0.20%     
==========================================
  Files         629      637       +8     
  Lines       53878    54584     +706     
==========================================
+ Hits        29827    30330     +503     
- Misses      21917    22117     +200     
- Partials     2134     2137       +3     
Files Coverage Δ
baseapp/baseapp.go 66.86% <100.00%> (+0.19%) ⬆️
tasksv2/task_execution.go 100.00% <100.00%> (ø)
server/config/config.go 34.26% <50.00%> (+0.17%) ⬆️
simapp/simd/cmd/root.go 69.10% <0.00%> (-0.29%) ⬇️
baseapp/abci.go 51.79% <75.00%> (+0.11%) ⬆️
tasksv2/task_validation.go 85.29% <85.29%> (ø)
tasksv2/scheduler.go 89.83% <89.83%> (ø)
tasksv2/task_queue.go 86.66% <86.66%> (ø)
tasksv2/utils.go 75.00% <75.00%> (ø)
tasksv2/task.go 74.73% <74.73%> (ø)
... and 2 more

... and 30 files with indirect coverage changes

@udpatil udpatil force-pushed the seiv2 branch 3 times, most recently from 20e0b67 to ed1bd73 Compare March 27, 2024 14:15
@udpatil udpatil force-pushed the seiv2 branch 2 times, most recently from e587881 to ea1f1e8 Compare April 19, 2024 17:56
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.

4 participants