Skip to content

DATU Accountability Enforcement with Smart Contract Enablement#14

Merged
alvinveroy merged 19 commits into
bettergovph:dev/futurenetfrom
greenarmor:feat/datu-aligned--modules-scaffold
Oct 22, 2025
Merged

DATU Accountability Enforcement with Smart Contract Enablement#14
alvinveroy merged 19 commits into
bettergovph:dev/futurenetfrom
greenarmor:feat/datu-aligned--modules-scaffold

Conversation

@greenarmor

Copy link
Copy Markdown
Contributor

Summary

  • Scaffolded the accountability scores module alongside the DATU budget, procurement, and disbursement keepers so they are registered with the application runtime and available through dependency injection.
  • Enabled the CosmWasm smart contract module, wiring its keeper into the app, exposing module accounts, and blocking addresses required for contract execution in DATU scenarios.
  • Added on-chain approval workflows across the DATU financial modules that require liability contract URIs, multi-party endorsements, and accountability score validation before state transitions.
  • Expanded the end-to-end DATU workflow example to register a smart contract, mint accountability scorecards, and walk a budget -> procurement -> disbursement lifecycle using the new approval guards.
     

Implementation Notes

  • Updated app/app.go and app/app_config.go to include the accountability and wasm keepers in the runtime wiring, begin/end blockers, and module account permissions.
  • Introduced protobuf definitions and generated types for accountability approvals and wasm module wiring, ensuring CLI and gRPC surfaces expose the new fields.
  • Extended keeper logic in x/budgetregistry, x/procurementledger, and x/disbursementtracker to enforce liability contracts, approval thresholds, and accountability score lookups prior to status promotions.
  • Implemented the CosmWasm keeper along with module configuration so contracts can be registered, iterated, and referenced by DATU accountability evidence URIs.
  • Reworked documentation sample documentation/datu_examples/full_workflow_test.go to bootstrap mock modules, register a treasury coordination contract, publish accountability scorecards, and demonstrate compliant approvals across the budget pipeline.

greenarmor and others added 19 commits October 12, 2025 17:44
…s validator model, and IPFS-powered data registry map onto the DATU reference architecture and detailed the changes needed across consensus, modules, data anchoring, governance, application, and security layers to reach feature parity
…rint a skip message when secrets are absent, and guard the scan and quality gate steps so they only run when both the token and host URL are available.
…ials, skip analysis when secrets are unavailable, and pass both the token and host URL when present to prevent scanner failures.
…plicit mapping and clarified how to add optional local variables without breaking schema validation.
…rk supplies one, so the upstream pipeline keeps using the key in sonar-project.properties.
…r, DisbursementTracker, AccountabilityScores, and GovernanceVoting—with placeholder AppModule definitions to prepare for future Cosmos SDK wiring.

Added baseline genesis structures and key-prefix helpers for each new module so state initialization and store wiring can evolve alongside the DATU roadmap.
…ITM-focused title, key talking points, and testing notes for the genesis poisoning documentation updates.
… parameter validation to stage smart contract metadata for future DATU capabilities.

Wired the wasm module into the application by exposing its keeper and updating module account permissions, blocked addresses, and lifecycle ordering in the runtime configuration.
… procurements, disbursements, accountability scores, and delegated governance relationships to capture the DATU module semantics.

Implemented keepers that persist state via JSON-backed collections, allocate sequence-based identifiers, enforce cross-module invariants, and expose genesis import/export helpers for each new module.

Added unit tests that exercise registration flows, lifecycle transitions, and edge conditions across the budget, procurement, disbursement, accountability, and governance modules.
…ed smart contract reference, exercising register, update, query, walk, and total operations end-to-end.

Documented how to run the DATU module operation example for reuse in future integration testing.

Switched the WASM keeper to JSON value codecs and ensured contract IDs advance correctly when registering new smart contracts.
… capture signer addresses, scorecard references, and signature URIs for DATU workflows.

Extended the budget registry to require liability contract URIs, track approval records, and validate them against accountability keeper scorecards before status changes.

Applied the same multi-party approval enforcement to the procurement and disbursement trackers so contract transitions only succeed when distinct, high-scoring signers have endorsed them.

Updated keeper unit tests and the DATU workflow example to create scorecards, record approvals, and exercise the guarded transitions end-to-end
… capture signer addresses, scorecard references, and signature URIs for DATU workflows.

Extended the budget registry to require liability contract URIs, track approval records, and validate them against accountability keeper scorecards before status changes.

Applied the same multi-party approval enforcement to the procurement and disbursement trackers so contract transitions only succeed when distinct, high-scoring signers have endorsed them.

Updated keeper unit tests and the DATU workflow example to create scorecards, record approvals, and exercise the guarded transitions end-to-end
…baseline schema so DATU accountability upgrades no longer introduce liability approval fields into the datasets module.

Regenerated the dataset pb.go types so the generated structs again expose only the original dataset fields.

Updated the reusable PR description document with an explicit title while keeping the summary focused on the DATU scaffolding and smart contract enablement narrative.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates accountability enforcement and smart contract capabilities into the DATU financial workflow by scaffolding new modules and extending existing ones with approval mechanisms. The changes enable on-chain liability contracts, multi-party endorsements with scorecard validation, and smart contract registration to support budget, procurement, and disbursement lifecycle management.

Key changes:

  • Scaffolded accountability scores, budget registry, procurement ledger, disbursement tracker, governance voting, and wasm modules with keeper implementations
  • Added approval workflow enforcement requiring liability contract URIs and accountability score validation across financial modules
  • Implemented comprehensive end-to-end test demonstrating the complete DATU workflow with smart contract integration

Reviewed Changes

