Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Add Support for Deferring Mints/Burns from the Module Accounts #63

Merged
BrandonWeng merged 1 commit intomainfrom
bweng-mint-msg
Oct 25, 2022
Merged

Add Support for Deferring Mints/Burns from the Module Accounts #63
BrandonWeng merged 1 commit intomainfrom
bweng-mint-msg

Conversation

@BrandonWeng
Copy link
Contributor

@BrandonWeng BrandonWeng commented Oct 21, 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 changed the title Bweng mint msg Add Support for Deferring Mints/Burns from the Module Accounts Oct 21, 2022
@BrandonWeng BrandonWeng marked this pull request as ready for review October 21, 2022 15:16
}
}

func (m *DeferredBankOperationMapping) get(moduleAccount string) (Coins, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

these functions don't need locking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made these private functions as they should only be called internally. let me add comments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, i just removed this. It's not really needed and adds more confusion

@BrandonWeng BrandonWeng mentioned this pull request Oct 22, 2022
BrandonWeng added a commit 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)
Base automatically changed from bweng-deferred-helpers to main October 24, 2022 14:43
@BrandonWeng BrandonWeng merged commit 432a0fd into main Oct 25, 2022
@BrandonWeng BrandonWeng deleted the bweng-mint-msg branch October 25, 2022 12:51
BrandonWeng added a commit 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 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
masih pushed a commit to sei-protocol/sei-chain 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 to sei-protocol/sei-chain 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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants