Comments (8)
Oh I see what is happening here. Helios only stores block data for blocks that start either after helios starts or within 64 blocks of the current block number (whichever is higher).
This is mostly a limitation due to efficiency as well as how the light client protocol works.
from helios.
Can you please provide the full code example so I can help you debug?
from helios.
sure, there's the whole function:
#[tokio::main]
async fn main() -> Result<()> {
dotenv().ok();
set_logger();
let network = Network::GOERLI;
let cf = checkpoints::CheckpointFallback::new()
.build()
.await
.unwrap();
info!("Checkpoint fallback services built");
let checkpoint = cf.fetch_latest_checkpoint(&network).await.unwrap();
let checkpoint = format!("{:?}", checkpoint);
let execution_rpc_url = get_env_variable("EXECUTION_RPC")?;
let consensus_rpc_url = get_env_variable("CONSENSUS_RPC")?;
let mut client: Client<FileDB> = ClientBuilder::new()
.network(network)
.execution_rpc(&execution_rpc_url)
.consensus_rpc(&consensus_rpc_url)
.load_external_fallback()
.checkpoint(&checkpoint)
.data_dir("/tmp/helios".parse()?)
.build()?;
info!("client created");
client.start().await?;
client.wait_synced().await;
let block_number: u64 = 19075597;
let block = client
.get_block_by_number(BlockTag::Number(block_number), true)
.await?;
info!("block: {:?}", block);
Ok(())
}
from helios.
@ncitron first, thanks for your help!
I have a similar problem now but with transactions.
I use the get_transaction_receipt
function in order to get the receipt of a transaction that is created after the start of the client, but I keep getting a None result for some reason.
I inject the hash of the transaction to the tx_hash_str
variable using a breakpoint, and i am taking a transaction hash from etherscan explorer.
I tried both pending transactions and approved transactions, but both gives the same result of None, when the transaction is clearly created after the client.
I use the same code as above, but with changing the block fetching part with the following:
let tx_hash_str = "";
//here i use a breakpoint and put the hash string into tx_hash_str
let tx_hash = H256::from_str(tx_hash_str).unwrap();
let tx = client
.get_transaction_receipt(&tx_hash)
.await?;
from helios.
Can you confirm that you can fetch a block for the block number of the transaction?
from helios.
Yes, I can do this.
from helios.
Hmm it seems I am able to fetch a receipt using this simple example:
client.start().await?;
client.wait_synced().await;
let head_block_num = client.get_block_number().await?;
let head_block = client.get_block_by_number(BlockTag::Number(head_block_num.as_u64()), false).await;
let tx_hash = head_block.unwrap().unwrap().transactions.hashes()[0];
let receipt = client.get_transaction_receipt(&tx_hash).await.unwrap().unwrap();
println!("{:?}", receipt);
I wonder if the breakpoints are causing it to act up. If helios can fetch the block it should always be able to get a receipt from within that block.
from helios.
Thanks for all the help!
It seems I did not understand the light client's logics just right. I now understand that I would be able to fetch only transactions from already fetched blocks.
from helios.
Related Issues (20)
- config example shows unable to interpret `strict_checkpoint_age`, `load_external_fallback`, and `data_dir` from ~/.helios/helios.toml HOT 1
- invalid header hash found HOT 1
- thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: rpc error on method: finality_update HOT 6
- Logging when building from source HOT 6
- rpc error on method: spec, message: error decoding response body: expected value at line 1 column 1 HOT 2
- could not fetch bootstrap HOT 3
- Error: out of sync: 1697023721 seconds behind HOT 2
- feat: add database that uses browser local storage for caching checkpoints HOT 1
- feat: transaction simulation endpoint HOT 2
- feat: expose wait_synced with helios-ts HOT 1
- feat: support tracking consensus updates in helios-ts HOT 4
- Can't build execution v0.5.1 in Rust project HOT 1
- refactor: seperate protocol verification from RPC logic HOT 2
- invalid: cannot get environment variable when run example/call
- version `GLIBC_2.32' not found
- The block synchronization information always lagging by about 2 blocks
- Crash on rpc error(s) HOT 1
- Can verify_logs() catch cases of eth_getLogs not returning all matching logs? HOT 3
- Helios as a library: compilation has a type error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helios.