js: replace bankrun with litesvm#634
Conversation
f2bc962 to
85bb70b
Compare
| const slot = await client.getSlot(); | ||
| context.warpToSlot(slot + SLOTS_PER_EPOCH); | ||
| context.advanceEpoch(); |
There was a problem hiding this comment.
bankrun ran on a real test validator so warpToSlot() worked perfectly. litesvm just uses svm, and for infuriating reasons that cost me a long time, they provide a fake warpToSlot() that just changes the clock slot without touching anything else. itd be one thing if they were lazy with stake history but they dont even change the epoch
admittedly im on an old version for web3js support so maybe its different or removed now
| // NOTE we cannot test executing this because bankrun latest is on 1.18 | ||
| // maybe someday | ||
| //await processTransaction(context, transaction); | ||
| t.true(true); | ||
| const stakeRent = await connection.getMinimumBalanceForRentExemption(StakeProgram.space); | ||
| const poolOnrampAccount = svm.getAccount(poolOnrampAddress); | ||
| t.is(poolOnrampAccount.lamports, LAMPORTS_PER_SOL + stakeRent, 'lamports have been replenished'); |
There was a problem hiding this comment.
for more context, the reason i have to do this pr is because bankrun was so old it didnt support sol_get_sysvar so any instruction that looked at stake history would immediately halt
| class BanksConnection { | ||
| constructor(client: BanksClient, payer: Keypair) { | ||
| this.client = client; | ||
| class LiteConnection { | ||
| constructor(svm: LiteSVM, payer: Keypair) { | ||
| this.svm = svm; | ||
| this.payer = payer; | ||
| } |
There was a problem hiding this comment.
the point of this is we emulate the interface of a web3js Connection and then can pass it to anything that expects a web3js Connection without it being any the wiser
have to do this now since otherwise i cant test new js required for #631
closes #587