Merge pull request #2586 from vladyslav-iosdev/#2584

Fix web3swift memory leaks #2584
pull/2451/head
Hwee-Boon Yar 4 years ago committed by GitHub
commit 875a48e7bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      AlphaWallet/Market/Coordinators/UniversalLinkCoordinator.swift
  2. 4
      AlphaWallet/Tokens/Coordinators/GetBlockTimestampCoordinator.swift
  3. 2
      Podfile
  4. 8
      Podfile.lock

@ -409,7 +409,6 @@ class UniversalLinkCoordinator: Coordinator {
}
}
}
private func ecrecover(signedOrder: SignedOrder) -> ResultResult<web3swift.EthereumAddress, web3swift.Web3Error>.t {
//need to hash message here because the web3swift implementation adds prefix
let messageHash = Data(bytes: signedOrder.message).sha3(.keccak256)
@ -420,9 +419,11 @@ class UniversalLinkCoordinator: Coordinator {
let signature = "0x" + signedOrder.signature.drop0x.substring(to: 128) + vString
let nodeURL = server.rpcURL
let provider = Web3HttpProvider(nodeURL, network: server.web3Network)!
return web3(provider: provider).personal.ecrecover(
hash: messageHash,
signature: Data(bytes: signature.hexToBytes)
let web3Instance = web3swift.web3(provider: provider)
return web3swift.web3.Personal(provider: provider, web3: web3Instance).ecrecover(
hash: messageHash,
signature: Data(bytes: signature.hexToBytes)
)
}

@ -21,7 +21,7 @@ class GetBlockTimestampCoordinator {
let promise: Promise<Date> = Promise { seal in
firstly {
web3.eth.getBlockByNumberPromise(blockNumber)
web3swift.web3.Eth(provider: web3.provider, web3: web3).getBlockByNumberPromise(blockNumber)
}.map {
$0.timestamp
}.done {
@ -30,8 +30,10 @@ class GetBlockTimestampCoordinator {
seal.reject($0)
}
}
cacheForServer[blockNumber] = promise
Self.blockTimestampCache[server] = cacheForServer
return promise
}
}

@ -26,7 +26,7 @@ target 'AlphaWallet' do
pod 'TrezorCrypto', :git=>'https://github.com/AlphaWallet/trezor-crypto-ios.git', :commit => '50c16ba5527e269bbc838e80aee5bac0fe304cc7'
pod 'TrustKeystore', :git => 'https://github.com/alpha-wallet/trust-keystore.git', :commit => 'c0bdc4f6ffc117b103e19d17b83109d4f5a0e764'
pod 'SwiftyJSON'
pod 'web3swift', :git => 'https://github.com/AlphaWallet/web3swift.git', :commit=> '169e50e29b60df72351c689a002005d2e2bc7559'
pod 'web3swift', :git => 'https://github.com/AlphaWallet/web3swift.git', :commit=> 'ac87fe63be2d69950c0411582a3f0d6604cc97c4'
pod 'SAMKeychain'
pod 'PromiseKit/CorePromise'
pod 'PromiseKit/Alamofire'

@ -155,7 +155,7 @@ DEPENDENCIES:
- TrustWalletCore
- UnstoppableDomainsResolution (= 0.1.6)
- WalletConnectSwift (from `https://github.com/WalletConnect/WalletConnectSwift.git`, commit `c86938785303b99ff09d90e32e553ce38eee0aa6`)
- web3swift (from `https://github.com/AlphaWallet/web3swift.git`, commit `169e50e29b60df72351c689a002005d2e2bc7559`)
- web3swift (from `https://github.com/AlphaWallet/web3swift.git`, commit `ac87fe63be2d69950c0411582a3f0d6604cc97c4`)
SPEC REPOS:
trunk:
@ -232,7 +232,7 @@ EXTERNAL SOURCES:
:commit: c86938785303b99ff09d90e32e553ce38eee0aa6
:git: https://github.com/WalletConnect/WalletConnectSwift.git
web3swift:
:commit: 169e50e29b60df72351c689a002005d2e2bc7559
:commit: ac87fe63be2d69950c0411582a3f0d6604cc97c4
:git: https://github.com/AlphaWallet/web3swift.git
CHECKOUT OPTIONS:
@ -267,7 +267,7 @@ CHECKOUT OPTIONS:
:commit: c86938785303b99ff09d90e32e553ce38eee0aa6
:git: https://github.com/WalletConnect/WalletConnectSwift.git
web3swift:
:commit: 169e50e29b60df72351c689a002005d2e2bc7559
:commit: ac87fe63be2d69950c0411582a3f0d6604cc97c4
:git: https://github.com/AlphaWallet/web3swift.git
SPEC CHECKSUMS:
@ -324,6 +324,6 @@ SPEC CHECKSUMS:
WalletConnectSwift: cd5e056cec5a2f44e92b8595199e7f2f9f0bd92d
web3swift: 06118d4c4edc801444aaa995bbbddeda176b97ef
PODFILE CHECKSUM: 2679996c68431417ec9021d3a4cc1faa4c583a52
PODFILE CHECKSUM: 1e562843fe5ce6d57fb6f4af5f74fca90d5ec92c
COCOAPODS: 1.10.0

Loading…
Cancel
Save