Skip to content

Commit

Permalink
fix(code standards): rename fullfilled -> fulfilled (#895)
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt authored May 21, 2024
1 parent 3ddff28 commit 551a945
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 76 deletions.
10 changes: 5 additions & 5 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ paths:
signatures required by gogoproto.
recipient:
type: string
is_fullfilled:
is_fulfilled:
type: boolean
tracking_packet_status:
type: string
Expand Down Expand Up @@ -801,7 +801,7 @@ paths:
signatures required by gogoproto.
recipient:
type: string
is_fullfilled:
is_fulfilled:
type: boolean
tracking_packet_status:
type: string
Expand Down Expand Up @@ -53288,7 +53288,7 @@ definitions:
signatures required by gogoproto.
recipient:
type: string
is_fullfilled:
is_fulfilled:
type: boolean
tracking_packet_status:
type: string
Expand Down Expand Up @@ -53366,7 +53366,7 @@ definitions:
signatures required by gogoproto.
recipient:
type: string
is_fullfilled:
is_fulfilled:
type: boolean
tracking_packet_status:
type: string
Expand Down Expand Up @@ -53437,7 +53437,7 @@ definitions:
signatures required by gogoproto.
recipient:
type: string
is_fullfilled:
is_fulfilled:
type: boolean
tracking_packet_status:
type: string
Expand Down
4 changes: 2 additions & 2 deletions ibctesting/eibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (suite *EIBCTestSuite) TestEIBCDemandOrderFulfillment() {
// Get last demand order created by TrackingPacketKey. Last part of the key is the sequence
lastDemandOrder := getLastDemandOrderByChannelAndSequence(demandOrders)
// Validate demand order wasn't fulfilled but finalized
suite.Require().False(lastDemandOrder.IsFullfilled)
suite.Require().False(lastDemandOrder.IsFulfilled)
suite.Require().Equal(commontypes.Status_FINALIZED, lastDemandOrder.TrackingPacketStatus)

}
Expand Down Expand Up @@ -335,7 +335,7 @@ func (suite *EIBCTestSuite) TestEIBCDemandOrderFulfillment() {
}
}
suite.Require().NotNil(finalizedDemandOrder)
suite.Require().True(finalizedDemandOrder.IsFullfilled)
suite.Require().True(finalizedDemandOrder.IsFulfilled)
suite.Require().Equal(commontypes.Status_FINALIZED, finalizedDemandOrder.TrackingPacketStatus)

path.EndpointA.Chain.NextBlock()
Expand Down
2 changes: 1 addition & 1 deletion proto/dymension/eibc/demand_order.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ message DemandOrder {
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
string recipient = 5;
bool is_fullfilled = 6;
bool is_fulfilled = 6;
dymensionxyz.dymension.common.Status tracking_packet_status = 8;
}
4 changes: 2 additions & 2 deletions proto/dymension/eibc/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ service Msg {
rpc FulfillOrder(MsgFulfillOrder) returns (MsgFulfillOrderResponse) {}
}

// MsgFulfillOrder defines the FullfillOrder request type.
// MsgFulfillOrder defines the FulfillOrder request type.
message MsgFulfillOrder {
// fulfiller_address is the bech32-encoded address of the account which the message was sent from.
string fulfiller_address = 1;
string order_id = 2;
}

// MsgFulfillOrderResponse defines the FullfillOrder response type.
// MsgFulfillOrderResponse defines the FulfillOrder response type.
message MsgFulfillOrderResponse {}
2 changes: 1 addition & 1 deletion x/delayedack/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (k Keeper) GetEIBCHooks() eibctypes.EIBCHooks {
}

