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

refactor: remove lien mechanism support #385

Merged
merged 4 commits into from
Mar 5, 2024
Merged

refactor: remove lien mechanism support #385

merged 4 commits into from
Mar 5, 2024

Conversation

JimLarson
Copy link

@JimLarson JimLarson commented Feb 26, 2024

Description

Closes: Agoric/agoric-sdk#8989

  • Undo the conversion of AccountKeeper into an interface.
  • Remove the *Action interfaces for vesting accounts and simplify the implementations of AddGrant, ReturnGrant, Clawback, etc.
  • Change the sdk.Context argument in VestingAccount.LockedCoins back to time.Time.

Reduces the footprint of our fork.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

The lien feature was implemented by having every account pretend
it was a vesting account, where the liened amount would appear
unvested. A wrapper was placed around AccountKeeper so every account
retrieved from the store would be itself wrapped in a ficticious
vesting account implementing this mechanism. But operations against
a real vesting account, e.g. clawback, adding a new grant, etc,
would have to be routed to the wrapped underlying account. Complicating
this, the wrapper code lived in the agoric-sdk repository, and we
had to avoid importing that, and circular imports all around.

The gist of this commit is that without these account wrappers,
simple type casts work and the interface and "action" gymnastics
are no longer needed. Actions on a vesting account can simply be
ordinary methods.
A context was needed for the lien feature to look up records in the
store. This usage has been removed.
@JimLarson JimLarson added enhancement New feature or request agoric-cosmos Agoric tags for cosmos labels Feb 26, 2024
@JimLarson JimLarson self-assigned this Feb 26, 2024
@JimLarson JimLarson marked this pull request as ready for review February 26, 2024 06:01
@JimLarson
Copy link
Author

The failing lint check is expected.

Copy link
Collaborator

@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! I only noticed one search-and-replaceo.


// NewAccountKeeper returns a new AccountKeeper that uses go-amino to
// NewAccountKeeper returns a new AccountKeeperI that uses go-amino to
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// NewAccountKeeper returns a new AccountKeeperI that uses go-amino to
// NewAccountKeeper returns a new AccountKeeper that uses go-amino to

Copy link
Author

Choose a reason for hiding this comment

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

This error is in the cosmos release, so I'm going to err on the side of minimizing our fork footprint. We can fix it in upstream some day.

@JimLarson JimLarson merged commit 9c20eac into Agoric Mar 5, 2024
28 of 29 checks passed
@JimLarson JimLarson deleted the 8989-rm-lien branch March 5, 2024 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agoric-cosmos Agoric tags for cosmos C:x/auth C:x/bank enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove lien support from cosmos-sdk
2 participants