Xử lý sự cố¶
Lỗi plugin¶
Các lỗi bắt đầu với `` GHC Core to PLC plugin ‘’ là lỗi từ `` plutus-tx-plugin ‘’.
Haddock¶
Plugin thường sẽ bị lỗi khi tạo tài liệu Haddock. Tuy nhiên, trong trường hợp này, bạn có thể chỉ cần yêu cầu nó trì hoãn bất kỳ lỗi nào đối với thời gian chạy (điều này sẽ không bao giờ xảy ra vì bạn đang xây dựng tài liệu).
Một cách dễ dàng để làm điều này là thêm các dòng sau cho package-name thành cabal.project:
package package-name
haddock-options: "--optghc=-fplugin-opt PlutusTx.Plugin:defer-errors"
Các hàm không phải ``INLINABLE ‘’¶
Một lỗi phổ biến là:
Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function
Điều này có nghĩa là plugin không có quyền truy cập vào việc triển khai chức năng, mà nó cần để có thể biên dịch chức năng thành Plutus Core. Một số điều bạn có thể làm để khắc phục:
Đảm bảo thêm
{-# INLINABLE functionname #-}vào hàm của bạn.Nếu có thểm
$c``phía trước tên hàm bị lỗi, GHC đã tạo một phiên bản chuyên biệt cho hàm của bạn, điều này ngăn không cho plugin truy cập vào nó . Bạn có thể tắt với ``{-# OPTIONS_GHC -fno-specialise #-}Các tùy chọn trình biên dịch khác có thể giúp:
{-# OPTIONS_GHC -fno-strictness #-}{-# OPTIONS_GHC -fno-ignore-interface-pragmas #-}{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}{-# OPTIONS_GHC -fobject-code #-}
Một số chi tiết khác có trong the plutus-tx readme.
Sự cố máy chủ ngôn ngữ Haskell¶
Để được tư vấn thêm về cách sử dụng Máy chủ ngôn ngữ Haskell (HLS), hãy tham khảo CONTRIBUTING guide in the plutus repository.
Sai version¶
ghcide compiled against GHC 8.10.3 but currently using 8.10.2.20201118
Trình chỉnh sửa của bạn không chọn đúng phiên bản của Máy chủ Ngôn ngữ Haskell (HLS). Plutus cần một phiên bản tùy chỉnh của HLS do Nix cung cấp. Vì vậy, làm cho điều này hoạt động trong trình chỉnh sửa của bạn, hãy đảm bảo thực hiện hai điều sau:
Khởi động trình soạn thảo của bạn từ `` nix-shell ‘’ (hoặc sử dụng `` direnv ‘’)
- Hầu hết các trình soạn thảo được định cấu hình để sử dụng `` haskell-language-server-wrapper ‘’, là một trình bao bọc chọn phiên bản HLS phù hợp.
Thay đổi điều này thành chỉ `` haskell-language-server ‘’.
Nếu cách này không hiệu quả, hãy chạy `` haskell-language-server ‘’ trong nix-shell và sử dụng đường dẫn tuyệt đối này trong cấu hình trình soạn thảo của bạn.
Mã lỗi¶
Để giảm kích thước mã, lỗi trên chuỗi chỉ xuất mã. Đây là ý nghĩa của chúng:
Ledger errors
L0: Input constraintL1: Output constraintL2: Missing datumL3: Wrong validation intervalL4: Missing signatureL5: Spent value not OKL6: Produced value not OKL7: Public key output not spentL8: Script output not spentL9: Value minted not OKLa: MustPayToPubKeyLb: MustPayToOtherScriptLc: MustHashDatumLd: checkScriptContext failedLe: Can't find any continuing outputsLf: Can't get any continuing outputsLg: Can't get validator and datum hashesLh: Can't get currency symbol of the current validator scriptLi: DecodingError
Prelude errors
PT1: TH Generation of Indexed Data ErrorPT2: Void is not supportedPT3: Ratio number can't have a zero denominatorPT4: 'round' got an incorrect inputPT5: 'check' input is 'False'PT6: PlutusTx.List.!!: negative indexPT7: PlutusTx.List.!!: index too largePT8: PlutusTx.List.head: empty listPT9: PlutusTx.List.tail: empty listPT10: PlutusTx.Enum.().succ: bad argumentPT11: PlutusTx.Enum.().pred: bad argumentPT12: PlutusTx.Enum.().toEnum: bad argumentPT13: PlutusTx.Enum.Bool.succ: bad argumentPT14: PlutusTx.Enum.Bool.pred: bad argumentPT15: PlutusTx.Enum.Bool.toEnum: bad argumentPT16: PlutusTx.Enum.Ordering.succ: bad argumentPT17: PlutusTx.Enum.Ordering.pred: bad argumentPT18: PlutusTx.Enum.Ordering.toEnum: bad argument
State machine errors
S0: Can't find validation inputS1: State transition invalid - checks failedS2: Thread token not foundS3: Non-zero value allocated in final stateS4: State transition invalid - constraints not satisfied by ScriptContextS5: State transition invalid - constraints not satisfied by ScriptContextS6: State transition invalid - input is not a valid transition at the current stateS7: Value minted different from expectedS8: Pending transaction does not spend the designated transaction output
Currency errors
C0: Value minted different from expectedC1: Pending transaction does not spend the designated transaction output