You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
genesis::setup();
let current_block_height = block::get_current_block_height();
debug::print(¤t_block_height);
The debug line outputs 0 as expected.
However, I don't see a way to advance to the next block.
Looks like block::public fun emit_writeset_block_event(vm_signer: &signer, fake_block_hash: address) requires a VM signer, not sure what other function would make sense.
If I run block::initialize_for_test(aptos_framework, 1); after genesis::setup() I get
97 │ move_to<CommitHistory>(aptos_framework, CommitHistory {
│ │ ^^^^^^^ Test was not expected to error, but it gave a RESOURCE_ALREADY_EXISTS (code 4004) error with error message: "Failed to move resource into 0000000000000000000000000000000000000000000000000000000000000001". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000001::block rooted here
If I run block::initialize_for_test(aptos_framework, 1); without running genesis::setup() I get
│ 778 │ let account = borrow_global_mut<Account>(addr);
│ │ ^^^^^^^^^^^^^^^^^ Test was not expected to error, but it gave a MISSING_DATA (code 4008) error with error message: "Failed to borrow global resource from 0000000000000000000000000000000000000000000000000000000000000001". Error originating in the module 0000000000000000000000000000000000000000000000000000000000000001::account rooted here
which makes sense because genesis::setup() calls block::initialize_for_testing(), so it seems like genesis::setup() should suffice.
I was thinking maybe the epoch change automatically advances block height? But it doesn't seem like it because when I try
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Discord user ID
No response
Describe your question in detail.
In a test, I have
The
debug
line outputs 0 as expected.However, I don't see a way to advance to the next block.
Looks like
block::public fun emit_writeset_block_event(vm_signer: &signer, fake_block_hash: address)
requires a VM signer, not sure what other function would make sense.If I run
block::initialize_for_test(aptos_framework, 1);
aftergenesis::setup()
I getIf I run
block::initialize_for_test(aptos_framework, 1);
without runninggenesis::setup()
I getwhich makes sense because
genesis::setup()
callsblock::initialize_for_testing()
, so it seems likegenesis::setup()
should suffice.I was thinking maybe the epoch change automatically advances block height? But it doesn't seem like it because when I try
it still prints the current block height of 0. Which also makes sense, as I wouldn't expect a change of epoch to produce new blocks.
That's what I've tried so far. How do I simulate the block height increasing for tests?
What error, if any, are you getting?
See "Describe your question in detail" field.
What have you tried or looked at? Or how can we reproduce the error?
See "Describe your question in detail" field.
Which operating system are you using?
macOS
Which SDK or tool are you using? (if any)
Aptos CLI
Describe your environment or tooling in detail
No response
Beta Was this translation helpful? Give feedback.
All reactions