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

fix: minted early tracking #11066

Merged
merged 4 commits into from
Mar 1, 2025
Merged

fix: minted early tracking #11066

merged 4 commits into from
Mar 1, 2025

Conversation

0xpatrickdev
Copy link
Member

@0xpatrickdev 0xpatrickdev commented Feb 28, 2025

Description

Ensures the mintedEarly store can track multiple settlements for the same amount from the same address.

Security Considerations

Ensures state diagram invariants are upheld.

Scaling Considerations

Same considerations as #10729 - the mapStore could grow large if an attacker spams the settlementAccount with uusdc. In these changes we ensure to delete map store entries when the count goes to 0.

Documentation Considerations

Changes should be clear to maintainers.

Testing Considerations

Adds a new test for the scenario not originally considered.

Upgrade Considerations

The mintedEarly kind is a Remotable, so changing from a SetStore to a MapStore does not seem to affect upgradability.

These change should be included in the FUSDC GTM CE.

@0xpatrickdev 0xpatrickdev requested a review from a team as a code owner February 28, 2025 02:18
@0xpatrickdev 0xpatrickdev self-assigned this Feb 28, 2025
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Good test.

We should have a multiset abstraction. Either with durable multiset or a light wrapper to make MapStore act like one.

@turadg turadg force-pushed the pc/minted-early-fix branch from c8ec060 to 400b37b Compare February 28, 2025 19:22
Copy link

cloudflare-workers-and-pages bot commented Feb 28, 2025

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5597958
Status: ✅  Deploy successful!
Preview URL: https://a55f4145.agoric-sdk.pages.dev
Branch Preview URL: https://pc-minted-early-fix.agoric-sdk.pages.dev

View logs

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

@0xpatrickdev I pushed the changes I requested but I won't merge. PTAL

Comment on lines +23 to +25
if (count <= 0) {
throw Fail`Cannot add a non-positive count ${count} to bag`;
}
Copy link
Member

Choose a reason for hiding this comment

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

Probably should check that count is a Nat ?

Copy link
Member

Choose a reason for hiding this comment

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

I'm using number and Nat is bigint

Copy link
Member

Choose a reason for hiding this comment

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

Sure, but we should still enforce that this in an integer, not any float.

Copy link
Member

Choose a reason for hiding this comment

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

Actually it's not just floats, but any NaN or non number values that will cause unexpected value for current count.

Comment on lines 53 to 59
if (currentCount <= count) {
mapStore.delete(item);
Copy link
Member

Choose a reason for hiding this comment

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

Feels like removing more than what is currently there should be an error.

Copy link
Member

Choose a reason for hiding this comment

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

it's returning a success boolean. we can align on this when moved to another package.

Copy link
Member

Choose a reason for hiding this comment

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

Asking to remove 5 from an entry that only has 3 still returns true, which seems incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

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

@turadg turadg force-pushed the pc/minted-early-fix branch from 400b37b to ca5ae30 Compare February 28, 2025 22:29
@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Feb 28, 2025
Copy link
Contributor

mergify bot commented Feb 28, 2025

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks:

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

Copy link
Contributor

mergify bot commented Mar 1, 2025

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks:

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@0xpatrickdev 0xpatrickdev force-pushed the pc/minted-early-fix branch from b3af0a0 to 3e5eaec Compare March 1, 2025 16:28
turadg and others added 3 commits March 1, 2025 11:37
- ensure multiples of the same NFA+amount are tracked
- `borrower.returnPool` already exits the seat
@0xpatrickdev 0xpatrickdev force-pushed the pc/minted-early-fix branch from 3e5eaec to 5597958 Compare March 1, 2025 16:37
Copy link
Contributor

mergify bot commented Mar 1, 2025

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks:

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@mergify mergify bot merged commit 92714b3 into master Mar 1, 2025
84 checks passed
@mergify mergify bot deleted the pc/minted-early-fix branch March 1, 2025 17:57
mujahidkay added a commit that referenced this pull request Mar 3, 2025
### Description

Cherrypicks the following changes:
 - #11065
 - #11052

Using the following rebase-todo:
```
# PR #11065 Branch fix-cosmos-upgrade-to-agoric-labs-ibc-go-v6-3-1-alpha-agoric-3-11065-
label base-fix-cosmos-upgrade-to-agoric-labs-ibc-go-v6-3-1-alpha-agoric-3-11065-
pick 52fb6cf build(deps): use new version of ibc-go
pick 3dbb1bc chore(golang): `go mod tidy`
label pr-11065--fix-cosmos-upgrade-to-agoric-labs-ibc-go-v6-3-1-alpha-agoric-3-11065-
reset base-fix-cosmos-upgrade-to-agoric-labs-ibc-go-v6-3-1-alpha-agoric-3-11065-
merge -C ee18609 pr-11065--fix-cosmos-upgrade-to-agoric-labs-ibc-go-v6-3-1-alpha-agoric-3-11065- # fix(cosmos): upgrade to `agoric-labs/ibc-go` `v6.3.1-alpha.agoric.3` (#11065)

# PR #11052 Branch fix-Properly-synchronize-slog-sender-termination-11052-
label base-fix-Properly-synchronize-slog-sender-termination-11052-
pick ec3c1a2 chore(SwingSet): Remove unused code and comments
pick 9ab1630 fix(SwingSet): Include level in kernel console slog output
pick fcfb944 refactor(SwingSet): Simplify makeFinishersKit into addSlogCallbacks
pick d8a5947 refactor(SwingSet): Improve addSlogCallbacks parameter/variable names
pick f83c01d fix: Properly synchronize slog sender termination
pick 318269e chore(telemetry): Use more readable async patterns
pick fa1f04a chore(SwingSet): Prefer type Callable over Function
pick 117c766 fix(internal): Exempt process.stdout from being closed by makeFsStreamWriter
pick 6c6fba4 refactor(internal): Prefer fs.WriteStream close() over stream.Writable end()
label pr-11052--fix-Properly-synchronize-slog-sender-termination-11052-
reset base-fix-Properly-synchronize-slog-sender-termination-11052- # fix: minted early tracking (#11066)
merge -C 42d5764 pr-11052--fix-Properly-synchronize-slog-sender-termination-11052- # fix: Properly synchronize slog sender termination (#11052)
```
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.

3 participants