Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the calculation of the security deposit amount #436

Merged
merged 60 commits into from
Jun 26, 2024

Conversation

Sharqiewicz
Copy link
Collaborator

What:

fix the calculation of the security deposit amount

How:

💥 I started from GET PEN branch #413 because there it includes refactored usePriceFetcher

✅ 🦖 Implement calculateGriefingCollateral for FeeBox > Security Deposit
✅ 🧪 Implement tests for calculateGriefingCollateral

Comments:

Closes: #416

…lockchain' into 277-get-pen-for-gas-using-any-token-from-the-pendulum-network
@Sharqiewicz Sharqiewicz requested a review from ebma May 1, 2024 15:02
Copy link

netlify bot commented May 1, 2024

Deploy Preview for rococo-souffle-a625f5 ready!

Name Link
🔨 Latest commit f6e579d
🔍 Latest deploy log https://app.netlify.com/sites/rococo-souffle-a625f5/deploys/667b080d10b2de00087b2863
😎 Deploy Preview https://deploy-preview-436--rococo-souffle-a625f5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ebma
Copy link
Member

ebma commented May 1, 2024

yarn.lock changes

Summary

Status Count
ADDED 48
UPDATED 434
DOWNGRADED 4
REMOVED 25
Click to toggle table visibility
Name Status Previous Current
@aashutoshrathi/word-wrap REMOVED 1.2.6 -
@adobe/css-tools UPDATED 4.3.2 4.3.3
@ampproject/remapping UPDATED 2.2.1 2.3.0
@babel/code-frame UPDATED 7.23.5 7.24.2
@babel/compat-data UPDATED 7.23.5 7.24.4
@babel/core UPDATED 7.23.6 7.24.5
@babel/generator UPDATED 7.23.6 7.24.5
@babel/helper-create-class-features-plugin UPDATED 7.23.6 7.24.5
@babel/helper-define-polyfill-provider UPDATED 0.4.4 0.6.2
@babel/helper-member-expression-to-functions UPDATED 7.23.0 7.24.5
@babel/helper-module-imports UPDATED 7.22.15 7.24.3
@babel/helper-module-transforms UPDATED 7.23.3 7.24.5
@babel/helper-plugin-utils UPDATED 7.22.5 7.24.5
@babel/helper-replace-supers UPDATED 7.22.20 7.24.1
@babel/helper-simple-access UPDATED 7.22.5 7.24.5
@babel/helper-split-export-declaration UPDATED 7.22.6 7.24.5
@babel/helper-string-parser UPDATED 7.23.4 7.24.1
@babel/helper-validator-identifier UPDATED 7.22.20 7.24.5
@babel/helper-wrap-function UPDATED 7.22.20 7.24.5
@babel/helpers UPDATED 7.23.6 7.24.5
@babel/highlight UPDATED 7.23.4 7.24.5
@babel/parser UPDATED 7.23.6 7.24.5
@babel/plugin-bugfix-firefox-class-in-computed-class-key ADDED - 7.24.5
@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression UPDATED 7.23.3 7.24.1
@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining UPDATED 7.23.3 7.24.1
@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly UPDATED 7.23.3 7.24.1
@babel/plugin-syntax-flow UPDATED 7.23.3 7.24.1
@babel/plugin-syntax-import-assertions UPDATED 7.23.3 7.24.1
@babel/plugin-syntax-import-attributes UPDATED 7.23.3 7.24.1
@babel/plugin-syntax-jsx UPDATED 7.23.3 7.24.1
@babel/plugin-syntax-typescript UPDATED 7.23.3 7.24.1
@babel/plugin-transform-arrow-functions UPDATED 7.23.3 7.24.1
@babel/plugin-transform-async-generator-functions UPDATED 7.23.4 7.24.3
@babel/plugin-transform-async-to-generator UPDATED 7.23.3 7.24.1
@babel/plugin-transform-block-scoped-functions UPDATED 7.23.3 7.24.1
@babel/plugin-transform-block-scoping UPDATED 7.23.4 7.24.5
@babel/plugin-transform-class-properties UPDATED 7.23.3 7.24.1
@babel/plugin-transform-class-static-block UPDATED 7.23.4 7.24.4
@babel/plugin-transform-classes UPDATED 7.23.5 7.24.5
@babel/plugin-transform-computed-properties UPDATED 7.23.3 7.24.1
@babel/plugin-transform-destructuring UPDATED 7.23.3 7.24.5
@babel/plugin-transform-dotall-regex UPDATED 7.23.3 7.24.1
@babel/plugin-transform-duplicate-keys UPDATED 7.23.3 7.24.1
@babel/plugin-transform-dynamic-import UPDATED 7.23.4 7.24.1
@babel/plugin-transform-exponentiation-operator UPDATED 7.23.3 7.24.1
@babel/plugin-transform-export-namespace-from UPDATED 7.23.4 7.24.1
@babel/plugin-transform-flow-strip-types UPDATED 7.23.3 7.24.1
@babel/plugin-transform-for-of UPDATED 7.23.6 7.24.1
@babel/plugin-transform-function-name UPDATED 7.23.3 7.24.1
@babel/plugin-transform-json-strings UPDATED 7.23.4 7.24.1
@babel/plugin-transform-literals UPDATED 7.23.3 7.24.1
@babel/plugin-transform-logical-assignment-operators UPDATED 7.23.4 7.24.1
@babel/plugin-transform-member-expression-literals UPDATED 7.23.3 7.24.1
@babel/plugin-transform-modules-amd UPDATED 7.23.3 7.24.1
@babel/plugin-transform-modules-commonjs UPDATED 7.23.3 7.24.1
@babel/plugin-transform-modules-systemjs UPDATED 7.23.3 7.24.1
@babel/plugin-transform-modules-umd UPDATED 7.23.3 7.24.1
@babel/plugin-transform-new-target UPDATED 7.23.3 7.24.1
@babel/plugin-transform-nullish-coalescing-operator UPDATED 7.23.4 7.24.1
@babel/plugin-transform-numeric-separator UPDATED 7.23.4 7.24.1
@babel/plugin-transform-object-rest-spread UPDATED 7.23.4 7.24.5
@babel/plugin-transform-object-super UPDATED 7.23.3 7.24.1
@babel/plugin-transform-optional-catch-binding UPDATED 7.23.4 7.24.1
@babel/plugin-transform-optional-chaining UPDATED 7.23.4 7.24.5
@babel/plugin-transform-parameters UPDATED 7.23.3 7.24.5
@babel/plugin-transform-private-methods UPDATED 7.23.3 7.24.1
@babel/plugin-transform-private-property-in-object UPDATED 7.23.4 7.24.5
@babel/plugin-transform-property-literals UPDATED 7.23.3 7.24.1
@babel/plugin-transform-react-display-name UPDATED 7.23.3 7.24.1
@babel/plugin-transform-regenerator UPDATED 7.23.3 7.24.1
@babel/plugin-transform-reserved-words UPDATED 7.23.3 7.24.1
@babel/plugin-transform-shorthand-properties UPDATED 7.23.3 7.24.1
@babel/plugin-transform-spread UPDATED 7.23.3 7.24.1
@babel/plugin-transform-sticky-regex UPDATED 7.23.3 7.24.1
@babel/plugin-transform-template-literals UPDATED 7.23.3 7.24.1
@babel/plugin-transform-typeof-symbol UPDATED 7.23.3 7.24.5
@babel/plugin-transform-typescript UPDATED 7.23.6 7.24.5
@babel/plugin-transform-unicode-escapes UPDATED 7.23.3 7.24.1
@babel/plugin-transform-unicode-property-regex UPDATED 7.23.3 7.24.1
@babel/plugin-transform-unicode-regex UPDATED 7.23.3 7.24.1
@babel/plugin-transform-unicode-sets-regex UPDATED 7.23.3 7.24.1
@babel/preset-env UPDATED 7.23.6 7.24.5
@babel/preset-typescript UPDATED 7.23.3 7.24.1
@babel/runtime UPDATED 7.23.6 7.24.5
@babel/template UPDATED 7.22.15 7.24.0
@babel/traverse UPDATED 7.23.6 7.24.5
@babel/types UPDATED 7.23.6 7.24.5
@eslint/js UPDATED 8.55.0 8.57.0
@graphql-codegen/add UPDATED 5.0.0 5.0.2
@graphql-codegen/cli UPDATED 5.0.0 5.0.2
@graphql-codegen/client-preset UPDATED 4.1.0 4.2.5
@graphql-codegen/core UPDATED 4.0.0 4.0.2
@graphql-codegen/gql-tag-operations UPDATED 4.0.1 4.0.6
@graphql-codegen/plugin-helpers UPDATED 5.0.1 5.0.3
@graphql-codegen/schema-ast UPDATED 4.0.0 4.0.2
@graphql-codegen/typed-document-node UPDATED 5.0.1 5.0.6
@graphql-codegen/typescript UPDATED 4.0.1 4.0.6
@graphql-codegen/typescript-operations UPDATED 4.0.1 4.2.0
@graphql-codegen/visitor-plugin-common UPDATED 4.0.1 5.1.0
@graphql-tools/apollo-engine-loader UPDATED 8.0.0 8.0.1
@graphql-tools/batch-execute UPDATED 9.0.2 9.0.4
@graphql-tools/code-file-loader UPDATED 8.0.3 8.1.1
@graphql-tools/delegate UPDATED 10.0.3 10.0.7
@graphql-tools/executor UPDATED 1.2.0 1.2.6
@graphql-tools/executor-graphql-ws UPDATED 1.1.1 1.1.2
@graphql-tools/executor-http UPDATED 1.0.5 1.0.9
@graphql-tools/executor-legacy-ws UPDATED 1.0.5 1.0.6
@graphql-tools/git-loader UPDATED 8.0.3 8.0.5
@graphql-tools/github-loader UPDATED 8.0.0 8.0.1
@graphql-tools/graphql-file-loader UPDATED 8.0.0 8.0.1
@graphql-tools/graphql-tag-pluck UPDATED 8.1.0 8.3.0
@graphql-tools/import UPDATED 7.0.0 7.0.1
@graphql-tools/json-file-loader UPDATED 8.0.0 8.0.1
@graphql-tools/load UPDATED 8.0.1 8.0.2
@graphql-tools/merge UPDATED 9.0.1 9.0.3
@graphql-tools/prisma-loader UPDATED 8.0.2 8.0.4
@graphql-tools/relay-operation-optimizer UPDATED 7.0.0 7.0.1
@graphql-tools/schema UPDATED 10.0.2 10.0.3
@graphql-tools/url-loader UPDATED 8.0.1 8.0.2
@graphql-tools/utils UPDATED 10.0.11 10.2.0
@graphql-tools/wrap UPDATED 10.0.1 10.0.5
@heroicons/react UPDATED 2.0.18 2.1.3
@humanwhocodes/config-array UPDATED 0.11.13 0.11.14
@humanwhocodes/object-schema UPDATED 2.0.1 2.0.3
@ioredis/commands REMOVED 1.2.0 -
@jridgewell/gen-mapping UPDATED 0.3.3 0.3.5
@jridgewell/resolve-uri UPDATED 3.1.1 3.1.2
@jridgewell/set-array UPDATED 1.1.2 1.2.1
@jridgewell/trace-mapping UPDATED 0.3.20 0.3.25
@jspm/core REMOVED 2.0.1 -
@noble/curves UPDATED 1.3.0 1.4.0
@noble/hashes UPDATED 1.3.3 1.4.0
@noble/secp256k1 ADDED - 1.7.1
@npmcli/agent UPDATED 2.2.0 2.2.2
@npmcli/arborist UPDATED 7.2.2 7.5.0
@npmcli/config UPDATED 8.0.3 8.3.0
@npmcli/disparity-colors DOWNGRADED 3.0.0 2.0.0
@npmcli/git UPDATED 5.0.3 5.0.6
@npmcli/installed-package-contents UPDATED 2.0.2 2.1.0
@npmcli/map-workspaces UPDATED 3.0.4 3.0.6
@npmcli/metavuln-calculator UPDATED 7.0.0 7.1.0
@npmcli/package-json UPDATED 5.0.0 5.1.0
@npmcli/promise-spawn UPDATED 7.0.0 7.0.1
@npmcli/query UPDATED 3.0.1 3.1.0
@npmcli/redact ADDED - 1.1.0
@npmcli/run-script UPDATED 7.0.2 8.1.0
@octokit/core UPDATED 5.0.2 5.2.0
@octokit/endpoint UPDATED 9.0.4 9.0.5
@octokit/graphql UPDATED 7.0.2 7.1.0
@octokit/openapi-types UPDATED 19.1.0 22.2.0
@octokit/plugin-paginate-rest UPDATED 9.1.5 9.2.1
@octokit/plugin-throttling UPDATED 8.1.3 8.2.0
@octokit/request UPDATED 8.1.6 8.4.0
@octokit/request-error UPDATED 5.0.1 5.1.0
@octokit/types UPDATED 12.4.0 13.5.0
@parcel/watcher UPDATED 2.4.0 2.4.1
@parcel/watcher-android-arm64 UPDATED 2.4.0 2.4.1
@parcel/watcher-darwin-arm64 UPDATED 2.4.0 2.4.1
@parcel/watcher-darwin-x64 UPDATED 2.4.0 2.4.1
@parcel/watcher-freebsd-x64 UPDATED 2.4.0 2.4.1
@parcel/watcher-linux-arm-glibc UPDATED 2.4.0 2.4.1
@parcel/watcher-linux-arm64-glibc UPDATED 2.4.0 2.4.1
@parcel/watcher-linux-arm64-musl UPDATED 2.4.0 2.4.1
@parcel/watcher-linux-x64-glibc UPDATED 2.4.0 2.4.1
@parcel/watcher-linux-x64-musl UPDATED 2.4.0 2.4.1
@parcel/watcher-wasm UPDATED 2.4.0 2.4.1
@parcel/watcher-win32-arm64 UPDATED 2.4.0 2.4.1
@parcel/watcher-win32-ia32 UPDATED 2.4.0 2.4.1
@parcel/watcher-win32-x64 UPDATED 2.4.0 2.4.1
@peculiar/webcrypto UPDATED 1.4.3 1.4.6
@polkadot-api/client ADDED - 0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0
@polkadot-api/json-rpc-provider ADDED - 0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0
@polkadot-api/json-rpc-provider-proxy ADDED - 0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0
@polkadot-api/metadata-builders ADDED - 0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0
@polkadot-api/substrate-bindings ADDED - 0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0
@polkadot-api/substrate-client ADDED - 0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0
@polkadot-api/utils ADDED - 0.0.1-492c132563ea6b40ae1fc5470dec4cd18768d182.1.0
@polkadot/api UPDATED 10.11.1 10.13.1
@polkadot/api-augment UPDATED 10.11.1 10.13.1
@polkadot/api-base UPDATED 10.11.1 10.13.1
@polkadot/api-contract UPDATED 10.11.1 10.13.1
@polkadot/api-derive UPDATED 10.11.1 10.13.1
@polkadot/extension-dapp UPDATED 0.46.6 0.46.9
@polkadot/extension-inject UPDATED 0.46.6 0.46.9
@polkadot/keyring UPDATED 12.6.1 12.6.2
@polkadot/networks UPDATED 12.6.1 12.6.2
@polkadot/rpc-augment UPDATED 10.11.1 10.13.1
@polkadot/rpc-core UPDATED 10.11.1 10.13.1
@polkadot/rpc-provider UPDATED 10.11.1 10.13.1
@polkadot/types UPDATED 10.11.1 10.13.1
@polkadot/types-augment UPDATED 10.11.1 10.13.1
@polkadot/types-codec UPDATED 10.11.1 10.13.1
@polkadot/types-create UPDATED 10.11.1 10.13.1
@polkadot/types-known UPDATED 10.11.1 10.13.1
@polkadot/types-support UPDATED 10.11.1 10.13.1
@polkadot/util UPDATED 12.6.1 12.6.2
@polkadot/util-crypto UPDATED 12.6.1 12.6.2
@polkadot/x-bigint UPDATED 12.6.1 12.6.2
@polkadot/x-fetch UPDATED 12.6.1 12.6.2
@polkadot/x-global UPDATED 12.6.1 12.6.2
@polkadot/x-randomvalues UPDATED 12.6.1 12.6.2
@polkadot/x-textdecoder UPDATED 12.6.1 12.6.2
@polkadot/x-textencoder UPDATED 12.6.1 12.6.2
@polkadot/x-ws UPDATED 12.6.1 12.6.2
@preact/preset-vite UPDATED 2.7.0 2.8.2
@prefresh/vite UPDATED 2.4.4 2.4.5
@remix-run/router UPDATED 1.13.1 1.16.0
@scure/base UPDATED 1.1.4 1.1.6
@semantic-release/github UPDATED 9.2.5 9.2.6
@semantic-release/npm UPDATED 11.0.2 11.0.3
@sigstore/bundle UPDATED 2.1.0 2.3.1
@sigstore/core ADDED - 1.1.0
@sigstore/protobuf-specs UPDATED 0.2.1 0.3.1
@sigstore/sign UPDATED 2.2.0 2.3.0
@sigstore/tuf UPDATED 2.2.0 2.3.2
@sigstore/verify ADDED - 1.2.0
@sindresorhus/merge-streams UPDATED 1.0.0 2.3.0
@sinonjs/commons UPDATED 3.0.0 3.0.1
@substrate/connect UPDATED 0.7.35 0.8.8
@substrate/connect-extension-protocol UPDATED 1.0.1 2.0.0
@substrate/connect-known-chains ADDED - 1.1.4
@substrate/light-client-extension-helpers ADDED - 0.0.4
@substrate/smoldot-light ADDED - 0.7.9
@substrate/ss58-registry UPDATED 1.44.0 1.47.0
@talismn/connect-components UPDATED 1.1.7 1.1.8
@talismn/connect-ui UPDATED 1.1.2 1.1.3
@talismn/connect-wallets UPDATED 1.2.3 1.2.5
@tanstack/react-table UPDATED 8.10.7 8.16.0
@tanstack/table-core UPDATED 8.10.7 8.16.0
@testing-library/react-hooks REMOVED 8.0.1 -
@tsconfig/node10 UPDATED 1.0.9 1.0.11
@types/babel__generator UPDATED 7.6.7 7.6.8
@types/babel__traverse UPDATED 7.20.4 7.20.5
@types/jest UPDATED 29.5.11 29.5.12
@types/json-stable-stringify REMOVED 1.0.36 -
@types/lodash UPDATED 4.14.202 4.17.0
@types/luxon UPDATED 3.3.7 3.4.2
@types/node UPDATED 18.19.3 18.19.31
@types/node-fetch ADDED - 2.6.11
@types/prop-types UPDATED 15.7.11 15.7.12
@types/react UPDATED 18.2.43 18.3.1
@types/react-dom UPDATED 18.2.17 18.3.0
@types/react-table UPDATED 7.7.18 7.7.20
@types/scheduler REMOVED 0.16.8 -
@types/semver UPDATED 7.5.6 7.5.8
@types/websocket ADDED - 1.0.10
@typescript-eslint/eslint-plugin UPDATED 5.62.0 7.8.0
@typescript-eslint/parser UPDATED 5.62.0 7.8.0
@typescript-eslint/scope-manager UPDATED 5.62.0 7.8.0
@typescript-eslint/type-utils UPDATED 5.62.0 7.8.0
@typescript-eslint/types UPDATED 5.62.0 7.8.0
@typescript-eslint/typescript-estree UPDATED 5.62.0 7.8.0
@typescript-eslint/utils UPDATED 5.62.0 7.8.0
@typescript-eslint/visitor-keys UPDATED 5.62.0 7.8.0
@walletconnect/core UPDATED 2.11.1 2.12.2
@walletconnect/logger UPDATED 2.0.1 2.1.2
@walletconnect/relay-api UPDATED 1.0.9 1.0.10
@walletconnect/sign-client UPDATED 2.11.1 2.12.2
@walletconnect/types UPDATED 2.11.1 2.12.2
@walletconnect/universal-provider UPDATED 2.11.1 2.12.2
@walletconnect/utils UPDATED 2.11.1 2.12.2
@whatwg-node/fetch UPDATED 0.9.14 0.9.17
@whatwg-node/node-fetch UPDATED 0.5.2 0.5.11
abort-controller REMOVED 3.0.0 -
acorn-walk UPDATED 8.3.1 8.3.2
agent-base UPDATED 7.1.0 7.1.1
ansi-escapes UPDATED 6.2.0 6.2.1
are-we-there-yet UPDATED 4.0.1 4.0.2
array-buffer-byte-length UPDATED 1.0.0 1.0.1
array-includes UPDATED 3.1.7 3.1.8
array.prototype.findlast ADDED - 1.2.5
array.prototype.toreversed ADDED - 1.1.2
array.prototype.tosorted UPDATED 1.1.2 1.1.3
arraybuffer.prototype.slice UPDATED 1.0.2 1.0.3
asynciterator.prototype REMOVED 1.0.0 -
autoprefixer UPDATED 10.4.16 10.4.19
available-typed-arrays UPDATED 1.0.5 1.0.7
babel-plugin-polyfill-corejs2 UPDATED 0.4.7 0.4.11
babel-plugin-polyfill-corejs3 UPDATED 0.8.7 0.10.4
babel-plugin-polyfill-regenerator UPDATED 0.5.4 0.6.2
binary-extensions UPDATED 2.2.0 2.3.0
browserslist UPDATED 4.22.2 4.23.0
buffer DOWNGRADED 6.0.3 5.7.1
bufferutil ADDED - 4.0.8
builtins UPDATED 5.0.1 5.1.0
cacache UPDATED 18.0.1 18.0.2
call-bind UPDATED 1.0.5 1.0.7
caniuse-lite UPDATED 1.0.30001568 1.0.30001614
chokidar UPDATED 3.5.3 3.6.0
cidr-regex UPDATED 4.0.3 4.0.5
cjs-module-lexer UPDATED 1.2.3 1.3.1
cli-table3 UPDATED 0.6.3 0.6.4
cluster-key-slot REMOVED 1.1.2 -
confbox ADDED - 0.1.7
cookie-es UPDATED 1.0.0 1.1.0
core-js-compat UPDATED 3.34.0 3.37.0
crossws UPDATED 0.1.1 0.2.4
css-select UPDATED 4.3.0 5.1.0
d UPDATED 1.0.1 1.0.2
data-view-buffer ADDED - 1.0.1
data-view-byte-length ADDED - 1.0.1
data-view-byte-offset ADDED - 1.0.0
dedent UPDATED 1.5.1 1.5.3
define-data-property UPDATED 1.1.1 1.1.4
denque REMOVED 2.1.0 -
diff UPDATED 5.1.0 5.2.0
dom-serializer UPDATED 1.4.1 2.0.0
domhandler UPDATED 4.3.1 5.0.3
domutils UPDATED 2.8.0 3.1.0
dotenv UPDATED 16.3.1 16.4.5
duplexify UPDATED 4.1.2 4.1.3
ed2curve ADDED - 0.3.0
electron-to-chromium UPDATED 1.4.610 1.4.751
es-abstract UPDATED 1.22.3 1.23.3
es-define-property ADDED - 1.0.0
es-errors ADDED - 1.3.0
es-iterator-helpers UPDATED 1.0.15 1.0.19
es-object-atoms ADDED - 1.0.0
es-set-tostringtag UPDATED 2.0.2 2.0.3
es5-ext UPDATED 0.10.62 0.10.64
es6-symbol UPDATED 3.1.3 3.1.4
esbuild-plugin-polyfill-node REMOVED 0.3.0 -
escalade UPDATED 3.1.1 3.1.2
eslint UPDATED 8.55.0 8.57.0
eslint-plugin-jest UPDATED 27.6.0 27.9.0
eslint-plugin-react UPDATED 7.33.2 7.34.1
eslint-plugin-react-hooks UPDATED 4.6.0 4.6.2
esniff ADDED - 2.0.1
event-target-shim REMOVED 5.0.1 -
fast-redact UPDATED 3.3.0 3.5.0
fastq UPDATED 1.15.0 1.17.1
flatted UPDATED 3.2.9 3.3.1
follow-redirects UPDATED 1.15.3 1.15.6
get-intrinsic UPDATED 1.2.2 1.2.4
get-symbol-description UPDATED 1.0.0 1.0.2
glob UPDATED 10.3.10 10.3.12
globalthis UPDATED 1.0.3 1.0.4
globby UPDATED 14.0.0 14.0.1
graphql-ws UPDATED 5.14.2 5.16.0
h3 UPDATED 1.10.2 1.11.1
has-property-descriptors UPDATED 1.0.1 1.0.2
has-proto UPDATED 1.0.1 1.0.3
has-tostringtag UPDATED 1.0.0 1.0.2
hasown UPDATED 2.0.0 2.0.2
he ADDED - 1.2.0
http-proxy-agent UPDATED 7.0.0 7.0.2
https-proxy-agent UPDATED 7.0.2 7.0.4
ignore UPDATED 5.3.0 5.3.1
immutable UPDATED 4.3.4 4.3.5
import-from-esm UPDATED 1.3.3 1.3.4
import-meta-resolve UPDATED 4.0.0 4.1.0
ini UPDATED 4.1.1 4.1.2
init-package-json UPDATED 6.0.0 6.0.2
internal-slot UPDATED 1.0.6 1.0.7
ioredis REMOVED 5.3.2 -
ip REMOVED 2.0.0 -
ip-address ADDED - 9.0.5
iron-webcrypto UPDATED 1.0.0 1.1.1
is-array-buffer UPDATED 3.0.2 3.0.4
is-cidr UPDATED 5.0.3 5.0.5
is-data-view ADDED - 1.0.1
is-map UPDATED 2.0.2 2.0.3
is-negative-zero UPDATED 2.0.2 2.0.3
is-set UPDATED 2.0.2 2.0.3
is-shared-array-buffer UPDATED 1.0.2 1.0.3
is-typed-array UPDATED 1.1.12 1.1.13
is-typedarray ADDED - 1.0.0
is-weakmap UPDATED 2.0.1 2.0.2
is-weakset UPDATED 2.0.2 2.0.3
istanbul-lib-instrument UPDATED 6.0.1 6.0.2
istanbul-reports UPDATED 3.1.6 3.1.7
jose UPDATED 5.1.3 5.2.4
jsbn ADDED - 1.1.0
json-stable-stringify REMOVED 1.1.0 -
jsonc-parser REMOVED 3.2.1 -
jsonify REMOVED 0.0.1 -
libnpmaccess UPDATED 8.0.2 8.0.4
libnpmdiff UPDATED 6.0.4 6.1.0
libnpmexec UPDATED 7.0.5 7.0.10
libnpmfund UPDATED 5.0.2 5.0.8
libnpmhook UPDATED 10.0.1 10.0.3
libnpmorg UPDATED 6.0.2 6.0.4
libnpmpack UPDATED 6.0.4 6.0.9
libnpmpublish UPDATED 9.0.3 9.0.6
libnpmsearch UPDATED 7.0.1 7.0.3
libnpmteam UPDATED 6.0.1 6.0.3
lilconfig UPDATED 3.0.0 3.1.1
listhen UPDATED 1.6.0 1.7.2
lodash.defaults REMOVED 4.2.0 -
lodash.isarguments REMOVED 3.1.0 -
lru-cache UPDATED 10.2.0 10.2.2
magic-string ADDED - 0.30.5
match-sorter UPDATED 6.3.1 6.3.4
mime UPDATED 4.0.0 4.0.3
minimatch UPDATED 9.0.3 9.0.4
mlly UPDATED 1.5.0 1.6.1
natural-compare-lite REMOVED 1.4.0 -
nock UPDATED 13.4.0 13.5.4
node-fetch-native UPDATED 1.6.2 1.6.4
node-gyp UPDATED 10.0.1 10.1.0
node-gyp-build UPDATED 4.7.1 4.8.0
node-html-parser ADDED - 6.1.13
normalize-url UPDATED 8.0.0 8.0.1
npm UPDATED 10.2.5 10.6.0
npm-package-arg UPDATED 11.0.1 11.0.2
npm-packlist UPDATED 8.0.1 8.0.2
npm-profile UPDATED 9.0.0 9.0.1
npm-registry-fetch UPDATED 16.1.0 16.2.1
npm-run-path UPDATED 5.1.0 5.3.0
nwsapi UPDATED 2.2.7 2.2.9
object-is UPDATED 1.1.5 1.1.6
object.entries UPDATED 1.1.7 1.1.8
object.fromentries UPDATED 2.0.7 2.0.8
object.hasown UPDATED 1.1.3 1.1.4
object.values UPDATED 1.1.7 1.2.0
ofetch UPDATED 1.3.3 1.3.4
optionator UPDATED 0.9.3 0.9.4
p-filter UPDATED 3.0.0 4.1.0
p-map UPDATED 5.5.0 7.0.2
pacote UPDATED 17.0.5 18.0.2
pako ADDED - 2.1.0
path-scurry UPDATED 1.10.1 1.10.2
pkg-types UPDATED 1.0.3 1.1.0
possible-typed-array-names ADDED - 1.0.0
postcss UPDATED 8.4.32 8.4.38
postcss-modules-extract-imports UPDATED 3.0.0 3.1.0
postcss-modules-local-by-default UPDATED 4.0.3 4.0.5
postcss-modules-scope UPDATED 3.0.0 3.2.0
postcss-selector-parser UPDATED 6.0.13 6.0.16
preact UPDATED 10.19.3 10.21.0
proc-log UPDATED 3.0.0 4.2.0
process REMOVED 0.11.10 -
proggy ADDED - 2.0.0
promise-call-limit UPDATED 1.0.2 3.0.1
promzard UPDATED 1.0.0 1.0.1
pure-rand UPDATED 6.0.4 6.1.0
radix3 UPDATED 1.1.0 1.1.2
react UPDATED 18.2.0 18.3.1
react-dom UPDATED 18.2.0 18.3.1
react-error-boundary REMOVED 3.1.4 -
react-hook-form UPDATED 7.49.0 7.51.3
react-is UPDATED 18.2.0 18.3.1
react-router UPDATED 6.20.1 6.23.0
react-router-dom UPDATED 6.20.1 6.23.0
read UPDATED 2.1.0 3.0.1
readable-stream DOWNGRADED 4.4.2 3.6.2
redis-errors REMOVED 1.2.0 -
redis-parser REMOVED 3.0.0 -
reflect.getprototypeof UPDATED 1.0.4 1.0.6
regenerator-runtime UPDATED 0.14.0 0.14.1
regexp.prototype.flags UPDATED 1.5.1 1.5.2
remove-accents UPDATED 0.4.2 0.5.0
rfdc UPDATED 1.3.0 1.3.1
safe-array-concat UPDATED 1.0.1 1.1.2
safe-regex-test UPDATED 1.0.0 1.0.3
sass UPDATED 1.69.5 1.75.0
scale-ts ADDED - 1.6.0
scheduler UPDATED 0.23.0 0.23.2
semver UPDATED 7.5.4 7.6.0
set-function-length UPDATED 1.1.1 1.2.2
set-function-name UPDATED 2.0.1 2.0.2
side-channel UPDATED 1.0.4 1.0.6
sigstore UPDATED 2.1.0 2.3.0
smoldot UPDATED 2.0.7 2.0.22
socks UPDATED 2.7.1 2.8.3
socks-proxy-agent UPDATED 8.0.2 8.0.3
source-map UPDATED 0.6.1 0.7.4
source-map-js UPDATED 1.0.2 1.2.0
spdx-exceptions UPDATED 2.3.0 2.5.0
spdx-expression-parse UPDATED 3.0.1 4.0.0
spdx-license-ids UPDATED 3.0.16 3.0.17
sprintf-js UPDATED 1.0.3 1.1.3
stack-trace ADDED - 1.0.0-pre2
standard-as-callback REMOVED 2.1.0 -
string_decoder DOWNGRADED 1.3.0 1.1.1
string.prototype.matchall UPDATED 4.0.10 4.0.11
string.prototype.trim UPDATED 1.2.8 1.2.9
string.prototype.trimend UPDATED 1.0.7 1.0.8
string.prototype.trimstart UPDATED 1.0.7 1.0.8
sucrase UPDATED 3.34.0 3.35.0
tailwindcss UPDATED 3.3.6 3.4.3
tar UPDATED 6.2.0 6.2.1
tough-cookie UPDATED 4.1.3 4.1.4
traverse UPDATED 0.6.7 0.6.9
ts-api-utils ADDED - 1.3.0
tuf-js UPDATED 2.1.0 2.2.0
type-fest UPDATED 4.8.3 4.18.0
typed-array-buffer UPDATED 1.0.0 1.0.2
typed-array-byte-length UPDATED 1.0.0 1.0.1
typed-array-byte-offset UPDATED 1.0.0 1.0.2
typed-array-length UPDATED 1.0.4 1.0.6
typedarray-to-buffer ADDED - 3.1.5
typedarray.prototype.slice ADDED - 1.0.3
typescript UPDATED 4.9.5 5.4.5
ufo UPDATED 1.4.0 1.5.3
unstorage UPDATED 1.10.1 1.10.2
urlpattern-polyfill UPDATED 9.0.0 10.0.0
use-sync-external-store UPDATED 1.2.0 1.2.2
utf-8-validate ADDED - 5.0.10
utility-types UPDATED 3.10.0 3.11.0
vite UPDATED 3.2.7 3.2.10
web-streams-polyfill UPDATED 3.2.1 3.3.3
webcrypto-core UPDATED 1.7.7 1.7.9
websocket ADDED - 1.0.34
which-collection UPDATED 1.0.1 1.0.2
which-typed-array UPDATED 1.1.13 1.1.15
word-wrap ADDED - 1.2.5
ws UPDATED 8.15.0 8.17.0
yaeti ADDED - 0.0.6
yaml UPDATED 2.3.4 2.4.2
yup UPDATED 1.3.2 1.4.0

@ebma
Copy link
Member

ebma commented May 31, 2024

@Sharqiewicz I changed the calculation of the griefing collateral to be a hook instead of a simple function. This makes testing more complex so for simplicity I just removed the test cases you added 😬 I think mocking the hooks could be a little too much. WDYT?

Besides that, I fixed all the remaining issue and this PR is ready for a final review.

Copy link
Collaborator Author

@Sharqiewicz Sharqiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebma Very good changes, very good collaboration on this task. I added 2 comments on what we could improve. As for testing, I think we could test the hook using @testing-library/react-hooks

src/helpers/spacewalk.ts Outdated Show resolved Hide resolved
src/pages/bridge/helpers.ts Outdated Show resolved Hide resolved
@ebma
Copy link
Member

ebma commented Jun 5, 2024

As for testing, I think we could test the hook using @testing-library/react-hooks

I tried adding a test with that but I wasn't able to make this run unfortunately. Some things I learned:

  • There is an extra preact port of this library https://github.com/testing-library/preact-hooks-testing-library. The last commit was 3 years ago, I'm not sure if this library is still required or not.
  • renderHook is also available from '@testing-library/react', see note here.
  • Adding the statement import { renderHook, act } from '@testing-library/react'; (or from the preact library) will make jest fail to compile the testing fail.
