Skip to content

Commit 6f8306d

Browse files
committed
feat: updating to cleaner interface and struct
1 parent a0add74 commit 6f8306d

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

app/provider/app.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ type AtomOneGovKeeper struct {
133133
}
134134

135135
// GetProposal implements the AtomOne-style GetProposal method
136-
func (a *AtomOneGovKeeper) GetProposal(ctx sdk.Context, proposalID uint64) (ccvtypes.ProposalI, bool) {
136+
func (a *AtomOneGovKeeper) GetProposal(ctx sdk.Context, proposalID uint64) (ccvtypes.Proposal, bool) {
137137
prop, err := a.keeper.Proposals.Get(ctx, proposalID)
138138
if err != nil {
139-
return nil, false
139+
return ccvtypes.Proposal{}, false
140140
}
141-
return &prop, true
141+
// Convert SDK proposal to ICS minimal proposal type
142+
return ccvtypes.Proposal{
143+
Messages: prop.Messages,
144+
}, true
142145
}
143146

144147
// AtomOneGovHooksWrapper wraps ICS provider hooks to work with standard SDK gov module

testutil/keeper/unit_test_helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ func NewInMemKeeperParams(tb testing.TB) InMemKeeperParams {
8282
// TestGovKeeper is a mock implementation of GovKeeper for testing
8383
type TestGovKeeper struct{}
8484

85-
// GetProposal returns nil - tests don't use actual proposals
86-
func (k TestGovKeeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.ProposalI, bool) {
87-
return nil, false
85+
// GetProposal returns an empty proposal - tests don't use actual proposals
86+
func (k TestGovKeeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool) {
87+
return types.Proposal{}, false
8888
}
8989

9090
// A struct holding pointers to any mocked external keeper needed for provider/consumer keeper setup.

x/ccv/types/expected_keepers.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,21 @@ type ConsumerHooks interface {
119119
AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddresses sdk.ValAddress) error
120120
}
121121

122-
// ProposalI defines the minimal proposal interface needed by ICS
123-
type ProposalI interface {
124-
GetMessages() []*codectypes.Any
122+
// Proposal defines the minimal proposal type needed by ICS
123+
// This is a simplified version that only contains the fields ICS actually uses
124+
type Proposal struct {
125+
Messages []*codectypes.Any
126+
}
127+
128+
// GetMessages returns the proposal messages
129+
func (p Proposal) GetMessages() []*codectypes.Any {
130+
return p.Messages
125131
}
126132

127133
// GovKeeper defines the expected interface for the governance keeper
128134
// Compatible with AtomOne's custom governance implementation
129135
type GovKeeper interface {
130-
GetProposal(ctx sdk.Context, proposalID uint64) (ProposalI, bool)
136+
GetProposal(ctx sdk.Context, proposalID uint64) (Proposal, bool)
131137
}
132138

133139
// BankKeeper defines the expected interface needed to retrieve account balances.

0 commit comments

Comments
 (0)