Skip to content

Conversation

@joncinque
Copy link
Contributor

Problem

It's time to move over the SPL program implementations to their specific repos, but it hasn't been done.

Summary of changes

Following the PR for the token-metadata program at solana-program/token-metadata#1, I ran:

# add the remote for the source repo
git remote add spl https://github.com/solana-labs/solana-program-library.git
# fetch the master from spl under a different local branch
git fetch spl master:fromspl
git switch fromspl
# be safe, remove the remote
git remote rm spl
# filter the stake related files
python3 ../../git-filter-repo \
  --path token/transfer-hook/example \
  --path token/transfer-hook/interface \
  --path token/transfer-hook/cli \
  --path-rename token/transfer-hook/example:program \
  --path-rename token/transfer-hook/interface:interface \
  --path-rename token/transfer-hook/cli:clients/cli \
  --force
# re-add this repo
git remote add origin [email protected]:joncinque/transfer-hook.git
git fetch origin main
git switch main
git switch fromspl
git rebase main

joncinque and others added 30 commits December 14, 2024 00:36
* transfer-hook-cli: Create tool for creating account metas

* Add to token CI, remove from general CI

* Review feedback: change command name and check account
This PR swaps any calls to the `entrypoint!` macro with the full path, ie: `solana_program::entrypoint!`.

This will play a role in the effort to introduce a linting standard to SPL.
This PR adds comment formatting configurations to the repository's `rustfmt.toml` file, and the associated changes from `cargo +nightly fmt --all`.

Comment width 80.
* repo: Update to 1.17.6 with script

* Update lockfile

* Remove disabling feature in token-cli tests
…alizing. (#5894)

* Added update function for ExtraAccountMetaList

* Updated interface to handle new update instruction

* Updated Cli to handle update command

* updated example program to handle updating

* Rust fmt trailing whitespace fix

* Removed unused variable

* Added more explicit update instruction doc comment

* Allow for resizing to smaller account size

* Removed system program from update instruction

* Added helper fn to calculate transfer lamports

* Added unit tests for update function

* Added unit test for update instruction

* removed unnecessary  commented out code

* re-added checks on initialization

* turned of zero_init for realloc for performance

* Fixed update doc comments

* Used block-scoping rather than explicit drop()

* Removed unnecessary convert to vec

* refactored updated test into single test

* added additional off-chain test of update instruct

* made on-chain invoke update test to match original

* moved helper function up to others

* refactored create and update with helpers

* rustfmt: fix

* rustfmt: fix

* removed commented out system program in update

* renamed helpers and removed unnecessary helper

* moved test helper up

* fixed test attribute location

* removed multiple init extra account metas in test

* added instruction assert to update test

* renamed transfer address to extra account metas

* rustfmt: comment fix

* clippy: fix

* added update test with simple PDA

* made more changes to updated metas in test

* added check for if extra metas have be initialized

* spelling fix

* fixed initialized condition
* token-2022: Bump to 1.0.0 for first prod release

* Update security.txt
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.29 to 0.3.30.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](rust-lang/futures-rs@0.3.29...0.3.30)

---
updated-dependencies:
- dependency-name: futures-util
  dependency-type: direct:production
  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>
* transfer hook cli: refactor account meta parsing into new module

* transfer hook cli: refactor account meta parsing to deal directly with `ExtraAccountMeta`s

* tlv account resolution: add serde-traits to seeds

* transfer hook cli: add transfer hook config file support

* transfer hook cli: help docs

* address some nits

* refactor out raw discriminator use

* transfer hook cli: refactor transfer hook accounts with better use of serde

* remove snake case

* restrict role configs to `Role` object

* update documentation

* drop kebab case
Bumps [serde_yaml](https://github.com/dtolnay/serde-yaml) from 0.9.27 to 0.9.30.
- [Release notes](https://github.com/dtolnay/serde-yaml/releases)
- [Commits](dtolnay/serde-yaml@0.9.27...0.9.30)

---
updated-dependencies:
- dependency-name: serde_yaml
  dependency-type: direct:production
  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 [serde](https://github.com/serde-rs/serde) from 1.0.194 to 1.0.195.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.194...v1.0.195)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  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>
This PR adds a new offchain helper for adding the necessary account metas for an 
`ExecuteInstruction` to the SPL Transfer Hook interface, deprecating the old 
one.

As described in #6064, the offchain helper in Token2022 was using the original 
offchain helper from the SPL Transfer Hook interface incorrectly when resolving 
extra account metas for a transfer.

In order to provide a safer, more robust helper, this new function takes the 
instruction, fetch account data function, as well as the individual arguments 
for `instruction::execute(..)`. This will help to ensure Token2022 as well as 
anyone else using the helpers from the SPL Transfer Hook interface are properly 
resolving the necessary additional accounts.

Note: Although deprecated, the original helper in the SPL Transfer Hook 
interface is not broken. It's just less safe to use than this new helper, since 
it can easily be misused.
As another step for solving #6064, the onchain helpers now need to be
replaced. This PR makes that change in the SPL Transfer Hook interface.

Specifically, this commit adds a new `add_extra_accounts_for_execute_cpi(..)`
helper and deprecates the old one.

Like its offchain counterpart, this new helper requires the arguments for
`instruction::execute(..)` in order to validate that a proper
`ExecuteInstruction` is being resolved, thus ensuring proper account resolution.

This function, like its now-deprecated sibling, is designed specifically to add
extra accounts to an `ExecuteInstruction` CPI instruction. It's expected that
the instruction being provided is a CPI instruction for another program, and
that program will CPI to the transfer hook program in question. Details about
this have been added to the helper's documentation.
* token 2022: upgrade sdk to 1.17.13

* Upgrade all remaining packages

---------

Co-authored-by: Jon C <[email protected]>
* token 2022 & transfer hook: drop deprecated helpers

* token js: drop deprecated helper
* transfer hook: bump interface

* transfer hook: bump cli
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.14.0 to 1.14.1.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](Lokathor/bytemuck@v1.14.0...v1.14.1)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: direct:production
  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>
* Update solana dependency version to allow 2.0.0

* Fix version number in solana-version.sh

* Fix version numbers

* Revert solana-version.sh with note

* Revert Anchor version change

* Relax dependency version upper bound to 2
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.195 to 1.0.196.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.195...v1.0.196)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  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 [serde_yaml](https://github.com/dtolnay/serde-yaml) from 0.9.30 to 0.9.31.
- [Release notes](https://github.com/dtolnay/serde-yaml/releases)
- [Commits](dtolnay/serde-yaml@0.9.30...0.9.31)

---
updated-dependencies:
- dependency-name: serde_yaml
  dependency-type: direct:production
  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>
dependabot bot and others added 26 commits December 14, 2024 00:36
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.30 to 0.3.31.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](rust-lang/futures-rs@0.3.30...0.3.31)

---
updated-dependencies:
- dependency-name: futures-util
  dependency-type: direct:production
  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 [bytemuck](https://github.com/Lokathor/bytemuck) from 1.18.0 to 1.19.0.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](Lokathor/bytemuck@v1.18.0...v1.19.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.128 to 1.0.129.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@1.0.128...1.0.129)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  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 [serde_json](https://github.com/serde-rs/json) from 1.0.129 to 1.0.132.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@1.0.129...1.0.132)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  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 [tokio](https://github.com/tokio-rs/tokio) from 1.40.0 to 1.41.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.40.0...tokio-1.41.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.210 to 1.0.211.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.210...v1.0.211)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  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 [serde](https://github.com/serde-rs/serde) from 1.0.211 to 1.0.213.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.211...v1.0.213)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  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 [serde](https://github.com/serde-rs/serde) from 1.0.213 to 1.0.214.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.213...v1.0.214)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  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>
* Run update script, update curve25519-dalek dep, rust

* Run clippy + fmt

* Add workspace lints, start fixing doc comments

* Update doc comments for clippy

* Re-run cargo fmt after doc comment update

* Update solana-version

* Update CI jobs
* transfer-hook-interface: Remove solana-program dependency

#### Problem

The transfer-hook-interface pulls in solana-program, but it doesn't need
to.

#### Summary of changes

Use the component crates. The only breaking change is the re-exports. It
still uses a dev-dependency on solana-program since the system program
id isn't available yet outside of solana-program.

* Add missing solana-pubkey feature

* Add all test programs

* Run cargo fmt

* Fixup imports
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.68 to 2.0.0.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](dtolnay/thiserror@1.0.68...2.0.0)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.41.0 to 1.41.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.41.0...tokio-1.41.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  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 [serde](https://github.com/serde-rs/serde) from 1.0.214 to 1.0.215.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.214...v1.0.215)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  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 [serde_json](https://github.com/serde-rs/json) from 1.0.132 to 1.0.133.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.132...v1.0.133)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  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>
* token: Fix typos

#### Problem

There are typos in the token code, and people sometimes fix them, but
mostly don't.

#### Summary of changes

Starting with the `token/*` directory, fix all typos or properly put
them between backticks if they're code.

These were all found using `cargo spellcheck` and a specialized
dictionary with programming / Solana / ZK terminology. Once all of the
typos are fixed, then we can add the spellchecking to CI.

* Update doctests
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.19.0 to 1.20.0.
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](Lokathor/bytemuck@v1.19.0...v1.20.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.41.1 to 1.42.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.41.1...tokio-1.42.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.215 to 1.0.216.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](serde-rs/serde@v1.0.215...v1.0.216)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  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>
@joncinque joncinque requested a review from febo December 13, 2024 23:37
Copy link

@febo febo left a comment

Choose a reason for hiding this comment

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

👌

@joncinque joncinque merged commit e00f3b5 into solana-program:main Dec 17, 2024
@joncinque joncinque deleted the fromspl branch December 17, 2024 16:11
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.

8 participants