image

I did some googling but the things mentioned didn't help. For example, this comment suggests babel-jest. I saw that we already use that however, see here and here.

@Sharqiewicz any ideas?

@Sharqiewicz
Copy link
Collaborator Author

@ebmai have implemented hook tests using @testing-library/react-hooks and @testing-library/preact.

The renderHook function from @testing-library/react-hooks is utilized to properly render the hook during the test.
The waitFor function from @testing-library/preact is used to detect changes in the hook. In this scenario, the hook initially returns 0, and then, after the useEffect is fired, it returns the calculated amount.
Although waitForNextUpdate and waitFor are available in renderHook for detecting changes, they did not work as expected in this context.

Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for fixing the test setup 🙏

Should we remove the dependencies to the pract-testing library then, if we don't need or use it?

Also, one thing that is unfortunate about the tests. Looking at the 'should calculate griefing collateral correctly' test case: It has the same structure as all the failing tests, except that we have another call with waitFor() to wait for the useEffect hook to fire. While this test is great, this means that our other test cases for the invalid value are not because if

    expect(result.current.eq(new Big(0))).toBeTruthy();

Always works, no matter if it's the happy or unhappy path, then this condition is not enough. Maybe we can add a timeout and check that this value doesn't change within like 1 second? Or do you have another idea @Sharqiewicz?

@ebma
Copy link
Member

ebma commented Jun 20, 2024

@pendulum-chain/product please review this

@vadaynujra
Copy link

vadaynujra commented Jun 20, 2024

@ebma I tested the following scenario:
Account with 0 PEN requesting bridging of 500 EURC - gives an accurate error message.
image

@vadaynujra
Copy link

vadaynujra commented Jun 20, 2024

The calculation of the security deposit is also accurate 43 PEN at the current value equals 2.5 Euros.
image

Looks good to be released @ebma @Sharqiewicz

@ebma
Copy link
Member

ebma commented Jun 20, 2024

@Sharqiewicz I improved the test now, please have another look and see if it looks okay to you. Then we merge 👍

Thanks for the review @vadaynujra

@Sharqiewicz
Copy link
Collaborator Author

@ebma Great changes. I approve ✅

@ebma ebma merged commit 98bc392 into main Jun 26, 2024
5 checks passed
@ebma ebma deleted the 416-fix-the-calculation-of-the-security-deposit-amount branch June 26, 2024 07:48
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.

Fix the calculation of the security deposit amount
3 participants