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

ensure transaction sent to non-authority node can be validated #1482

Closed
noot opened this issue Mar 19, 2021 · 3 comments
Closed

ensure transaction sent to non-authority node can be validated #1482

noot opened this issue Mar 19, 2021 · 3 comments
Assignees

Comments

@noot
Copy link
Contributor

noot commented Mar 19, 2021

Task summary

  • ensure transaction sent to non-authority node can be validated, added to the tx pool, and gossiped to the network and eventually be included in a block
  • currently, the integration test sends the transaction to an authority node because it seems non-authority nodes cannot validate the tx
  • fix this and update the integration test
@noot noot added p3 and removed p3 labels Mar 19, 2021
@arijitAD arijitAD self-assigned this Apr 6, 2021
@noot
Copy link
Contributor Author

noot commented Apr 6, 2021

@arijitAD this issue is probably due to this code: https://github.com/ChainSafe/gossamer/blob/development/dot/core/messages.go#L28

func (s *Service) HandleTransactionMessage(msg *network.TransactionMessage) error {
	logger.Debug("received TransactionMessage")
	if !s.isBlockProducer {
		return nil
	}
       //etc
}

@arijitAD
Copy link
Contributor

arijitAD commented Apr 12, 2021

Investigated this issue. The Authority node fails to execute the block.
Looking at the block execute code.