Copilot reviewed 80 out of 80 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
x/wasm/types/*.go Type definitions, parameters, keys, and error handling for the wasm module
x/wasm/keeper/*.go Keeper implementation for smart contract registration and retrieval
x/wasm/module/*.go Module registration and depinject wiring for the wasm module
x/accountabilityscores/types/*.go Scorecard and approval type definitions with validation logic
x/accountabilityscores/keeper/*.go Keeper implementation for managing accountability scorecards
x/accountabilityscores/module/*.go Module registration and depinject wiring
x/budgetregistry/types/*.go Budget type definitions with status transitions and approval tracking
x/budgetregistry/keeper/*.go Keeper implementing budget registration and approval validation
x/procurementledger/types/*.go Procurement type definitions with liability contract requirements
x/procurementledger/keeper/*.go Keeper enforcing procurement approval workflows
x/disbursementtracker/types/*.go Disbursement type definitions with approval tracking
x/disbursementtracker/keeper/*.go Keeper managing disbursement approvals and totals
x/governancevoting/types/*.go Delegation type definitions for governance workflows
x/governancevoting/keeper/*.go Keeper managing delegation relationships
x/datasets/types/*.pb.go Import statement reordering in generated protobuf files
proto/govchain/*/module.proto Protobuf definitions for module configuration
documentation/datu_examples/* Comprehensive integration test and documentation
app/app_config.go, app/app.go Application-level wiring for new modules

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1 to +37
--- x/wasm/types/module.pb.go
+++ x/wasm/types/module.pb.go
@@ -0,0 +1,322 @@
+// Code generated by protoc-gen-gogo. DO NOT EDIT.
+// source: govchain/wasm/module/v1/module.proto
+
+package types
+
+import (
+ _ "cosmossdk.io/depinject/appconfig/v1alpha1"
+ fmt "fmt"
+ proto "github.com/cosmos/gogoproto/proto"
+ io "io"
+ math "math"
+ math_bits "math/bits"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+
+// Module is the config object for the wasm module.
+type Module struct {
+ // authority defines the custom module authority.
+ // If not set, defaults to the governance module.
+ Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
+}
+
+func (m *Module) Reset() { *m = Module{} }
+func (m *Module) String() string { return proto.CompactTextString(m) }

Copilot AI Oct 22, 2025

Copy link

Choose a reason for hiding this comment

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

This appears to be a rejected patch file (.rej) that should not be committed to the repository. Patch rejection files are artifacts from failed merge attempts and should be excluded from version control.

Suggested change
--- x/wasm/types/module.pb.go
+++ x/wasm/types/module.pb.go
@@ -0,0 +1,322 @@
+// Code generated by protoc-gen-gogo. DO NOT EDIT.
+// source: govchain/wasm/module/v1/module.proto
+
+package types
+
+import (
+ _ "cosmossdk.io/depinject/appconfig/v1alpha1"
+ fmt "fmt"
+ proto "github.com/cosmos/gogoproto/proto"
+ io "io"
+ math "math"
+ math_bits "math/bits"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+
+// Module is the config object for the wasm module.
+type Module struct {
+ // authority defines the custom module authority.
+ // If not set, defaults to the governance module.
+ Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
+}
+
+func (m *Module) Reset() { *m = Module{} }
+func (m *Module) String() string { return proto.CompactTextString(m) }
# (Delete the entire file)

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +56
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: govchain/wasm/module/v1/module.proto

package types

import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
proto "github.com/cosmos/gogoproto/proto"
io "io"
math "math"
math_bits "math/bits"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package

// Module is the config object for the module.
type Module struct {
// authority defines the custom module authority.
// If not set, defaults to the governance module.
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
}

func (m *Module) Reset() { *m = Module{} }
func (m *Module) String() string { return proto.CompactTextString(m) }
func (*Module) ProtoMessage() {}
func (*Module) Descriptor() ([]byte, []int) {
return fileDescriptor_9845709267c03ccf, []int{0}
}
func (m *Module) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Module.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Module) XXX_Merge(src proto.Message) {
xxx_messageInfo_Module.Merge(m, src)
}

Copilot AI Oct 22, 2025

Copy link

Choose a reason for hiding this comment

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

This .orig file appears to be a backup file from a merge conflict or patch operation and should not be committed to the repository. Only the final generated protobuf file should be tracked in version control.

Suggested change
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: govchain/wasm/module/v1/module.proto
package types
import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
proto "github.com/cosmos/gogoproto/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// Module is the config object for the module.
type Module struct {
// authority defines the custom module authority.
// If not set, defaults to the governance module.
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (m *Module) Reset() { *m = Module{} }
func (m *Module) String() string { return proto.CompactTextString(m) }
func (*Module) ProtoMessage() {}
func (*Module) Descriptor() ([]byte, []int) {
return fileDescriptor_9845709267c03ccf, []int{0}
}
func (m *Module) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Module.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Module) XXX_Merge(src proto.Message) {
xxx_messageInfo_Module.Merge(m, src)
}
# (Delete the file entirely; no replacement lines.)

Copilot uses AI. Check for mistakes.
if _, err := k.addressCodec.StringToBytes(delegation.Delegatee); err != nil {
return types.Delegation{}, fmt.Errorf("%w: %v", types.ErrDelegationInvalidAddr, err)
}
if delegation.Active == false {

Copilot AI Oct 22, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Explicit comparison with false is redundant. Use if !delegation.Active for more idiomatic Go code.

Suggested change
if delegation.Active == false {
if !delegation.Active {

Copilot uses AI. Check for mistakes.
@alvinveroy alvinveroy merged commit 0a6d594 into bettergovph:dev/futurenet Oct 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants