forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sandbox): fast forwarding (near#6158)
* Added fast-forwarding to sandbox * Changed name to delta_height for better clarity * Remove print statements * Cargo format * Added sandbox fast forward test * Move import into inplaced location as full path * Move other sandbox imports into inplaced locations * Added python test for sandbox fast forwarding * Format python test * Fix import issue from updating to latest * Addressed comments * Removed unnecessary conditional flags for sandbox * Use utils module over direct import for patch_state
- Loading branch information
1 parent
6f9aea9
commit d8d7448
Showing
11 changed files
with
222 additions
and
38 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# python sandbox node tests | ||
pytest sandbox/patch_state.py --features sandbox | ||
pytest sandbox/fast_forward.py --features sandbox |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
# test fast fowarding by a specific block height within a sandbox node. This will | ||
# fail if the block height is not past the forwarded height. | ||
|
||
import sys, time | ||
import pathlib | ||
|
||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2] / 'lib')) | ||
|
||
from cluster import start_cluster | ||
from utils import figure_out_sandbox_binary | ||
|
||
# startup a RPC node | ||
BLOCKS_TO_FASTFORARD = 10000 | ||
CONFIG = figure_out_sandbox_binary() | ||
nodes = start_cluster(1, 0, 1, CONFIG, [["epoch_length", 10]], {}) | ||
|
||
# request to fast forward | ||
nodes[0].json_rpc('sandbox_fast_forward', { | ||
"delta_height": BLOCKS_TO_FASTFORARD, | ||
}) | ||
|
||
# wait a little for it to fast forward | ||
time.sleep(3) | ||
|
||
# Assert at the end that the node is past the amounts of blocks we specified | ||
assert nodes[0].get_latest_block().height > BLOCKS_TO_FASTFORARD |
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