- Scaffold Cosmos SDK chain with Ignite CLI (address prefix: claw, token: uclaw) - Implement x/privacy module with ZK UTXO shielded pool: - gnark Groth16 circuits (TransferCircuit: 2-in-2-out, UnshieldCircuit) - MiMC-based Merkle tree (depth 32) for commitment storage - Shield/Unshield/PrivateTransfer message handlers with proof verification - Nullifier double-spend prevention - On-chain Merkle tree state management - Implement x/agent module for AI agent identities: - Agent registration with pubkey, endpoint, name - Agent action logging with type validation - Query handlers for agent lookup - 26 passing tests covering full ZK proof lifecycle Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
package keeper_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"cosmossdk.io/core/address"
|
|
storetypes "cosmossdk.io/store/types"
|
|
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
|
|
"github.com/cosmos/cosmos-sdk/runtime"
|
|
"github.com/cosmos/cosmos-sdk/testutil"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
|
|
"clawchain/x/privacy/keeper"
|
|
module "clawchain/x/privacy/module"
|
|
"clawchain/x/privacy/types"
|
|
)
|
|
|
|
type fixture struct {
|
|
ctx context.Context
|
|
keeper keeper.Keeper
|
|
addressCodec address.Codec
|
|
}
|
|
|
|
func initFixture(t *testing.T) *fixture {
|
|
t.Helper()
|
|
|
|
encCfg := moduletestutil.MakeTestEncodingConfig(module.AppModule{})
|
|
addressCodec := addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix())
|
|
storeKey := storetypes.NewKVStoreKey(types.StoreKey)
|
|
|
|
storeService := runtime.NewKVStoreService(storeKey)
|
|
ctx := testutil.DefaultContextWithDB(t, storeKey, storetypes.NewTransientStoreKey("transient_test")).Ctx
|
|
|
|
authority := authtypes.NewModuleAddress(types.GovModuleName)
|
|
|
|
k := keeper.NewKeeper(
|
|
storeService,
|
|
encCfg.Codec,
|
|
addressCodec,
|
|
authority,
|
|
nil, // bankKeeper: nil for basic tests that don't exercise bank operations
|
|
)
|
|
|
|
// Initialize params
|
|
if err := k.Params.Set(ctx, types.DefaultParams()); err != nil {
|
|
t.Fatalf("failed to set params: %v", err)
|
|
}
|
|
|
|
return &fixture{
|
|
ctx: ctx,
|
|
keeper: k,
|
|
addressCodec: addressCodec,
|
|
}
|
|
}
|