Skip to content

feat: add hinted fp12 inverse#153

Merged
lucidLuckylee merged 2 commits intoBitVM:mainfrom
alpenlabs:feat/hinted_fp12_inverse
Dec 20, 2024
Merged

feat: add hinted fp12 inverse#153
lucidLuckylee merged 2 commits intoBitVM:mainfrom
alpenlabs:feat/hinted_fp12_inverse

Conversation

@manishbista28
Copy link
Copy Markdown
Contributor

This PR requests addition of hinted Fp12 inverse.
It is useful because pairing operation makes use of auxiliary hint "c" and its inverse.

It seems cheaper to do the inverse directly on-script instead of receiving it as bit commitment input.
Script and max stack size used by a single joint script is 6,168,525 bytes and stack 1116 respectively.
This script can be split into 3 chunks with the intermediates hashed, each of these chunks fit within 4 MB and stack limit.

In total, the cost on Assert Tx is from having to bit commit 3 hashed elements.

Tests have been added and does not impact any other code.

@manishbista28
Copy link
Copy Markdown
Contributor Author

chunked version of fp12 inverse is not included here.

@lucidLuckylee
Copy link
Copy Markdown
Contributor

chunked version of fp12 inverse is not included here.

Are you planning on submitting a PR for a chunked version?

@manishbista28
Copy link
Copy Markdown
Contributor Author

manishbista28 commented Dec 16, 2024

I have already implemented a chunked version of this which I can include in this PR.
Was wondering how helpful can this direct inversion be to the current chunker.
Didn't include assuming isn't as helpful to this version of chunker.

@Hakkush-07 , @wz14 do you have answer if it can be useful to you with the chunker ?

@freddi8e
Copy link
Copy Markdown
Contributor

@wz14 do you have answer if it can be useful to you with the chunker

yes, it is also useful for chunker , please include the chunked version, thanks.

@manishbista28
Copy link
Copy Markdown
Contributor Author

manishbista28 commented Dec 19, 2024

I have split the hinted_fp12 inverse into 3 parts, each fits within a tapscript and adjusted tests accordingly.

I haven't integrated it to the chunker implementation though. I did not feel very sure about the changes required but I assume it may not be as difficult to integrate it with the examples given.

Stats:
Chunk 0; Fp12 Inv script len 1542178 and max stack size 612
Chunk 1; Fp12 Inv script len 2487216 and max stack size 648
Chunk 2; Fp12 Inv script len 2138822 and max stack size 684

@freddi8e
Copy link
Copy Markdown
Contributor

that is great, thank you,

@manishbista28
Copy link
Copy Markdown
Contributor Author

thanks, in that case, should be good to merge

@lucidLuckylee lucidLuckylee merged commit ebfec01 into BitVM:main Dec 20, 2024
lucidLuckylee pushed a commit that referenced this pull request Jan 6, 2025
@manishbista28 manishbista28 deleted the feat/hinted_fp12_inverse branch February 23, 2025 11:05
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.

3 participants