Skip to content

feat(contract): define contract API for verification of foreign transactions#1923

Merged
DSharifi merged 16 commits intomainfrom
1921-create-user-api-for-foreign-chain-transactions
Feb 3, 2026
Merged

feat(contract): define contract API for verification of foreign transactions#1923
DSharifi merged 16 commits intomainfrom
1921-create-user-api-for-foreign-chain-transactions

Conversation

@DSharifi
Copy link
Contributor

closes #1921

@DSharifi DSharifi linked an issue Jan 31, 2026 that may be closed by this pull request
@netrome netrome force-pushed the 1921-create-user-api-for-foreign-chain-transactions branch from 9bc04d4 to d4a9047 Compare February 3, 2026 11:51
netrome
netrome previously approved these changes Feb 3, 2026
Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

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

Great stuff!

netrome
netrome previously approved these changes Feb 3, 2026
@DSharifi DSharifi enabled auto-merge February 3, 2026 13:33
Copy link
Contributor

@gilcu3 gilcu3 left a comment

Choose a reason for hiding this comment

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

Looks good overall, although there are three points that need improvements:

  • There were some changes in the struct, that should be reflected in the doc
  • We are serde serializing a bunch of structs as arrays, but should be hex to make them human readable and compact
  • We are duplicating type names in the contract ABI interface, which IMO we should avoid

Copy link
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

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

Let's goo!

@netrome netrome force-pushed the 1921-create-user-api-for-foreign-chain-transactions branch from 51a1685 to f3e89ea Compare February 3, 2026 14:16
pub struct BitcoinRpcRequest {
pub tx_id: BitcoinTxId, // This is the payload we're signing
pub confirmations: usize, // required confirmations before considering final
pub confirmations: u64, // required confirmations before considering final
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the values of this?
I am wondering whether it is not possible to do generalize the implementation, something like this instead:

struct RpcRequest<T: TxId, Extractor, Confirmation>{
pub tx_id: T
pub confirmation: Confirmation,
pub extractors: Vec<Extractor>
}

trait TxId{
...
}

...

pub struct BitcoinRpcRequest  = RpcRequest<Confirmation, BiitcoinExtractor, u64>
pub struct SolanaRpcRequest  = RpcRequest<Finality, SolanaExtractor, Finality>

I guess you understood what kind of generalization I am talking about?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This might be generalizable, but given the few number of initial chains I'd advocate for starting specific. For example we might want to expose both number of confirmations and some finality notion for a single chain (as Ethereum has both notions). The above structure would make that hard.

Once we have a bunch of chains supported we could break out the shared logic to something like the above if we think it would simplify things.

Comment on lines +57 to +58
pub chain: ForeignChain,
pub tx_id: EvmTxId,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: For the sake of order, please swap those lines

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add more context, why should tx_id be before the chain specification?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because in the other structs, tx_id is first, just to keep better readibility

@DSharifi DSharifi added this pull request to the merge queue Feb 3, 2026
Merged via the queue into main with commit 60d2c4d Feb 3, 2026
8 checks passed
@DSharifi DSharifi deleted the 1921-create-user-api-for-foreign-chain-transactions branch February 3, 2026 15:03
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.

create user API for foreign chain transactions

4 participants