Skip to content

Commit

Permalink
remove unused codes
Browse files Browse the repository at this point in the history
  • Loading branch information
bylingo committed Jul 24, 2023
1 parent 1be2790 commit df26def
Showing 1 changed file with 1 addition and 76 deletions.
77 changes: 1 addition & 76 deletions app/rpc/namespaces/eth/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,47 +142,10 @@ func TransformDataError(err error, method string) error {
data: RPCNullData,
}
}
//m, retErr := preProcessError(realErr, err.Error())
return preProcessError(realErr, err.Error())
//if retErr != nil {
// return realErr
//}
////if there have multi error type of EVM, this need a reactor mode to process error
//revert, f := m[vm.ErrExecutionReverted.Error()]
//if !f {
// revert = RPCUnknowErr
//}
//data, f := m[types.ErrorHexData]
//if !f {
// data = RPCNullData
//}
//switch method {
//case RPCEthEstimateGas:
// return DataError{
// code: VMExecuteExceptionInEstimate,
// Msg: revert,
// data: data,
// }
//case RPCEthCall:
// return DataError{
// code: VMExecuteException,
// Msg: revert,
// data: newDataError(revert, data),
// }
//default:
// return DataError{
// code: DefaultEVMErrorCode,
// Msg: revert,
// data: newDataError(revert, data),
// }
//}
}

//Preprocess error string, the string of realErr.Log is most like:
//`["execution reverted","message","HexData","0x00000000000"];some failed information`
//we need marshalled json slice from realErr.Log and using segment tag `[` and `]` to cut it

// realErrs are all cosmosError, which is formatted from wrappedError. Msgs are concatenated with ':' between each of them
// realErr is a cosmosError, which is formatted from wrappedError. Msgs are concatenated with ':' between each of them
// Main cause always appears in the first place, thus this function only get the first part of the error out of realErr.
func preProcessError(realErr *cosmosError, origErrorMsg string) error {
lastSeg := strings.IndexAny(realErr.Log, ":")
Expand All @@ -201,46 +164,8 @@ func preProcessError(realErr *cosmosError, origErrorMsg string) error {
Msg: errorSeg,
data: RPCNullData,
}
//var logs []string
//lastSeg := strings.LastIndexAny(realErr.Log, "]")
//if lastSeg < 0 {
// return nil, DataError{
// code: DefaultEVMErrorCode,
// Msg: origErrorMsg,
// data: RPCNullData,
// }
//}
//marshaler := realErr.Log[0 : lastSeg+1]
//e := json.Unmarshal([]byte(marshaler), &logs)
//if e != nil {
// return nil, DataError{
// code: DefaultEVMErrorCode,
// Msg: origErrorMsg,
// data: RPCNullData,
// }
//}
//m := genericStringMap(logs)
//if m == nil {
// return nil, DataError{
// code: DefaultEVMErrorCode,
// Msg: origErrorMsg,
// data: RPCNullData,
// }
//}
//return m, nil
}

//func genericStringMap(s []string) map[string]string {
// var ret = make(map[string]string)
// if len(s)%2 != 0 {
// return nil
// }
// for i := 0; i < len(s); i += 2 {
// ret[s[i]] = s[i+1]
// }
// return ret
//}

func CheckError(txRes sdk.TxResponse) (common.Hash, error) {
switch txRes.Code {
case sdkerror.ErrTxInMempoolCache.ABCICode():
Expand Down

0 comments on commit df26def

Please sign in to comment.