Skip to content

Commit

Permalink
test: simulate MsgSend failure on localchain bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Aug 9, 2024
1 parent 7d1818e commit bd7c95e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/vats/tools/fake-bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Nat } from '@endo/nat';
/**
* @import {JsonSafe} from '@agoric/cosmic-proto';
* @import {MsgDelegateResponse, MsgUndelegateResponse} from '@agoric/cosmic-proto/cosmos/staking/v1beta1/tx.js';
* @import {MsgSendResponse} from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
* @import {BridgeHandler, ScopedBridgeManager} from '../src/types.js';
* @import {Remote} from '@agoric/vow';
*/
Expand Down Expand Up @@ -181,6 +182,12 @@ export const fakeLocalChainBridgeTxMsgHandler = (message, sequence) => {
sequence,
};
}
case '/cosmos.bank.v1beta1.MsgSend': {
if (message.amount[0].amount === '400') {
throw Error('simulated error');
}
return /** @type {JsonSafe<MsgSendResponse>} */ ({});
}
case '/cosmos.staking.v1beta1.MsgDelegate': {
if (message.amount.amount === '504') {
throw Error('simulated packet timeout');
Expand Down

0 comments on commit bd7c95e

Please sign in to comment.