alpha-wallet-ios icon indicating copy to clipboard operation
alpha-wallet-ios copied to clipboard

cast data issue

Open oa-s opened this issue 2 years ago • 3 comments

crash appears in function AssetAttributeMethodCall, was several times on simulator only

func response(from resultObject: Any) throws -> AssetInternalValue {
        guard let dictionary = resultObject as? [String: AnyObject] else { <--- crashes here `swift_dynamicCast`
            throw CastError(actualValue: resultObject, expectedType: [String: AnyObject].self)
        }

        if let value = dictionary["0"] {
            return CallForAssetAttributeProvider.functional.mapValue(of: functionCall.output, for: value)
        } else {
            if case SolidityType.void = functionCall.output.type {
                return .bool(false)
            } else {
                throw Web3Error(description: "nil result from calling: \(function.name)() on contract: \(functionCall.contract.eip55String)")
            }
        }
    }

https://console.firebase.google.com/u/0/project/alphawallet-ios-prod/crashlytics/app/ios:com.stormbird.alphawallet/issues/2667f4bf9b6d3a0f2892c21ebf84ee4c?time=last-seven-days&versions=3.62%20(475)&sessionEventKey=b42e2e5aaea14f1183ff10417e5af771_1784330522929874011

oa-s avatar Mar 03 '23 07:03 oa-s

reproduced when for me when send rpc call

▿ contract: 0x90ee3Cf59FcDe2FE11838b9075Ea4681462362F1, name: name, parameters: [] ▿ functionCall : AssetFunctionCall - server : AlphaWalletFoundation.RPCServer.main ▿ contract : ethereumAddress: 0x90ee3Cf59FcDe2FE11838b9075Ea4681462362F1 ▿ ethereumAddress : 1 element - eip55String : "0x90ee3Cf59FcDe2FE11838b9075Ea4681462362F1" - functionName : "name" - inputs : 0 elements ▿ output : ReturnType - type : AlphaWalletFoundation.SolidityType.string - arguments : 0 elements - argumentsDescription : "[]" ▿ function : CallForAssetAttribute - abi : "{\n "inputs" : [\n\n ],\n "outputs" : [\n {\n "type" : "string",\n "name" : ""\n }\n ],\n "payable" : false,\n "type" : "function",\n "name" : "name",\n "stateMutability" : "view",\n "constant" : true\n}" - name : "name" ▿ contract : ethereumAddress: 0x90ee3Cf59FcDe2FE11838b9075Ea4681462362F1 ▿ ethereumAddress : 1 element - eip55String : "0x90ee3Cf59FcDe2FE11838b9075Ea4681462362F1"

  • abi : "[{\n "inputs" : [\n\n ],\n "outputs" : [\n {\n "type" : "string",\n "name" : ""\n }\n ],\n "payable" : false,\n "type" : "function",\n "name" : "name",\n "stateMutability" : "view",\n "constant" : true\n}]"
  • name : "name"
  • parameters : 0 elements
  • shouldDelayIfCached : true

oa-s avatar Mar 03 '23 07:03 oa-s

@oa-s was at https://github.com/AlphaWallet/alpha-wallet-android/issues/3133. Move since it's in the wrong repo :) Buzz you so you can find it

hboon avatar Mar 03 '23 07:03 hboon

oh, yep, my bad, thanks!

oa-s avatar Mar 03 '23 07:03 oa-s