Skip to content
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

It got stuck while sending lots of transactions #180

Closed
Dengjianping opened this issue Sep 29, 2020 · 8 comments
Closed

It got stuck while sending lots of transactions #180

Dengjianping opened this issue Sep 29, 2020 · 8 comments

Comments

@Dengjianping
Copy link

Dengjianping commented Sep 29, 2020

Hi,

I'm using the master right now due to 0.12 lacks of supporting substrate 2.0.0.

While I tried to send lots of transactions to cloud nodes, it would get stuck after some transactions were sent, no more transaction would be sent, and there's no error log prompted.
Both on cargo run/release, cloud nodes are upgraded to substrate 2.0.0.
It kind of weird.

By the way, it works good while RC6 with subxt0.12.

@dvdplm
Copy link
Contributor

dvdplm commented Sep 29, 2020

Can you try the 0.13 draft release and see if that helps?

@Dengjianping
Copy link
Author

All right, I'll give a try asap.

@DemiMarie
Copy link
Contributor

@Dengjianping
Copy link
Author

@DemiMarie

The version you provide isn't compatible with substrate 2.0.0, got this error

Codec(Error("Error decoding field RuntimeMetadataPrefixed.1"))

@Dengjianping
Copy link
Author

@dvdplm

It still got the same situation, maybe I should put some of my code here.

pub async fn issue_voucher_call(signer: &str, url: &str, voucher: &CC2Voucher, who: &AccountId32) -> Result<String, Box<dyn Error>> {
	let client: Client<BifrostRuntime> = subxt::ClientBuilder::new().set_url(url).build().await?;

	let signer = Pair::from_string(signer, None).map_err(|_| BifrostxtError::WrongSudoSeed)?;
	let mut signer = PairSigner::<BifrostRuntime, Pair>::new(signer);

	let nonce = client.account(&signer.signer().public().into(), None).await?.nonce;

	let amount = {
		let amount_f64 = voucher.bnc.parse::<f64>()?;
		(amount_f64 * 10f64.powi(12i32)) as u128
	};

	let args = IssueVoucherCall {
		dest: &who.clone().into(),
		amount,
	};
	let proposal = client.encode(args)?;
	let call = create_sudo_call(&proposal);

	let extrinsic = client.create_signed(call, &signer).await?;

	let mut decoder = client.events_decoder::<IssueVoucherCall<BifrostRuntime>>();
	decoder.with_voucher();

	let voucher_events = client.submit_and_watch_extrinsic(extrinsic, decoder).await?;
	let event = voucher_events.find_event::<IssuedVoucherEvent::<BifrostRuntime>>()?.ok_or("No Event found or decoded.")?;
	let block_hash = voucher_events.block;

	Ok(block_hash.to_string())
}

And I'll do some more testing to find out which line it will get stuck at.

@Dengjianping
Copy link
Author

I found that it got stuck at where it called submit_and_watch_extrinsic, after sent couple of transactions.

@Dengjianping
Copy link
Author

I found it might be my problem.

I have a couple of nodes running on cloud. Somehow, at some point, these nodes were producing blocks, but halted on finalizing blocks. So, there's a big gap between the finalized block and the latest produced block, and the gap became bigger and bigger.

If I push transactions to these nodes, it always got stuck.
But once the gap become small, blocks get finalized, it wouldn't get stuck.

Now, 0.13 works for me. I'm going to close this issue.

@dvdplm
Copy link
Contributor

dvdplm commented Oct 9, 2020

Glad you got it sorted! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants