Open dragon0170 opened 5 years ago
1Q 에 추가할 필요가 있을까요?
현재 MasterApplication에서 return하는 에러는 아래와 같이 3가지가 존재하네요.
const (
CodeTypeOK uint16 = 0
CodeTypeJsonFormatError uint16 = 1
CodeTypeFieldNilError uint16 = 2
CodeTypeFieldInternalDBError uint16 = 3
)
tendermint에서 uint32를 사용한 이유가 있을까요? uint16으로도 충분할 것 같은데..
@kwjooo tendermint 정책상 Response의 Code를 uint32로 통일한 것 같아요.
MasterApplicadtion의 CheckTx, DelieverTx, Query 함수에서 return하는 response에는 Code라는 field가 존재합니다. 이는 해당 함수의 실행 결과에 대해 쉽고 간단하게 체크할 수 있는 field입니다.
현재 MasterApplication에서는 아래의 tendermint abci example에서 사용하는 code를 그대로 가져와서 response를 생성할 때 사용하고 있습니다. 동작상에 문제는 없으나 paust-db에 적절한 CodeType을 paust-db/consts 패키지에 정의하여서 사용하는 것이 좋을 것 같습니다.
// Return codes for the examples const ( CodeTypeOK uint32 = 0 CodeTypeEncodingError uint32 = 1 CodeTypeBadNonce uint32 = 2 CodeTypeUnauthorized uint32 = 3 CodeTypeUnknownError uint32 = 4 )