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

x/superfluid: ensure events are emitted and tests added #2194

Closed
7 tasks
p0mvn opened this issue Jul 22, 2022 · 0 comments · Fixed by #2255
Closed
7 tasks

x/superfluid: ensure events are emitted and tests added #2194

p0mvn opened this issue Jul 22, 2022 · 0 comments · Fixed by #2255
Assignees
Labels
C:x/superfluid Good first issue T:bug 🐛 Something isn't working T:story A story belongs to an epic T:tests

Comments

@p0mvn
Copy link
Member

p0mvn commented Jul 22, 2022

Background

There are a few issues with how we emit superfluid events.

First, some of them are not being emitted on success:

if err != nil {
ctx.EventManager().EmitEvent(sdk.NewEvent(
types.TypeEvtSuperfluidDelegate,
sdk.NewAttribute(types.AttributeLockId, fmt.Sprintf("%d", msg.LockId)),
sdk.NewAttribute(types.AttributeValidator, msg.ValAddr),
))
}

The conditional should be the opposite of what it is now.

Second, there are no tests for any superfluid events so we cannot be confident if the rest function as expected.

Third, there is no documentation about what events are for and which attributes they should contain.

Suggested Design

Follow a similar change in x/gamm: #1942

To limit the scope and ease the review, I suggest associating each PR with the following tasks:

  • Task 1 - Core logic + Test TypeEvtSetSuperfluidAsset
  1. Create an internal x/superfluid/internal/events package that contains core logic for emitting events
  2. Keep the event names in types since they might be used by integrators
  3. Follow this PR for an example in GAMM
  4. Test TypeEvtSetSuperfluidAsset
    • test attributes in x/superfluid/internal/events
    • test that the event is emitted in the right location
    • Add docs to the README about what the event is for and which attributes it contains
  • Task 2 - Test TypeEvtRemoveSuperfluidAsset
    Test TypeEvtRemoveSuperfluidAsset
    • test attributes in x/superfluid/internal/events
    • test that the event is emitted in the right location
    • Add docs to the README about what the event is for and which attributes it contains
  • Task 3 - Test TypeEvtSuperfluidDelegate
    Test TypeEvtSuperfluidDelegate
    • test attributes in x/superfluid/internal/events
    • test that the event is emitted in the right location
    • Add docs to the README about what the event is for and which attributes it contains
  • Task 4 - Test TypeEvtSuperfluidIncreaseDelegation
    Test TypeEvtSuperfluidIncreaseDelegation
    • test attributes in x/superfluid/internal/events
    • test that the event is emitted in the right location
    • Add docs to the README about what the event is for and which attributes it contains
  • Task 5 - Test TypeEvtSuperfluidUndelegate
    Test TypeEvtSuperfluidUndelegate
    • test attributes in x/superfluid/internal/events
    • test that the event is emitted in the right location
    • Add docs to the README about what the event is for and which attributes it contains
  • Task 6 - Test TypeEvtSuperfluidUnbondLock
    Test TypeEvtSuperfluidUnbondLock
    • test attributes in x/superfluid/internal/events
    • test that the event is emitted in the right location
    • Add docs to the README about what the event is for and which attributes it contains
  • Task 7 - Test TypeEvtUnpoolId
    Test TypeEvtUnpoolId
    • test attributes in x/superfluid/internal/events
    • test that the event is emitted in the right location
    • Add docs to the README about what the event is for and which attributes it contains

Acceptance Criteria

  • superfluid events are emitted correctly in the right locations
  • tests added for attributes
  • tests added for verifying that events are emitted in the correct locations
  • every event is documented in superfluid README
    • what the events is for / when it is emitted
    • what attributes it contains
  • final design is consistent with x/gamm: x/gamm: test that swap and LP events are emitted #1942
@p0mvn p0mvn added T:bug 🐛 Something isn't working T:tests Good first issue C:x/superfluid T:story A story belongs to an epic labels Jul 22, 2022
@p0mvn p0mvn added this to the V11 Blockers milestone Jul 22, 2022
@p0mvn p0mvn moved this to Needs Review 🔍 in Osmosis Chain Development Jul 22, 2022
@hieuvubk hieuvubk self-assigned this Jul 28, 2022
@p0mvn p0mvn removed this from the V12 Blockers milestone Aug 18, 2022
Repository owner moved this from Needs Review 🔍 to Done ✅ in Osmosis Chain Development Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/superfluid Good first issue T:bug 🐛 Something isn't working T:story A story belongs to an epic T:tests
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants