EOS。生成原始(未签名)交易后意外数量减少,签名并广播
EOS. Unexpected amount descreasing after generate raw (unsigned) transaction, sign it and broadcast
Account 在丛林测试网上。
I. 这是尝试发送 95 EOS 并且在尝试时余额为 102 EOS 的同时加电并购买 ram。结果:得到了足够数量的错误。
Picture with balance
交易内容:
{"transaction":{"expiration":"2022-05-16T09:42:23.349+00:00","ref_block_num":140806677,"ref_block_prefix":3316434404,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getName":"transfer"}],"transaction_extensions":[],"signatures":[],"context_free_data":[],"getRefBlockPrefix":3316434404,"getMaxNetUsageWords":0,"getMaxCpuUsageMs":0,"getDelaySec":0,"getContextFreeActions":[],"getActions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getName":"transfer"}],"getTransactionExtensions":[],"getExpiration":1652694143349,"getRefBlockNum":140806677},"chainId":"2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"}
当我尝试发送时,出现错误:
Can't broadcast transaction #hex {"signatures":["SIG_K1_Jw6ws6tJWRpy93ySXzv6B8QTotgLadfoaLULPMrSwG8m4skYCi5nVnMBm1RC6qEmUT2fAWqKka37CALgbYVnzEJpF5hdep"],"compression":"none","packed_context_free_data":"","packed_trx":"7f1c8262158ae4c5acc500000000040000000000ea3055000000a0eaab38ad0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32323410420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f530000000000a6823403ea3055000000572d3ccdcd0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32322110420835aa96949a203256b96a4e6bd6f07e0e000000000004454f5300000000000000000000ea3055000000a0eaab38ad0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32323410420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f530000000000a6823403ea3055000000572d3ccdcd0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32322110420835aa96949a203256b96a4e6bd6f07e0e000000000004454f53000000000000"}.
com.unitedtraders.luna.crypto.spi.exception.BlockchainDataProviderException: Cannot send eos transaction. Response: ChainError(code=500, message=Internal Service Error, error=Error(code=3050003, name=eosio_assert_message_exception, what=eosio_assert_message assertion failure, details=[Details(message=assertion failure with message: overdrawn balance, method=eosio_assert), Details(message=pending console output: , method=exec_one)])).
II. 这里是尝试发送 30 EOS 并且在尝试时余额为 102 EOS 时加电并购买 ram。结果:减少量约为60 EOS。
这次尝试是successful.
但余额意外减少:
- 发送前是102 EOS
- 发送后是41.9996 EOS。
x2 似乎在减少(转账是 30,powerup 费用是 0.0002)。
交易内容:
{"transaction":{"expiration":"2022-05-16T11:02:44.414+00:00","ref_block_num":140816318,"ref_block_prefix":1732454216,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getName":"transfer"}],"transaction_extensions":[],"signatures":[],"context_free_data":[],"getRefBlockPrefix":1732454216,"getMaxNetUsageWords":0,"getMaxCpuUsageMs":0,"getDelaySec":0,"getContextFreeActions":[],"getActions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getName":"transfer"}],"getTransactionExtensions":[],"getExpiration":1652698964414,"getRefBlockNum":140816318},"chainId":"2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"}
谁能解释一下哪里出了问题,为什么发送数量是 30,减少数量是 60?
提前致谢)
问题出在 serialization/deserialization 部分。
使用的库在 DTO 中创建分隔字段 getter 命名模式(例如,有字段 'account' 并且附近还有字段 'getAccount')。
当原始(未签名)交易被序列化时,它也为“getter”字段创建了json字段。并且原始事务反序列化时,jackson库合并了字段数据和“getter”数据,因此存在重复。
您可以在主题开始 post 中看到原始交易中的重复项(“account”和“getAccount”、“data”和“getData”等)。
在主网上,这需要双重发送,但在测试网上,它就像是“双重支出和一次发送”。
我们在反序列化步骤中使用了下一个修复:
val objectMapper: ObjectMapper = objectMapper
.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE)
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
Account 在丛林测试网上。
I. 这是尝试发送 95 EOS 并且在尝试时余额为 102 EOS 的同时加电并购买 ram。结果:得到了足够数量的错误。
Picture with balance
交易内容:
{"transaction":{"expiration":"2022-05-16T09:42:23.349+00:00","ref_block_num":140806677,"ref_block_prefix":3316434404,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getName":"transfer"}],"transaction_extensions":[],"signatures":[],"context_free_data":[],"getRefBlockPrefix":3316434404,"getMaxNetUsageWords":0,"getMaxCpuUsageMs":0,"getDelaySec":0,"getContextFreeActions":[],"getActions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getName":"transfer"}],"getTransactionExtensions":[],"getExpiration":1652694143349,"getRefBlockNum":140806677},"chainId":"2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"}
当我尝试发送时,出现错误:
Can't broadcast transaction #hex {"signatures":["SIG_K1_Jw6ws6tJWRpy93ySXzv6B8QTotgLadfoaLULPMrSwG8m4skYCi5nVnMBm1RC6qEmUT2fAWqKka37CALgbYVnzEJpF5hdep"],"compression":"none","packed_context_free_data":"","packed_trx":"7f1c8262158ae4c5acc500000000040000000000ea3055000000a0eaab38ad0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32323410420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f530000000000a6823403ea3055000000572d3ccdcd0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32322110420835aa96949a203256b96a4e6bd6f07e0e000000000004454f5300000000000000000000ea3055000000a0eaab38ad0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32323410420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f530000000000a6823403ea3055000000572d3ccdcd0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32322110420835aa96949a203256b96a4e6bd6f07e0e000000000004454f53000000000000"}. com.unitedtraders.luna.crypto.spi.exception.BlockchainDataProviderException: Cannot send eos transaction. Response: ChainError(code=500, message=Internal Service Error, error=Error(code=3050003, name=eosio_assert_message_exception, what=eosio_assert_message assertion failure, details=[Details(message=assertion failure with message: overdrawn balance, method=eosio_assert), Details(message=pending console output: , method=exec_one)])).
II. 这里是尝试发送 30 EOS 并且在尝试时余额为 102 EOS 时加电并购买 ram。结果:减少量约为60 EOS。 这次尝试是successful.
但余额意外减少:
- 发送前是102 EOS
- 发送后是41.9996 EOS。
x2 似乎在减少(转账是 30,powerup 费用是 0.0002)。
交易内容:
{"transaction":{"expiration":"2022-05-16T11:02:44.414+00:00","ref_block_num":140816318,"ref_block_prefix":1732454216,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getName":"transfer"}],"transaction_extensions":[],"signatures":[],"context_free_data":[],"getRefBlockPrefix":1732454216,"getMaxNetUsageWords":0,"getMaxCpuUsageMs":0,"getDelaySec":0,"getContextFreeActions":[],"getActions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getName":"transfer"}],"getTransactionExtensions":[],"getExpiration":1652698964414,"getRefBlockNum":140816318},"chainId":"2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"}
谁能解释一下哪里出了问题,为什么发送数量是 30,减少数量是 60?
提前致谢)
问题出在 serialization/deserialization 部分。 使用的库在 DTO 中创建分隔字段 getter 命名模式(例如,有字段 'account' 并且附近还有字段 'getAccount')。
当原始(未签名)交易被序列化时,它也为“getter”字段创建了json字段。并且原始事务反序列化时,jackson库合并了字段数据和“getter”数据,因此存在重复。
您可以在主题开始 post 中看到原始交易中的重复项(“account”和“getAccount”、“data”和“getData”等)。
在主网上,这需要双重发送,但在测试网上,它就像是“双重支出和一次发送”。
我们在反序列化步骤中使用了下一个修复:
val objectMapper: ObjectMapper = objectMapper
.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE)
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)