-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: DNS example #1059
feat: DNS example #1059
Conversation
cfb859a
to
5e94897
Compare
ae4465b
to
f715bd8
Compare
d430382
to
e62d138
Compare
f715bd8
to
4e6241d
Compare
4e6241d
to
fb5aa3f
Compare
d2e0e46
to
de5d56d
Compare
fb5aa3f
to
e2c775a
Compare
e2c775a
to
89a3b75
Compare
de5d56d
to
1d7e40f
Compare
89a3b75
to
7d87a9d
Compare
cli/accounts/nullifier_queue_pubkey_44J4oDXpjPAbzHCSc24q7NEiPekss4sAbLd8ka4gd9CZ.json
Outdated
Show resolved
Hide resolved
7d87a9d
to
9749ed2
Compare
Thanks for adding the changes! However, the instructions sent a lot of redundant data because the complete The pattern we implement for example in the token program is to create an additional input data struct and just send the most necessary data for the operation instead of the complete compressed account including its Another more complex example where I use a different input and data struct. Since this is a minimal example optimizing instruction data might be overkill up to you to what degree you think it makes sense to optimize. cc @SwenSchaeferjohann |
I'm actually fine with optimizing instruction data now - it will give us an idea how a generic instruction is going to look like and whether there is any room for improvement or having some convenience structs. One I can already think of is packing all |
The address convenience struct makes sense. From a security standpoint this could help to incentivize secure patterns since seeds need to be checked onchain. |
7d0f247
to
1ff4e84
Compare
2216f3d
to
cc35240
Compare
- `AsByteVec`, providing `as_byte_vec()` method, guarantees consistent way of serializing types to 2D byte vectors before hashing. We provide default implementations for primitives. More complex types need to implement `IntoBytes` themselves. - By using 2D vectors, we make it possible to represent structs with multiple fields. This way, we can handle struct fields (nested structs) the same way as primitive fields and deal with all types by using one trait. - The reason behing using vectors instead of slices is that in some cases, we cannot just cast the type without defining custom bytes. Vectors, although they might introduce copies, make sure we always own the bytes we are creating. - `#[derive(LightHasher)]` implements `AsByteVec` and `DataHasher` traits. The `DataHasher` implementation takes bytes returned by `AsByteVec` as an input.
- empty string - `Option` with `Some` and `None` and assertion that `None != Some(0)` - array (including an empty one)
14c9f46
to
84c55be
Compare
Add an example program which stores simple DNS records as compressed accounts. It consists of the following endpoints: - create - update - delete Currently it has only Rust SBF tests. Co-authored-by: Michal Rostecki <vadorovsky@protonmail.com>
This gives a security guarantee for the program. Allowing the caller to pass a custom seed was not secure.
- Avoid sending a full `CompressedAccount`. - SDK changes which make it easier: - Add `MerkleOutputContext` which stores only the Merkle tree pubkey. - Add `PackedAddressContext` for address Merkle tree and queue. - Add `pack_*` methods for above. - Add separate methods for single Merkle contexts (e.g. `pack_merkle_context`) and multiple ones (e.g. `pack_merkle_contexts`). - In contrast to the equivalents existing in system program SDK, do everything in one `iter().collect()` chain, not in 3 loops. - Add `RemainingAccounts` structure which takes out the burden of iteracting with `HashMap` directly.
4866c74
to
4a0b569
Compare
This reverts commit 08b666a.
Add an example program which stores simple DNS records as compressed
accounts. It consists of the following endpoints:
Currently it has only Rust SBF tests.