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

offchain send_signed_transaction any_account early exit #450

Open
2 tasks done
swm888 opened this issue Aug 24, 2022 · 0 comments
Open
2 tasks done

offchain send_signed_transaction any_account early exit #450

swm888 opened this issue Aug 24, 2022 · 0 comments

Comments

@swm888
Copy link

swm888 commented Aug 24, 2022

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

  1. I have two account for offchain woker. First account is no money.

截屏2022-08-24 09 03 48

2. send_signed_transaction get error: `InvalidTransaction::Payment` . But second account is has money to `send_signed_transaction` and can **let who = ensure_signed(origin)?;**

(offchain call) Error submitting a transaction to the pool: Transaction pool error: Invalid transaction validity: InvalidTransaction::Payment

let signer = Signer::<T, T::AuthorityId>::any_account();
let result = signer.send_signed_transaction(|_acct|
		Call::submit_number_signed{number});

https://github.com/paritytech/substrate/blob/master/frame/system/src/offchain.rs#L206-L213

let accounts = self.accounts_from_keys();
for account in accounts.into_iter() {
	let res = f(&account);
	if let Some(res) = res {
		return Some((account, res))
	}
}
None

What's the problem cause?
I think it'ssend_signed_transaction should be success by second account call func.
But for account in accounts.into_iter() { first loop use no money account and stop for.
I don't know it's correct for stop for and send_signed_transaction failed. Because second account has money to ensure_signed call dispatch func.

Steps to reproduce

git clone https://github.com/hello-substrate/substrate-pallet.git
cd substrate-pallet && git checkout ocw-demo-sigtx
cargo build --release && ./target/release/node-template --dev
  1. https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/rpc
  2. author -> insertKey
keyType= demo
suri= boat stick victory lazy teach science summer outdoor sugar royal message great
publicKey= 0x6c3b2c14bab0c58bdff69a8c7169577c3ed0e480b1f99e34ea45aa84c43ece3a
keyType= demo
suri= robust degree pear oppose scene catch fashion fuel disorder excuse auction shallow
publicKey= 0xd45d732c621dd4a3e635311f47ed8913c34edb8bffadfefa198c2ed26d60c60f

截屏2022-08-24 09 24 20

transfer accounts money

Public key (SS58): 5Gs9mZdChuKpmfvpTFKfMXDVUPnZ33zEfR6y1WwTvNMQKqWS
publicKey= 0xd45d732c621dd4a3e635311f47ed8913c34edb8bffadfefa198c2ed26d60c60f

check log


2022-08-24 08:56:30 (offchain call) Error submitting a transaction to the pool: Transaction pool error: Invalid transaction validity: InvalidTransaction::Payment    
2022-08-24 08:56:30 fail call submit_number_signed: check error and offchain_signed_tx account: 6c3b2c14bab0c58bdff69a8c7169577c3ed0e480b1f99e34ea45aa84c43ece3a (5EWcc8bA...)    
2022-08-24 08:56:30 offchain_worker error: OffchainSignedTxError    
2022-08-24 08:56:31 💤 Idle (0 peers), best: paritytech/substrate#145 (0x67d6…9d54), finalized paritytech/substrate#143 (0xafa0…ba22), ⬇ 0 ⬆ 0 

Thank you very much.

@bkchr bkchr transferred this issue from paritytech/substrate Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant