Nhảy đến nội dung chính

Giới thiệu

did you know?

The NEAR Platform overview clarifies much of the language in this section.

Vòng đời của một transaction:

  • A client creates a transaction, computes the transaction hash and signs this hash to get a signed transaction. Now this signed transaction can be sent to a node.
  • The RPC interface receives the transaction and routes it to the correct physical node using signer_id. Since the signer_id must be a NEAR Account ID which lives on a single shard, the account is mapped to a shard which is followed by at least one validator running at least one machine with an IP address.
  • When a node receives a new signed transaction, it validates the transaction for signer, receiver, account balance, cost overflow, signature, etc. (see here) and gossips it to all peers following the same shard. If a transaction has an invalid signature or would be invalid on the latest state, it is rejected quickly and returns an error to the original RPC call.
  • Valid transactions are added to the transaction pool (every validating node has its own independent copy of a transaction pool). The transaction pool maintains transactions that are not yet discarded and not yet included into the chain.
  • A pool iterator is used to pick transactions from the pool one at a time, ordered from the smallest nonce to largest, until the pool is drained or some chunk limit is reached (max number of transactions per chunk or max gas burnt per chunk to process transactions). Please refer to articles on the pool iterator and gas for more details.
  • Để phù hợp với bản chất phân tán của một sharded blockchain, tất cả các transaction được trả về lần lượt cho một phân đoạn transaction pool có 3 lớp riêng biệt: các transaction được chấp nhận (sẽ được xử lý trên chunk tiếp theo), các transaction đang chờ xử lý (đã vượt quá các giới hạn của chunk hiện tại và sẽ được thêm vào chu trình xử lý sau) và các transaction không hợp lệ (sẽ bị từ chối tại thời điểm khả dụng tiếp theo).
  • Before producing a chunk, transactions are ordered and validated again. This is done to produce chunks with only valid transactions across a distributed system.
  • Trong khi một transaction đang được xử lý trên một chunk, bất kì lỗi nào phát sinh từ các action của ứng dụng cũng được trả về thông qua RPC.

Các lỗi của nền tảng NEAR

Các lỗi do nền tảng NEAR đưa ra được thực hiện ở các file sau trong nearcore:

Trang này bao gồm:

  • RuntimeError và các subtype: các lỗi phát sinh khi một transaction được node đích nhận được đầu tiên và một lần nữa, trước khi nó được xử lý và áp dụng cho một chunk
  • TxExecutionError và các subtype: các lỗi phát sinh khi một transaction và (các) component action của nó đang được xác nhận và áp dụng cho một chunk
  • VMerror and và các subtype: các lỗi phát sinh trong quá trình thực thi Wasm contract bởi NEAR VM

RuntimeError và các subtype

