Skip to content

Add concurrency for BurnMsg and MintMsg#331

Merged
BrandonWeng merged 1 commit into2.0.0betafrom
bweng-tokenfactory
Oct 25, 2022
Merged

Add concurrency for BurnMsg and MintMsg#331
BrandonWeng merged 1 commit into2.0.0betafrom
bweng-tokenfactory

Conversation

@BrandonWeng
Copy link
Contributor

@BrandonWeng BrandonWeng commented Oct 21, 2022

Describe your changes and provide context

Adding Concurrency mapping to mint msg and burn msg for token factory

Testing performed to validate your change

Create Denom + Mint
seid tx tokenfactory create-denom bando --from brandon --chain-id sei-chain --fees=1000000000usei --broadcast-mode=block --gas=30000000 --yes

Also spammed these commands on a load test chain to see no consensus errors.

seid tx tokenfactory mint 1000factory/sei16jrfnar3rcm48g9u6485kyz0rhgdese7jwqm4c/bando --from brandon --fees 10000000usei --gas=100000000 --chain-id sei-chain --yes --broadcast-mode block

> seid q bank total
pagination:
  next_key: null
  total: "0"
supply:
- amount: "1000"
  denom: factory/sei16jrfnar3rcm48g9u6485kyz0rhgdese7jwqm4c/bando
- amount: "100000000000000000000"
  denom: uatom
- amount: "100000087794340194236"
  denom: usei
- amount: "100000000000000000000"
  denom: uusdc
...

Burn
seid tx tokenfactory burn 100factory/sei16jrfnar3rcm48g9u6485kyz0rhgdese7jwqm4c/bando --from brandon --fees 100000000usei --gas=100000000 --chain-id sei-chain --yes --broadcast-mode block

> seid q bank total
pagination:
  next_key: null
  total: "0"
supply:
- amount: "900"
  denom: factory/sei16jrfnar3rcm48g9u6485kyz0rhgdese7jwqm4c/bando
- amount: "100000000000000000000"
  denom: uatom
- amount: "100000126517210604535"
  denom: usei
- amount: "100000000000000000000"
  denom: uusdc

BrandonWeng added a commit to sei-protocol/sei-cosmos that referenced this pull request Oct 24, 2022
## Describe your changes and provide context
Refactors the code a bit and add necessary helpers for Tokenfactory mint
and burn message types.
* They both will deposit and withdraw from module accounts as they're
used as intermediaries for storage

For context, module accounts are a single source of the bottom neck when
it comes to concurrency, so to remove this bottle neck, we avoid
declaring them in the access ops, instead, we store an in-memory value
protected by mutex locks and flush it to the AVL tree at the very end.
This will ensure deterministic updates

Follow-up PRs, still need to test concurrency:
sei-protocol/sei-chain#331 
#63

## Testing performed to validate your change
Mainly unit tests - will need to do some E2E testing once it's
integrated with the sei-chain level chains. Will follow up with two more
PRs

Sanity check that bank sends aren't affected with the follow up PRs:

