Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Apply custom setter for FinalizeBlock logic
Browse files Browse the repository at this point in the history
dudong2 committed Mar 13, 2024
1 parent 9fd510a commit aca507a
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 11 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
@@ -296,7 +296,7 @@ func NewEthermintApp(
voteExtHandler := simapp.NewVoteExtensionHandler()
voteExtHandler.SetHandlers(bApp)
}
baseAppOptions = append(baseAppOptions, voteExtOp, baseapp.SetOptimisticExecution())
baseAppOptions = append(baseAppOptions, voteExtOp)

// NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
// Setup Mempool and Proposal Handlers
@@ -804,6 +804,16 @@ func NewEthermintApp(
app.SetEndBlocker(app.EndBlocker)
app.setAnteHandler(txConfig, cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)))

// app.InternalFinalizeBlock is the Cosmos SDK native FinalizeBlock logic.
// To run custom FinalizeBlock logic, make the following modifications Replace
// app.InternalFinalizeBlock with your custom function
//
// NOTE: If you want to perform custom FinalizeBlock logic,
// SetOptimisticExecution should be called after SetFinalizeBlockHandler.
//
// app.SetFinalizeBlockHandler(FinalizeBlockFunc)
baseapp.SetOptimisticExecution()(app.BaseApp)

// In v0.46, the SDK introduces _postHandlers_. PostHandlers are like
// antehandlers, but are run _after_ the `runMsgs` execution. They are also
// defined as a chain, and have the same signature as antehandlers.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -248,11 +248,11 @@ require (

replace (
cosmossdk.io/core => cosmossdk.io/core v0.11.0
cosmossdk.io/store => github.com/b-harvest/cosmos-sdk/store v0.0.0-20240312082708-417c9916b31c
cosmossdk.io/store => github.com/b-harvest/cosmos-sdk/store v0.0.0-20240313070058-dfda7de13923
// use cosmos keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76

github.com/cosmos/cosmos-sdk => github.com/b-harvest/cosmos-sdk v0.0.0-20240312082708-417c9916b31c
github.com/cosmos/cosmos-sdk => github.com/b-harvest/cosmos-sdk v0.0.0-20240313070058-dfda7de13923
// github.com/cosmos/cosmos-sdk => /Users/dudong2/workspace/github.com/b-harvest/cosmos-sdk
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -270,10 +270,10 @@ github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX
github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ=
github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/b-harvest/cosmos-sdk v0.0.0-20240312082708-417c9916b31c h1:f7rLaSeZRBNrx36hVsPrnrpxmIse6gaoSAWqv1IyfDA=
github.com/b-harvest/cosmos-sdk v0.0.0-20240312082708-417c9916b31c/go.mod h1:tlrkY1sntOt1q0OX/rqF0zRJtmXNoffAS6VFTcky+w8=
github.com/b-harvest/cosmos-sdk/store v0.0.0-20240312082708-417c9916b31c h1:h5D+cjW/4fYIBUU9Z5NKOyE1ir0pEgs+tz1PpDAHCsQ=
github.com/b-harvest/cosmos-sdk/store v0.0.0-20240312082708-417c9916b31c/go.mod h1:5LkoZ32cKQmlvK7rlUNdLJ+UdmhxM7p2f7xarnu01wo=
github.com/b-harvest/cosmos-sdk v0.0.0-20240313070058-dfda7de13923 h1:NG60BkcZyCCr803DbqntsDpEJkYVZbcZ2YWo/x6bovI=
github.com/b-harvest/cosmos-sdk v0.0.0-20240313070058-dfda7de13923/go.mod h1:tlrkY1sntOt1q0OX/rqF0zRJtmXNoffAS6VFTcky+w8=
github.com/b-harvest/cosmos-sdk/store v0.0.0-20240313070058-dfda7de13923 h1:uwwcnGl+SMbDBNuzr4+sqiMfPXQX59V8/4POfI7nEjk=
github.com/b-harvest/cosmos-sdk/store v0.0.0-20240313070058-dfda7de13923/go.mod h1:5LkoZ32cKQmlvK7rlUNdLJ+UdmhxM7p2f7xarnu01wo=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=

0 comments on commit aca507a

Please sign in to comment.