Skip to content

Commit 6148646

Browse files
gastonpontiyorhodesjmrossyMedha Kothari
authored
Sdk Modularization (#4790)
* Add core types sdk package * Config compiler options to use web3 type wrappers * Try path resolutions and typeRoots for tsc use with sdk-types * Change typechain to use sdk-types * Change imports from base * Remove web3-celo.d.ts * Extracting web3 types * Fix types in other packages * Keep extracting types * Add wallet modules * Adjust sdk-types for devDependency * Signer types * Add communication wrapper * Add typechain. Remove Sdk-types * Fix types celotool * Fix other packages builds * Remove unnecesary patch * Fix yarn.lock * Fix repo build * Fix yarn.lock (this time for real, haha) * Dependency graph updated * Fix build packages in circle-ci * Fix build packages in circle-ci v2 * Fix build packages in circle-ci v3 * Fix build packages in circle-ci v4 * Add lint for temp package * Remove temp package * Remove temp package (update dep-graph) * Fix lint * Fix rpcCaller provider * Update dockerfiles * Bump contractkit deps * Remove sdk-types and add wallet-base/types * Update wallet base to master * Update local wallet to master * Update remote wallet to master * Update ledger wallet to master * Update azure hsm to master * Add wallet-hsm and update wallet-azurehsm to master * Add wallet-awshsm package and update to master * Update cli to consume wallet base * Remove sdk-types dep from protocol * Update rpc wallet to master * Remove sdk-types from contractkit * Remove wallets from contractkit * Fix types with wallets * Remove soliditySha3 from communication * Remove sdk-types * Fix phone-number dependency * Fix mobile dependencies * Update dependency graph * Fix mobile dependencies * Mobile metro dependencies * Mobile metro dependencies * Refactor wallets * Fix lints * Fix communcation tests * Update dependency graph * Fix communcation test dependency * Remove ganache from communication dependencies * Update dependecy graph * Fix contractkit test * Fix celotools types * Fix master merge incomp * Protocol typechain fix * Protocol typechain fix v2 * Typechain fix lint * Protocol typechain fix v3 * Contractkit Extenders package * Fix cli command * Fix lint * Fix blockchain api setup jest * Change check-versions script * Fix wallet ledger tests * Fix wallet rpc tests * Fix contractkit-extenders tests * Fix phone-number-privacy tests * wip fix notification-service * Remove implicit types * Refactor communication->connect * Remove typechain from the repo * Refector: Move to Sdk and Wallets folders * Add dependency to pnp-common * Update graph * Dappkit to the sdk * Dappkit to the sdk 2 * Divide contractkit-extenders * Add console lint for connect * Fix circleci config * Move CHANGELOGS * Update dependency graph * Fix dinamic require * Fix typing * Backwards compatibility for the kit * Add Local Wallet as default for the kit * Add wallet-local dep to contractkit * Update metro for mobile * Add identity package to mobile * Fix lint * Fix reference docs from ck * Fix specs * Fix docs gen * Fix mobile tests * extract wallets tests from general tests * extract web tests from general tests * Fix notification service tests * Extract packages that require devchain * Remove docs requirement in circle for now * Fix komencikit reference to CK * Fix komencikit specs * Env tests import packages * Fix slashing tests * Fix gas calculation * Fix txParamsNormalizer * Change expected error text * Fix parameter decoding * Fix GoldToken's balanceOf * Fix rpc-caller * Remove unnecesary debug-provider from faucet * Update identity package description Co-authored-by: J M Rossy <[email protected]> * Cli trasfer:celo fixed. Minor fixes too * Update network-utils description Co-authored-by: J M Rossy <[email protected]> * Re org metro packages * Connect as a non-dev dependency * Removing Logo.v2 * Update all sdk versions to 1.0.0-dev * Web3 utils fixes * Clean dependencies * Modify circle-ci yarn_install cache depth * More rpcCalls from connect * Add sign to connection * Add sign to connection, using provider * Add web3 to CK * Sign in connection return promise * Fix sign * Upgrade web3 1.3.0 * Fix non-migrated types in mobile * Update dependecy graph * Fix sign from connection * dev-utils revert dependencies * Fix types mobile * Adding logs to protocol-test-release * Fix circle dep issue * Fix local wallet tests * Fix circle dep issue v2 * Fix KomenciKit tests * Fix lints * Fix wallet tests * Fix protocol-test-release types issue * Refactor connection * Fix formatters * Fix mobile types * Fix normalize parameter tests * Add wallet dependencies * Revert goldTokenWrapper change * Fix sign * Fix sign Accounts * Fix release contract test * Split release contract test * Extract wallet tests * Fix packages versions for gcloud build * Remove --frozen-lockfile flag * Add wallets to dockerfiles * Fix celotool dockerfile * Fix celotool dockerfile v2 * Fix celotool dockerfile v3 * Add prepublish hooks and .npmignores * Add secp256k1 types * Fix typo * Package fixed versions * Update types deps for connect * gcloud build fix * moment dependency added * Update yarn.lock * Update moment lib Co-authored-by: yorhodes <[email protected]> Co-authored-by: J M Rossy <[email protected]> Co-authored-by: Medha Kothari <[email protected]>
1 parent c33a5ef commit 6148646

File tree

575 files changed

+5185
-3061
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

575 files changed

+5185
-3061
lines changed

.circleci/config.yml

Lines changed: 140 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ commands:
4646
command: |
4747
mkdir -p ~/.tmp/checksumfiles
4848
# Concatenate package.json so we can use them as a part of the cache key
49-
find . -maxdepth 3 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > ~/.tmp/checksumfiles/package.json
49+
find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > ~/.tmp/checksumfiles/package.json
5050
# Concatenate patches so we can use them as a part of the cache key
5151
find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > ~/.tmp/checksumfiles/patches
5252
- restore_cache:
@@ -154,6 +154,8 @@ jobs:
154154
# separate build to avoid ENOMEM in CI :(
155155
yarn build --scope @celo/base
156156
yarn build --scope @celo/utils
157+
yarn build --scope @celo/dev-utils
158+
yarn build --scope @celo/connect
157159
yarn build --scope @celo/protocol
158160
yarn build --ignore @celo/protocol --ignore docs
159161
@@ -403,7 +405,33 @@ jobs:
403405
name: jest tests
404406
command: |
405407
mkdir -p test-results/jest
406-
yarn run lerna --ignore @celo/contractkit --ignore @celo/mobile --ignore @celo/protocol --ignore @celo/celotool --ignore @celo/celocli --ignore @celo/env-tests run test
408+
yarn run lerna \
409+
--ignore @celo/contractkit \
410+
--ignore @celo/mobile \
411+
--ignore @celo/protocol \
412+
--ignore @celo/celotool \
413+
--ignore @celo/celocli \
414+
--ignore @celo/env-tests \
415+
--ignore @celo/web \
416+
--ignore @celo/identity \
417+
--ignore @celo/transactions-uri \
418+
--ignore '@celo/wallet-*' \
419+
run test
420+
421+
- store_test_results:
422+
path: test-results
423+
424+
web-test:
425+
<<: *defaults
426+
steps:
427+
- attach_workspace:
428+
at: ~/app
429+
430+
- run:
431+
name: jest tests
432+
command: |
433+
mkdir -p test-results/jest
434+
yarn --cwd=packages/web run test
407435
408436
- store_test_results:
409437
path: test-results
@@ -463,6 +491,45 @@ jobs:
463491
name: Upload to CodeCov
464492
command: yarn codecov -F mobile
465493

494+
wallets-test:
495+
<<: *defaults
496+
steps:
497+
- attach_workspace:
498+
at: ~/app
499+
- run:
500+
name: Run Tests
501+
command: yarn run lerna --scope '@celo/wallet-*' run test
502+
503+
504+
# Split from the original script. The original script was assuming not big changes in dependencies.
505+
# As that's a possibility, we require to install the old and re-install the new one, and circle
506+
# crashes on the second re-install.
507+
# This pre script, generates the build and devchain, and adds it to the workspace to be used for the
508+
# other script
509+
pre-protocol-test-release:
510+
<<: *defaults
511+
resource_class: large
512+
steps:
513+
- attach_workspace:
514+
at: ~/app
515+
- run:
516+
name: Check if the test should run
517+
command: |
518+
./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol
519+
- run:
520+
name: Generate devchain of previous release
521+
command: |
522+
mkdir -p ~/.ssh
523+
ssh-keyscan github.com >> ~/.ssh/known_hosts
524+
echo "Comparing against first commit to contain version numbers"
525+
RELEASE_TAG=celo-core-contracts-v1.rc1
526+
yarn --cwd packages/protocol test:generate-old-devchain-and-build -b $RELEASE_TAG -d .tmp/released_chain -l /dev/stdout
527+
- persist_to_workspace:
528+
root: .
529+
paths:
530+
- "packages/protocol/.tmp/released_chain/*"
531+
532+
466533
protocol-test-release:
467534
<<: *defaults
468535
resource_class: large
@@ -473,14 +540,21 @@ jobs:
473540
name: Check if the test should run
474541
command: |
475542
./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol
543+
- run:
544+
name: Copy DevChain and Build generated from released tag
545+
command: |
546+
RELEASE_TAG=celo-core-contracts-v1.rc1
547+
BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g'))
548+
(cp -r packages/protocol/.tmp/released_chain packages/protocol/$BUILD_AND_DEVCHAIN_DIR)
476549
- run:
477550
name: Test release against v2
478551
command: |
479552
mkdir -p ~/.ssh
480553
ssh-keyscan github.com >> ~/.ssh/known_hosts
481554
echo "Comparing against first commit to contain version numbers"
482555
RELEASE_TAG=celo-core-contracts-v1.rc1
483-
yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG
556+
BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g'))
557+
yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG -d $BUILD_AND_DEVCHAIN_DIR -l /dev/stdout
484558
485559
protocol-test-common:
486560
<<: *defaults
@@ -612,19 +686,52 @@ jobs:
612686
- run:
613687
name: Generate DevChain
614688
command: |
615-
(cd packages/contractkit && yarn test:reset)
689+
(cd packages/sdk/contractkit && yarn test:reset)
616690
- run:
617691
name: Run Tests
618-
command: yarn --cwd=packages/contractkit test
692+
command: yarn --cwd=packages/sdk/contractkit test
693+
# TODO: remove comment after new docs generation
694+
# - run:
695+
# name: Fail if someone forgot to commit contractkit docs
696+
# command: |
697+
# yarn --cwd=packages/sdk/contractkit docs
698+
# if [[ $(git status packages/docs/developer-resources/contractkit --porcelain) ]]; then
699+
# git --no-pager diff packages/docs/developer-resources/contractkit
700+
# echo "There are git differences after generating contractkit docs"
701+
# exit 1
702+
# fi
703+
- persist_to_workspace:
704+
root: .
705+
paths:
706+
- "packages/sdk/contractkit/.tmp/devchain.tar.gz"
707+
708+
# extrated to reuse the devchain generated by contractkit
709+
identity-tests:
710+
<<: *defaults
711+
steps:
712+
- attach_workspace:
713+
at: ~/app
619714
- run:
620-
name: Fail if someone forgot to commit contractkit docs
715+
name: Copy DevChain generated by Contractkit
621716
command: |
622-
yarn --cwd=packages/contractkit docs
623-
if [[ $(git status packages/docs/developer-resources/contractkit --porcelain) ]]; then
624-
git --no-pager diff packages/docs/developer-resources/contractkit
625-
echo "There are git differences after generating contractkit docs"
626-
exit 1
627-
fi
717+
(cp -r packages/sdk/contractkit/.tmp packages/sdk/identity/.tmp)
718+
- run:
719+
name: Run Tests
720+
command: yarn --cwd=packages/sdk/identity test
721+
722+
# extrated to reuse the devchain generated by contractkit
723+
transactions-uri-tests:
724+
<<: *defaults
725+
steps:
726+
- attach_workspace:
727+
at: ~/app
728+
- run:
729+
name: Copy DevChain generated by Contractkit
730+
command: |
731+
(cp -r packages/sdk/contractkit/.tmp packages/sdk/transactions-uri/.tmp)
732+
- run:
733+
name: Run Tests
734+
command: yarn --cwd=packages/sdk/transactions-uri test
628735

629736
cli-test:
630737
<<: *defaults
@@ -698,10 +805,10 @@ jobs:
698805
name: Install and test the npm package
699806
command: |
700807
set -euo pipefail
701-
cd packages/base
808+
cd packages/sdk/base
702809
yarn pack
703810
cd /tmp
704-
npm install ~/app/packages/base/*.tgz
811+
npm install ~/app/packages/sdk/base/*.tgz
705812
706813
utils-test:
707814
<<: *defaults
@@ -716,13 +823,13 @@ jobs:
716823
name: Install and test the npm package
717824
command: |
718825
set -euo pipefail
719-
cd packages/base
826+
cd packages/sdk/base
720827
yarn pack
721828
cd ../utils
722829
yarn pack
723830
cd /tmp
724-
npm install ~/app/packages/base/*.tgz
725-
npm install ~/app/packages/utils/*.tgz
831+
npm install ~/app/packages/sdk/base/*.tgz
832+
npm install ~/app/packages/sdk/utils/*.tgz
726833
727834
end-to-end-geth-transfer-test:
728835
<<: *e2e-defaults
@@ -999,17 +1106,33 @@ workflows:
9991106
- cli-test:
10001107
requires:
10011108
- install_dependencies
1109+
- web-test:
1110+
requires:
1111+
- install_dependencies
10021112
- contractkit-test:
10031113
requires:
10041114
- install_dependencies
1115+
- wallets-test:
1116+
requires:
1117+
- install_dependencies
1118+
- identity-tests:
1119+
requires:
1120+
- contractkit-test
1121+
- transactions-uri-tests:
1122+
requires:
1123+
- contractkit-test
10051124
- mobile-test:
10061125
requires:
10071126
- lint-checks
10081127
- end-to-end-mobile-test-android
10091128
- end-to-end-mobile-test-ios
1129+
- pre-protocol-test-release:
1130+
requires:
1131+
- lint-checks
10101132
- protocol-test-release:
10111133
requires:
10121134
- lint-checks
1135+
- pre-protocol-test-release
10131136
- protocol-test-common:
10141137
requires:
10151138
- lint-checks

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/packages/blockchain-api/ @jmrossy @cmcewen @i1skn @jeanregisser
1313
/packages/celotool/ @asaj
1414
/packages/cli/ @mcortesi @gastonponti @medhak1 @celo-org/devx
15-
/packages/contractkit/ @mcortesi @gastonponti @medhak1 @barbaraliau @celo-org/devx
15+
/packages/sdk/ @mcortesi @gastonponti @medhak1 @barbaraliau @celo-org/devx
1616
/packages/dappkit/ @cmcewen @barbaraliau @celo-org/devx
1717
/packages/dev-utils/ @mcortesi
1818
/packages/docs/ @timmoreton @barbaraliau @critesjosh
@@ -29,8 +29,8 @@
2929
/packages/terraform-modules-public/ @tkporter
3030
/packages/terraform-modules/ @tkporter
3131
/packages/typescript/ @cmcewen
32-
/packages/utils/ @barbaraliau @medhak1 @celo-org/devx
33-
/packages/base/ @barbaraliau @medhak1 @celo-org/devx
32+
/packages/sdk/utils/ @barbaraliau @medhak1 @celo-org/devx
33+
/packages/sdk/base/ @barbaraliau @medhak1 @celo-org/devx
3434
/packages/web/validator-badges @cla-bel @bohan-zhang @pranaymohan
3535
/packages/web/openpgpkey @nategraf
3636
/packages/web/ @aaronmgdr

0 commit comments

Comments
 (0)