Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast-forwarding support #105

Open
danielwpz opened this issue Jan 29, 2022 · 7 comments
Open

Fast-forwarding support #105

danielwpz opened this issue Jan 29, 2022 · 7 comments

Comments

@danielwpz
Copy link

danielwpz commented Jan 29, 2022

hey, I saw this issue: #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.

@ailisp
Copy link
Member

ailisp commented Feb 9, 2022

nearcore side work to support fast-forwarding is recently accomplished by @ChaoticTempest , support in workspaces-js is not added yet

@ChaoticTempest
Copy link
Member

relevant PRs for reference:
block fast forwarding: near/nearcore#6158
fast-forward API addition: near/near-workspaces-rs#73

still waiting on near/nearcore#6211 for timestamps/epoch

@danielwpz
Copy link
Author

cool, thanks for the update!

@june07
Copy link

june07 commented Nov 17, 2022

Any ideas on when this will be available for this api? I see it's already made it to workspaces-rs.

@volovyks
Copy link
Collaborator

@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.

@june07
Copy link

june07 commented Nov 24, 2022

@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...

@ChaoticTempest
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants