keep-starknet-strange / raito

Bitcoin ZK client written in Cairo.
https://raito.wtf
MIT License
20 stars 26 forks source link

[feat] Validate relative locktime (BIP-68) #138

Closed m-kus closed 1 week ago

m-kus commented 1 week ago

Validate transaction inputs if relative locktime is enabled.

Hints:

Reading:

Suggested deadline: 9 Sep

mubarak23 commented 1 week ago

@m-kus i will like to take this,

The validate_input function checks the sequence field of a transaction's input to determine if a locktime is set. If a locktime is present, it means the transaction can't be mined until a specific block height or time is reached.

The function will then validate the locktime against the current block height or time. If the current block height or time is greater than or equal to the locktime, the input is considered valid for use in the next transaction.

since input sequence with tx_input.sequence < 0xFFFFFFFF mean the input of the transaction is not subject to locktime

for tx_input.sequence > 0xFFFFFFFF, mean the input of the transaction is subject to locktime,

having work on coinbase maturity #108 this should a continue of my work as i understand the existing transaction validation implementation.

onlydustapp[bot] commented 1 week ago

Hey @mubarak23! Thanks for showing interest. We've created an application for you to contribute to Raito - Bitcoin ZK Client. Go check it out on OnlyDust!

ShantelPeters commented 1 week ago

Please can I work on this?

onlydustapp[bot] commented 1 week ago

Hey @ShantelPeters! Thanks for showing interest. We've created an application for you to contribute to Raito - Bitcoin ZK Client. Go check it out on OnlyDust!

mubarak23 commented 1 week ago

@m-kus from this function https://github.com/bitcoin/bitcoin/blob/d661e2b1b771abafb0b152842d775d3150032230/src/consensus/tx_verify.cpp#L39

if i understand the function above correctly,

if a transaction has locktime, we are to determine the minimum block height and time required to satisfy the relative lock-time constraints of a transaction

is this what the validate input function is suppose to do

as again checking to ensure the input's locktime is respected

m-kus commented 1 week ago

The keyword is relative

Check out https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki