metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

[Bug]: Program log: panicked at 'attempt to subtract with overflow': Transaction simulation failed #2131

Closed iamsk closed 2 years ago

iamsk commented 2 years ago

Which package is this bug report for?

candy machine cli

Issue description

just follow the lesson: https://buildspace.so/p/ship-solana-nft-collection/lessons/LE6560a067-18fa-4510-af54-9a041599776a

Command

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e devnet -k ~/.config/solana/devnet.json -cp config.json ./assets

Relevant log output

wallet public key: 4mrkhVRFjnL4oHLEipbPp8D2eRWRNrkqKujwvK7PTjrz
(node:5405) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
WARNING: The "arweave" storage option will be going away soon. Please migrate to arweave-bundle or arweave-sol for mainnet.

Beginning the upload for 3 (img+json) pairs
started at: 1652873328881
initializing candy machine
Transaction simulation failed: Error processing Instruction 1: Program failed to complete 
    Program 11111111111111111111111111111111 invoke [1]
    Program 11111111111111111111111111111111 success
    Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ invoke [1]
    Program log: Instruction: InitializeCandyMachine
    Program log: panicked at 'attempt to subtract with overflow', src/lib.rs:812:39
    Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ consumed 11522 of 1400000 compute units
    Program failed to complete: BPF program panicked
    Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ failed: Program failed to complete
Translating error SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: Program failed to complete
    at Connection.sendEncodedTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3964:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Connection.sendRawTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3921:20)
    at async sendAndConfirmRawTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/util/send-and-confirm-raw-transaction.ts:27:21)
    at async Provider.send (/home/codespace/metaplex/js/node_modules/@project-serum/anchor/src/provider.ts:114:18)
    at async Object.rpc [as initializeCandyMachine] (/home/codespace/metaplex/js/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:19:23)
    at async createCandyMachineV2 (/home/codespace/metaplex/js/packages/cli/src/helpers/accounts.ts:156:11)
    at async uploadV2 (/home/codespace/metaplex/js/packages/cli/src/commands/upload.ts:148:19)
    at async Command.<anonymous> (/home/codespace/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:269:7) {
  logs: [
    'Program 11111111111111111111111111111111 invoke [1]',
    'Program 11111111111111111111111111111111 success',
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ invoke [1]',
    'Program log: Instruction: InitializeCandyMachine',
    "Program log: panicked at 'attempt to subtract with overflow', src/lib.rs:812:39",
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ consumed 11522 of 1400000 compute units',
    'Program failed to complete: BPF program panicked',
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ failed: Program failed to complete'
  ]
}
Error deploying config to Solana network. SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: Program failed to complete
    at Connection.sendEncodedTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3964:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Connection.sendRawTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3921:20)
    at async sendAndConfirmRawTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/util/send-and-confirm-raw-transaction.ts:27:21)
    at async Provider.send (/home/codespace/metaplex/js/node_modules/@project-serum/anchor/src/provider.ts:114:18)
    at async Object.rpc [as initializeCandyMachine] (/home/codespace/metaplex/js/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:19:23)
    at async createCandyMachineV2 (/home/codespace/metaplex/js/packages/cli/src/helpers/accounts.ts:156:11)
    at async uploadV2 (/home/codespace/metaplex/js/packages/cli/src/commands/upload.ts:148:19)
    at async Command.<anonymous> (/home/codespace/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:269:7) {
  logs: [
    'Program 11111111111111111111111111111111 invoke [1]',
    'Program 11111111111111111111111111111111 success',
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ invoke [1]',
    'Program log: Instruction: InitializeCandyMachine',
    "Program log: panicked at 'attempt to subtract with overflow', src/lib.rs:812:39",
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ consumed 11522 of 1400000 compute units',
    'Program failed to complete: BPF program panicked',
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ failed: Program failed to complete'
  ]
}
upload was not successful, please re-run. SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: Program failed to complete
    at Connection.sendEncodedTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3964:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Connection.sendRawTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3921:20)
    at async sendAndConfirmRawTransaction (/home/codespace/metaplex/js/node_modules/@solana/web3.js/src/util/send-and-confirm-raw-transaction.ts:27:21)
    at async Provider.send (/home/codespace/metaplex/js/node_modules/@project-serum/anchor/src/provider.ts:114:18)
    at async Object.rpc [as initializeCandyMachine] (/home/codespace/metaplex/js/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:19:23)
    at async createCandyMachineV2 (/home/codespace/metaplex/js/packages/cli/src/helpers/accounts.ts:156:11)
    at async uploadV2 (/home/codespace/metaplex/js/packages/cli/src/commands/upload.ts:148:19)
    at async Command.<anonymous> (/home/codespace/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:269:7) {
  logs: [
    'Program 11111111111111111111111111111111 invoke [1]',
    'Program 11111111111111111111111111111111 success',
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ invoke [1]',
    'Program log: Instruction: InitializeCandyMachine',
    "Program log: panicked at 'attempt to subtract with overflow', src/lib.rs:812:39",
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ consumed 11522 of 1400000 compute units',
    'Program failed to complete: BPF program panicked',
    'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ failed: Program failed to complete'
  ]
}

Operating system

Ubuntu 20.04.4 LTS

Priority this issue should have

High (immediate attention needed)

Check the Docs First

drunckj commented 2 years ago

Faced the two days ago, it can be fixed easily by checking field limits from js/packages/cli/src/helpers/constants.ts. Just make sure you don't exceed the limits mentioned inside the file.

iamsk commented 2 years ago

Faced the two days ago, it can be fixed easily by checking field limits from js/packages/cli/src/helpers/constants.ts. Just make sure you don't exceed the limits mentioned inside the file.

Fixed, thanks, as the length of default {"symbol": "SYMBOL_OF_NFT"} is already greater than 10.