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

Feature/init with root #2

Closed
wants to merge 40 commits into from
Closed

Feature/init with root #2

wants to merge 40 commits into from

Conversation

StanChe
Copy link
Owner

@StanChe StanChe commented May 27, 2024

Initializing a tree with a root

This PR modifies the account-compression program allowing the creation of the trees that were prepared offline. It allows creating trees with or without a canopy.
Verification of the validity, events, any additional checks and fields (URLs, hashes, etc.), and any additional permissions for the created tree are left to the discretion of the calling program.

The workflow

sequenceDiagram
autonumber
actor TC as Tree creator program
participant AC as account-compression
activate TC
TC ->> AC: prepare_tree(tree_account, max_depth, max_buffer_size)
AC -> AC: initializes the header, but not the tree
loop For a tree with a canopy
TC ->> AC: append_canopy_nodes(tree_account, start_index, canopy_nodes)
end
TC ->> AC: finalize_merkle_tree_with_root(tree_account, root, rightmost_leaf, rightmost_index, proof)
AC -> AC: verifies the canopy is valid
AC -> AC: initializes the tree
Loading

This change is inspired by solana-labs#6441

Next steps

The current master is giving similar errors when building the contract:

...
 Compiling spl-account-compression v0.3.0 (xxx/solana-program-library/account-compression/programs/account-compression)
Error: Function _ZN23spl_account_compression23spl_account_compression30finalize_merkle_tree_with_root17h9805555f38fa9781E Stack offset of 4976 exceeded max offset of 4096 by 880 bytes, please minimize large stack variables
Error: Function _ZN23spl_account_compression23spl_account_compression12replace_leaf17h2b3444654638b071E Stack offset of 4976 exceeded max offset of 4096 by 880 bytes, please minimize large stack variables
Error: Function _ZN23spl_account_compression23spl_account_compression11verify_leaf17ha925f198f492934cE Stack offset of 4912 exceeded max offset of 4096 by 816 bytes, please minimize large stack variables
Error: Function _ZN23spl_account_compression23spl_account_compression16insert_or_append17hc0d69cec9d07924fE Stack offset of 4952 exceeded max offset of 4096 by 856 bytes, please minimize large stack variables
    Finished release [optimized] target(s) in 30.04s
...

This PR does not change that. It appears to be related to the anchor - solana sdk versions on master. All the existing and the new tests are working fine though, but whether this might create some issues during deploys is unknown.

As a separate note empty_node_cached in the concurent merkle tree library was used as if it was modifying the passed in cache, but in fact it was not, this PR adds empty_node_cached_mut that caches the already processed nodes, but it doesn't change the existing logic.

@StanChe StanChe force-pushed the feature/init_with_root branch from b208909 to 4756083 Compare May 27, 2024 10:16
@StanChe StanChe force-pushed the feature/init_with_root branch from 612330e to 2191e25 Compare June 25, 2024 11:42
@StanChe StanChe force-pushed the feature/init_with_root branch 2 times, most recently from 34158c5 to f343436 Compare September 11, 2024 14:15
tests for the canopy are included, the bpf/sbf tests for the contract will follow
tests will be added later in a form of integration tests
next steps:
- verify the zero-ed check is valid for the tree;
- drop is_initialized_wrapped method.
…tree_with_root as the merkle tree account will not be zeroed at that point
…ounts + updated comments on append_canopy_nodes to reflect the possibility to replace those
…initialization call in a wrapper as it started reporting a stack overflow
@StanChe StanChe force-pushed the feature/init_with_root branch from f343436 to 7cda6c4 Compare September 11, 2024 14:31
bumped the node version to the latest used in some other flows trying to narrow down the build issue
tonton-sol and others added 15 commits September 12, 2024 14:39
…sfers with the transfer-fee extension. (solana-labs#7171)

* Added transfer_fee extension

* added create_transfer_checked_with_fee_instruction_with_extra_metas

* add support for transfer-hook account resolution in transfer_with_fee

* add offchain helper `invoke_transfer_checked_with_fee`

* Nit: Added better description to function

* add test for offchain helper `create_transfer_checked_with_fee_instruction_with_extra_metas`

* add `success_transfer_with_fee` test

* add test `success_transfers_with_fee_using_onchain_helper`

* Add cli test `transfer_hook_with_transfer_fee`

* fix: correctly use the new onchain helper in test

* Remove unneeded helpers
* Revert "build(deps-dev): bump @typescript-eslint/parser from 8.4.0 to 8.5.0 (solana-labs#7257)"

This reverts commit 3522730.

* Revert "build(deps-dev): bump @typescript-eslint/eslint-plugin from 8.4.0 to 8.5.0 (solana-labs#7258)"

This reverts commit eeb0b29.
Bumps [body-parser](https://github.com/expressjs/body-parser) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `body-parser` from 1.20.2 to 1.20.3
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](expressjs/body-parser@1.20.2...1.20.3)

Updates `express` from 4.19.2 to 4.21.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
- [Commits](expressjs/express@4.19.2...4.21.0)

---
updated-dependencies:
- dependency-name: body-parser
  dependency-type: indirect
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* build(deps): bump uint from 0.9.1 to 0.10.0

Bumps [uint](https://github.com/paritytech/parity-common) from 0.9.1 to 0.10.0.
- [Commits](paritytech/parity-common@uint-v0.9.1...uint-v0.10.0)

---
updated-dependencies:
- dependency-name: uint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Allow missing docs for new version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jon C <[email protected]>
Bumps [rollup](https://github.com/rollup/rollup) from 4.21.2 to 4.21.3.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](rollup/rollup@v4.21.2...v4.21.3)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tsx](https://github.com/privatenumber/tsx) from 4.19.0 to 4.19.1.
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](privatenumber/tsx@v4.19.0...v4.19.1)

---
updated-dependencies:
- dependency-name: tsx
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…traction (solana-labs#6955)

* add proof generation logic for confidential mint and burn

* add proof extraction logic for confidential mint and burn

* add tests for confidential mint and burn

* Apply suggestions from code review

Co-authored-by: Jon C <[email protected]>

* add equality and range proof to confidential mint proof

* rename `aes_key` to `source_aes_key` in confidential burn

---------

Co-authored-by: Jon C <[email protected]>
Bumps [turbo](https://github.com/vercel/turborepo) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/vercel/turborepo/releases)
- [Changelog](https://github.com/vercel/turborepo/blob/main/release.md)
- [Commits](vercel/turborepo@v2.1.1...v2.1.2)

---
updated-dependencies:
- dependency-name: turbo
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…-labs#7273)

Bumps [eslint-config-turbo](https://github.com/vercel/turborepo/tree/HEAD/packages/eslint-config-turbo) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/vercel/turborepo/releases)
- [Changelog](https://github.com/vercel/turborepo/blob/main/release.md)
- [Commits](https://github.com/vercel/turborepo/commits/v2.1.2/packages/eslint-config-turbo)

---
updated-dependencies:
- dependency-name: eslint-config-turbo
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…s#7274)

Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 29.5.12 to 29.5.13.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#7275)

Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 10.0.7 to 10.0.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

---
updated-dependencies:
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix Transfer amount for 1 token in token-2022.md

* Change the token number to 0.75 for clarity

Co-authored-by: Jon C <[email protected]>

* Update the byte-represented data

---------

Co-authored-by: Jon C <[email protected]>
@github-actions github-actions bot added the stale label Sep 30, 2024
@github-actions github-actions bot closed this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants