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

feat: simapp/v2 #20412

Merged
merged 111 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 101 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
d530e80
upstream more changes from v2
tac0turtle May 14, 2024
0a15db8
add proto
tac0turtle May 14, 2024
8455318
chagnes
tac0turtle May 15, 2024
62ded17
fix runtime
tac0turtle May 15, 2024
5c4a43a
remove sdk import
tac0turtle May 15, 2024
decf4a2
lint issues
tac0turtle May 15, 2024
dbf509e
remove config stuff
tac0turtle May 15, 2024
d845064
Merge branch 'main' into marko/upstream_more_v2
tac0turtle May 15, 2024
ed638cd
go mod changes
tac0turtle May 15, 2024
cb2cc01
go mod changes
tac0turtle May 15, 2024
da38aff
Merge branch 'main' of github.com:cosmos/cosmos-sdk into marko/upstre…
kocubinski May 16, 2024
2691838
pause here
kocubinski May 16, 2024
faba9d1
revert for cherry-pick
kocubinski May 16, 2024
35fd591
refactor: sdk.Tx implements transaction.Tx (#19588)
likhita-809 Mar 13, 2024
e394e18
go mod tidy
kocubinski May 16, 2024
cce35fc
progress on txs
kocubinski May 16, 2024
d2241fa
seem to have handled all errors
kocubinski May 16, 2024
15619d9
lots of progress
kocubinski May 16, 2024
ca160d8
init, key, and genesis commands working
kocubinski May 16, 2024
65db2cf
back to unwrap errs, yay
kocubinski May 16, 2024
7308c68
progress to same err as server-v2
kocubinski May 16, 2024
2a12963
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 17, 2024
a7503e4
defer router build
kocubinski May 17, 2024
1eac3b2
fix store bug
kocubinski May 17, 2024
2c3ce95
wait goroutine
kocubinski May 17, 2024
aa91391
add start up script
kocubinski May 17, 2024
d3b3a24
special case hack for genesis
kocubinski May 17, 2024
05942a0
recursive implementation of GetStateChanges
kocubinski May 19, 2024
3fd6eb3
chore: go mod tidy
kocubinski May 19, 2024
a9ef4e4
use comet info service with comet info in context
kocubinski May 19, 2024
290263f
sort of working
kocubinski May 19, 2024
00f6999
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 19, 2024
a63762e
revert x/tx changes
kocubinski May 20, 2024
4b86a66
fix app_v1 build
kocubinski May 20, 2024
04b8f98
fix simapp/v2 go.mod
kocubinski May 20, 2024
73e00c0
fix distribution integration test
kocubinski May 21, 2024
e9e8ab8
fix distribution integration test
kocubinski May 21, 2024
b16d2bc
linting fixes
kocubinski May 21, 2024
330b8ed
more lint fix
kocubinski May 21, 2024
fc684c5
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 21, 2024
108978d
fix docker image
kocubinski May 21, 2024
be3b27b
fix test
kocubinski May 21, 2024
24e019b
rm debug print
kocubinski May 21, 2024
2ca0c70
more lint fix
kocubinski May 21, 2024
b427037
Merge branch 'main' into kocu/simapp-v2
kocubinski May 21, 2024
02947fa
add changelog for x/distribution break
kocubinski May 21, 2024
5bf88be
rm conseneus.MsgUpdateCometInfo
kocubinski May 22, 2024
e55810e
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 28, 2024
b50f50c
go mod tidy
kocubinski May 28, 2024
b029625
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 28, 2024
cbab735
fixes from merging main
kocubinski May 28, 2024
2738109
more fixes, go mod tidy
kocubinski May 28, 2024
92539ec
fix nil ref
kocubinski May 28, 2024
c95c217
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 29, 2024
bb09616
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 29, 2024
bb1c1cc
go mod tidy all
kocubinski May 29, 2024
f1b9a29
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 30, 2024
c529edd
go mod tidy
kocubinski May 30, 2024
bf16d79
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski May 31, 2024
f235226
add TODO
kocubinski May 31, 2024
87d1c5b
add TODO
kocubinski May 31, 2024
aa21e93
add TODO
kocubinski May 31, 2024
52b883e
clean up
kocubinski May 31, 2024
acfb730
comments
kocubinski May 31, 2024
aa0cebd
lint fix
kocubinski May 31, 2024
fd34264
fix issue #20492
kocubinski May 31, 2024
2a2b3f1
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 2, 2024
2bb2b90
app version modifier clean up
kocubinski Jun 3, 2024
ce36a1c
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 3, 2024
44c465b
lint
tac0turtle Jun 6, 2024
faf1450
remove comment
Jun 6, 2024
a2312d0
add todo
Jun 6, 2024
591bb8e
use separate identity for STF
Jun 6, 2024
1c074d3
Merge branch 'main' into kocu/simapp-v2
tac0turtle Jun 6, 2024
6f36227
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 6, 2024
2ad7cbf
Merge branch 'kocu/simapp-v2' of github.com:cosmos/cosmos-sdk into ko…
kocubinski Jun 6, 2024
5a9e899
clean up go.mod
kocubinski Jun 6, 2024
0a5b6d0
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 11, 2024
4f54b95
go mod tidy
kocubinski Jun 11, 2024
2759dab
fix bad merge bits
kocubinski Jun 11, 2024
fb32eaf
hardcode provide stf key in runtime/v2
kocubinski Jun 11, 2024
c6f6902
rever to main x/distribution
kocubinski Jun 11, 2024
64a51f9
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 12, 2024
f59e682
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 12, 2024
99bc320
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 13, 2024
8ebdc82
fix linting
tac0turtle Jun 14, 2024
eb6d1f6
update startup script
kocubinski Jun 14, 2024
921b627
fix logic error from #20296
kocubinski Jun 14, 2024
d10b7dd
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 17, 2024
83440d8
rm whitespace commits
kocubinski Jun 17, 2024
08cf9af
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 17, 2024
68c61d5
prototype change for x/staking
kocubinski Jun 17, 2024
959542e
improve test script for CI run
kocubinski Jun 17, 2024
88a2a0b
proto CI job
kocubinski Jun 17, 2024
20ef626
Merge branch 'main' into kocu/simapp-v2
kocubinski Jun 17, 2024
e7178c6
go mod tidy
kocubinski Jun 17, 2024
14419bd
Merge branch 'kocu/simapp-v2' of github.com:cosmos/cosmos-sdk into ko…
kocubinski Jun 17, 2024
6ed4b0f
go mod tidy all
kocubinski Jun 17, 2024
343258c
rm sed usage
kocubinski Jun 17, 2024
8c1e2d2
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/simapp-v2
kocubinski Jun 18, 2024
d914de2
Merge branch 'main' into kocu/simapp-v2
kocubinski Jun 18, 2024
6577d23
fetch x/auth/tx changes from #20698
kocubinski Jun 18, 2024
2dc02c0
Merge branch 'kocu/simapp-v2' of github.com:cosmos/cosmos-sdk into ko…
kocubinski Jun 18, 2024
03e791b
rm dead code
kocubinski Jun 18, 2024
fd39547
rm dead file
kocubinski Jun 18, 2024
b02723f
Merge branch 'main' into kocu/simapp-v2
kocubinski Jun 18, 2024
c73e11e
Merge branch 'main' into kocu/simapp-v2
kocubinski Jun 18, 2024
0243a83
Merge branch 'main' into kocu/simapp-v2
kocubinski Jun 19, 2024
40f9393
return err in depinject provider
kocubinski Jun 19, 2024
77e1603
wrap err in depinject provider
kocubinski Jun 19, 2024
921be8a
Merge branch 'main' into kocu/simapp-v2
kocubinski Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,30 @@ jobs:
cd simapp
go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock' ./...

test-simapp-v2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
- name: simapp-v2-smoke-test
if: env.GIT_DIFF
run: |
./scripts/simapp-v2-init.sh

Comment on lines +507 to +511
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The simapp-v2-init.sh script includes some good practices such as set -o errexit and set -o nounset for error handling. However, it lacks comprehensive logging and detailed error messages. Here are some suggestions to improve the script:

  • Initialization and Build Process:

    • Check if directories exist before changing into them.
    • Verify the success of the go build command.
  • Configuration Changes:

    • Check the success of each jq command to ensure the configuration changes are applied correctly.
  • Key Management:

    • Verify the success of key addition and address retrieval commands.
  • Genesis Setup:

    • Check the success of commands related to genesis account and transaction setup.
  • Block Query Loop:

    • Add logging to indicate the progress of the block height query loop and any errors encountered.

Would you like me to provide a revised version of the script with these improvements?

Analysis chain

Ensure that simapp-v2-init.sh includes proper error handling and logging to facilitate debugging and reliability.

Would you like me to review the script for best practices in error handling and provide improvements?

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the content of `simapp-v2-init.sh` for proper error handling.
cat scripts/simapp-v2-init.sh

Length of output: 1362

test-collections:
runs-on: ubuntu-latest
steps:
Expand Down
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
"program": "${fileDirname}",
"args": ["-test.timeout", "30m", "-test.v"],
"buildFlags": "-tags e2e"
},
{
"name": "Start: simapp/v2",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/simapp/v2/simdv2",
"args": ["start"],
"buildFlags": ""
}
]
}
8 changes: 4 additions & 4 deletions codec/depinject.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ProvideInterfaceRegistry(
addressCodec address.Codec,
validatorAddressCodec address.ValidatorAddressCodec,
customGetSigners []signing.CustomGetSigner,
) (types.InterfaceRegistry, registry.InterfaceRegistrar, error) {
) (types.InterfaceRegistry, registry.InterfaceRegistrar) {
signingOptions := signing.Options{
AddressCodec: addressCodec,
ValidatorAddressCodec: validatorAddressCodec,
Expand All @@ -35,14 +35,14 @@ func ProvideInterfaceRegistry(
SigningOptions: signingOptions,
})
if err != nil {
return nil, nil, err
panic(err)
}

if err := interfaceRegistry.SigningContext().Validate(); err != nil {
return nil, nil, err
panic(err)
}

return interfaceRegistry, interfaceRegistry, nil
return interfaceRegistry, interfaceRegistry
}

func ProvideLegacyAmino() legacy.Amino {
Expand Down
1 change: 1 addition & 0 deletions contrib/images/simd-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ COPY x/mint/go.mod x/mint/go.sum /work/x/mint/
COPY x/consensus/go.mod x/consensus/go.sum /work/x/consensus/
COPY x/accounts/go.mod x/accounts/go.sum /work/x/accounts/
COPY runtime/v2/go.mod runtime/v2/go.sum /work/runtime/v2/
COPY server/v2/go.mod server/v2/go.sum /work/server/v2/
COPY server/v2/appmanager/go.mod server/v2/appmanager/go.sum /work/server/v2/appmanager/
COPY server/v2/stf/go.mod server/v2/stf/go.sum /work/server/v2/stf/
COPY server/v2/cometbft/go.mod server/v2/cometbft/go.sum /work/server/v2/cometbft/
Expand Down
7 changes: 7 additions & 0 deletions core/header/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func (i *Info) Bytes() ([]byte, error) {
binary.LittleEndian.PutUint64(heightBytes, uint64(i.Height))
buf = append(buf, heightBytes...)

// TODO; permit empty hash OK for genesis block?
if len(i.Hash) == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

in baseapp empty hash is populated with hash("") @facundomedica would need to confirm this. If so then id propose we do the same

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't able to find where this happens, I'll add an issue to investigate it.

i.Hash = make([]byte, hashSize)
}
// Encode Hash
if len(i.Hash) != hashSize {
return nil, errors.New("invalid hash size")
Expand All @@ -44,6 +48,9 @@ func (i *Info) Bytes() ([]byte, error) {
binary.LittleEndian.PutUint64(timeBytes, uint64(i.Time.Unix()))
buf = append(buf, timeBytes...)

if len(i.AppHash) == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

same as above

i.AppHash = make([]byte, hashSize)
}
// Encode AppHash
if len(i.Hash) != hashSize {
return nil, errors.New("invalid hash size")
Expand Down
4 changes: 2 additions & 2 deletions runtime/v2/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func init() {
ProvideModuleManager,
ProvideGenesisTxHandler,
ProvideCometService,
ProvideAppVersionModifier,
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
),
appconfig.Invoke(SetupAppBuilder),
)
Expand Down Expand Up @@ -161,11 +162,10 @@ func SetupAppBuilder(inputs AppInputs) {
app.moduleManager.RegisterInterfaces(inputs.InterfaceRegistrar)
app.moduleManager.RegisterLegacyAminoCodec(inputs.LegacyAmino)

// TODO: this is a bit of a hack, but it's the only way to get the store keys into the app
// registerStoreKey could instead set this on StoreOptions directly
if inputs.StoreOptions != nil {
inputs.AppBuilder.storeOptions = inputs.StoreOptions
inputs.AppBuilder.storeOptions.StoreKeys = inputs.AppBuilder.app.storeKeys
inputs.AppBuilder.storeOptions.StoreKeys = append(inputs.AppBuilder.storeOptions.StoreKeys, "stf")
}
}

Expand Down
52 changes: 52 additions & 0 deletions scripts/simapp-v2-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -x

ROOT=$PWD
SIMAPP_DIR="$ROOT/simapp/v2"

SIMD="$ROOT/build/simdv2"
CONFIG="${CONFIG:-$HOME/.simappv2/config}"

cd "$SIMAPP_DIR"
go build -o "$ROOT/build/simdv2" simdv2/main.go

$SIMD init simapp-v2-node --chain-id simapp-v2-chain
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The verification script indicates that the expected directories (~/.simapp, ~/.simapp/config, ~/.simapp/data) do not exist, suggesting that the init command may have failed. This aligns with the review comment's suggestion to verify the success of the init command.

  • Please ensure the init command in scripts/simapp-v2-init.sh is executed successfully and the necessary directories are created before proceeding with further steps.
Analysis chain

Consider verifying the success of the init command before proceeding.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the success of the `init` command.

# Test: Check if the `init` command executed successfully. Expect: No errors.
grep "Completed initializing" "$CONFIG/log.txt"

Length of output: 82



Script:

#!/bin/bash
# Description: Verify the success of the `init` command by checking for expected directories or files.

# Expected directories or files created by the `init` command
EXPECTED_DIRS=("~/.simapp" "~/.simapp/config" "~/.simapp/data")

# Check if the expected directories exist
for dir in "${EXPECTED_DIRS[@]}"; do
  if [ ! -d "$dir" ]; then
    echo "Directory $dir does not exist. The init command may have failed."
  else
    echo "Directory $dir exists."
  fi
done

Length of output: 740


cd "$CONFIG"

# to enable the api server
$SIMD config set app api.enable true

# to change the voting_period
jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.json && mv temp.json genesis.json

# to change the inflation
jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json

# change the initial height to 2 to work around store/v2 and iavl limitations with a genesis block
jq '.initial_height = 2' genesis.json > temp.json && mv temp.json genesis.json
Comment on lines +24 to +30
Copy link
Contributor

Choose a reason for hiding this comment

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

Optimize the jq commands by combining them into a single invocation.

- jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.json && mv temp.json genesis.json
- jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json
- jq '.initial_height = 2' genesis.json > temp.json && mv temp.json genesis.json
+ jq '.app_state.gov.voting_params.voting_period = "600s" | .app_state.mint.minter.inflation = "0.300000000000000000" | .initial_height = 2' genesis.json > temp.json && mv temp.json genesis.json
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.json && mv temp.json genesis.json
# to change the inflation
jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json
# change the initial height to 2 to work around store/v2 and iavl limitations with a genesis block
jq '.initial_height = 2' genesis.json > temp.json && mv temp.json genesis.json
jq '.app_state.gov.voting_params.voting_period = "600s" | .app_state.mint.minter.inflation = "0.300000000000000000" | .initial_height = 2' genesis.json > temp.json && mv temp.json genesis.json


$SIMD keys add test_validator --indiscreet
VALIDATOR_ADDRESS=$($SIMD keys show test_validator -a --keyring-backend test)

$SIMD genesis add-genesis-account "$VALIDATOR_ADDRESS" 1000000000stake
$SIMD genesis gentx test_validator 1000000000stake --keyring-backend test
$SIMD genesis collect-gentxs

$SIMD start &
SIMD_PID=$!

cnt=0
while ! $SIMD query block --type=height 5; do
cnt=$((cnt + 1))
if [ $cnt -gt 30 ]; then
kill -9 "$SIMD_PID"
exit 1
fi
sleep 1
done

kill -9 "$SIMD_PID"
113 changes: 113 additions & 0 deletions server/v2/cometbft/abci_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package cometbft

/* TODO this has been failing for months, it needs to be re-written
Copy link
Contributor

Choose a reason for hiding this comment

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

Address the failing test as indicated by the TODO comment.

Would you like assistance in rewriting this test to ensure reliability?

import (
"context"
"testing"

appmodulev2 "cosmossdk.io/core/appmodule/v2"
corestore "cosmossdk.io/core/store"
"cosmossdk.io/core/transaction"
am "cosmossdk.io/server/v2/appmanager"
ammstore "cosmossdk.io/server/v2/appmanager/store"
"cosmossdk.io/server/v2/cometbft/mempool"
"cosmossdk.io/server/v2/stf"
"cosmossdk.io/server/v2/stf/branch"
"cosmossdk.io/server/v2/stf/mock"
"cosmossdk.io/store/v2/storage/pebbledb"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/wrapperspb"
)

func TestConsensus(t *testing.T) {
mockTx := mock.Tx{
Sender: []byte("sender"),
Msg: wrapperspb.Bool(true), // msg does not matter at all because our handler does nothing.
GasLimit: 100_000,
}

s := stf.NewSTF(
func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error) {
err = kvSet(t, ctx, "exec")
return nil, err
},
func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error) {
err = kvSet(t, ctx, "query")
return nil, err
},
func(ctx context.Context, txs []mock.Tx) error { return nil },
func(ctx context.Context) error {
return kvSet(t, ctx, "begin-block")
},
func(ctx context.Context) error {
return kvSet(t, ctx, "end-block")
},
func(ctx context.Context, tx mock.Tx) error {
return kvSet(t, ctx, "validate")
},
func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error) { return nil, nil },
func(ctx context.Context, tx mock.Tx, success bool) error {
return kvSet(t, ctx, "post-tx-exec")
},
branch.DefaultNewWriterMap,
)

storageDB, err := pebbledb.New(t.TempDir())
require.NoError(t, err)
ss, _ := ammstore.New(storageDB)

b := am.Builder[mock.Tx]{
STF: s,
DB: ss,
ValidateTxGasLimit: 100_000,
QueryGasLimit: 100_000,
SimulationGasLimit: 100_000,
}

am, err := b.Build()
require.NoError(t, err)

mockStore := NewMockStore()

c := NewConsensus[mock.Tx](am, mempool.NoOpMempool[mock.Tx]{}, mockStore, Config{}, mock.TxCodec{}, nil)

t.Run("Check tx basic", func(t *testing.T) {
res, err := c.CheckTx(context.Background(), &abci.CheckTxRequest{
Tx: mockTx.Bytes(),
Type: 0,
})
require.NotNil(t, res.GasUsed)
require.NoError(t, err)
})
}

var actorName = []byte("cookies")

func kvSet(t *testing.T, ctx context.Context, v string) error {
t.Helper()
executionCtx := stf.GetExecutionContext(ctx)
require.NotNil(t, executionCtx)
state, err := executionCtx.State.GetWriter(actorName)
require.NoError(t, err)
return state.Set([]byte(v), []byte(v))
}

func stateHas(t *testing.T, accountState corestore.ReaderMap, key string) {
t.Helper()
state, err := accountState.GetReader(actorName)
require.NoError(t, err)
has, err := state.Has([]byte(key))
require.NoError(t, err)
require.Truef(t, has, "state did not have key: %s", key)
}

func stateNotHas(t *testing.T, accountState corestore.ReaderMap, key string) {
t.Helper()
state, err := accountState.GetReader(actorName)
require.NoError(t, err)
has, err := state.Has([]byte(key))
require.NoError(t, err)
require.Falsef(t, has, "state was not supposed to have key: %s", key)
}
*/
1 change: 1 addition & 0 deletions server/v2/cometbft/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ replace (
cosmossdk.io/depinject => ../../../depinject
cosmossdk.io/server/v2 => ../
cosmossdk.io/server/v2/appmanager => ../appmanager
cosmossdk.io/store => ../../../store
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The paths specified in the replace section of the go.mod file are not found in the current directory structure. This suggests that the paths might be incorrectly specified or the directory structure has changed. Please verify the paths and update them accordingly.

  • Paths not found:
    • ../../../api
    • ../../../core
    • ../../../core/testing
    • ../../../depinject
    • ../appmanager
    • ../../../store
    • ../../../store/v2
    • ../../../x/accounts
    • ../../../x/auth
    • ../../../x/bank
    • ../../../x/consensus
    • ../../../x/staking
Analysis chain

Ensure the paths in the replace section are correct and accessible. Incorrect paths can lead to build failures.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the paths in the replace section of the go.mod file.

# Test: Check if paths are accessible. Expect: No errors or not found messages.
for path in ../../../api ../../../core ../../../core/testing ../../../depinject ../ ../appmanager ../../../store ../../../store/v2 ../../../x/accounts ../../../x/auth ../../../x/bank ../../../x/consensus ../../../x/staking; do
  if [ ! -d "$path" ]; then
    echo "Path $path not found."
  fi
done

Length of output: 4262

cosmossdk.io/store/v2 => ../../../store/v2
cosmossdk.io/x/accounts => ../../../x/accounts
cosmossdk.io/x/auth => ../../../x/auth
Expand Down
2 changes: 0 additions & 2 deletions server/v2/cometbft/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI=
cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM=
cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg=
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU=
cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 h1:eb0kcGyaYHSS0do7+MIWg7UKlskSH01biRNENbm/zDA=
cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5/go.mod h1:drzY4oVisyWvSgpsM7ccQ7IX3efMuVIvd9Eij1Gm/6o=
cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g=
Expand Down
2 changes: 1 addition & 1 deletion server/v2/streaming/context.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package streaming

import "cosmossdk.io/log"
import "cosmossdk.io/core/log"

// Context is an interface used by an App to pass context information
// needed to process store streaming requests.
Expand Down
2 changes: 1 addition & 1 deletion server/v2/streaming/streaming_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"cosmossdk.io/log"
"cosmossdk.io/core/log"
)

type PluginTestSuite struct {
Expand Down
8 changes: 8 additions & 0 deletions simapp/v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
sidebar_position: 1
---

# `SimApp/v2`

SimApp is an application built using the Cosmos SDK for testing and educational purposes.
`SimApp/v2` demonstrate a runtime/v2, server/v2 and store/v2 wiring.
Loading
Loading