iotaledger / evil-tools

Apache License 2.0
2 stars 1 forks source link

Debug account creation #24

Closed daria305 closed 7 months ago

daria305 commented 7 months ago

Account created, transaction is accepted, there are no failure codes when requesting BlockMetadata

daria305 commented 7 months ago

Working on branch debug/accounts Implicit account are created, there was no error nor any failure reason, but we could not spam, as the node does not see the account. When we request CongestionResp for some of genesis account, we can actually skip the account not found issue and start spamming with the new implicit account.

After spam: Accounts are visible in grafana, and even in the node's logs we can see that if we start spam, the account will soon be blocked when we use all the credits. Also the indexer endpoint is not able to retrieve the accounts. The problem might be handling of AccountAddress inside the node, as endpoints that have the problem are using AccountAddress instead of AccountID, that is used without any problems for Posting Blocks.

daria305 commented 7 months ago

The problem with transition account is that the accountID is not found by Congestion endpoint, so we cannot create transition transaction and pay for it with implicit account. We replaced fresh account with genesis to skip congestion error. If we stop on creatin implictAccount, do not transition, but start spamming with freshly created implicit account, it works, with no errors, on the node side we've seen mana is burned, and ProcessSolidBlock is finding the accountID. Also the accountID is visible in Grafana.

 daria@daria-x1  ~/go/src/iotaledger/evil-tools   debug/accounts ±  ./scripts/test_account_implicit.sh
2023-12-01T15:36:30+01:00       INFO    main    script accounts
2023-12-01T15:36:30+01:00       INFO    main    Parsing create account flags, subcommands: [--alias IMPLICIT --implicit]
2023-12-01T15:36:30+01:00       INFO    main    Parsed flags: alias: IMPLICIT, BIF: false, implicit: true, transition: false
2023-12-01T15:36:30+01:00       DEBUG   AccountWallet   faucet initiated with 1000000000000 tokens and 100000000 mana
2023-12-01T15:36:30+01:00       INFO    main    Run subcommand: create, with parametetr set: &{IMPLICIT false true true}
2023-12-01T15:36:30+01:00       DEBUG   AccountWallet   Creating an implicit account
Faucet request funds for Bech address: rms1yp2fvxltyrs7788y7g8wul5qtn59l54ass4z9cryh9pqf3z7xrr5xsf0zpu
2023-12-01T15:36:38+01:00       DEBUG   AccountWallet   RequestFaucetFunds received faucet funds for addr type: ImplicitAccountCreationAddress, 0x2054961beb20e1ef1ce4f20eee7e805ce85fd2bd842a22e064b94204c45e30c743
2023-12-01T15:36:38+01:00       DEBUG   AccountWallet   created implicit account output with outputID: 0x2a0fb3afac29ff4c07560f1d6419edeac05736fcb0637b0a35e3ca0bdfcd3b3c2c0000000000 accountAddress: rms1pp64dt55r5kwvx7fdkt5azuqg5kmvyvq8tdhncsvwfa0r8qmv3ul2qznrk3
2023-12-01T15:36:38+01:00       INFO    AccountWallet   Created account with addr: rms1pp64dt55r5kwvx7fdkt5azuqg5kmvyvq8tdhncsvwfa0r8qmv3ul2qznrk3, accID: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5 blk ID: 0x000000000000000000000000000000000000000000000000000000000000000000000000, txID: 0x2a0fb3afac29ff4c07560f1d6419edeac05736fcb0637b0a35e3ca0bdfcd3b3c2c000000 and creation output: 0x2a0fb3afac29ff4c07560f1d6419edeac05736fcb0637b0a35e3ca0bdfcd3b3c2c0000000000 awaiting the commitment.
2023-12-01T15:36:38+01:00       DEBUG   utils   Awaiting commitment for slot 50, latest committed slot: 44
2023-12-01T15:36:48+01:00       DEBUG   utils   Awaiting commitment for slot 50, latest committed slot: 45
2023-12-01T15:36:58+01:00       DEBUG   utils   Awaiting commitment for slot 50, latest committed slot: 46
2023-12-01T15:37:08+01:00       DEBUG   utils   Awaiting commitment for slot 50, latest committed slot: 47
2023-12-01T15:37:18+01:00       DEBUG   utils   Awaiting commitment for slot 50, latest committed slot: 48
2023-12-01T15:37:28+01:00       DEBUG   utils   Awaiting commitment for slot 50, latest committed slot: 49
2023-12-01T15:37:38+01:00       DEBUG   utils   Awaiting commitment for slot 50, latest committed slot: 50
2023-12-01T15:37:38+01:00       INFO    AccountWallet   Slot 50 is committed
2023-12-01T15:37:38+01:00       DEBUG   AccountWallet   Failed to get account from indexer, even after slot 50 is already committed
2023-12-01T15:37:38+01:00       DEBUG   AccountWallet   Node returned: outputID OutputID(0x2a0fb3afac29ff4c07560f1d6419edeac05736fcb0637b0a35e3ca0bdfcd3b3c2c0000000000:44), output BasicOutput
2023-12-01T15:37:38+01:00       INFO    AccountWallet   Account created, Bech addr: rms1pp64dt55r5kwvx7fdkt5azuqg5kmvyvq8tdhncsvwfa0r8qmv3ul2qznrk3, slot: 50
2023-12-01T15:37:38+01:00       DEBUG   AccountWallet   registering account 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5 with alias IMPLICIT
outputID: OutputID(0x2a0fb3afac29ff4c07560f1d6419edeac05736fcb0637b0a35e3ca0bdfcd3b3c2c0000000000:44) addr: 0x087556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5

