Skip to content

Commit

Permalink
feat: add block height in RefundRecord (#273)
Browse files Browse the repository at this point in the history
Co-authored-by: fx0x55 <80245546+fx0x55@users.noreply.github.com>
  • Loading branch information
zakir-code and fx0x55 committed Mar 18, 2024
1 parent 8db1a93 commit 70baa99
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 100 deletions.
1 change: 1 addition & 0 deletions proto/fx/crosschain/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ message RefundRecord {
uint64 timeout = 3;
repeated ERC20Token tokens = 4 [(gogoproto.nullable) = false];
uint64 oracle_set_nonce = 5;
uint64 block = 6;
}

message SnapshotOracle {
Expand Down
1 change: 1 addition & 0 deletions x/crosschain/keeper/bridge_call_refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (k Keeper) AddRefundRecord(ctx sdk.Context, receiver string, eventNonce uin
Timeout: refundTimeout,
OracleSetNonce: oracleSet.Nonce,
Tokens: tokens,
Block: uint64(ctx.BlockHeight()),
})
return nil
}
Expand Down
5 changes: 5 additions & 0 deletions x/crosschain/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,7 @@ func (suite *CrossChainGrpcTestSuite) TestKeeper_RefundRecordByNonce() {
Timeout: tmrand.Uint64(),
Tokens: nil,
OracleSetNonce: uint64(tmrand.Int63n(10000)),
Block: tmrand.Uint64(),
}
suite.Keeper().SetRefundRecord(suite.ctx, refundRecord)
request = &types.QueryRefundRecordByNonceRequest{
Expand Down Expand Up @@ -2494,6 +2495,7 @@ func (suite *CrossChainGrpcTestSuite) TestKeeper_RefundRecordByReceiver() {
Timeout: tmrand.Uint64(),
Tokens: nil,
OracleSetNonce: uint64(tmrand.Int63n(10000)),
Block: tmrand.Uint64(),
}
suite.Keeper().SetRefundRecord(suite.ctx, refundRecord)
request = &types.QueryRefundRecordByReceiverRequest{
Expand Down Expand Up @@ -2573,6 +2575,7 @@ func (suite *CrossChainGrpcTestSuite) TestKeeper_RefundConfirmByNonce() {
Timeout: tmrand.Uint64(),
Tokens: nil,
OracleSetNonce: oracleNonce,
Block: tmrand.Uint64(),
}
suite.Keeper().SetRefundRecord(suite.ctx, refundRecord)

Expand Down Expand Up @@ -2646,6 +2649,7 @@ func (suite *CrossChainGrpcTestSuite) TestKeeper_LastPendingRefundRecordByAddr()
Timeout: tmrand.Uint64(),
Tokens: nil,
OracleSetNonce: oracleNonce,
Block: tmrand.Uint64(),
}
suite.Keeper().SetRefundRecord(suite.ctx, refundRecord)

Expand Down Expand Up @@ -2696,6 +2700,7 @@ func (suite *CrossChainGrpcTestSuite) TestKeeper_LastPendingRefundRecordByAddr()
Timeout: tmrand.Uint64(),
Tokens: nil,
OracleSetNonce: oracleNonce,
Block: tmrand.Uint64(),
}
suite.Keeper().SetRefundRecord(suite.ctx, refundRecordNew)
request = &types.QueryLastPendingRefundRecordByAddrRequest{
Expand Down
1 change: 1 addition & 0 deletions x/crosschain/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ func (suite *KeeperTestSuite) TestConfirmRefund() {
Timeout: tmrand.Uint64(),
Tokens: tokens,
OracleSetNonce: oracleSetNonce,
Block: tmrand.Uint64(),
}
suite.Keeper().SetRefundRecord(suite.ctx, refundRecord)

Expand Down
Loading

0 comments on commit 70baa99

Please sign in to comment.