-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add bootstrap test for axelar-gmp contract
- Loading branch information
1 parent
6997149
commit a3e8706
Showing
3 changed files
with
117 additions
and
18 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
packages/boot/test/orchestration/axelar-gmp-upgrade.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** @file Bootstrap test of restarting contracts using orchestration */ | ||
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; | ||
import type { TestFn } from 'ava'; | ||
import { withChainCapabilities } from '@agoric/orchestration'; | ||
import { | ||
makeWalletFactoryContext, | ||
type WalletFactoryTestContext, | ||
} from '../bootstrapTests/walletFactory.js'; | ||
import { minimalChainInfos } from '../tools/chainInfo.js'; | ||
|
||
const test: TestFn<WalletFactoryTestContext> = anyTest; | ||
test.before(async t => { | ||
t.context = await makeWalletFactoryContext( | ||
t, | ||
'@agoric/vm-config/decentral-itest-orchestration-config.json', | ||
); | ||
}); | ||
test.after.always(t => t.context.shutdown?.()); | ||
|
||
/** | ||
* This test core-evals an installation of the axelarGmp contract that | ||
* initiates an IBC Transfer. | ||
*/ | ||
test('start axelarGmp and send an offer', async t => { | ||
const { | ||
walletFactoryDriver, | ||
bridgeUtils: { runInbound }, | ||
buildProposal, | ||
evalProposal, | ||
storage, | ||
} = t.context; | ||
|
||
const { IST } = t.context.agoricNamesRemotes.brand; | ||
|
||
t.log('start axelarGmp'); | ||
await evalProposal( | ||
buildProposal('@agoric/builders/scripts/testing/init-axelar-gmp.js', [ | ||
'--chainInfo', | ||
JSON.stringify(withChainCapabilities(minimalChainInfos)), | ||
'--assetInfo', | ||
JSON.stringify([ | ||
[ | ||
'uist', | ||
{ | ||
baseDenom: 'uist', | ||
baseName: 'agoric', | ||
chainName: 'agoric', | ||
}, | ||
], | ||
]), | ||
]), | ||
); | ||
|
||
t.log('making offer'); | ||
const wallet = await walletFactoryDriver.provideSmartWallet('agoric1test'); | ||
// no money in wallet to actually send | ||
const zero = { brand: IST, value: 0n }; | ||
// send because it won't resolve | ||
await wallet.sendOffer({ | ||
id: 'invokeEVMContract', | ||
invitationSpec: { | ||
source: 'agoricContract', | ||
instancePath: ['axelarGmp'], | ||
callPipe: [['makeSendInvitation']], | ||
}, | ||
proposal: { | ||
// @ts-expect-error XXX BoardRemote | ||
give: { Send: zero }, | ||
}, | ||
offerArgs: { | ||
destAddr: '0x20E68F6c276AC6E297aC46c84Ab260928276691D', | ||
type: 1, | ||
destinationEVMChain: 'ethereum', | ||
gasAmount: 33, | ||
contractInvocationDetails: { | ||
evmContractAddress: 'anyContract', | ||
functionSelector: 'fnSelector', | ||
encodedArgs: 'args', | ||
nonce: 25, | ||
deadline: 3444, | ||
}, | ||
}, | ||
}); | ||
|
||
const getLogged = () => | ||
JSON.parse(storage.data.get('published.axelarGmp.log')!).values; | ||
|
||
// This log shows the flow started, but didn't get past the IBC Transfer settlement | ||
t.deepEqual(getLogged(), [ | ||
'offer args', | ||
'evmContractAddress:anyContract', | ||
'functionSelector:fnSelector', | ||
'encodedArgs:args', | ||
'nonce:25', | ||
'got info for denoms: ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9, ibc/toyatom, ibc/toyusdc, ubld, uist', | ||
'got info for chain: osmosis-1', | ||
'completed transfer to localAccount', | ||
'payload received', | ||
]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters