EOS. Unexpected amount descreasing after generate raw (unsigned) transaction, sign it and broadcast - eos

Account on jungle testnet.
I. Here is attempt to send 95 EOS and also powerup and buy ram while balance is 102 EOS at attempt moment. As result: got error which is about enough amount.
Picture with balance
Transaction content:
{"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"}
When I tried send, I have got error:
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. Here is attempt to send 30 EOS and also powerup and buy ram while balance is 102 EOS at attempt moment. As result: decreasing amount is about 60 EOS.
This attempt is successful.
But balance decreased in unexpected amount:
before sending it was 102 EOS
after sending it was 41.9996 EOS.
Seems like x2 decreasing (transferring is 30, powerup fee is 0.0002).
Transaction content:
{"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"}
Can anybody explain what's going wrong and why sending amount is 30, but decreasing amount is 60?
Thx in advance)

Problem was in serialization/deserialization part.
Used library creates in DTOs separated field with getter naming pattern (for example, there is field 'account' and also there is field 'getAccount' near).
When raw (unsigned) transaction was serialized, it had created json field also for "getter" field. And when raw transaction was deserialized, jackson library had merged field data and "getter" data, thus there were duplicates.
You can see duplicates in raw transactions in topic start post ("account" and "getAccount", "data" and "getData", etc.).
On mainnet this entailed double sending, but on testnet it was just, something like, "double spending and one sending".
We have used next fix on deserialization step:
val objectMapper: ObjectMapper = objectMapper
.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE)
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)

Related

TransactionError when using Brownie on Optimism - Tx dropped without known replacement

I have a Python script using Brownie that occasionally triggers a swap on Uniswap by sending a transaction to Optimism Network.
It worked well for a few days (did multiple transactions successfully), but now each time it triggers a transaction, I get an error message:
TransactionError: Tx dropped without known replacement
However, the transaction goes through and get validated, but the script stops.
swap_router = interface.ISwapRouter(router_address)
params = (
weth_address,
dai_address,
3000,
account.address,
time.time() + 86400,
amount * 10 ** 18,
0,
0,
)
amountOut = swap_router.exactInputSingle(params, {"from": account})
There is a possibility that one of your methods seeks data off-chain and is being called prematurely before the confirmation is received.
I had the same problem, and I managed to sort it out by adding
time.sleep(60)
at the end of the function that seeks for data off-chain
"Dropped and replaced" means the transaction is being replaced by a new one, Eth is being overloaded with a new gas fee. My guess is that you need to increase your gas costs in order to average the price.

web3js Uniswap handle event log data

I am building a scraper to get all Swap data from Uniswap using web3js.
So far I subscribe to the log and filter topics by Swap() event.
then I decode the data and get amount0In, amount1In, amount0Out, amount1Out.
My problem is in the swapExactETHForTokensSupportingFeeOnTransferTokens() function.
Normally a swap has token0 in and token1 out, but this function gives me values for 3 of the 4 and I can not seem to understand how to handle that. eventually what I want is to know what they spend, what they got and what I need to update the new reserves of that pair.
If someone has the understanding of the Uniswap RouterV2 contract swap functions, I would like to get some pointers on how to handle the data to get my calculations right.
I found the solution here ethereum.stackexchange Anyone with the same question gets a very detailed answer there.
some contracts actually transfers to recipient specified amount of tokens minus 10% (5% tax fee and 5% liquidity fee) 208940457743532637 - 10% = 188046411969179375 and emits Transfer event. Then, PancakePair _swap function emits Swap event with base value of Amount0Out 208940457743532637
Amount0In is greater than zero because the token contract returns part of tokens as a liquidity pair on Pancake Swap.

MIPS Pipeline forwarding: How to forward to the second succeeding instruction?

Say, for example, I have 3 instructions: 1, 2, and 3.
I want to forward data from instruction 1 to instruction 3. The catch is, I can only forward from the EX/MEM register of instruction 1.
So we have:
1: IF ID EX MEM WB
2: IF ID EX MEM WB
3: IF ID EX MEM WB
and I want to forward from EX/MEM of 1 to ID/EX of 3.
This is part of a homework problem, and apparently I need to stall an instruction. I don't see how this would help anything in the slightest, since it already makes no sense for me to forward data forward in time.
Problem in question:
Answer:
Thanks for any help
... since it already makes no sense for me to forward data forward in time.
Data can only be forwarded forwards in time, not backwards, since as of 2021, we still don't have time machines.
So, forwarding necessarily feeds information available in the processor generated just right now, to somewhere else in the processor, so it can be used in the future (i.e. the next cycle).
Forwarding and stalling are both ways to mitigate a RAW hazard — the idea is simply to get a value from where generated to where needed.
If the "where needed" is earlier in time than the "where generated", then a stall is required.  However, if the "where needed" is later in time than the "where generated" then a forward can mitigate the hazard.  The hazard is caused by the pipeline's assumption that "where needed" is the register file, which is incorrect in back to back operations.
Some hazards require both a forward and a stall, as the best that can be done.
But all hazards can be mitigated with sufficient stalling and without forwarding, though that will reduce performance.  With sufficient stalling, the "where needed" and the "where generated" can both be the register file.
The catch is, I can only forward from the EX/MEM register of instruction 1.  and I want to forward from EX/MEM of 1 to ID/EX of 3.
We cannot forward from EX/MEM of 1 directly to ID/EX of 3.  Why?  Because, ID/EX of 3 is two cycles further along, so the data we want to forward from there (EX/MEM of 1) is no longer there: it has moved down the pipeline to the next stage.  By the time that ID/EX of 3 wants that data, that data is now in MEM/WB (e.g. of 1) — EX/MEM at that time is doing instruction 2.

Warning! Error encountered during contract execution [Reverted] =ETH main chain after EIP 1559

The transaction does not go through, each attempt deducts a gas commission!
I'm trying to stake DNXC coins (https://portal.dinox.io/staking/gen-0-eth#), it is clear that according to the contract that others get it, why do I get it?
Here are all my attempts:
https://etherscan.io/tx/0x52c809e81eb7e4207213322fb77d7485d60df6dda6d77b4f294aaae2a66d2554
https://etherscan.io/tx/0xda781add7ac0006ee1d6e5f818ffa47368dd1a902d8a9c4b1a59d89e19be05ac
https://etherscan.io/tx/0x037826c6074cfba548ebc93c673312cbc21be476fa96598ecdef9933ac499eaf
https://etherscan.io/tx/0x18d87decbf11da799852c9030e787bc552f28eb2372b914b68c54728cc99bc16
https://etherscan.io/tx/0x35cfe1d7f66bf6ef2e666ebde0c74c6512a503473783125eb66bf6146ba1b33f
What is the problem and can the lost money be returned?
contract adress: 0xB2643342434a46B5088E17C7606cF81f6911647e
If you look at the transactions under the contract, you will notice that the problem is quite common.

List of EOS accounts who are staking my account's CPU and/or NET bandwidth

is there a way to determine exactly what accounts have staked EOS to my contract, and the amount of EOS each such staker has staked to CPU and NET?
I know that the cleos command
$ cleos system listbw <my-contract-account>
will list the accounts which my-contract-account has staked; I'm looking for the reverse of this: given a contract, who out there in the wild world of EOS has staked me?
Use EOSPark, look under "stake detail"->"staked by others". This option can be found below the token listings.