- 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>
33 lines
835 B
Go
33 lines
835 B
Go
package keeper
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
errorsmod "cosmossdk.io/errors"
|
|
|
|
"clawchain/x/agent/types"
|
|
)
|
|
|
|
func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
|
|
authority, err := k.addressCodec.StringToBytes(req.Authority)
|
|
if err != nil {
|
|
return nil, errorsmod.Wrap(err, "invalid authority address")
|
|
}
|
|
|
|
if !bytes.Equal(k.GetAuthority(), authority) {
|
|
expectedAuthorityStr, _ := k.addressCodec.BytesToString(k.GetAuthority())
|
|
return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", expectedAuthorityStr, req.Authority)
|
|
}
|
|
|
|
if err := req.Params.Validate(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := k.Params.Set(ctx, req.Params); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &types.MsgUpdateParamsResponse{}, nil
|
|
}
|