Skip to content

feat: vesting account poc#5840

Merged
moul merged 21 commits into
masterfrom
julien/vesting-poc
Jul 16, 2026
Merged

feat: vesting account poc#5840
moul merged 21 commits into
masterfrom
julien/vesting-poc

Conversation

@julienrbrt

@julienrbrt julienrbrt commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

ref #5798

Implement vesting accounts. A small struct need to be added on genesis with the vesting account type, the vested amount and the vesting schedule. Bank will automatically verifies if a vesting account can spend those tokens.
Once the vesting schedule is over, vesting accounts are upgrade to normal accounts.

@Gno2D2

Gno2D2 commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details (checked by @tbruyelle)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Pending initial approval by a review team member, or review from tech-staff

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🟢 Requirement satisfied
└── 🟢 If
    ├── 🟢 Condition
    │   └── 🟢 Or
    │       ├── 🔴 At least one of these user(s) reviewed the pull request: [aronpark1007 davd-gzl jefft0 notJoon omarsy MikaelVallenet] (with state "APPROVED")
    │       ├── 🟢 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🔴 This pull request is a draft
    └── 🟢 Then
        └── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)
    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

@tbruyelle tbruyelle linked an issue Jun 23, 2026 that may be closed by this pull request
@julienrbrt
julienrbrt marked this pull request as ready for review June 23, 2026 14:45
@Gno2D2 Gno2D2 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Jun 23, 2026
@moul
moul requested review from aeddi, jaekwon and moul June 24, 2026 10:16
Comment thread tm2/pkg/std/std.proto
Comment thread gno.land/pkg/gnoland/app.go Outdated
Comment thread tm2/pkg/std/vesting_account.go Outdated
@Gno2D2 Gno2D2 removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Jun 24, 2026

@moul moul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few findings not already raised in the thread (the empty-baseAcc.Coins genesis bug, missing regenerated .pb.go, and the overflow risk are already covered by @tbruyelle).

Comment thread gno.land/pkg/gnoland/app.go
Comment thread tm2/pkg/sdk/bank/keeper.go
Comment thread tm2/pkg/std/errors.go
Comment thread tm2/pkg/std/vesting_account.go Outdated
@julienrbrt
julienrbrt force-pushed the julien/vesting-poc branch from 93a1934 to 74979df Compare June 25, 2026 15:06

@tbruyelle tbruyelle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have a remaining comment for the proto generated files, but I dont want to block the merge for that. Approving.

moul and others added 6 commits June 28, 2026 18:38
This reverts commit 74979df.

Per #5798 the GNOT lockup is send-limiting, not spend-limiting: fees and
realm calls must stay usable. Restricting gas to spendable coins would
brick a fully-locked account from transacting at all. Gas is therefore
paid via SendCoinsUnrestricted (which bypasses the vesting check) again.
Cover the runtime vesting checks in SubtractCoins through the public
SendCoins path: locked coins are rejected, the vested portion is
spendable, and a fully-vested account is upgraded to a BaseAccount.
Also assert SendCoinsUnrestricted (gas/refunds) bypasses the lock.
Satisfies the 'main / lint' CI check, which runs 'go fix' (Go 1.26
modernizers) over the tm2 module and rejects unapplied fixes.
@tbruyelle

Copy link
Copy Markdown
Contributor

@moul OK for merging ?

@moul

moul commented Jul 16, 2026

Copy link
Copy Markdown
Member

Review note — no blockers found; well-structured and well-tested. Two non-blocking warnings worth an explicit sign-off:

  1. Consensus-critical surface from a poc-tagged PR. bank.SubtractCoins is on the hot path for every transfer (including the VM banker via RemoveCoin/SendCoins). The change is inert unless genesis contains vesting entries (*BaseAccount doesn't satisfy std.VestingAccount, non-vesting paths are unchanged), so no state migration is needed — but reviewers should confirm intent to land core-bank behavior from a PoC. Worth stating "no migration needed, no pre-existing vesting accounts" in the description.
  2. Unrestricted-transfer bypass lets still-locked coins pay gas/storage-deposits (SendCoinsUnrestricted, auth/ante.go, bank/keeper.go). This is deliberate and tested (TestBankKeeper_VestingUnrestrictedBypass), and doesn't let a holder redirect locked funds to themselves (fees → fee collector). Fine as policy, but call it out so it's an accepted decision rather than an oversight.

Determinism checked: big.Int integer math on ctx.BlockTime(), sorted Coins iteration, no maps/floats/time.Now(). Upgrade preserves PubKey/Sequence/AccountNumber so signatures survive.

🤖 Posted autonomously by an AI review agent on @moul's behalf; not human-reviewed before posting.

@moul
moul merged commit a876beb into master Jul 16, 2026
90 checks passed
@moul
moul deleted the julien/vesting-poc branch July 16, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related

Projects

Development

Successfully merging this pull request may close these issues.

4 participants