-
Notifications
You must be signed in to change notification settings - Fork 248
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
tx: Remove wait_for_in_block
helper method
#1237
Conversation
Signed-off-by: Alexandru Vasile <[email protected]>
I still find this useful for instance on some scenarios such as the staking miner then one could select "best blocks" instead of "finalized block" but yeah it can be a footgun |
I think this is a good way to go; we don't remove the ability to wait for whatever event somebody wants (via the lower level stream of events one can wait for as above), but we take away the method and thus the assumption that That said, if this did prove contentious I'd also be happy with us just adding a warning to the method that it may fail some times under normal operation. |
Yep, this is still possible to do, although using a lower-level approach. This is in response to #1236 just to keep the stronger guarantees around the RPC v2, waiting for @ascjones to confirm this is ok from their side 🙏 |
Yepp, it's dangerous to use but "might be faster" than finalized blocks so in some applications it might be worth the risk (probably not).... It's probably better for subxt just to support finalized blocks and for anything else one can implement custom logic for specific behavior but it's tricky to write such thing because the actual behavior when a subscription is closed or not. Not really clearly documented, see https://substrate.stackexchange.com/questions/7892/when-will-i-stop-receiving-transactionstatus-updates-for-a-transaction-submitted |
In Subxt, if you use |
Signed-off-by: Alexandru Vasile <[email protected]>
* skeleton commit * signed extension decoding * fix some minor things * make api more similar to Extrinsics * defer decoding of signed extensions * fix byte slices * add test for nonce signed extension * adjust test and extend for tip * clippy * support both ChargeTransactionPayment and ChargeAssetTxPayment * address PR comments * Extend lifetimes, expose pub structs, remove as_type * add signed extensions to block subscribing example * add Decoded type * fix merging bug and tests * add decoded type in CustomSignedExtension * fix minor issues, extend test * cargo fmt differences * remove the `decoded` function * new as_signed_extra fn, do not expose as_type anymore * fix Result-Option order, simplify obtaining Nonce * tx: Remove `wait_for_in_block` helper method (#1237) Signed-off-by: Alexandru Vasile <[email protected]> * Update smoldot to 0.12 (#1212) * Update lightclient Signed-off-by: Alexandru Vasile <[email protected]> * testing: Fix typo Signed-off-by: Alexandru Vasile <[email protected]> * testing: Update cargo.toml Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Add tracing logs to improve debugging Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Add socket buffers module for `PlatformRef` Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Update `SubxtPlatform` Signed-off-by: Alexandru Vasile <[email protected]> * cargo: Add lightclient dependencies Signed-off-by: Alexandru Vasile <[email protected]> * Update cargo.lock of wasm tests Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Add constant for with-buffer module Signed-off-by: Alexandru Vasile <[email protected]> * lightclient: Replace rand crate with getrandom Signed-off-by: Alexandru Vasile <[email protected]> * example: Update cargo lock file Signed-off-by: Alexandru Vasile <[email protected]> * examples: Update deps Signed-off-by: Alexandru Vasile <[email protected]> --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Tadeo Hepperle <[email protected]> * ChargeAssetTxPayment: support providing u32 or MultiLocation in default impl (#1227) * Asset Id in Config trait * add example configuring the config * fmt * fix Default trait bound * merge examples, fix default again * adjust config in examples * Update subxt/src/config/mod.rs Co-authored-by: James Wilson <[email protected]> --------- Co-authored-by: James Wilson <[email protected]> * generic AssetId * fix generics * fmt --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: James Wilson <[email protected]> Co-authored-by: Alexandru Vasile <[email protected]>
The
wait_for_in_block
waits until the transaction stream produces aTxStatus::InBestBlock
event.Transitioning to the latest RPC-V2, mainly using the
transaction
andchainHead
, there is no strong guarantee that a new block reported by thetransaction
method will ever be reported by thechainHead
.This edge case could happen when the
transaction
API encounters a best block that is immediately pruned, possibly leading to thechainHead
not gaining visibility for the said pruned block.To offer stronger guarantees, the subxt
submit_transaction
ensures that a block reported byTxStatus::InFinalizedBlock
is accompanied by achainHead::Finalized
event.Users who may still want the same behavior for testing purposes could then:
Motivated by: #1236
cc @ascjones this might be of interest for contracts