movementlabsxyz / movement

The Movement Network is a Move-based L2 on Ethereum.
Apache License 2.0
71 stars 61 forks source link

Resource Accounts Failing Transactions #343

Closed Rahat-ch closed 2 months ago

Rahat-ch commented 2 months ago

Describe the bug Modules that are utilizing Resource accounts are unable to perform transactions completely after about 6 hours of transactions according to data collected by Rize. The error that occurs is the following mempool issue:

AptosApiError: Request to [Fullnode]: POST https://aptos.testnet.suzuka.movementlabs.xyz/v1/transactions failed with: 

{"message":"Mempool failed to initially evaluate submitted transaction: oneshot canceled","error_code":"internal_error","vm_error_code":null}

Code available here: https://explorer.movementlabs.xyz/account/0xd697cbe1d0ab95d9c79f847ee7a075db6e5d99196328785ff354fcbda7e28652/modules/code/momo?network=testnet

Rize redeployed their modules without resource accounts and see that when they do not use resource accounts their smart contracts are running well.

To Reproduce Curl command to reproduce:

curl --location 'https://aptos.testnet.suzuka.movementlabs.xyz/v1/transactions' \
--header 'Content-Type: application/json' \
--data '{
  "sender": "0xd697cbe1d0ab95d9c79f847ee7a075db6e5d99196328785ff354fcbda7e28652",
  "sequence_number": "3925",
  "max_gas_amount": "200000",
  "gas_unit_price": "100",
  "expiration_timestamp_secs": "1723219200",
  "payload": {
    "type": "entry_function_payload",
    "function": "0xd697cbe1d0ab95d9c79f847ee7a075db6e5d99196328785ff354fcbda7e28652::momo::create_resource_account",
    "type_arguments": [],
    "arguments": ["1723105958005"]
  },
  "signature": {
    "type": "ed25519_signature",
    "public_key": "0x5077571aa94340504f6bb0be292bfe7c2544b0394439ab723b9a5c3c88754dbd",
    "signature": "0x4182c23bee684b9863e82474852c4b51f739c43de763eb8ccfe8e09ff898edada9bc292026f45b155137ccec386707581fd0c5c61839fef907cbe87c1b364401"
  }
}'

Expected behavior

Transaction with resource accounts should run normally

l-monninger commented 2 months ago

It's the same throughput issue. Our testnet node (which is behind main) is pretty much consistently operating past the limit of what the node can handle most of the time it seems.

Again this most likely has to do with transaction by hash requests being based on polling and using the same channel as submissions. There's a bit of a viscous cycle here. First the node backs up mainly due to DA throughput, this slows the transaction confirmation speed which results in more transaction by hash requests per transaction because they are polled. This, then becomes bad enough to backup the transaction channel to the point where the Tokio runtime has to actually drop requests.

JackyWYX commented 2 months ago

However, from our experiment, it's only the smart contract with resource account that is effected. The success rate is literally 0%. For smart contract without resource account, the success rate is much better and not effected.

Do you have any more insights about this specific performance difference between smart contract with & without resource account?

l-monninger commented 2 months ago

Is this still an issue after the recent upgrades?

l-monninger commented 2 months ago

@Rahat-ch

Rahat-ch commented 2 months ago

looks to be resolved closing