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

feat(cosmic-swingset): Leave inbound actions in vstorage #7115

Merged
merged 12 commits into from
Mar 23, 2023

Conversation

mhofman
Copy link
Member

@mhofman mhofman commented Mar 5, 2023

closes: #7102
refs: agoric-labs/cosmos-sdk#300 (pre-requisite)

Best reviewed commit-by-commit

Description

Remove the inboundQueue from swingstore, keep pending inbound actions in the vstorage backed actionQueue.
To keep functionality intact, create a new context for actions at the cosmos level, which includes blockHeight, txHash and msgIdx, which in the future will allow better integrated telemetry. Use that context to generate the inboundNum identifier.
InboundAllowed is now computed in the golang side, meaning cosmic-swingset no longer has a say in how many actions should be pending. If we need to in the future, we can re-introduce data that cosmic-swingset can return to cosmos to include in the decision.

Security Considerations

None

Scaling Considerations

This will potentially make 2 performance related upcoming features slightly more complicated:

Documentation Considerations

None

Testing Considerations

Manually tested by dropping the computron limit and maxAllowedQueue size, and verified with the loadgen that inboundQueue limits still function correctly.

@mhofman mhofman requested a review from michaelfig March 5, 2023 00:09
@datadog-full-agoric
Copy link

datadog-full-agoric bot commented Mar 5, 2023

Datadog Report

Branch report: mhofman/7102-keep-action-queue
Commit report: 4d4ba07

agoric-sdk: 0 Failed, 0 New Flaky, 3659 Passed, 57 Skipped, 16m 7.8s Wall Time

Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

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

Just some questions. If you have good answers or make appropriate changes, I'll be happy to approve. :)

golang/cosmos/x/swingset/keeper/keeper.go Outdated Show resolved Hide resolved
golang/cosmos/x/swingset/keeper/keeper.go Outdated Show resolved Hide resolved
golang/cosmos/x/vbank/vbank.go Outdated Show resolved Hide resolved
packages/cosmic-swingset/src/chain-main.js Outdated Show resolved Hide resolved
packages/cosmic-swingset/src/chain-main.js Show resolved Hide resolved
packages/cosmic-swingset/src/kernel-stats.js Show resolved Hide resolved
packages/cosmic-swingset/src/make-queue.js Outdated Show resolved Hide resolved
@mhofman mhofman requested a review from michaelfig March 6, 2023 22:33
@mhofman
Copy link
Member Author

mhofman commented Mar 6, 2023

PTAL @michaelfig

Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for this.

@mhofman mhofman requested a review from JimLarson March 20, 2023 22:49
@datadog-full-agoric
Copy link

datadog-full-agoric bot commented Mar 20, 2023

Datadog Report

Branch report: mhofman/7102-keep-action-queue
Commit report: e9a40df

agoric-sdk: 0 Failed, 0 New Flaky, 3789 Passed, 55 Skipped, 23m 14.87s Wall Time

type ActionContext struct {
BlockHeight int64 `json:"blockHeight"`
TxHash string `json:"txHash"`
MsgIdx int `json:"msgIdx"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on where this index is meaningful. Index of the cosmos message in its transaction? In the block? Or is this the index of a swingset message?

golang/cosmos/x/swingset/keeper/keeper.go Outdated Show resolved Hide resolved
golang/cosmos/x/swingset/keeper/keeper.go Outdated Show resolved Hide resolved
golang/cosmos/x/swingset/keeper/keeper.go Outdated Show resolved Hide resolved
if !found {
return errors.New("could not find max inboundQueue size in params")
}
inboundMempoolQueueMax := inboundQueueMax / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a separate entry: types.QueueInboundMempool. Please correct any comment or doc which says it's always half of QueueInbound.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand, which docs or comment says that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me turn my request in to a question instead - what made you think that the inbound mempool queue max should be half of the inbound queue max?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what the existing behavior that I'm porting from JS is.

While we have a params.QueueMax value for QueueInbound, we don't have an explicit param value for QueueInboundMempool, which is hardcoded and documented as 50% of the QueueInbound value.

However we do need to compute a a value for the QueueInboundMempool of the state.QueueAllowed. That value is indeed only going to be 50% of the allowed QueueInbound if the actionQueue is empty. However I don't believe there is any claim anywhere that the allowed QueueInboundMempool is always 50% of the allowed QueueInbound.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, okay, I get it now.

golang/cosmos/x/vbank/vbank.go Show resolved Hide resolved
@mhofman mhofman requested a review from JimLarson March 21, 2023 21:43
if !found {
return errors.New("could not find max inboundQueue size in params")
}
inboundMempoolQueueMax := inboundQueueMax / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Let me turn my request in to a question instead - what made you think that the inbound mempool queue max should be half of the inbound queue max?

golang/cosmos/x/vbank/vbank.go Show resolved Hide resolved
golang/cosmos/x/swingset/keeper/keeper.go Outdated Show resolved Hide resolved
golang/cosmos/x/swingset/keeper/keeper.go Outdated Show resolved Hide resolved
@mhofman mhofman requested a review from JimLarson March 22, 2023 01:10
if !found {
return errors.New("could not find max inboundQueue size in params")
}
inboundMempoolQueueMax := inboundQueueMax / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, okay, I get it now.

@mhofman mhofman force-pushed the mhofman/7102-keep-action-queue branch from 5115f02 to c14f611 Compare March 22, 2023 20:02
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #7115 (c14f611) into master (3aa2b5d) will decrease coverage by 0.06%.
The diff coverage is 7.59%.

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

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7115      +/-   ##
==========================================
- Coverage   70.64%   70.58%   -0.06%     
==========================================
  Files         447      442       -5     
  Lines       85082    84613     -469     
  Branches        3        3              
==========================================
- Hits        60107    59725     -382     
+ Misses      24909    24820      -89     
- Partials       66       68       +2     
Impacted Files Coverage Δ
golang/cosmos/x/swingset/abci.go 0.00% <0.00%> (ø)
golang/cosmos/x/swingset/keeper/keeper.go 11.96% <0.00%> (-2.73%) ⬇️
packages/cosmic-swingset/src/kernel-stats.js 29.29% <0.00%> (-0.36%) ⬇️
golang/cosmos/x/vbank/vbank.go 57.47% <100.00%> (-1.46%) ⬇️

... and 13 files with indirect coverage changes

Impacted file tree graph

@mhofman mhofman added the automerge:rebase Automatically rebase updates, then merge label Mar 23, 2023
@mhofman mhofman force-pushed the mhofman/7102-keep-action-queue branch from c14f611 to a32299d Compare March 23, 2023 00:27
@mergify mergify bot merged commit 8343c53 into master Mar 23, 2023
@mergify mergify bot deleted the mhofman/7102-keep-action-queue branch March 23, 2023 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep pending actions in actionQueue
3 participants