This repository was archived by the owner on Jan 20, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
Add Tx channels to context #27
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bd351aa
Add Tx channels to context
BrandonWeng 2c5ca0f
comment
BrandonWeng dd77eed
use access operations instead
BrandonWeng fbd9edf
fix with handlers
BrandonWeng 74da2b4
Fixed dependency
BrandonWeng 91a221e
add message index
BrandonWeng 46e0dfa
alias
BrandonWeng 3d4b45b
alias
BrandonWeng 209c2ea
msg index
BrandonWeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
x/accesscontrol/types/access_operation.go → types/accesscontrol/access_operation.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package types | ||
| package accesscontrol | ||
|
|
||
| import ( | ||
| fmt "fmt" | ||
|
|
||
26 changes: 13 additions & 13 deletions
26
x/accesscontrol/types/accesscontrol.pb.go → types/accesscontrol/accesscontrol.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
x/accesscontrol/types/constants.pb.go → types/accesscontrol/constants.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import ( | |
|
|
||
| "github.com/cosmos/cosmos-sdk/store/gaskv" | ||
| stypes "github.com/cosmos/cosmos-sdk/store/types" | ||
| acltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" | ||
| ) | ||
|
|
||
| /* | ||
|
|
@@ -39,8 +40,18 @@ type Context struct { | |
| consParams *tmproto.ConsensusParams | ||
| eventManager *EventManager | ||
| priority int64 // The tx priority, only relevant in CheckTx | ||
|
|
||
| txBlockingChannels MessageAccessOpsChannelMapping | ||
| txCompletionChannels MessageAccessOpsChannelMapping | ||
| messageIndex int // Used to track current message being processed | ||
| } | ||
|
|
||
| // Alias for Map of MessageIndex -> AccessOperation -> Channel | ||
| type MessageAccessOpsChannelMapping = map[int]AccessOpsChannelMapping | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should map by tx index |
||
|
|
||
| // Alias for Map of AccessOperation -> Channel | ||
| type AccessOpsChannelMapping = map[*acltypes.AccessOperation][]chan interface{} | ||
|
|
||
| // Proposed rename, not done to avoid API breakage | ||
| type Request = Context | ||
|
|
||
|
|
@@ -60,6 +71,9 @@ func (c Context) IsReCheckTx() bool { return c.recheckTx } | |
| func (c Context) MinGasPrices() DecCoins { return c.minGasPrice } | ||
| func (c Context) EventManager() *EventManager { return c.eventManager } | ||
| func (c Context) Priority() int64 { return c.priority } | ||
| func (c Context) TxCompletionChannels() MessageAccessOpsChannelMapping { return c.txCompletionChannels } | ||
| func (c Context) TxBlockingChannels() MessageAccessOpsChannelMapping { return c.txBlockingChannels } | ||
| func (c Context) MessageIndex() int { return c.messageIndex } | ||
|
|
||
| // clone the header before returning | ||
| func (c Context) BlockHeader() tmproto.Header { | ||
|
|
@@ -222,6 +236,24 @@ func (c Context) WithEventManager(em *EventManager) Context { | |
| return c | ||
| } | ||
|
|
||
| // WithTxCompletionChannels returns a Context with an updated list of completion channel | ||
| func (c Context) WithTxCompletionChannels(completionChannels MessageAccessOpsChannelMapping) Context { | ||
| c.txCompletionChannels = completionChannels | ||
| return c | ||
| } | ||
|
|
||
| // WithTxBlockingChannels returns a Context with an updated list of blocking channels for completion signals | ||
| func (c Context) WithTxBlockingChannels(blockingChannels MessageAccessOpsChannelMapping) Context { | ||
| c.txBlockingChannels = blockingChannels | ||
| return c | ||
| } | ||
|
|
||
| // WithMessageIndex returns a Context with the current message index that's being processed | ||
| func (c Context) WithMessageIndex(messageIndex int) Context { | ||
| c.messageIndex = messageIndex | ||
| return c | ||
| } | ||
|
|
||
| // TODO: remove??? | ||
| func (c Context) IsZero() bool { | ||
| return c.ms == nil | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,4 +78,4 @@ type TxEncoder func(tx Tx) ([]byte, error) | |
| // MsgTypeURL returns the TypeURL of a `sdk.Msg`. | ||
| func MsgTypeURL(msg Msg) string { | ||
| return "/" + proto.MessageName(msg) | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: newline |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we tracking message index instead of txindex? in the other places for dependency mapping, we're indexing by the tx index, this distinction is relevant since each tx can have multiple messages as part of it.