Open danielwpz opened 2 years ago
nearcore side work to support fast-forwarding is recently accomplished by @ChaoticTempest , support in workspaces-js is not added yet
relevant PRs for reference: block fast forwarding: https://github.com/near/nearcore/pull/6158 fast-forward API addition: https://github.com/near/workspaces-rs/pull/73
still waiting on https://github.com/near/nearcore/pull/6211 for timestamps/epoch
cool, thanks for the update!
Any ideas on when this will be available for this api? I see it's already made it to workspaces-rs.
@june07 it is on our roadmap but looks like we will have the capacity ~Q1 2023. Feel free to contribute if it's something that interests you. We will provide all the support.
@volovyks So it seems that it's possible in workspace-js simply using the following:
await worker.manager.provider.sendJsonRpc('sandbox_fast_forward', { delta_height: 2000 });
I forked the repo and considered contributing in this regard... but it doesn't seem like much more abstraction is needed?!
HOWEVER... while it does appear to work somewhat, it seems rather buggy with the block forwarding halting (verified by logs from rpc) more than half the time... at which time the test simply needs to be cancelled and restarted... else the test hangs until the test framework timeout.
More important... when spooning a staking contract from testnet, the .get_account_total_balance method isn't showing any increase in value... in other words it seems that the spooned contract isn't being affected by the sandbox_fast_forward action. Since it has been spooned to the sandbox... it seems to be that it should be running its own code per blocks being fast forwarded, and as such I should see some increase in account balance...
Any idea's on this...
@june07 how are you using it with other calls? Any full code snippets I can take a look at to get more context? Its working as intended for me when I utilize the same contract in workspaces-rs/fast_forward.rs for workspaces-js
Also, just noting that sandbox_fast_forward
RPC call blocks any sort of transaction from being processed. It's more for forwarding in time, with the only relevant data affected being block height, block timestamp and epoch height; so actual blocks/transaction being processed are not guaranteed.
hey, I saw this issue: https://github.com/near/workspaces-js/issues/1 , do we support fast-forwarding now?
I'm working on a contract that interacts with validator staking contract, it will be hard to test without the ability to fast-forward epoch numbers.