2023-12-01T15:37:38+01:00       INFO    main    Created account 0x0000000000000000000000000000000000000000000000000000000000000000
2023-12-01T15:38:08+01:00       INFO    main    script spammer
2023-12-01T15:38:08+01:00       DEBUG   AccountWallet   faucet initiated with 1000000000000 tokens and 100000000 mana
2023-12-01T15:38:08+01:00       INFO    customSpam      Start spamming with rate: 1, time unit: 1s, and spamming type: blk.
2023-12-01T15:38:08+01:00       INFO    Spammer Start spamming transactions with 1 rate
2023-12-01T15:38:09+01:00       INFO    AccountWallet   Waiting for account IMPLICIT to be committed within slot 44...
2023-12-01T15:38:09+01:00       DEBUG   utils   Awaiting commitment for slot 44, latest committed slot: 53
BLock BlockID(0x5087625d7f962b237ff9d4a2dbb0427e5f5d240d68c595a6fe74af5dc9ffba163c000000:60) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:09+01:00       DEBUG   Spammer Issued block, blockID BlockID(0x5087625d7f962b237ff9d4a2dbb0427e5f5d240d68c595a6fe74af5dc9ffba163c000000:60), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0x6456c35f9d09ff4ed2fce75328e2da0bace34d67919b3b2b8963ef4c57683af23d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:10+01:00       DEBUG   Spammer Issued block, blockID BlockID(0x6456c35f9d09ff4ed2fce75328e2da0bace34d67919b3b2b8963ef4c57683af23d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0xe320347bbf1d5075f7a1b59ee1401e846e58a93f73c223b947db46c7267cb2b53d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:11+01:00       DEBUG   Spammer Issued block, blockID BlockID(0xe320347bbf1d5075f7a1b59ee1401e846e58a93f73c223b947db46c7267cb2b53d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0xa8aaa6e1aa030d9a9db16560ddc4c85cbc1670b48493b5424adb707e6ee9cc9f3d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:12+01:00       DEBUG   Spammer Issued block, blockID BlockID(0xa8aaa6e1aa030d9a9db16560ddc4c85cbc1670b48493b5424adb707e6ee9cc9f3d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0x0baab1b866a2b07bcd1193763a4a478f22081d4c304b9d38567db2acab0bbfb73d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:13+01:00       DEBUG   Spammer Issued block, blockID BlockID(0x0baab1b866a2b07bcd1193763a4a478f22081d4c304b9d38567db2acab0bbfb73d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0xbb324fb28126b501db2e8e04472ec5744e97122fad5799699d151fc28545223a3d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:14+01:00       DEBUG   Spammer Issued block, blockID BlockID(0xbb324fb28126b501db2e8e04472ec5744e97122fad5799699d151fc28545223a3d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0xe6a6a695ab89cf8eff81a33c561997cdf88579e42318ce0b27a275844abf58c53d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:15+01:00       DEBUG   Spammer Issued block, blockID BlockID(0xe6a6a695ab89cf8eff81a33c561997cdf88579e42318ce0b27a275844abf58c53d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0xb8516dd456f933724233fb09f5e7bedfb77c713e26bb3d64291fb4f0f89576a93d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:16+01:00       DEBUG   Spammer Issued block, blockID BlockID(0xb8516dd456f933724233fb09f5e7bedfb77c713e26bb3d64291fb4f0f89576a93d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
BLock BlockID(0xf2a276cb0823966b190ac93f4068a668cdedfb0547bc3526aa93c1f2be0c2e903d000000:61) issued with account: 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:17+01:00       DEBUG   Spammer Issued block, blockID BlockID(0xf2a276cb0823966b190ac93f4068a668cdedfb0547bc3526aa93c1f2be0c2e903d000000:61), issuer 0x7556ae941d2ce61bc96d974e8b80452db611803adb79e20c727af19c1b6479f5
2023-12-01T15:38:19+01:00       INFO    Spammer Maximum number of blocks sent, stopping spammer...
2023-12-01T15:38:19+01:00       INFO    Spammer No errors encountered
2023-12-01T15:38:19+01:00       INFO    Spammer Finishing spamming, total txns sent: 9, TotalTime: 11.018535983, Rate: 0.816805
2023-12-01T15:38:19+01:00       INFO    customSpam      Basic spamming finished!
 daria@daria-x1  ~/go/src/iotaledger/evil-tools   debug/accounts ±  

TODO: Next to check if we can spam again after a while, if account is blocked TODO: will congestion work for fresh account in this example?

daria305 commented 7 months ago

When we uncomment implicit transition, instead of spamming, the function is stuck on AwaitBlock with error reason that account is not found.

 daria@daria-x1  ~/go/src/iotaledger/evil-tools   debug/accounts ±  ./scripts/test_account_implicit.sh                                          
2023-12-01T15:48:11+01:00       INFO    main    script accounts
2023-12-01T15:48:11+01:00       INFO    main    Parsing create account flags, subcommands: [--alias IMPLICIT --implicit]
2023-12-01T15:48:11+01:00       INFO    main    Parsed flags: alias: IMPLICIT, BIF: false, implicit: true, transition: false
2023-12-01T15:48:11+01:00       DEBUG   AccountWallet   faucet initiated with 1000000000000 tokens and 100000000 mana
2023-12-01T15:48:11+01:00       INFO    main    Run subcommand: create, with parametetr set: &{IMPLICIT false true true}
2023-12-01T15:48:11+01:00       DEBUG   AccountWallet   Creating an implicit account
Faucet request funds for Bech address: rms1ypl6ey8hctsxedtrtqvq5daktyyd2u277pjnl8t0fsx26j8da2zr5n2zlpq
2023-12-01T15:48:18+01:00       DEBUG   AccountWallet   RequestFaucetFunds received faucet funds for addr type: ImplicitAccountCreationAddress, 0x207fac90f7c2e06cb56358180a37b65908d5715ef0653f9d6f4c0cad48edea843a
2023-12-01T15:48:18+01:00       DEBUG   AccountWallet   created implicit account output with outputID: 0x963a1d6b320979eac14b341ef78a03a516f02bc106c1d54ce2c2f505d18e9862720000000000 accountAddress: rms1pqj7vhjd6wg0lae4s7vc3532yygpqls6ndl0x3x9s0ynnvqaqs74ynvj5uu
2023-12-01T15:48:18+01:00       INFO    AccountWallet   Created account with addr: rms1pqj7vhjd6wg0lae4s7vc3532yygpqls6ndl0x3x9s0ynnvqaqs74ynvj5uu, accID: 0x25e65e4dd390fff735879988d22a2110107e1a9b7ef344c583c939b01d043d52 blk ID: 0x000000000000000000000000000000000000000000000000000000000000000000000000, txID: 0x963a1d6b320979eac14b341ef78a03a516f02bc106c1d54ce2c2f505d18e986272000000 and creation output: 0x963a1d6b320979eac14b341ef78a03a516f02bc106c1d54ce2c2f505d18e9862720000000000 awaiting the commitment.

2023-12-01T15:49:18+01:00       INFO    AccountWallet   Slot 120 is committed
2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   Failed to get account from indexer, even after slot 120 is already committed
2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   Node returned: outputID OutputID(0x963a1d6b320979eac14b341ef78a03a516f02bc106c1d54ce2c2f505d18e9862720000000000:114), output BasicOutput
2023-12-01T15:49:18+01:00       INFO    AccountWallet   Account created, Bech addr: rms1pqj7vhjd6wg0lae4s7vc3532yygpqls6ndl0x3x9s0ynnvqaqs74ynvj5uu, slot: 120
2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   registering account 0x25e65e4dd390fff735879988d22a2110107e1a9b7ef344c583c939b01d043d52 with alias IMPLICIT
outputID: OutputID(0x963a1d6b320979eac14b341ef78a03a516f02bc106c1d54ce2c2f505d18e9862720000000000:114) addr: 0x0825e65e4dd390fff735879988d22a2110107e1a9b7ef344c583c939b01d043d52

2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   Transitioning implicit account with implicitAccountID 0x25e65e4dd390fff735879988d22a2110107e1a9b7ef344c583c939b01d043d52 for alias IMPLICIT to regular account
2023-12-01T15:49:18+01:00       INFO    AccountWallet   Address generated for account: 0x00ae6a6ceb2fafaf88d7c23d6be439ef5422093bea4a65f70ea00e903e349e21b8
2023-12-01T15:49:18+01:00       INFO    AccountWallet   Created account 0x25e65e4dd390fff735879988d22a2110107e1a9b7ef344c583c939b01d043d52 with 1000000000000 tokens

2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   Available mana results:
Total: 199179619 Unbound: 199179619
Potential:99179619 Unbound: 99179619
Stored: 100000000 Undound: 100000000
2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   Min required allotted mana: 5281000
2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   Transition transaction created:
        Signed Transaction ID: 0x3f2bfc0c57c9b90dab48955f8849f9ad6bd7819269513ec49f9279cce74cc5577f000000, txID: 0x505fa53cf29a8fd00b3c4c5e984fa41ccf368b75d8d0b726aff2068502608cf17f000000, slotCreation: 127
        Input index: 0, type: UTXOInput
        Context input: unknown input type: 1
        Context input: unknown input type: 2
        Output index: 0, base token: 1000000000000, stored mana: 0, type: AccountOutput
        Allotments:
        AllotmentID: 0x6aee704f25558e8aa7630fed0121da53074188abc423b3c5810f80be4936eb6e, value: 199179619

BLock BlockID(0x82e28a0c3d9e4b8e62e03cd0f4bb427923568def239ca911cb3c55adce53cd4a7f000000:127) issued with account: 0x25e65e4dd390fff735879988d22a2110107e1a9b7ef344c583c939b01d043d52
2023-12-01T15:49:18+01:00       DEBUG   AccountWallet   Block sent with ID: 0x82e28a0c3d9e4b8e62e03cd0f4bb427923568def239ca911cb3c55adce53cd4a7f000000, and no error
2023-12-01T15:49:18+01:00       DEBUG   utils   Block 0x82e28a0c3d9e4b8e62e03cd0f4bb427923568def239ca911cb3c55adce53cd4a7f000000 issuance failure, block failure reason: 5, tx failure reason: 0
...

And if we use genesis account to issue transition transaction, we get failure reason 15, which means account not found.