�[36mDBUG�[0m[04-12|20:24:48] 🔗 imported block                      �[36mpkg�[0m=sync �[36mnumber�[0m=2 �[36mhash�[0m=0x4de3e69633434358f1781c2ab82ea7e2723b62ca0cffc93b2d15a15d9a071925 �[36mcaller�[0m=syncer.go:341
�[36mDBUG�[0m[04-12|20:24:48] block processed                          �[36mpkg�[0m=sync �[36mhash�[0m=0x4de3e69633434358f1781c2ab82ea7e2723b62ca0cffc93b2d15a15d9a071925 �[36mcaller�[0m=syncer.go:256
�[36mDBUG�[0m[04-12|20:24:48] starting processing of block             �[36mpkg�[0m=sync �[36mhash�[0m=0x95dec08f16b930fa5234ea44f3a34548e10cfd0395241ae0ce44c78f94e6e3be �[36mcaller�[0m=syncer.go:165
�[36mDBUG�[0m[04-12|20:24:48] processing block                         �[36mpkg�[0m=sync �[36mhash�[0m=0x95dec08f16b930fa5234ea44f3a34548e10cfd0395241ae0ce44c78f94e6e3be �[36mcaller�[0m=syncer.go:248
�[36mDBUG�[0m[04-12|20:24:48] going to execute block                   �[36mpkg�[0m=sync �[36mheader�[0m="ParentHash=0x4de3e69633434358f1781c2ab82ea7e2723b62ca0cffc93b2d15a15d9a071925 Number=3 StateRoot=0x961d42c69e6dc929826c0a1f35a6e7200093be77d0901797e7ad292e71633dda ExtrinsicsRoot=0x6f13f0de35a9fa8e28bb736c491b1810789f686b3f1274b5ac8dc3ca3d46357d Digest=[PreRuntimeDigest ConsensusEngineID=BABE Data=0x01020000005fca262000000000a8a8fc210da46db8270a6a72a0711db363c6945bb4a2ad8f4e4f9436f98bdd4606c4622921cff2f5a6c22819ec5758ce8c5dfee9ad2af9902a562039cc4def01d7e79540d740b5ba2a4839fac5991c951d1be7df0f302d87abc083fda2a39709 SealDigest ConsensusEngineID=BABE Data=0x36dda12be70597e9604761f645cdd4b0f812f88530ce247ee8d6d4f897c46203a4c1770fb23b9bfe6c8cafc3f0787eed3df9871dd27fabc0117f62df3b266782] Hash=0x95dec08f16b930fa5234ea44f3a34548e10cfd0395241ae0ce44c78f94e6e3be" �[36mexts�[0m="&[8 32 4 3 0 3 207 106 116 96 53 2 45 2 132 255 212 53 147 199 21 253 211 28 97 20 26 189 4 169 159 214 130 44 133 88 133 76 205 227 154 86 132 231 165 109 162 125 1 184 117 96 197 159 239 95 203 125 98 164 163 131 173 201 52 27 251 205 55 108 53 64 161 150 182 27 102 50 0 255 29 231 168 251 56 255 170 114 41 245 235 208 243 143 0 87 126 197 141 44 181 188 49 179 185 143 175 113 182 238 241 42 142 0 0 0 6 0 255 144 181 171 32 92 105 116 201 234 132 27 230 136 134 70 51 220 156 168 163 87 132 62 234 207 35 20 100 153 101 254 34 229 192]" �[36mcaller�[0m=syncer.go:317
�[35mCRIT�[0m[04-12|20:24:48] [ext_logging_log_version_1]              �[35mpkg�[0m=runtime �[35mmodule�[0m=go-wasmer �[35mtarget�[0m=runtime �[35mmessage�[0m="panicked at 'Bad input data provided to execute_block: ', /home/elizabeth/substrate/bin/node/runtime/src/lib.rs:971:1" �[35mcaller�[0m=imports.go:135
�[31mEROR�[0m[04-12|20:24:48] failed to handle block                   �[31mpkg�[0m=sync �[31mnumber�[0m=3 �[31merror�[0m="failed to execute block 3: Failed to call the `Core_execute_block` exported function." �[31mcaller�[0m=syncer.go:252
�[33mWARN�[0m[04-12|20:24:48] failed to handle block data              �[33mpkg�[0m=network �[33mfailed on block�[0m=3 �[33merror�[0m="failed to execute block 3: Failed to call the `Core_execute_block` exported function." �[33mcaller�[0m=sync.go:737
�[36mDBUG�[0m[04-12|20:24:48] pushing request to queue                 �[36mpkg�[0m=network �[36mstart�[0m=3 �[36mcaller�[0m=sync.go:411
�[36mDBUG�[0m[04-12|20:24:48] pushed block data to queue               �[36mpkg�[0m=network �[36mstart�[0m=3 �[36mend�[0m=12 �[36mqueue�[0m="[start=3 end=12] " �[36mcaller�[0m=sync.go:523
�[36mDBUG�[0m[04-12|20:24:49] pushing to response queue                �[36mpkg�[0m=network �[36mstart�[0m=3 �[36mcaller�[0m=sync.go:254
�[36mDBUG�[0m[04-12|20:24:49] pushed responses!                        �[36mpkg�[0m=network �[36mstart�[0m=3 �[36mcaller�[0m=sync.go:256
�[36mDBUG�[0m[04-12|20:24:49] sending block data to syncer             �[36mpkg�[0m=network �[36mstart�[0m=3 �[36mend�[0m=12 �[36mcaller�[0m=sync.go:712
�[36mDBUG�[0m[04-12|20:24:49] starting processing of block             �[36mpkg�[0m=sync �[36mhash�[0m=0x95dec08f16b930fa5234ea44f3a34548e10cfd0395241ae0ce44c78f94e6e3be �[36mcaller�[0m=syncer.go:165
�[36mDBUG�[0m[04-12|20:24:49] processing block                         �[36mpkg�[0m=sync �[36mhash�[0m=0x95dec08f16b930fa5234ea44f3a34548e10cfd0395241ae0ce44c78f94e6e3be �[36mcaller�[0m=syncer.go:248
�[36mDBUG�[0m[04-12|20:24:49] going to execute block                   �[36mpkg�[0m=sync 

@noot
Copy link
Contributor Author

noot commented Apr 13, 2021

@arijitAD do you mean the non-authority node?

the "Bad input data" error means the input was formatted/encoded incorrectly, in this case the block body. can you try decoding the body into extrinsics and see if they are correct?

looking at the BABE code, I think the issue is likely in this function:

func extrinsicsToBody(inherents [][]byte, txs []*transaction.ValidTransaction) (*types.Body, error) {
	extrinsics := types.BytesArrayToExtrinsics(inherents)

	for _, tx := range txs {
		extrinsics = append(extrinsics, tx.Extrinsic)
	}

	return types.NewBodyFromExtrinsics(extrinsics)
}

potentially the tx.Extrinsics are being double encoded or there is some other encoding issue.

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