Co-authored-by: Marko <marko@baricevic.me> Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
co-authored by
Marko
Julien Robert
parent
b2c23403f8
commit
b522c2c22a
@@ -11,10 +11,10 @@ import (
|
||||
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
coreappmgr "cosmossdk.io/core/app"
|
||||
"cosmossdk.io/core/comet"
|
||||
corecontext "cosmossdk.io/core/context"
|
||||
"cosmossdk.io/core/event"
|
||||
"cosmossdk.io/core/server"
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/core/transaction"
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
@@ -134,10 +134,6 @@ func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxReques
|
||||
GasWanted: uint64ToInt64(resp.GasWanted),
|
||||
GasUsed: uint64ToInt64(resp.GasUsed),
|
||||
Events: intoABCIEvents(resp.Events, c.indexedEvents),
|
||||
Info: resp.Info,
|
||||
Data: resp.Data,
|
||||
Log: resp.Log,
|
||||
Codespace: resp.Codespace,
|
||||
}
|
||||
if resp.Error != nil {
|
||||
cometResp.Code = 1
|
||||
@@ -268,7 +264,7 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe
|
||||
// populate hash with empty byte slice instead of nil
|
||||
bz := sha256.Sum256([]byte{})
|
||||
|
||||
br := &coreappmgr.BlockRequest[T]{
|
||||
br := &server.BlockRequest[T]{
|
||||
Height: uint64(req.InitialHeight - 1),
|
||||
Time: req.Time,
|
||||
Hash: bz[:],
|
||||
@@ -289,7 +285,7 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe
|
||||
// TODO necessary? where should this WARN live if it all. helpful for testing
|
||||
for _, txRes := range blockresponse.TxResults {
|
||||
if txRes.Error != nil {
|
||||
c.logger.Warn("genesis tx failed", "code", txRes.Code, "log", txRes.Log, "error", txRes.Error)
|
||||
c.logger.Warn("genesis tx failed", "code", txRes.Code, "error", txRes.Error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +437,7 @@ func (c *Consensus[T]) FinalizeBlock(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
blockReq := &coreappmgr.BlockRequest[T]{
|
||||
blockReq := &server.BlockRequest[T]{
|
||||
Height: uint64(req.Height),
|
||||
Time: req.Time,
|
||||
Hash: req.Hash,
|
||||
|
||||
@@ -6,7 +6,7 @@ replace (
|
||||
// pseudo version lower than the latest tag
|
||||
cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main
|
||||
// pseudo version lower than the latest tag
|
||||
cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240826100755-28c792bcd06c // main
|
||||
cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240827095516-355f748add9e // main
|
||||
// pseudo version lower than the latest tag
|
||||
cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main
|
||||
cosmossdk.io/x/accounts => ../../../x/accounts
|
||||
@@ -23,8 +23,8 @@ require (
|
||||
cosmossdk.io/core v1.0.0 // main
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/log v1.4.1
|
||||
cosmossdk.io/server/v2 v2.0.0-20240802142126-a26970e547ab // main
|
||||
cosmossdk.io/server/v2/appmanager v0.0.0-20240816111545-aeeaca64da2c // main
|
||||
cosmossdk.io/server/v2 v2.0.0-20240827095516-355f748add9e // main
|
||||
cosmossdk.io/server/v2/appmanager v0.0.0-20240827095516-355f748add9e // main
|
||||
cosmossdk.io/store/v2 v2.0.0-20240731205446-aee9803a0af6 // main
|
||||
cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000
|
||||
github.com/cometbft/cometbft v1.0.0-rc1
|
||||
@@ -72,7 +72,7 @@ require (
|
||||
github.com/cosmos/cosmos-db v1.0.2 // indirect
|
||||
github.com/cosmos/crypto v0.1.2 // indirect
|
||||
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
||||
github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 // indirect
|
||||
github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e // indirect
|
||||
github.com/cosmos/ics23/go v0.10.0 // indirect
|
||||
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
|
||||
github.com/danieljoos/wincred v1.2.1 // indirect
|
||||
@@ -133,7 +133,7 @@ require (
|
||||
github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_golang v1.20.0 // indirect
|
||||
github.com/prometheus/client_golang v1.20.2 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.55.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
|
||||
+10
-10
@@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI
|
||||
cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE=
|
||||
cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo=
|
||||
cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw=
|
||||
cosmossdk.io/core v0.12.1-0.20240826100755-28c792bcd06c h1:NhVJ8mH5JnOBV/b1mR3NO8PJhUi6VND8S9FI1wO7hIU=
|
||||
cosmossdk.io/core v0.12.1-0.20240826100755-28c792bcd06c/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90=
|
||||
cosmossdk.io/core v0.12.1-0.20240827095516-355f748add9e h1:pi4KA2O6SJqq2AZ/DlOEgv7F/WEeHSSkGASPUqzfPtg=
|
||||
cosmossdk.io/core v0.12.1-0.20240827095516-355f748add9e/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90=
|
||||
cosmossdk.io/core/testing v0.0.0-20240826100755-28c792bcd06c h1:JabqeaOY2EJ3+uH5K+bNRWOFO9dOKXBueMyHtGIEg0E=
|
||||
cosmossdk.io/core/testing v0.0.0-20240826100755-28c792bcd06c/go.mod h1:+k84x9hU54Ckuc/JtppTSSQ+niEOU3CWcQghNz5NJWY=
|
||||
cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050=
|
||||
@@ -24,10 +24,10 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
|
||||
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
|
||||
cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA=
|
||||
cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
cosmossdk.io/server/v2 v2.0.0-20240802142126-a26970e547ab h1:6IGp/R/6D4NZT+MKIoM2OkmxZG4UFh32HgwN7mYynvk=
|
||||
cosmossdk.io/server/v2 v2.0.0-20240802142126-a26970e547ab/go.mod h1:alRmtz2gedZe+goFHbNjkBPNTkShFW6HEeXiyT7hdHM=
|
||||
cosmossdk.io/server/v2/appmanager v0.0.0-20240816111545-aeeaca64da2c h1:sxMoOFQvf5g1Wl1D2HidVtLpQhK1YCVq0YiDeT6qTNQ=
|
||||
cosmossdk.io/server/v2/appmanager v0.0.0-20240816111545-aeeaca64da2c/go.mod h1:fJDDnWJCBRxLLIyu2byqtf3KTRYIVS4OxKwdZozJi20=
|
||||
cosmossdk.io/server/v2 v2.0.0-20240827095516-355f748add9e h1:5B5vereMsxfQsk8eXchBQPB1sc5POgYxZOBaUlST6WQ=
|
||||
cosmossdk.io/server/v2 v2.0.0-20240827095516-355f748add9e/go.mod h1:rUve692/2QXV8ulpAG1mlytqiyW5nhZySY4ngmgJyQA=
|
||||
cosmossdk.io/server/v2/appmanager v0.0.0-20240827095516-355f748add9e h1:9eB2si1gT6c5ea8Jsh498Ei6E3Th1yMyuJgSLiT6D4Y=
|
||||
cosmossdk.io/server/v2/appmanager v0.0.0-20240827095516-355f748add9e/go.mod h1:fJDDnWJCBRxLLIyu2byqtf3KTRYIVS4OxKwdZozJi20=
|
||||
cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 h1:o024zaPHYtmUGL2BCX1ns9rfZmMc19U4hQ2CAPt2Xgg=
|
||||
cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897/go.mod h1:Ma4uny4RFegWTbU71fBmkSIoHrWHlLC/JwwgWgehZm4=
|
||||
cosmossdk.io/store/v2 v2.0.0-20240731205446-aee9803a0af6 h1:/ffIfMKzoCVUI38t5Vq3BNW9U8exRMxK5QgS/ujn0lA=
|
||||
@@ -123,8 +123,8 @@ github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiK
|
||||
github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI=
|
||||
github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro=
|
||||
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
|
||||
github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179 h1:wmwDn7V3RodN9auB3FooSQxs46nHVE3u0mb87TJkZFE=
|
||||
github.com/cosmos/iavl v1.2.1-0.20240725141113-7adc688cf179/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw=
|
||||
github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e h1:5bxw1E0peLMrr8ZO9mYT0d9sxy0WgR1ZEWb92yjKnnk=
|
||||
github.com/cosmos/iavl v1.2.1-0.20240731145221-594b181f427e/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw=
|
||||
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
|
||||
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
|
||||
github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM=
|
||||
@@ -405,8 +405,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||
github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI=
|
||||
github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||
github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
|
||||
github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
|
||||
@@ -9,14 +9,14 @@ import (
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
|
||||
consensusv1 "cosmossdk.io/api/cosmos/consensus/v1"
|
||||
appmanager "cosmossdk.io/core/app"
|
||||
"cosmossdk.io/core/server"
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/core/transaction"
|
||||
"cosmossdk.io/server/v2/cometbft/mempool"
|
||||
)
|
||||
|
||||
type AppManager[T transaction.Tx] interface {
|
||||
ValidateTx(ctx context.Context, tx T) (appmanager.TxResult, error)
|
||||
ValidateTx(ctx context.Context, tx T) (server.TxResult, error)
|
||||
Query(ctx context.Context, version uint64, request transaction.Msg) (response transaction.Msg, err error)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package cometbft
|
||||
import (
|
||||
"context"
|
||||
|
||||
coreappmgr "cosmossdk.io/core/app"
|
||||
"cosmossdk.io/core/event"
|
||||
"cosmossdk.io/core/server"
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/server/v2/streaming"
|
||||
)
|
||||
@@ -14,7 +14,7 @@ func (c *Consensus[T]) streamDeliverBlockChanges(
|
||||
ctx context.Context,
|
||||
height int64,
|
||||
txs [][]byte,
|
||||
txResults []coreappmgr.TxResult,
|
||||
txResults []server.TxResult,
|
||||
events []event.Event,
|
||||
stateChanges []store.StateChanges,
|
||||
) error {
|
||||
@@ -23,13 +23,9 @@ func (c *Consensus[T]) streamDeliverBlockChanges(
|
||||
for i, txResult := range txResults {
|
||||
streamingTxResults[i] = &streaming.ExecTxResult{
|
||||
Code: txResult.Code,
|
||||
Data: txResult.Data,
|
||||
Log: txResult.Log,
|
||||
Info: txResult.Info,
|
||||
GasWanted: uint64ToInt64(txResult.GasWanted),
|
||||
GasUsed: uint64ToInt64(txResult.GasUsed),
|
||||
Events: streaming.IntoStreamingEvents(txResult.Events),
|
||||
Codespace: txResult.Codespace,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ import (
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
v1beta1 "cosmossdk.io/api/cosmos/base/abci/v1beta1"
|
||||
appmanager "cosmossdk.io/core/app"
|
||||
appmodulev2 "cosmossdk.io/core/appmodule/v2"
|
||||
"cosmossdk.io/core/comet"
|
||||
"cosmossdk.io/core/event"
|
||||
"cosmossdk.io/core/server"
|
||||
"cosmossdk.io/core/transaction"
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
consensus "cosmossdk.io/x/consensus/types"
|
||||
@@ -68,7 +68,7 @@ func splitABCIQueryPath(requestPath string) (path []string) {
|
||||
}
|
||||
|
||||
func finalizeBlockResponse(
|
||||
in *appmanager.BlockResponse,
|
||||
in *server.BlockResponse,
|
||||
cp *cmtproto.ConsensusParams,
|
||||
appHash []byte,
|
||||
indexSet map[string]struct{},
|
||||
@@ -99,7 +99,7 @@ func intoABCIValidatorUpdates(updates []appmodulev2.ValidatorUpdate) []abci.Vali
|
||||
return valsetUpdates
|
||||
}
|
||||
|
||||
func intoABCITxResults(results []appmanager.TxResult, indexSet map[string]struct{}) []*abci.ExecTxResult {
|
||||
func intoABCITxResults(results []server.TxResult, indexSet map[string]struct{}) []*abci.ExecTxResult {
|
||||
res := make([]*abci.ExecTxResult, len(results))
|
||||
for i := range results {
|
||||
if results[i].Error != nil {
|
||||
@@ -146,7 +146,7 @@ func intoABCIEvents(events []event.Event, indexSet map[string]struct{}) []abci.E
|
||||
return abciEvents
|
||||
}
|
||||
|
||||
func intoABCISimulationResponse(txRes appmanager.TxResult, indexSet map[string]struct{}) ([]byte, error) {
|
||||
func intoABCISimulationResponse(txRes server.TxResult, indexSet map[string]struct{}) ([]byte, error) {
|
||||
indexAll := len(indexSet) == 0
|
||||
abciEvents := make([]*abciv1.Event, len(txRes.Events))
|
||||
for i, e := range txRes.Events {
|
||||
|
||||
Reference in New Issue
Block a user