Skip to content

Account signing utilities - #114

Merged
Destiner merged 22 commits into
mainfrom
feature/rhi-2136
Aug 7, 2025
Merged

Account signing utilities#114
Destiner merged 22 commits into
mainfrom
feature/rhi-2136

Conversation

@Destiner

@Destiner Destiner commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

Description

Adds signing utilities to the account instance:

  • signMessage for EIP191 message signing
  • signTypedData for EIP712 typed data signing

Also uses typed data signing to sign the intent ops.

Checklist

  • Changeset

Comment on lines +49 to +57
// Manually tweak the `v` value to trigger the message prefixing onchain
// https://github.com/rhinestonewtf/checknsignatures/blob/main/src/CheckNSignatures.sol#L53-L61
const { r, s, v } = parseSignature(originalSignature)
if (!v) {
throw new Error('Invalid signature')
}
const newV = v + 4n
const newSignature = concat([r, s, toHex(newV)])
return newSignature

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

v flickering to toggle between message and typed data signing

rhinestoneApiKey: MOCK_API_KEY,
})
expect(address).toEqual('0xa32fa78416f6c68ce4f75f702e07849a269feffb')
expect(address).toEqual('0x7fbe9b0796484c06c94968b910a4cf488fd1719b')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All the unit test updates are due to the contract address changes.

Comment thread src/accounts/nexus.ts
Comment on lines 39 to +44
const NEXUS_IMPLEMENTATION_ADDRESS: Address =
'0x0000000000Fb742636364B5ca9B6D2ebbC63FB5D'
'0x55cc6609fDb3620ABeABf4dB020abfc469494778'
const NEXUS_FACTORY_ADDRESS: Address =
'0x0000000000751F0a4816c34fB95ccbD463878361'
'0xFF4454d15707a6f6BF01540796040f9E1646322C'
const NEXUS_BOOTSTRAP_ADDRESS: Address =
'0x00000000001Cf4667Bfd7be8f67D01d63938784b'
'0x40E89A87C56A340c9257350dEDf4B89a3FcCCcD3'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kopy-kat ideally we update to prod addresses before merging, but we can test with those I think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah if we're confident in the tests then I can redeploy

Comment thread src/execution/utils.ts

interface IntentData {
type: 'intent'
hash: Hex

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could put back but probably not needed for consumers

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nah dont think its needed

Comment on lines 477 to +481
initData: encodePacked(
['uint128', 'uint128'],
['uint48', 'uint48'],
[
BigInt(policy.validUntil) / 1000n,
BigInt(policy.validAfter) / 1000n,
Math.floor(policy.validUntil / 1000),
Math.floor(policy.validAfter / 1000),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Backporting the module-sdk fix.

@Destiner
Destiner requested a review from kopy-kat August 5, 2025 13:54

@kopy-kat kopy-kat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lets also remove the claimhash proofer in this pr

Comment thread src/accounts/nexus.ts
Comment on lines 39 to +44
const NEXUS_IMPLEMENTATION_ADDRESS: Address =
'0x0000000000Fb742636364B5ca9B6D2ebbC63FB5D'
'0x55cc6609fDb3620ABeABf4dB020abfc469494778'
const NEXUS_FACTORY_ADDRESS: Address =
'0x0000000000751F0a4816c34fB95ccbD463878361'
'0xFF4454d15707a6f6BF01540796040f9E1646322C'
const NEXUS_BOOTSTRAP_ADDRESS: Address =
'0x00000000001Cf4667Bfd7be8f67D01d63938784b'
'0x40E89A87C56A340c9257350dEDf4B89a3FcCCcD3'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah if we're confident in the tests then I can redeploy

Comment thread src/execution/compact.ts Outdated
{ name: 'tokenOut', type: 'Token[]' },
{ name: 'targetChain', type: 'uint256' },
{ name: 'fillExpiry', type: 'uint256' },
{ name: 'claimProofer', type: 'address' },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need to remove this now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed 1d06f9a

Comment thread src/execution/utils.ts

interface IntentData {
type: 'intent'
hash: Hex

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nah dont think its needed

@Destiner
Destiner merged commit eada1a3 into main Aug 7, 2025
2 checks passed
@Destiner
Destiner deleted the feature/rhi-2136 branch September 16, 2025 12:37
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