![image](https://user-images.githubusercontent.com/18161326/197229251-0afe0517-c930-4745-993a-10aad7c1c038.png)
BrandonWeng added a commit to sei-protocol/sei-cosmos that referenced this pull request Oct 25, 2022
## Describe your changes and provide context
sei-protocol/sei-chain#331 

Adds helpers to support deferring mints and burn messages. Without this,
we would need to define the module account as a dependency in the ACL
mapping for concurrent TXs, and that would result in all mint/burns
running sequentially, which is already the existing behavior.

This keeps track of the mints and burns a mem-var and in sei-chain, at
the end of delieverTx, they are written all at once

## Testing performed to validate your change
See sei-protocol/sei-chain#331
@BrandonWeng BrandonWeng merged commit 80bb2a5 into 2.0.0beta Oct 25, 2022
@BrandonWeng BrandonWeng deleted the bweng-tokenfactory branch October 25, 2022 13:20
BrandonWeng added a commit to sei-protocol/sei-cosmos that referenced this pull request Oct 27, 2022
## Describe your changes and provide context
Refactors the code a bit and add necessary helpers for Tokenfactory mint
and burn message types.
* They both will deposit and withdraw from module accounts as they're
used as intermediaries for storage

For context, module accounts are a single source of the bottom neck when
it comes to concurrency, so to remove this bottle neck, we avoid
declaring them in the access ops, instead, we store an in-memory value
protected by mutex locks and flush it to the AVL tree at the very end.
This will ensure deterministic updates

Follow-up PRs, still need to test concurrency:
sei-protocol/sei-chain#331 
#63

## Testing performed to validate your change
Mainly unit tests - will need to do some E2E testing once it's
integrated with the sei-chain level chains. Will follow up with two more
PRs

Sanity check that bank sends aren't affected with the follow up PRs:

![image](https://user-images.githubusercontent.com/18161326/197229251-0afe0517-c930-4745-993a-10aad7c1c038.png)
BrandonWeng added a commit to sei-protocol/sei-cosmos that referenced this pull request Oct 27, 2022
## Describe your changes and provide context
sei-protocol/sei-chain#331 

Adds helpers to support deferring mints and burn messages. Without this,
we would need to define the module account as a dependency in the ACL
mapping for concurrent TXs, and that would result in all mint/burns
running sequentially, which is already the existing behavior.

This keeps track of the mints and burns a mem-var and in sei-chain, at
the end of delieverTx, they are written all at once

## Testing performed to validate your change
See sei-protocol/sei-chain#331
udpatil pushed a commit that referenced this pull request Oct 28, 2022
Co-authored-by: Brandon Weng <brandon@Brandons-MacBook-Pro.local>
udpatil pushed a commit that referenced this pull request Oct 28, 2022
Co-authored-by: Brandon Weng <brandon@Brandons-MacBook-Pro.local>
udpatil pushed a commit that referenced this pull request Nov 1, 2022
Co-authored-by: Brandon Weng <brandon@Brandons-MacBook-Pro.local>
udpatil pushed a commit that referenced this pull request Nov 1, 2022
Co-authored-by: Brandon Weng <brandon@Brandons-MacBook-Pro.local>
udpatil added a commit that referenced this pull request Nov 1, 2022
udpatil added a commit that referenced this pull request Nov 1, 2022
* Revert "Update Antehandler resource depedencies  (#354)"

This reverts commit 6c672fb.

* Revert "update staking validation identifier (#353)"

This reverts commit 8a17c26.

* Revert "Update Oracle Parallel Tx Resource Identifiers  (#351)"

This reverts commit c9229ab.

* Revert "Update IdentifierTemplate for TokenFactory  (#350)"

This reverts commit e81fc93.

* Revert "[loadtest] Loadtest fixes"

This reverts commit 68bfab5.

* Revert "fix unit tests"

This reverts commit 49eb809.

* Revert "Fix Bank Send Unit Tests  (#348)"

This reverts commit 9c11837.

* Revert "integrate with sei-cosmos changes (#347)"

This reverts commit e1b1790.

* Revert "Validate Concurrent Messages + Update BankSend  (#345)"

This reverts commit e4d3176.

* Revert "Add concurrency for BurnMsg and MintMsg (#331)"

This reverts commit 4a5cff0.

* Revert "Ezhu/granularize staking resources (#343)"

This reverts commit 90e288c.

* Revert "Oracle parallel (#334)"

This reverts commit 67c0db3.

* Revert "Ezhu/staking dep gen mappings v2 rebase (#338)"

This reverts commit 1324183.

* Revert "Refactor Loadtest script (#336)"

This reverts commit c8b83c7.

* Revert "Optimize genesis account creation script (#320)"

This reverts commit a0c0306.

* Revert "Wasm gov (#316)"

This reverts commit c3b421b.

* Revert "Lazy Deposit All Module Accounts During EndBlock (#313)"

This reverts commit 5ad4d9b.

* Revert "Wasm signal (#305)"

This reverts commit 206f2bb.

* Revert "Add dependencies for ante handlers that read/write accounts (#314)"

This reverts commit 5d39f90.

* Revert "Add Gasless decorator back and remove CountTxDecorator  (#311)"

This reverts commit 93fa4bd.

* Revert "Branch another cache for all transactions (#309)"

This reverts commit c2ce1ed.

* Revert "Add msg send dynamic access ops (#303)"

This reverts commit 2c5f14e.

* Revert "[ante] Add ante dep generator default behavior (#294)"

This reverts commit 0ada1db.

* Revert "Add more parallel TX metrics (#296)"

This reverts commit 567ffd9.

* Revert "Add aclmapping options and mapping folder (#287)"

This reverts commit c9522a5.

* Revert "Bump sei-cosmos and sei-tendermint for 2.0.0beta (#293)"

This reverts commit d9254b6.

* Revert "Cherry-pick loadtesting changes and make a fix for parallel tx (#288)"

This reverts commit 255fec9.

* Revert "[app] refactored graph into acl module (#286)"

This reverts commit 9b2d204.

* Revert "Add gov proposal handler for acl (#277)"

This reverts commit bbb5a50.

* Revert "Fix for DAG building switch cases (#282)"

This reverts commit 9eebc8e.

* Revert "Optimize signals (#280)"

This reverts commit fd9a3b6.

* Revert "[app] Add behavior to process blocks with gov txs sync (#276)"

This reverts commit ea2a906.

* Revert "[graph] Move metric to dag builder helper (#275)"

This reverts commit c530c02.

* Revert "Fixes for parallel TX and metrics (#272)"

This reverts commit 30207e7.

* Revert "[graph] Add resource hierarchy to dependency graph (#268)"

This reverts commit da7c070.

* Revert "Revert "Parallel TX Synchrnous Testing""

This reverts commit f343740.

* Revert "Parallel TX Synchrnous Testing"

This reverts commit b95b44c.

* Revert "Dag optimization (#263)"

This reverts commit ac3fdbf.

* Revert "Create Channels from DAG (#261)"

This reverts commit 35b9cf4.

* Revert "[accesscontrol] Add dependency dag (#258)"

This reverts commit 6721845.

* Revert "Register accesscontrol module (#257)"

This reverts commit 3e34d34.
masih pushed a commit that referenced this pull request Sep 29, 2025
## Describe your changes and provide context
Refactors the code a bit and add necessary helpers for Tokenfactory mint
and burn message types.
* They both will deposit and withdraw from module accounts as they're
used as intermediaries for storage

For context, module accounts are a single source of the bottom neck when
it comes to concurrency, so to remove this bottle neck, we avoid
declaring them in the access ops, instead, we store an in-memory value
protected by mutex locks and flush it to the AVL tree at the very end.
This will ensure deterministic updates

Follow-up PRs, still need to test concurrency:
#331 
sei-protocol/sei-cosmos#63

## Testing performed to validate your change
Mainly unit tests - will need to do some E2E testing once it's
integrated with the sei-chain level chains. Will follow up with two more
PRs

Sanity check that bank sends aren't affected with the follow up PRs:

![image](https://user-images.githubusercontent.com/18161326/197229251-0afe0517-c930-4745-993a-10aad7c1c038.png)
masih pushed a commit that referenced this pull request Sep 29, 2025
## Describe your changes and provide context
#331 

Adds helpers to support deferring mints and burn messages. Without this,
we would need to define the module account as a dependency in the ACL
mapping for concurrent TXs, and that would result in all mint/burns
running sequentially, which is already the existing behavior.

This keeps track of the mints and burns a mem-var and in sei-chain, at
the end of delieverTx, they are written all at once

## Testing performed to validate your change
See #331
masih pushed a commit that referenced this pull request Sep 29, 2025
## Describe your changes and provide context
Previously, a proposal to change Tendermint consensus params to an
invalid value could be made, but could potentially halt the chain b/c at
the block in which the proposal passes, Tendermint will verify that the
params are valid and panic if the change is not valid (see
https://github.com/sei-protocol/sei-tendermint/blob/d426f1fe475eb0c406296770ff5e9f8869b3887e/internal/state/execution.go#L320),
thus halting the change. This PR early rejects the proposal so that the
chain will no longer halt.
## Testing performed to validate your change
- Added unit tests
- Verified on a internal chain:
```
root@ip-172-31-34-209:/home/ubuntu/sei-chain# seid tx gov submit-proposal param-change prop.json --from admin -b block --fees 20000usei
Enter keyring passphrase:
Error: block.MaxGas must be greater or equal to -1. Got -2
...
root@ip-172-31-34-209:/home/ubuntu/sei-chain# seid tx gov submit-proposal param-change prop.json --from admin -b block --fees 2000usei
Enter keyring passphrase:
Error: block.MaxBytes is too big. 2202009600000 > 104857600
```
masih pushed a commit that referenced this pull request Sep 30, 2025
## Describe your changes and provide context
Refactors the code a bit and add necessary helpers for Tokenfactory mint
and burn message types.
* They both will deposit and withdraw from module accounts as they're
used as intermediaries for storage

For context, module accounts are a single source of the bottom neck when
it comes to concurrency, so to remove this bottle neck, we avoid
declaring them in the access ops, instead, we store an in-memory value
protected by mutex locks and flush it to the AVL tree at the very end.
This will ensure deterministic updates

Follow-up PRs, still need to test concurrency:
#331 
sei-protocol/sei-cosmos#63

## Testing performed to validate your change
Mainly unit tests - will need to do some E2E testing once it's
integrated with the sei-chain level chains. Will follow up with two more
PRs

Sanity check that bank sends aren't affected with the follow up PRs:

![image](https://user-images.githubusercontent.com/18161326/197229251-0afe0517-c930-4745-993a-10aad7c1c038.png)
masih pushed a commit that referenced this pull request Sep 30, 2025
## Describe your changes and provide context
#331 

Adds helpers to support deferring mints and burn messages. Without this,
we would need to define the module account as a dependency in the ACL
mapping for concurrent TXs, and that would result in all mint/burns
running sequentially, which is already the existing behavior.

This keeps track of the mints and burns a mem-var and in sei-chain, at
the end of delieverTx, they are written all at once

## Testing performed to validate your change
See #331
masih pushed a commit that referenced this pull request Sep 30, 2025
## Describe your changes and provide context
Previously, a proposal to change Tendermint consensus params to an
invalid value could be made, but could potentially halt the chain b/c at
the block in which the proposal passes, Tendermint will verify that the
params are valid and panic if the change is not valid (see
https://github.com/sei-protocol/sei-tendermint/blob/d426f1fe475eb0c406296770ff5e9f8869b3887e/internal/state/execution.go#L320),
thus halting the change. This PR early rejects the proposal so that the
chain will no longer halt.
## Testing performed to validate your change
- Added unit tests
- Verified on a internal chain:
```
root@ip-172-31-34-209:/home/ubuntu/sei-chain# seid tx gov submit-proposal param-change prop.json --from admin -b block --fees 20000usei
Enter keyring passphrase:
Error: block.MaxGas must be greater or equal to -1. Got -2
...
root@ip-172-31-34-209:/home/ubuntu/sei-chain# seid tx gov submit-proposal param-change prop.json --from admin -b block --fees 2000usei
Enter keyring passphrase:
Error: block.MaxBytes is too big. 2202009600000 > 104857600
```
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