Skip to content

fixed duplicate symbol with another lib (#4093)#1

Open
Cruzpapap wants to merge 426 commits into
ar/btc-sign-verify-recover2from
master
Open

fixed duplicate symbol with another lib (#4093)#1
Cruzpapap wants to merge 426 commits into
ar/btc-sign-verify-recover2from
master

Conversation

@Cruzpapap

@Cruzpapap Cruzpapap commented Mar 25, 2025

Copy link
Copy Markdown
Owner

Description

How to test

Types of changes

Checklist

  • Create pull request as draft initially, unless its complete.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • If there is a related Issue, mention it in the description.

If you're adding a new blockchain

  • I have read the guidelines for adding a new blockchain.

Milerius and others added 30 commits April 21, 2023 11:55
…rustwallet#3065)

* init codegen-v2

* play around with possible implementation

* impl derive for GSeparator

* add GSeparators with wrapped Vec<GSeparator>

* impl ParseTree for GSeparator

* add Driver and DriverUsed convenient structs

* add read_amt function, use in ParseTree impl

* add DerivationResult and Error type, continue impl

* update existing code to DerivationResult changes

* small cleanup

* rename revert to rollback

* implement basic tests for GSeparator

* fix target slice in Driver impl

* track test module

* make a GStruct test in GType::derive

* handle EOF in ParseTree

* check for EOF in tests

* init basic types for function parameters

* impl ParseTree for GParamItemWithMarker

* impl ParseTree for GMarker and GParamName

* complete ParseTree impl for GParamItemWithMarker

* expand tests, derive Eq and PartialEq for relevant types

* implement ParseTree for GParamItemWithoutMarker, write unit tests

* add Continuum and ContinuumNext structs

* implement ParseTree for Continuum

* introduce WithEof struct for checking EOF

* add EitherOr struct

* deprecate WithEof

* make internal changes to Driver

* update ParseTree impls to Driver changes

* complete new Driver implementation

* update unit tests

* rename DriverScope to Driver

* update scoping mechanism

* return DriverFinalized from derive impl

* add test for individual separator items

* add test_eof

* fix position when applying scope

* rename various types and methods

* move Reader types into reader module

* move types into grammar module

* rename ReaderToMerge to ReaderBranch

* introduce GFuncParams type

* add GNonAlphanumeric type

* add wipe and ensure convenience functions

* expand usage of ensure

* use convenience functions in GFuncParams

* check explicitly for brackets

* complete function definition parsing

* convert GMarker to enum, set explicit variants

* expand tests for function decleration

* reorder impls in grammar

* cleanup

* add comments

* rename GType to GPrimitive

* add additional type categories

* handle parsing of pointers, add unit tests

* handle struct parsing

* test Unknown type variant

* handle markers in function declaration

* add test

* cleanup warnings

* start ParseTree impl for GHeaderInclude

* complete ParseTree impl for GHeaderInclude

* deprecate GParamItemWithMarker

* rename GParamItemWithoutMarker to GParamItem

* write simple parse_file test, add GNewline and GAnyLine to grammar

* expand

* implement ParseTree for GEndOfLine

* introduce GHeaderFileItem

* introduce GCommentLine and GCommentBlock types

* handle comments in GHeaderFileItem

* start with impl of handling of structs

* expand tests for struct parsing

* split tests into smaller files

* implement ParseTree for GType, convert function params to GType

* fix mutability indicator

* handle struct declarations

* implement GEnum

* fix some warnings

* get rid of remaining warnings

* handle marker after return value

* introduce GReturnValue

* update unit test

* handle marker for struct

* handle #pragma

* handle makers directly

* reorder grammar module

* return in parse_file

* implement serde support

* rename variant to g_variant

* add ASCII only for now

* ignore attribute for test_parse_file

* handle 'define' attributes, write unit tests

* track attributes tests

* implement GMarkers type

* introduce GMarkers into other G types

* convert inner GMarkers field to tuple

* remove unused imports

* remove double comment

* support typedef, add unit test

* track typedef unit test module

* test with const void TWData

* handle typedef and define in GHeaderFileItem

* rename GHeaderDefine to GDefine

* check for more separators

* be more precise with GDefine parsing

* more characters tests for define

* handle GDefine better

* add must_ok and must_err convenience functions

* convert must_ok and must_err to macros

* add comment

* add unit tests for GKeyword

* convert From<String> to From<&str> for test cases

* cleanup warnings

* use must_ok! in type categories unit tests

* migrate functions unit tests to macros too

* check for separator handling in functions tests

* additional tests in functions module

* cleanup

* rename var

* update unit tests for typedef

* deprecate some tests

* use GKeyword for GTypeCategory internally

* make use of GKeyword in GStruct

* use GKeyword in GEnum impl

* deprecate GTypeCategory::Unknown

* fix warnings

* rename GStruct to GStructName

* migrate primitives tests to must_ok!

* migrate other unit tests to must_ok!

* update in mod.rs

* poc for reading includes

* formatting

* complete parse_file and parse_dir impl

* print unrecognized items in test

* remove unused import

* add Unrecognized variant for types, used to handle structs as params

* explicitly check for GTypeCategory::Unrecognized

* add parser for inline comments

* start with ParseTree impl for GEnumDecl

* adjust comma check for enums

* additional unit tests for enum decls

* handle enum decl as part of GHeaderFileItem

* track tests

* expand tests for enum declaration

* handle HEX values in enum variant values

* implement ParseTree for GStaticVar

* add support for static variables

* use macro for single character definitions

* move macro to root

* wipe comment line in enums

* write test for number in static var

* handle TW_EXPORT_ENUM marker

* cleanup

* add test for non-parameter functions

* typo

* rename GStructDecl to GStructInd

* implement ParseTree for GStructDecl

* add unit tests for GStructDecl

* handle struct declarations in primary parser

* handle 'extern' functions

* track .devcontainer

* update .devcontainer

* add extension to devcontainer

* add README

* add minimal main() method

* update README

* add workflow for codegen-v2 tests

* update workflow

* add manifest path to cargo test

* deprecate GParamName

* deprecate GFuncName

* removed example.include_manifest.json

* GStructName wraps GKeyword

* adjust GStruct and GEnum

* deprecate wipe, just use optional

* rename Continuum types to plural

* move define_char! decl to grammar module

* rename EitherOr to Either

* update comment

* remove unnecessary check on GKeyword derive impl

* rename GEnum to GEnumName

* add more tests for primitives

* fix devcontainer

* add copyright notice to each Rust file

* track Cargo lock and ignore target
Remove Ruslan and my self for every pr notification, feel free to request review if needed
* update method hbs template

* track init.hbs

* update part_property.hbs

* complete Swift class template

* organize unit test structure, write simple test for swift method rendering

* implement convenience function for engine creation

* additional test

* adjust test input/outputs

* remove extra newline from template

* add comment

* implement from_grammer function and get_type_str for creating native Swift types

* add get_method_name function for extracting Swift-appropriate name

* fix devcontainer

* add copyright notice to each Rust file

* track Cargo lock and ignore target

* fix src/tests/mod.rs

* init manifest

* impl mapping for ImportInfo

* impl additional TryFrom's for manifest types

* add mappings for ObjectInfo

* cleanup and add comment

* convert G-type to PropertyInfo

* format tabs

* expand g-type conversion to TypeInfo

* handle additional variants

* get rid of TryFrom impl

* implement g-type conversion for MethodInfo

* reorder code

* stard with C header directory lookup

* remove attempt at C header directory processing

* separate impl from manifest file

* remove unused imports

* rename ObjectInfo to StructInfo, update EnumInfo fields

* expand on process_c_header_dir

* continue on process_c_header_dir

* check both structs and enums for methods

* proceed with function decl

* remove prefix for method name

* remove unused found_* variables

* track GStruct

* write process_c_header_dir output to a directory

* use match in convert items

* don't remove prefix of functions

* create output dir if not exists

* display manifest output in yaml

* handle Init and Deinit methods

* handle properties, skip none-exported methods

* handle include header

* handle TWData and TWString explicitly

* adjust serde representation

* add TW_DATA and TW_STRING tags where appropriate

* replicate manifest type variants from grammar

* rename MethodInfo to FunctionInfo

* prefix swift structs with Swift*

* adjust Swift types, implement C type mapping

* complete conversion from manifest to SwiftFunction

* remove tags field on ParamInfo

* rename TWData to Data and TWString to String

* add process_func function

* implement process_struct_methods

* generate property templates

* handle inits

* fix partial inclusion of templates

* include class directly into file tempalte

* experiment with templates more

* add entire template in one file

* expand deinit section

* remove parital templates, cleanup lib.rs

* reorder code in codegen/swift

* add simple CLI interface

* add parser-headers command to cli

* remove warnings

* handle both Const and Mutable for TWSting/TWData

* remove comment

* remove deprecated test

* remove .h suffix on imports

* support enum rendering

* make render_file_info return Result<Option<T>>

* cleanup file template a little

* remove TW prefix from type names and filenames

* add skip tag

* generate header grammer to out/

* remove redundant check

* add RenderInput and RenderOutput structs, generate multiple files for each FileInfo

* rename main manifest parser

* render enums separately in enum/ dir, render enum extensions

* add comments

* track templates

* avoid rendering empty structs/extensions

* cleanup enum skip mechanism

* add Proto typedefs to manifest

* remove imports from FileInfo

* generate Protobuf bindings

* convert first char of function and property names to lowercase

* track proto template

* rename enum dir to Enum

* rename deter_as to defer_as

* strip prefix from enum variant

* add default counter values for enum variants

* setup is_public in enum template rendering

* replace variant tuple with EnumVariantInfo

* add custom handler for TWStellarPassphrase

* add custom handler for TWHRP

* adjust template to enum variant changes

* track markers for enum in C grammer parser

* add value_type field to EnumInfo

* add inherited parents to enums

* tiny formatting addition to enum template

* add 'Address' parent to struct where appropriate

* rename functions

* rename parents to superclasses

* fix markers in enum tests

* render deinits

* fix formatting in extension.hbs

* fix enum generation

* classes are always final, add is_nullable for inits

* handle equality operator

* only classes are final, not structs

* handle enum explicitly

* wrap structs and enums as rawValue

* wrap structs and enums differently, correctly handle optional params

* fix wrappers for return value

* set this.rawValue for underlying C FFI call if non-static

* fix how underlying enum extension is called

* fix template regarding extra comma

* remove static option from properties

* add SwiftSelfParam

* adjust template for extensions

* add temporary handling of HRP object name

* adjust handling of UnsafeRawPointer

* update templates

* remove is_static field from PropertyInfo

* wrap returnin enum accordingly

* distinguish between class and struct when initaiting obj

* unwrap enum result

* add and track typed Swift operations in process_object_properties

* update SwiftProperty struct based on changes

* convert process_object_methods

* cleanup and fix errors

* adjust template to adjusted structure design

* handle skipping self-reference correctly

* adjust init to struct changes

* merge Call and CallDefer

* implement CallOptional

* deprecate TryFrom<ParamInfo> for SwiftParam

* implement support for guarded calls

* remove unused imports

* handle struct and enum returns correctly

* handle structs/enums correctly for properties too

* unwrap enum on return

* fix C FFI call in equal operator

* set is_public for methods in manifest

* skip non-exported inits

* handle optional structs

* guard call for properties

* convert enum variant names to camelCase

* cleanup templates

* add special handler for non-conventional TWStoredKey function names

* handle single void param in C header grammer

* checkout correctly in grammer

* add custom handlers for non-conventional variant names

* add extra ripemd handler

* add special handler for sha512_256

* add special handler for Hash functions

* add special handler for AES

* convert manifest and swift modules into directories

* split logic over files

* deprecate tags, just use bool fields

* remove dbg statements

* skip specific files entirely

* deprecate parser, track manifest directly

* reference variables directly from main

* add IoError and YamlError variants to Error type

* seperate swift codgen into individual files

* clear some TODOs

* implement Display for SwiftType

* comment on properties function and add comments

* add docs to function mapping

* cleanup

* unify C FFI call handler

* format special name handler

* note comment on unwrap

* add rustfmt::skip on special handling

* rename handle_* to param_*

* add a wrapper for return value

* descripte swift operation variants

* add additional comments

* update manifest with TWBase*.yaml

* add proper error types and handlings

* handle unwraps in main

* small fix

* formatting

* add copyright header

* trigger CI

* deprecate tags field from TWBase*.yaml

* update TWDataVector

* expand TWCommonProto

* replace Swift type () with Void

* track TWLiquidStakingProto.yaml

* add string description to TWCurve

* fix outdated path in println

* undo changes to tool and swift

* automatically add year in copyright header in templates

* remove deprecated skip_self field in templates

* only use one call to current_year

* separate string generation from swift type conversion

* don't render empty protos, stip Proto suffix correctly

* reorder structs

* add convenience function pretty_name

* move render functions into render module

* add comments to Swift types

* rename render types/functions

* init tests module, test single_struct, add expected input/output

* test template rendering for with optional types

* test single class

* add tests for private fields

* fix spacing for private properties

* simplify struct tests

* test private enum

* add convenience method for enum comparision

* set options.swift in legacy codegen to false

* add build step for swift codegen-v2 generation

* add test for enum extensions

* add processor for deinits

* test for non-associated properties

* track non-associated properties tests

* remove unnecessary to_string calls

* format

* create function partial for hbs template

* implement function and init partials

* implement partial property

* use partials in enum extensions

* add partial templates to RenderInput

* move templates to swift subfolder

* typo

* convert enum values to strings, use hex values in enums where required

* trigger CI

* add recommended changes by @satoshiotomakan

* update codgen-v2/README.md
* Webauthn public key support

* Update Webauthn.h

* Update Webauthn.cpp

* Code review fixes

* make public key optional

* rename files

* Counterfactual address computation for ERC-4337 (trustwallet#3150)

Added to your initial branch you can follow up the fixes in the other branch

* Move Barz to separate files

* update tests

* update tests

* Update EIP4337Tests.cpp

* Update TWEthereum.cpp

* Update TestBarz.kt

* Update TWEthereum.cpp

* Create TWBarz.yaml

* Update WalletCore.h

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* Update TWBarz.yaml

* feat(barz): fix barz

---------

Co-authored-by: Milerius <rmscastle@gmail.com>
Depending on CMAKE_CURRENT_SOURCE_DIR might cause all sorts of unintended consequences. For instance, this will break configuration when your project is included into another CMake managed project.
* feat(Scroll): Add Scroll zkEVM chain

* feat(Scroll): Fix swift tests

* feat(Scroll): Add `TWAnySignerScroll.Sign` test
trustwallet#3173)

* [ERC-4337] Making UserOp generation compatible with different wallet implementations

* Add init code

* Update BarzTests.swift

* update user op construction

* Fix swift tests

* remove old tests

* fix issues related to the new ethereum proto size

* update android tests

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* disable unity build and fix some warnings

* Fix android codegen Init check

* commit missing files

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* Update Barz.cpp

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

* Update TestBarz.kt

---------

Co-authored-by: hewigovens <360470+hewigovens@users.noreply.github.com>
* [r2r] Update starknet-crypto and starknet-ff

* [r2r] Update code coverage
…ion (trustwallet#3183)

* feat(NEAR): Add a test with successfully broadcasted NEP-141 transaction

* [r2r] Bump wallet-core-kotlin dep to 3.1.36

* [r2r] Bump wallet-core-kotlin dep to 3.1.35

* [r2r] Try to use 3.1.36 wallet-core-kotlin version

* feat(NEAR): Add TokenTransfer action to NEAR signing input
* [RLP]: Fix decode list/string length overflow

* [NEO]: Fix potential OOB

* Fix lint issues

* [NEAR]: Check NEAR legacy address length

* [Cbor]: Fix infinite decode

* [Stellar]: Check decoded data boundaries for an invalid address

* [r2r]: Use `std::enable_if` SFINAE instead of `std::unsigned_integral` constraint

* [r2r]: Fix Kotlin, Android builds
10gic and others added 30 commits September 2, 2024 17:53
…#4005)

* Eliminate nondeterminism in TON boc serialization

Fix issue trustwallet#4004

* Replace all instances of HashMap with BTreeMap
* Support calculating the TX hash of a transaction

* Implement the calc_tx_hash for TON/Aptos/Sui

* Adjust the code according to the comments

* Refactor the calcTxHash for Solana

* Format rust code using `cargo fmt`

* Change UtxoTransactionUtil to BitcoinTransactionUtil

* Add some comments

* Adjust the code according to the comments

* Add more test cases

* Fix issue found by `cargo clippy`
Co-authored-by: satoshiotomakan <127754187+satoshiotomakan@users.noreply.github.com>
…-2022 Program (trustwallet#4010)

* Add function TWSolanaAddressToken2022Address

* Extract common code into a separate function to reduce duplication

* Add C++ test cases for TWSolanaAddressToken2022Address
* feat(eth): Add support for EIP-2930 access list

* feat(eth): Fix formatting

* feat(eth): Fix Rust tests

* feat(eth): Fix Rust CI
* feat(btc): Move `tw_bitcoin` to `rust/chains/`

* feat(btc): Add PSBT signing of `witness_utxo`

* TODO add support for signing of `non_witness_utxo`
* TODO add support for PSBT planning

* feat(btc): Add PSBT signing of `non_witness_utxo`

* feat(btc): Add `planPSBT`

* Add `ChainInfo.hrp`

* feat(btc): Move all tests from `tw_any_coin` to `tw_tests`

* feat(btc): Minor changes in `tw_tests`

* feat(btc): Move all tests from `wallet_core_rs` to `tw_tests`

* feat(btc): Add `tw_bitcoin_sign_psbt` and `tw_bitcoin_plan_psbt`

* feat(btc): Add `TWBitcoinPsbtSign` and `TWBitcoinPsbtPlan` C interface

* feat(btc): Add Android, iOS tests

* [CI] Trigger CI

* chore(codegen): Fix codegen-v2
* feat(btc): Refactor BitcoinV2.proto

* Move PSBT input to `BitcoinV2.SigningInput.transaction.psbt`
* Add `BitcoinV2.TransactionBuilder`

* feat(btc): Refactor Signer, Planner and Compiler to the refactored Protobuf

* Remove `tw_bitcoin_psbt_sign` and `tw_bitcoin_psbt_plan`

* feat(btc): Adopt integration tests

* feat(btc): Remove `TWBitcoinPsbt` module

* Adopt C++ integration tests

* feat(btc): Adopt iOS tests

* feat(btc): Adopt Android tests

* feat(btc): Adopt WASM tests
* Support TON mintless jettons

* Only adjust comments

* Adjust TheOpenNetwork.proto

---------

Co-authored-by: Sztergbaum Roman <rmscastle@gmail.com>
* feat(bch): Add `BitcoinCash` blockchain type

* feat(bch): Add support for `CashAddress`

* TODO implement `Entry::parse_address_unchecked`

* feat(bch): Finalize BitcoinCash `Address`

* Add `UncheckedCashAddress`
* TODO test `Address::from_str_unchecked`

* feat(bch): Add `UtxoContext` to allow custom Address types

* feat(bch): Add signing test with from/to Cash address

* feat(bch): Add Compiling test

* feat(bch): Fix `CoinEntry::normalize_address` to validate address network

* feat(bch): Add Base58 address prefix to BitcoinCash

* feat(bch): Add `ECash` Blockchain type

* feat(bch): Add Android signing test

* [CI] Trigger CI

* feat(bch): Fix codegen-v2 and ECash CoinType test
* Fix Linux CI

* Try to install any libc and libstd versions

* Try to use `mjp41/workaround8649` package

* Try to use `mjp41/workaround8649` package

* Use ubuntu-22.04

* Try to disable the temporary fix for ubuntu-latest

* Downgrade lcov to 1.15

* Downgrade lcov to 1.15-1

* Downgrade lcov to 1.15-1

* Disable derive_function_end_line setting

* Install lcov 1.15-1 manually

* Install lcov 1.15-1 manually

* Install lcov 1.15-1 manually

* Install lcov 1.15-1 manually

* Minor changes

* [CI] Trigger CI

* Update emsdk to 3.1.33

* Install gcc-multilib

* Revert wasm-ci.yml
* Add linux-ci-jni.yml for tests only

* Fix compilation

* Include algorithm

* Delete linux-ci-jni.yml
…twallet#4011)

* Fix an issue in deserializing the EntryFunction object

* Add more test cases

---------

Co-authored-by: satoshiotomakan <127754187+satoshiotomakan@users.noreply.github.com>
* [Bitcoin]: Add taproot derivation

* Refactor codegen tool to generate newly added derivations
* Add `TWDerivation.h` to the git index

* [Bitcoin]: Generate Rust enum variants as well

* [Bitcoin]: Handle `TWDerivationBitcoinTaproot` enum variant

* Add missing `file_editor.rb` file

* [Bitcoin]: Forward deriveAddress to Rust if derivation is Taproot

* [Bitcoin]: Add Android tests

* [Bitcoin]: Add taproot derivation iOS tests
…4085)

* [Solana]: Add `SolanaTransaction` functions to get/set compute unit price/limit

* [Solana]: Add Rust FFI functions

* Fix `VersionedMessage::address_table_lookups()` method

* [Solana]: Add set priority tests

* [Solana]: Add C++ bindings

* [Solana]: Add Android, iOS tests
* [Cardano]: Check if `assetName` is a UTF-8 string

* Treat `assetName` as a byte array by default

* [Cardano]: Add TokenAmount transfer with assetName CIP-0067

* [CI] Trigger CI

* [Cardano]: Add missing transaction link
* [TRON]: Add transaction memo

* [TRON]: Skip empty memo JSON serialization
* feat: support Pactus

* fix: fix compile_impl implementation

* update Pactus address tests

* encoding treasury addresss

* update tests for HD wallet

* define Decodable trait and implement decode

* encode and decode for amount and address

* decode transaction and calculate id

* test(pactus): add compiler and signer tests

* add C++ integration tests

* extend central derivation and validation tests

* revert changes on non-pactus files

* fix compile error

* update tests for Kotlin and Swift

* use H160 for PubKeyHash

* update VarInt test

* fix: resolve PR review comments

* fix compile error

* update C++ tests

* fix formatting issue

* update Java and Swift tests

* update swift test

* fix broken swift test

* fix: add successfully transfer broadcasted in mainnet

* add bls validator public key

* add bond payload encodable and decodable

* add generic for decode_fix_slice

* add bond payload for sign transaction

* add bond payload as public use

* add pub use validator public key

* add original test case for bond and transfer

* refactor transfer in test compile

* add bond sign test

* refactor transfer sign payload

* refactor change to bond module name

* fix rust tests

* add transfer and bond test for swift

* add test sign bond without public key

* use broadcasted transaction data for tests

* fix mistake on Android test

---------

Co-authored-by: Javad <ja7ad@live.com>
…stwallet#4107)

* Update Polkadot extrinsic encoding to support new spec for Acala

* Make Test Fail

* Fix Acala test

---------

Co-authored-by: jaimeToca <jaime.toca@binance.com>
* Add support for Nimiq Albatross PoS transaction serialization (trustwallet#4110)

* Update Nimiq Transaction encoding for Albatross PoS

* Update tests

* [Nimiq]: Add networkId parameter to SigningInput

* [Nimiq]: Fix iOS test

* [Nimiq]: Fix invalid integer type cast

* [Nimiq]: Fix iOS test

---------

Co-authored-by: Sören Schwert <hello@soerenschwert.de>
* [BCH]: Fix Transaction Planning

* [BCH]: Add BitcoinCash transaction signing V2 test in C++
* Export bech32 and bech32m functions

* Fix test cases

* Merge bech32m functions into TWBech32 struct

* Fix failed test cases

* Fix failed swift test case
* fixed duplicate symbol with another lib

* fixed review

---------

Co-authored-by: satoshiotomakan <127754187+satoshiotomakan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.