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: general fixes #2245

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
run: |
cd website
yarn
yarn crowdin:upload
yarn build

- name: Commit build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
run: |
cd website
yarn
yarn crowdin:upload
yarn crowdin:download
yarn build

Expand Down
14 changes: 5 additions & 9 deletions docs/2.build/2.smart-contracts/anatomy/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,21 @@ You can choose between two types of collections:

Understanding how the contract stores and loads both types of collections is crucial to decide which one to use.

<details>

<summary> Native vs SDK Collections </summary>
:::tip Native vs SDK Collections

Use native collections for small amounts of data that need to be accessed all together, and SDK collections for large amounts of data that do not need to be accessed all together.

If your collection has up to 100 entries, it's acceptable to use the native collection, as it might be simpler since you don't have to manage prefixes as we do with SDK collections.

However, if your collection has 1,000 or more entries, it's better to use SDK collection. [This user test](https://github.com/volodymyr-matselyukh/near-benchmarking) shows that running the `contains` method on a native `HashSet i32` consumes 41% more gas compared to SDK `IterableSet i32`.
If your collection has up to 100 entries, it's acceptable to use the native collection. For larger ones, prefer to use SDK collection. For comparison please refer to [this benchmark](https://www.github.com/volodymyr-matselyukh/near-benchmarking).

</details>
:::

<details>

<summary> How the State is Handled </summary>
<summary> How the State is Handled </summary>

Each time the contract is executed, the first thing it will do is to read the values and [deserialize](./serialization.md) them into memory, and after the function finishes, it will [serialize](./serialization.md) and write the values back to the database.

That means the contract will load your native collections fully into memory before the contract's method execution. The method you invoke may not even use the loaded collection. This will have impact on GAS you spend for methods in your contract. So, using native collection which will have more than 100 entries as the top level property of your contract is a bad practice.
For native collections, the contract will fully load the collection into memory before all methods execution. The method you invoke may not even use the loaded collection. Know that this will have impact on GAS you spend for methods in your contract.

</details>

Expand Down
11 changes: 2 additions & 9 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@
"wait-on": "^5.2.0"
},
"dependencies": {
"@crowdin/cli": "^4.1.1",
"@crowdin/cli": "^4.2.0",
"@docusaurus/core": "^3.5.2",
"@docusaurus/plugin-ideal-image": "^3.5.2",
"@docusaurus/plugin-sitemap": "^3.5.2",
"@docusaurus/preset-classic": "^3.5.2",
"@docusaurus/theme-mermaid": "^3.5.2",
"@feelback/react": "^0.3.4",
"@near-wallet-selector/core": "^8.5.1",
"@near-wallet-selector/here-wallet": "^8.5.1",
"@near-wallet-selector/modal-ui": "^8.5.1",
"@near-wallet-selector/my-near-wallet": "^8.5.1",
"@rudderstack/analytics-js": "^3.0.0-beta.20",
"@saucelabs/theme-github-codeblock": "^0.2.3",
"axios": "^1.7.4",
"bootstrap": "^5.3.2",
Expand All @@ -62,9 +57,7 @@
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"react-monaco-editor": "^0.54.0",
"rxjs": "^7.8.1",
"sass": "^1.69.5",
"url": "^0.11.3",
"zustand": "^4.4.4"
"url": "^0.11.3"
}
}
7 changes: 0 additions & 7 deletions website/src/theme/Root.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// https://docusaurus.io/docs/swizzling#wrapper-your-site-with-root
import '@near-wallet-selector/modal-ui/styles.css';

import React, { useEffect } from 'react';
import Gleap from "gleap"; // See https://gleap.io/docs/javascript/ and https://app.gleap.io/projects/62697858a4f6850036ae2e6a/widget
import { withRouter } from 'react-router-dom';
Expand All @@ -26,13 +23,9 @@ function Root({ children, location }) {

useEffect(() => {
if (isBrowser) {
const { initRudderAnalytics, recordPageView } = require('./scripts/rudderstack');

Gleap.initialize('K2v3kvAJ5XtPzNYSgk4Ulpe5ptgBkIMv');

const rudderAnalytics = initRudderAnalytics();
recordPageView(rudderAnalytics, location.pathname);

// Initialize PostHog
posthog.init(customFields.REACT_APP_PUBLIC_POSTHOG_KEY, {
api_host: customFields.REACT_APP_PUBLIC_POSTHOG_HOST,
Expand Down
153 changes: 0 additions & 153 deletions website/src/theme/scripts/rudderstack.js

This file was deleted.

Loading
Loading