Easy to understand

[SOLANA] Debug Notes 본문

카테고리 없음

[SOLANA] Debug Notes

Homo knowledgian 2024. 7. 25. 16:35
728x90
반응형

배경설명)

- devnet에서 SPL-token minting을 진행했고, 2022 Program이 아닌 과거 버전을 사용 개발을 진행했다.

- devnet에서 개발은 정상적으로 완료되었지만, mainnet-beta에서 token minting을 진행하던 중

- >> clusterApiUrl을 활용해 endpoint를 사용하니, 아래와 같이 서버응답 error를 확인했다.

Server responded with 429 Too Many Requests.  Retrying after 500ms delay...
Server respnded with 429 Too Many Requests.  Retrying after 1000ms delay...
Server responded with 429 Too Many Requests.  Retrying after 2000ms delay...
Server responded with 429 Too Many Requests.  Retrying after 4000ms delay...
Error: 429 Too Many Requests:  {"jsonrpc":"2.0","error":{"code": 429, "message":"Too many requests for a specific RPC call, contact your app developer or support@rpcpool.com."}, "id": "0d4cc645-edbb-4aac-97d4-fcc92105703e" } 

    at ClientBrowser.callServer (/Users/{PATH}/node_modules/@solana/web3.js/src/connection.ts:1698:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

- >> 당시 사용한 공용 node-endpoint 구성에 다양한 requests들이 발생하고 있다고 판단했다.

const connection = new Connection(clusterApiUrl("mainnet-beta"), "confirmed");

- >> Alchemy를 통해, 생성한 SOLANA mainnet-beta node를 사용해보기로 했다.

const connection = new Connection("https://solana-mainnet.g.alchemy.com/v2/{API_KEY}");

 

- >> node-endpoint 구성을 위와 같이 변경한 후, 다시 작업을 진행했지만 'createMint'를 통해 Mint Account를 생성하는 transaction은 성공했지만, Token Account를 생성하는 'createAccount' 호출(invoke)는 실패했다.

-- >> Mint Account : Token Program으로 만들어진 주소로, token을 식별하는데 쓰이고 아래와 같은 data를 저장한다.

-- -- >> Supply : 총 발행량

-- -- >> Decimals : token decimal

-- -- >> Mint authority : 새로운 token 발행 권한을 가지는 account로, 추가 발행시 총 발행량은 증가한다.

-- -- >> Freeze authority : 전송 제한(동결)에 대한 권한을 가지는 account이다.

Mint Account

-- >> Token Account : Token의 individual ownership을 tracking하기 위해 생성된 Account로 아래와 같은 데이터를 저장한다.

-- -- >> Mint : token의 단위로, symbol과 token name을 말하는 거 같다.

-- -- >> Owner : token transfer에 대한 권한을 가진 소유자(보통 payer)

-- -- >> Amount : 현재 보유한 수량 (Owner가 보유한 수량으로 판단됨)

Token Account

 

 

 

Token Program으로 만들어진 주소로, token을 식별하는데 쓰이고 아래와 같은 data를 저장한다.

-- -- >> Supply : 총 발행량

-- -- >> Decimals : token decimal

-- -- >> Mint authority : 새로운 token 발행 권한을 가지는 account로, 추가 발행시 총 발행량은 증가한다.

-- -- >> Freeze authority : 전송 제한(동결)에 대한 권한을 가지는 account이다.

TransactionExpiredBlockheightExceededError: Signature 3c3jYMsRfWsf29jwDqacnRRswyi9hwDwbzkesjxkmwx1yMY1N1dxG52UvvuwbJrZCjmyESyCS7cijRGxWRvytnt8 has expired: block height exceeded.
    at Connection.confirmTransactionUsingBlockHeightExceedanceStrategy (/Users/{PATH}/node_modules/@solana/web3.js/src/connection.ts:4059:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Connection.confirmTransaction (/Users/{PATH}/node_modules/@solana/web3.js/src/connection.ts:3870:14)
    at sendAndConfirmTransaction (/Users/{PATH}/node_modules/@solana/web3.js/src/utils/send-and-confirm-transaction.ts:48:7) {
  signature: '3c3jYMsRfWsf29jwDqacnRRswyi9hwDwbzkesjxkmwx1yMY1N1dxG52UvvuwbJrZCjmyESyCS7cijRGxWRvytnt8'
}

 

 

- 원인을 찾진 못하고, 문서를 둘러보던 중 Token Program 2022 내용을 확인했고 다시 devnet 환경에서 개발을 이어나갔다.

- >> devnet에서 Token program 2022로 SPL-token 발행을 완료한 후, mainnet-beta에서 다시 발행을 진행했다.

- >> node-endpoint 구성은 아래와 같이 했다.

const connection = new Connection(clusterApiUrl("mainnet-beta"), "confirmed");

 

- >> 이번엔 아래와 같은 에러가 발생했다.

/Users/{PATH}/node_modules/@solana/web3.js/src/connection.ts:6043
      throw new SendTransactionError({
            ^


SendTransactionError: Simulation failed. 
Message: Transaction simulation failed: Blockhash not found. 
Logs: 
[]. 
Catch the `SendTransactionError` and call `getLogs()` on it for full details.
    at Connection.sendEncodedTransaction (/Users/{PATH}/node_modules/@solana/web3.js/src/connection.ts:6043:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Connection.sendRawTransaction (/Users/{PATH}/node_modules/@solana/web3.js/src/connection.ts:5999:20)
    at Connection.sendTransaction (/Users/{PATH}/node_modules/@solana/web3.js/src/connection.ts:5987:12)
    at sendAndConfirmTransaction (/Users/{PATH}/node_modules/@solana/web3.js/src/utils/send-and-confirm-transaction.ts:36:21) {
  signature: '',
  transactionMessage: 'Transaction simulation failed: Blockhash not found',
  transactionLogs: []
}

- >> https://solana.stackexchange.com/questions/295/transaction-simulation-failed-blockhash-not-found

-- >> RPC node의 commitment level을 "confirmed"에서 "finalized"로 다시 시도한 후 token minting을 성공할 수 있었다.

const connection = new Connection(clusterApiUrl("mainnet-beta"), "finalized");

 

 

- token 전송에 대한 이슈가 있었는데, 오류 메시지는 아래와 같았다.

/workspaces/solana-api-basic/node_modules/@solana/web3.js/src/connection.ts:6043
      throw new SendTransactionError({
            ^

Error: Simulation failed. 
Message: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1. 
Logs: 
[
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
  "Program log: Instruction: Transfer",
  "Program log: Error: insufficient funds",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4299 of 200000 compute units",
  "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0x1"
]. 
Catch the `SendTransactionError` and call `getLogs()` on it for full details.
    at Connection.sendEncodedTransaction (/workspaces/solana-api-basic/node_modules/@solana/web3.js/src/connection.ts:6043:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Connection.sendRawTransaction (/workspaces/solana-api-basic/node_modules/@solana/web3.js/src/connection.ts:5999:20)
    at Connection.sendTransaction (/workspaces/solana-api-basic/node_modules/@solana/web3.js/src/connection.ts:5987:12)
    at sendAndConfirmTransaction (/workspaces/solana-api-basic/node_modules/@solana/web3.js/src/utils/send-and-confirm-transaction.ts:36:21) {
  signature: '',
  transactionMessage: 'Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1',
  transactionLogs: [
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
    'Program log: Instruction: Transfer',
    'Program log: Error: insufficient funds',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4299 of 200000 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0x1'
  ]
}

- insufficient funds인데, "createTransferInstruction"에서 source param을 token account로 설정해야 했었다.

 

 

 

 


 

 

 

 


 

반응형
Comments