RuntimeError                                              Error returned from `Runtime::apply  
StorageError Unexpected error which is typically related to the node storage corruption.account
BalanceMismatchError An error happens if `check_balance` fails, which is likely an indication of an invalid state
InvalidTxError An error happened during TX verification and account charging
InvalidAccessKeyError Describes the error for validating access key
ActionsValidationError Describes the error for validating a list of actions
TotalPrepaidGasExceeded The total prepaid gas (for all given actions) exceeded the limit.
TotalNumberOfActionsExceeded The number of actions exceeded the given limit.
AddKeyMethodNamesNumberOfBytesExceeded The total number of bytes of the method names exceeded the limit in a Add Key action.
AddKeyMethodNameLengthExceeded The length of some method name exceeded the limit in a Add Key action.
IntegerOverflow Integer overflow during a compute.
InvalidAccountId Invalid account ID.
ContractSizeExceeded The size of the contract code exceeded the limit in a DeployContract action.
FunctionCallMethodNameLengthExceeded The length of the method name exceeded the limit in a Function Call action.
FunctionCallArgumentsLengthExceeded The length of the arguments exceeded the limit in a Function Call action.

TxExecutionError và các subtype

TxExecutionError                                          Error returned in the ExecutionOutcome in case of failure
InvalidTxError An error happened during Transaction execution
InvalidAccessKeyError Describes the error for validating access key
ActionsValidationError Describes the error for validating a list of actions
TotalPrepaidGasExceeded The total prepaid gas (for all given actions) exceeded the limit.
TotalNumberOfActionsExceeded The number of actions exceeded the given limit.
AddKeyMethodNamesNumberOfBytesExceeded The total number of bytes of the method names exceeded the limit in a Add Key action.
AddKeyMethodNameLengthExceeded The length of some method name exceeded the limit in a Add Key action.
IntegerOverflow Integer overflow during a compute.
InvalidAccountId Invalid account ID.
ContractSizeExceeded The size of the contract code exceeded the limit in a DeployContract action.
FunctionCallMethodNameLengthExceeded The length of the method name exceeded the limit in a Function Call action.
FunctionCallArgumentsLengthExceeded The length of the arguments exceeded the limit in a Function Call action.
ActionError An error happened during Acton execution
ActionErrorKind The kind of ActionError happened
RuntimeCallError
ReceiptValidationError Describes the error for validating a receipt
ActionsValidationError Describes the error for validating a list of actions
TotalPrepaidGasExceeded The total prepaid gas (for all given actions) exceeded the limit.
TotalNumberOfActionsExceeded The number of actions exceeded the given limit.
AddKeyMethodNamesNumberOfBytesExceeded The total number of bytes of the method names exceeded the limit in a Add Key action.
AddKeyMethodNameLengthExceeded The length of some method name exceeded the limit in a Add Key action.
IntegerOverflow Integer overflow during a compute.
InvalidAccountId Invalid account ID.
ContractSizeExceeded The size of the contract code exceeded the limit in a DeployContract action.
FunctionCallMethodNameLengthExceeded The length of the method name exceeded the limit in a Function Call action.
FunctionCallArgumentsLengthExceeded The length of the arguments exceeded the limit in a Function Call action.

VMerror và các subtype

VMerror                                                   An error that occurs in the NEAR virtual machine
ExternalError Serialized external error from External trait implementation
InconsistentStateError An error that is caused by an operation on an inconsistent state (ie. an integer overflow by using a value from the given context
IntegerOverflow Math operation with a value from the state resulted in a integer overflow
FunctionCallError
LinkError
WasmTrap
MethodResolveError
MethodEmptyName
MethodUTF8Error
MethodNotFound
MethodInvalidSignature
HostError
BadUTF16 String encoding is bad UTF-16 sequence
BadUTF8 String encoding is bad UTF-8 sequence
GasExceeded Exceeded the prepaid ga
GasLimitExceeded Exceeded the maximum amount of gas allowed to burn per contract
BalanceExceeded Exceeded the account balance
EmptyMethodName Tried to call an empty method nam
GuestPanic Smart contract panicked
IntegerOverflow IntegerOverflow happened during a contract execution
InvalidPromiseIndex `promise_idx` does not correspond to existing promises
CannotAppendActionToJointPromise Actions can only be appended to non-joint promise.
CannotReturnJointPromise Returning joint promise is currently prohibited
InvalidPromiseResultIndex Accessed invalid promise result index
InvalidRegisterId Accessed invalid register id
IteratorWasInvalidated Iterator `iterator_index` was invalidated after its creation by performing a mutable operation on trie
MemoryAccessViolation Accessed memory outside the bounds
InvalidReceiptIndex VM Logic returned an invalid receipt index
InvalidIteratorIndex Iterator index `iterator_index` does not exist
InvalidAccountId VM Logic returned an invalid account id
InvalidMethodName VM Logic returned an invalid method name
InvalidPublicKey VM Logic provided an invalid public key
ProhibitedInView `method_name` is not allowed in view calls
NumberOfLogsExceeded The total number of logs will exceed the limit.
KeyLengthExceeded The storage key length exceeded the limit.
ValueLengthExceeded The storage value length exceeded the limit.
TotalLogLengthExceeded The total log length exceeded the limit.
NumberPromisesExceeded The maximum number of promises within a FunctionCall exceeded the limit.
NumberInputDataDependenciesExceeded The maximum number of input data dependencies exceeded the limit.
ReturnedValueLengthExceeded The returned value length exceeded the limit.
ContractSizeExceeded The contract size for DeployContract action exceeded the limit.
CompilationError
CodeDoesNotExist
WasmerCompileError
PrepareError Error that can occur while preparing or executing Wasm smart-contract
Serialization Error happened while serializing the module
Deserialization Error happened while deserializing the module
InternalMemoryDeclared Internal memory declaration has been found in the module
GasInstrumentation Gas instrumentation failed. This most likely indicates the module isn't valid
StackHeightInstrumentation Stack instrumentation failed. This most likely indicates the module isn't valid
Instantiate Error happened during instantiation. This might indicate that `start` function trapped, or module isn't instantiable and/or unlinkable
Memory Error creating memory