clawchain/x/privacy/keeper/msg_update_params_test.go
caelum0x 53f5135228 feat: implement ClawChain Phase 1 - ZK privacy module and agent registry
- 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>
2026-02-18 00:27:29 +03:00

69 lines
1.3 KiB
Go

package keeper_test
import (
"testing"
"github.com/stretchr/testify/require"
"clawchain/x/privacy/keeper"
"clawchain/x/privacy/types"
)
func TestMsgUpdateParams(t *testing.T) {
f := initFixture(t)
ms := keeper.NewMsgServerImpl(f.keeper)
params := types.DefaultParams()
require.NoError(t, f.keeper.Params.Set(f.ctx, params))
authorityStr, err := f.addressCodec.BytesToString(f.keeper.GetAuthority())
require.NoError(t, err)
// default params
testCases := []struct {
name string
input *types.MsgUpdateParams
expErr bool
expErrMsg string
}{
{
name: "invalid authority",
input: &types.MsgUpdateParams{
Authority: "invalid",
Params: params,
},
expErr: true,
expErrMsg: "invalid authority",
},
{
name: "send enabled param",
input: &types.MsgUpdateParams{
Authority: authorityStr,
Params: types.Params{},
},
expErr: false,
},
{
name: "all good",
input: &types.MsgUpdateParams{
Authority: authorityStr,
Params: params,
},
expErr: false,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
_, err := ms.UpdateParams(f.ctx, tc.input)
if tc.expErr {
require.Error(t, err)
require.Contains(t, err.Error(), tc.expErrMsg)
} else {
require.NoError(t, err)
}
})
}
}