// AfterDemandOrderFulfilled is called every time a demand order is fulfilled.
// Once it is fulfilled the underlying packet recipient should be updated to the fullfiller.
// Once it is fulfilled the underlying packet recipient should be updated to the fulfiller.
func (k eibcHooks) AfterDemandOrderFulfilled(ctx sdk.Context, demandOrder *eibctypes.DemandOrder, fulfillerAddress string) error {
err := k.UpdateRollappPacketTransferAddress(ctx, demandOrder.TrackingPacketKey, fulfillerAddress)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/eibc/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (k *Keeper) UpdateDemandOrderWithStatus(ctx sdk.Context, demandOrder *types

// FulfillOrder should be called only at most once per order.
func (k Keeper) FulfillOrder(ctx sdk.Context, order *types.DemandOrder, fulfillerAddress sdk.AccAddress) error {
order.IsFullfilled = true
order.IsFulfilled = true
err := k.SetDemandOrder(ctx, order)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions x/eibc/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (m msgServer) FulfillOrder(goCtx context.Context, msg *types.MsgFulfillOrde
return nil, err
}
// Check that the order is not fulfilled yet
if demandOrder.IsFullfilled {
if demandOrder.IsFulfilled {
return nil, types.ErrDemandAlreadyFulfilled
}
// Check the underlying packet is still relevant (i.e not expired, rejected, reverted)
Expand All @@ -48,7 +48,7 @@ func (m msgServer) FulfillOrder(goCtx context.Context, msg *types.MsgFulfillOrde
// Check that the fulfiller has enough balance to fulfill the order
fulfillerAccount := m.GetAccount(ctx, msg.GetFulfillerBech32Address())
if fulfillerAccount == nil {
return nil, types.ErrFullfillerAddressDoesNotExist
return nil, types.ErrFulfillerAddressDoesNotExist
}
// Send the funds from the fulfiller to the eibc packet original recipient
err = m.BankKeeper.SendCoins(ctx, fulfillerAccount.GetAddress(), demandOrder.GetRecipientBech32Address(), demandOrder.Price)
Expand Down
24 changes: 12 additions & 12 deletions x/eibc/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "false"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "false"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
expectedPostFulfillmentEventsType: eibcEventType,
Expand All @@ -55,7 +55,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "true"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "true"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
},
Expand All @@ -75,7 +75,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "false"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "false"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
expectedPostFulfillmentEventsType: eibcEventType,
Expand All @@ -84,7 +84,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "false"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "false"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
},
Expand All @@ -104,7 +104,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150adym"),
sdk.NewAttribute(types.AttributeKeyFee, "50adym"),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "false"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "false"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
expectedPostFulfillmentEventsType: eibcEventType,
Expand All @@ -113,7 +113,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150adym"),
sdk.NewAttribute(types.AttributeKeyFee, "50adym"),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "false"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "false"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
},
Expand All @@ -133,7 +133,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "true"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "true"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
expectedPostFulfillmentEventsType: eibcEventType,
Expand All @@ -142,7 +142,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "true"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "true"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_PENDING.String()),
},
},
Expand All @@ -162,7 +162,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "false"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "false"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_FINALIZED.String()),
},
expectedPostFulfillmentEventsType: eibcEventType,
Expand All @@ -171,7 +171,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
sdk.NewAttribute(types.AttributeKeyId, types.BuildDemandIDFromPacketKey(string(rollappPacketKey))),
sdk.NewAttribute(types.AttributeKeyPrice, "150"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyFee, "50"+sdk.DefaultBondDenom),
sdk.NewAttribute(types.AttributeKeyIsFullfilled, "false"),
sdk.NewAttribute(types.AttributeKeyIsFulfilled, "false"),
sdk.NewAttribute(types.AttributeKeyPacketStatus, commontypes.Status_FINALIZED.String()),
},
},
Expand All @@ -189,7 +189,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
suite.App.DelayedAckKeeper.SetRollappPacket(suite.Ctx, *rollappPacket)
// Create new demand order
demandOrder := types.NewDemandOrder(*rollappPacket, math.NewIntFromUint64(tc.demandOrderPrice), math.NewIntFromUint64(tc.demandOrderFee), tc.demandOrderDenom, eibcSupplyAddr.String())
demandOrder.IsFullfilled = tc.demandOrderFulfillmentStatus
demandOrder.IsFulfilled = tc.demandOrderFulfillmentStatus
err := suite.App.EIBCKeeper.SetDemandOrder(suite.Ctx, demandOrder)
suite.Require().NoError(err)
// Update rollapp status if needed
Expand Down Expand Up @@ -219,7 +219,7 @@ func (suite *KeeperTestSuite) TestMsgFulfillOrder() {
// Check that the demand fulfillment
demandOrder, err = suite.App.EIBCKeeper.GetDemandOrder(suite.Ctx, tc.demandOrderUnderlyingPacketStatus, demandOrder.Id)
suite.Require().NoError(err)
suite.Assert().Equal(tc.expectedDemandOrdefFulfillmentStatus, demandOrder.IsFullfilled)
suite.Assert().Equal(tc.expectedDemandOrdefFulfillmentStatus, demandOrder.IsFulfilled)
// Check balances updates in case of success
if tc.expectedFulfillmentError == nil {
afterFulfillmentSupplyAddrBalance := suite.App.BankKeeper.GetBalance(suite.Ctx, eibcSupplyAddr, sdk.DefaultBondDenom)
Expand Down
4 changes: 2 additions & 2 deletions x/eibc/types/demand_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewDemandOrder(rollappPacket commontypes.RollappPacket, price, fee math.Int
Price: sdk.NewCoins(sdk.NewCoin(denom, price)),
Fee: sdk.NewCoins(sdk.NewCoin(denom, fee)),
Recipient: recipient,
IsFullfilled: false,
IsFulfilled: false,
TrackingPacketStatus: commontypes.Status_PENDING,
}
}
Expand Down Expand Up @@ -67,7 +67,7 @@ func (m *DemandOrder) GetEvents() []sdk.Attribute {
sdk.NewAttribute(AttributeKeyId, m.Id),
sdk.NewAttribute(AttributeKeyPrice, m.Price.String()),
sdk.NewAttribute(AttributeKeyFee, m.Fee.String()),
sdk.NewAttribute(AttributeKeyIsFullfilled, strconv.FormatBool(m.IsFullfilled)),
sdk.NewAttribute(AttributeKeyIsFulfilled, strconv.FormatBool(m.IsFulfilled)),
sdk.NewAttribute(AttributeKeyPacketStatus, m.TrackingPacketStatus.String()),
}
return eventAttributes
Expand Down
Loading

0 comments on commit 551a945

Please sign in to comment.