Skip to content

Conversation

@amkCha
Copy link
Collaborator

@amkCha amkCha commented Oct 28, 2025

Add new recognition of precompile address in TRM module as per this issue Consensys/linea-specification#272

From Osaka and on, a PRC address for curve secp256r1 has been added at address 0x100

In trm.accepts

  • I've changed the tests to light up IS_PRECOMPILE up to address 0x11 (like in Prague)
  • added the following

{"trm": {"RAW_ADDRESS":[256],"IS_PRECOMPILE":[1],"ADDRESS_HI":[0]}}
{"trm": {"RAW_ADDRESS":[255],"IS_PRECOMPILE":[0],"ADDRESS_HI":[0]}}
{"trm": {"RAW_ADDRESS":[257],"IS_PRECOMPILE":[0],"ADDRESS_HI":[0]}}

  • and as well

{"trm": {"RAW_ADDRESS":[1461501637330902918203684832716283019655932543231],"IS_PRECOMPILE":[0],"ADDRESS_HI":[0]}}
{"trm": {"RAW_ADDRESS":[1461501637330902918203684832716283019655932543232],"IS_PRECOMPILE":[1],"ADDRESS_HI":[0]}}
{"trm": {"RAW_ADDRESS":[1461501637330902918203684832716283019655932543233],"IS_PRECOMPILE":[0],"ADDRESS_HI":[0]}}

PLUS Fix of bit_xoan/signextend documentation


Note

Extend TRM precompile detection to {0x1..0x11} ∪ {0x100} and tidy docs in bit_xoan and signextend.

  • TRM (testdata/asm/bench/trm.zkasm):
    • Add MAX_PRC_CONTIGUOUS_ADDRESS = 0x11 and detect 0x100 (secp256r1) as precompile.
    • Update trm logic to flag precompiles when low <= 0x11 or low == 0x100 using boolean combine (b1 + b2) - (b1 * b2).
    • Clarify precompile set in header comment.
  • Docs:
    • Refine comments/wording in testdata/asm/util/bit_xoan.zkasm and testdata/asm/util/signextend.zkasm; reformat examples and instruction names.

Written by Cursor Bugbot for commit 93899ef. This will update automatically on new commits. Configure here.

;; determine low <= MAX_PRC_CONTIGUOUS_ADDRESS
;; or low is P256_VERIFY_ADDRESS
b1,tmp = low - MAX_PRC_CONTIGUOUS_ADDRESS - 1
b2 = low == 256 ? 1 : 0
Copy link
Collaborator Author

@amkCha amkCha Oct 28, 2025

Choose a reason for hiding this comment

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

I was not able to use a constant in the ternary operation like so
low == P256_VERIFY_ADDRESS ? 1 : 0
I got an "unexpected token" error

If it's preferable to use the constant, I can also re-write it with a difference

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Opened an issue here #1284

@amkCha amkCha force-pushed the feat/recognition-precomp-secp256r1-in-TRM branch from c2a971f to e0c53c3 Compare October 30, 2025 13:18
@amkCha amkCha force-pushed the feat/recognition-precomp-secp256r1-in-TRM branch from e0c53c3 to 93899ef Compare October 30, 2025 14:22
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.

2 participants