Questions tagged [blocknumber]
The blocknumber tag has no usage guidance.
10
questions
0
votes
1
answer
24
views
Call function when block is initialized
I want to call function on every block in ink smart contract?
So when new block is initialized, function is called automatically. Is that possible in ink?
2
votes
1
answer
54
views
What type should an ink! contract use to store a `uint256` block number retrieved from a Solidity contract?
In Solidity, if we get the block.number it returns type uint256 (alias uint), so I use type uint256 to store the block number in a Solidity contract.
However, in ink! the equivalent u256 is not ...
4
votes
1
answer
43
views
How to stub ink! contract environment to produce fake values for use in tests?
In an ink! contract I need to use Self.env().block_number() to get the current block number to compare it with a block_number_guessed value that I provide when instantiating the contract and check ...
0
votes
0
answers
38
views
Get block number range for selected era in polkadot.js/api [duplicate]
I want to get block number range for selected era.
So, I want to get start, end block number for specific era.
How can I get them using polkadot.js/api? I can know from explorer, I need to get from ...
3
votes
1
answer
46
views
Block number in the benchmark code is 0, but is 1 in the running code
If I'm running a benchmark and I get the current block number from inside the benchmark code (i.e. in the setup before I actually call the call I'm trying to benchmark) using frame_system::Pallet::<...
1
vote
1
answer
89
views
Get BlockNumber from Pallet
I have struct that holds when it's created as BlockNumber.
#[derive(Encode, Decode, Default, Clone, PartialEq, RuntimeDebug, TypeInfo)]
#[scale_info(skip_type_params(BlockTime, MaxContentLength))]
pub ...
4
votes
2
answers
141
views
How do you tell which block number the last runtime upgrade happened on a chain?
How do you efficiently tell which block number the last runtime upgrade happened on for a particular chain (without reading every block)?
A couple of people have hinted to me that the answer is in a ...
7
votes
1
answer
95
views
From a parachain, how to get the current relay chain block number?
From a parachain, how to get the current relay chain block number?
I would like to write a hook using the relay chain block as a trigger.
1
vote
2
answers
118
views
How do I access current block number within Benchmarks
Trying to establish this function to be able to run to a specific block to test progressive extrinsics across blocks to simulate real execution within benchmarks:
while System::block_number() < ...
3
votes
2
answers
100
views
How get eraIndex by blockNumber?
How can I get the eraIndex by having a blockNumber, or get date of an era? whichever works.
like:
const eraIndex = getEraIndex(blockNumber);
or
const date = getDate(eraIndex);
Thank you.