web3dart icon indicating copy to clipboard operation
web3dart copied to clipboard

Exceptions in metamask

Open cryptobys-rami opened this issue 4 years ago • 1 comments

So when I make a call on my contract which should revert with an exception, I can see the exception in my console:

final client = Web3Client(rpcUrl, Client(), socketConnector: () {
 return IOWebSocketChannel.connect(wsUrl).cast<String>();
  });

However, when I make the same call via metamask, the transaction fails, but the exception is swallowed somewhere:

final client = Web3Client.custom(eth.asRpcService());

Is there any way to be able to see this exception somewhere? it's important because otherwise we wouldn't know it has failed unless we look up the transaction hash later on etherscan or something.

cryptobys-rami avatar Sep 24 '21 17:09 cryptobys-rami

It looks like some AWS thing is depending on the SQLite.swift pod, which links SQLCipher which is incompatible with sqlite3_flutter_libs linking sqlite3.

Just out of interest, does it work if you depend on sqlcipher_flutter_libs?

simolus3 avatar Jun 20 '22 12:06 simolus3

No, this does not work either having the same error. On Android I also receive the following:

Unhandled Exception: Invalid argument(s): Failed to load dynamic library '/data/data/xxx/lib/libsqlite3.so': dlopen failed: library "/data/data/xxx/lib/libsqlite3.so" not found

when compiling

MSKoWa avatar Jun 20 '22 13:06 MSKoWa

I also can't install on iOS, using an Mac M1, sqlite3_flutter_libs: ^0.5.8 . It works fine for Android.

Running Xcode build...                                                  
Xcode build done.                                            3.7s
Failed to build iOS app
Error output from Xcode build:
↳
    2022-07-21 00:15:26.612 xcodebuild[32717:3137737] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
    Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    2022-07-21 00:15:26.612 xcodebuild[32717:3137737] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
    Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/3x/g7bqrncn3qbc0gb1kkgy35rw0000gn/T/flutter_tools.pLLh4Q/flutter_ios_build_temp_dirC83jmq/temporary_xcresult_bundle

    In file included from /Users/.../.../.../ios/Pods/SQLite.swift/Sources/SQLiteObjc/SQLiteObjc.m:26:
    /Users/.../.../.../ios/Pods/SQLite.swift/Sources/SQLiteObjc/fts3_tokenizer.h:27:9: fatal error: 'sqlite3.h' file not found
    #import "sqlite3.h"
            ^~~~~~~~~~~
    1 error generated.
    Command CompileSwiftSources failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

    Result bundle written to path:
        /var/folders/3x/g7bqrncn3qbc0gb1kkgy35rw0000gn/T/flutter_tools.pLLh4Q/flutter_ios_build_temp_dirC83jmq/temporary_xcresult_bundle


Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): 'sqlite3.h' file not found
/Users/.../.../.../ios/Pods/SQLite.swift/Sources/SQLiteObjc/fts3_tokenizer.h:26:8

Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

I already tried the following (sometimes it fixes for Mac M1), but it didn't work.

cd ios
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.4, on macOS 12.4 21F79 darwin-arm, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.69.1)
[✓] Connected device (3 available)
    ! Error: iPhone de Danilo is not connected. Xcode will continue when iPhone de Danilo is connected. (code -13)
[✓] HTTP Host Availability

• No issues found!

daniloapr avatar Jul 21 '22 03:07 daniloapr

I don't know if this could affect the issue, but I have a background service that accesses the database from Swift code. So I have pod 'SQLite.swift', '~> 0.12.2' in my Podfile.

daniloapr avatar Jul 21 '22 03:07 daniloapr

The error above comes from the SQLite.swift pod, so yea, that is probably the cause of the problem. No idea how to fix it.

kuhnroyal avatar Jul 21 '22 10:07 kuhnroyal

I think this may be because SQLite.swift links sqlite via spec.library, while the setup used by sqlite3_flutter_libs is intended to not use the system's sqlite3 and instead compile a fixed sqlite3 version from source.

I see that the SQLite.swift pod contains two subspecs (standard and sqlite3): https://github.com/stephencelis/SQLite.swift/blob/dd3e813577b8b6ba363b12cff024dd633e9e29ab/SQLite.swift.podspec#L31-L62. The sqlite3 subspec seems to depend on the sqlite3 pod (which is also used by sqlite3_flutter_libs and should be compatible). Do you have a way to depend on that pod instead (e.g. SQLite.swift/sqlite3)?

simolus3 avatar Jul 22 '22 10:07 simolus3