Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

change: Use transaction metadata instead of datum in bridge transfers - #1130

Closed
AmbientTea wants to merge 12 commits into
masterfrom
bridge-c-to-pc-metadata-instead-of-utxo
Closed

AmbientTea wants to merge 12 commits into
masterfrom
bridge-c-to-pc-metadata-instead-of-utxo

Conversation

@AmbientTea

Copy link
Copy Markdown
Contributor

Description

Add your description here, if it fixes a particular issue please provide a
link
to the issue.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages.
  • The size limit of 400 LOC isn't needlessly exceeded
  • The PR refers to a JIRA ticket (if one exists)
  • New tests are added if needed and existing tests are updated.
  • New code is documented and existing documentation is updated.
  • Relevant logging and metrics added
  • Any changes are noted in the changelog.md for affected crate
  • Self-reviewed the diff

@AmbientTea
AmbientTea force-pushed the bridge-c-to-pc-metadata-instead-of-utxo branch from e72977a to 7b94d95 Compare December 17, 2025 16:29
@AmbientTea
AmbientTea force-pushed the bridge-c-to-pc-metadata-instead-of-utxo branch from 7b94d95 to 1aee631 Compare December 19, 2025 12:54
@AmbientTea
AmbientTea force-pushed the bridge-c-to-pc-metadata-instead-of-utxo branch from 1aee631 to 36be496 Compare December 19, 2025 14:20
@AmbientTea AmbientTea changed the title WIP: change: Use transaction metadata instead of datum in bridge transfers change: Use transaction metadata instead of datum in bridge transfers Dec 19, 2025
@AmbientTea
AmbientTea marked this pull request as ready for review December 19, 2025 15:53
]
}';
reserve_datum jsonb := '{ "v": 1, "p": "reserve" }';
transfer_datum_1 jsonb := '{ "v": 1, "p": { "receiver": "0xabcd" } }';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where does v, p, and receiver come from?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These keys correspond to the TokenTransferMetadatum and VersionedMetadatum structures defined in our Rust codebase, mirroring the on-chain metadata format:

v stands for "version" (defined in VersionedMetadatum trait in toolkit/smart-contracts/plutus-data/src/lib.rs).
p stands for "payload" (also in VersionedMetadatum).
receiver is a field in the UserTransfer variant of TokenTransferMetadatumV1 (defined in toolkit/smart-contracts/plutus-data/src/bridge.rs).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So our own Rust implementation of the offchain code is a specification in this case. I'm wondering about the other offchain that will be used instead of our own. Let me get back to you soon.

VALUES ( 0 , 0 , reserve_datum , '' , reserve_transfer_tx )
, ( 1 , 1 , transfer_datum_1 , '' , user_transfer_tx_1 )
, ( 2 , 2 , transfer_datum_2 , '' , user_transfer_tx_2 )
, ( 3 , 3 , invalid_datum , '' , invalid_transfer_tx_1 )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is something I don't like. Shouldn't there be same "key" for each user transfer and maybe a different one for reserve transfer? Or maybe even multiple keys for each transaction?

@AmbientTea AmbientTea closed this Apr 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants