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

Events Tracking #4387

Closed
4 tasks
alexanderbez opened this issue May 21, 2019 · 0 comments · Fixed by #4541
Closed
4 tasks

Events Tracking #4387

alexanderbez opened this issue May 21, 2019 · 0 comments · Fixed by #4541
Assignees
Milestone

Comments

@alexanderbez
Copy link
Contributor

alexanderbez commented May 21, 2019

Summary

This is a place holder to issue to update the way the SDK handles tags (events). With the advent of tendermint/tendermint#3643, we'll have to modify the way SDK tracks events to support more aggregate and complex events.

AC/Proposal

Instead of having handlers and ABCI methods explicitly return tags (now events), we can track events through the block and tx context lifecycle. At any point when we return an ABCI response, we simply aggregate all the events by type.

pseudo example:

func BeginBlock(ctx sdk.Context, ...) error {
  ctx.Event("rewards", {"...": "..."}, ...)
  
  // ...
}

func msgHandler(ctx sdk.Context, msg sdk.Msg, ...) error {
  ctx.Event("transfer", {"...": "..."}, ...)

  // ...
}

func (ba *BaseApp) runTx() {
    return abci.Response{
        Events: ctx.CollectEvents()
    }
}

So three new methods on the context:

type Context struct {
    // ...
    events map[string][]cmn.KVPair
}

func (ctx Context) Event(eType string, attrs ...cmn.KVPair) {}
func (ctx Context) CollectEvents() []abci.Event {}

// not necessary, but may be helpful
func (ctx Context) FlushEvents() {}

replaces: #3122
replaces: #3956


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants