Skip to content

Commit bc8a425

Browse files
refactor: rename raw to memo field in custom instructions
1 parent 9f95038 commit bc8a425

9 files changed

Lines changed: 43 additions & 43 deletions

File tree

docs/smart-accounts/1-overview.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ Instructions for interacting with an Upshift-type vault.
155155

156156
The XRPL memo for the direct-minting flow selects one of the following opcodes in its first byte:
157157

158-
| Memo opcode | Action | Description |
159-
| ----------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
160-
| `0xFE` | Custom Instruction | Carry `keccak256(PackedUserOperation)` in the memo; the bytes are delivered off-chain by an executor. See [Custom Instruction](/smart-accounts/custom-instruction). |
161-
| `0xFF` | Raw Custom Instruction | Carry the full ABI-encoded `PackedUserOperation` inline in the memo. See [Raw Custom Instruction](/smart-accounts/raw-custom-instruction). |
162-
| `0xE0` | Skip memo | Mark a target XRPL transaction's memo to be skipped on its next direct mint. |
163-
| `0xE1` | Fast-forward nonce | Advance the personal account's memo-instruction nonce. |
164-
| `0xE2` | Replace executor fee | Set a replacement executor fee for a stuck XRPL transaction. |
165-
| `0xD0` | Pin executor | Pin a specific executor address to the personal account. |
166-
| `0xD1` | Unpin executor | Unpin the executor from the personal account. |
158+
| Memo opcode | Action | Description |
159+
| ----------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
160+
| `0xFE` | Custom Instruction | Carry `keccak256(PackedUserOperation)` in the memo; the bytes are delivered off-chain by an executor. See [Custom Instruction](/smart-accounts/custom-instruction). |
161+
| `0xFF` | Memo Field Custom Instruction | Carry the full ABI-encoded `PackedUserOperation` inline in the memo. See [Memo Field Custom Instruction](/smart-accounts/memo-field-custom-instruction). |
162+
| `0xE0` | Skip memo | Mark a target XRPL transaction's memo to be skipped on its next direct mint. |
163+
| `0xE1` | Fast-forward nonce | Advance the personal account's memo-instruction nonce. |
164+
| `0xE2` | Replace executor fee | Set a replacement executor fee for a stuck XRPL transaction. |
165+
| `0xD0` | Pin executor | Pin a specific executor address to the personal account. |
166+
| `0xD1` | Unpin executor | Unpin the executor from the personal account. |
167167

168168
The [Custom Instruction Comparison](/smart-accounts/custom-instruction-comparison) covers when to choose `0xFE` over `0xFF`.
169169

@@ -197,7 +197,7 @@ It enforces that the caller is the `AssetManager`, resolves (or deploys) the use
197197
The XRPL user's smart account performs the actions in the instructions.
198198
This can be any of the instructions listed above, reserving collateral for minting FXRP, transferring FXRP to another address, redeeming FXRP, depositing it into a vault ...
199199
Furthermore, custom instructions can be executed - arbitrary function calls on Flare, encoded as an [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337) `PackedUserOperation` and replayed on-chain by the personal account.
200-
The user operation can be committed to as a 32-byte hash with the bytes delivered to Flare by an off-chain executor (opcode `0xFE`, see the [Custom Instruction guide](/smart-accounts/custom-instruction)), or carried in the XRPL memo in full (opcode `0xFF`, see the [Raw Custom Instruction guide](/smart-accounts/raw-custom-instruction)).
200+
The user operation can be committed to as a 32-byte hash with the bytes delivered to Flare by an off-chain executor (opcode `0xFE`, see the [Custom Instruction guide](/smart-accounts/custom-instruction)), or carried in the XRPL memo in full (opcode `0xFF`, see the [Memo Field Custom Instruction guide](/smart-accounts/memo-field-custom-instruction)).
201201
Authorization comes from the XRPL `Payment` signature itself; the on-chain check only validates the `sender` and `nonce` fields of the `PackedUserOperation`.
202202
The [Custom Instruction Comparison](/smart-accounts/custom-instruction-comparison) covers when to pick each.
203203

docs/smart-accounts/3-custom-instruction.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The **custom instruction** (memo opcode `0xFE`) is the recommended way to drive
2626
The XRPL memo is a fixed 42 bytes that commits to a `PackedUserOperation` by carrying only its `keccak256` hash, and an off-chain executor delivers the actual user operation bytes to the FAssets `AssetManager` on Flare.
2727
This keeps the XRPL footprint constant regardless of how complex the call batch is.
2828

29-
For the simpler single-actor variant that ships the entire `PackedUserOperation` inline in the XRPL memo, see the [Raw Custom Instruction](/smart-accounts/raw-custom-instruction); the [comparison guide](/smart-accounts/custom-instruction-comparison) covers when to pick which.
29+
For the simpler single-actor variant that ships the entire `PackedUserOperation` inline in the XRPL memo, see the [Memo Field Custom Instruction](/smart-accounts/memo-field-custom-instruction); the [comparison guide](/smart-accounts/custom-instruction-comparison) covers when to pick which.
3030

3131
:::warning No destination tags
3232
XRPL transactions targeting smart accounts must not use a destination tag.
@@ -110,7 +110,7 @@ The custom instruction memo is a constant 42 bytes:
110110
| `10-41` | `userOpHash` | `keccak256(abi.encode(userOp))` - the 32-byte commitment |
111111

112112
The memo length is independent of the call batch: a single small call and a 50-call batch both fit in the same 42 bytes, because the user-operation bytes the executor delivers off-chain never touch the XRPL ledger.
113-
This is the main practical advantage over the [Raw Custom Instruction](/smart-accounts/raw-custom-instruction), whose memo carries the entire ABI-encoded `PackedUserOperation` and is therefore subject to the XRPL's 1024-byte memo cap.
113+
This is the main practical advantage over the [Memo Field Custom Instruction](/smart-accounts/memo-field-custom-instruction), whose memo carries the entire ABI-encoded `PackedUserOperation` and is therefore subject to the XRPL's 1024-byte memo cap.
114114

115115
The off-chain delivery also makes the call payload **private on XRPL**.
116116
Only the 32-byte commitment is published; the inner `target`, `value`, and `data` of each call only become visible when the executor submits the user operation to Flare.
@@ -211,6 +211,6 @@ The minted FXRP remains in the personal account and the user can recover by eith
211211
## Next steps
212212

213213
- Walk through a Viem implementation in the [Custom Instruction TypeScript guide](/smart-accounts/guides/typescript-viem/custom-instruction-ts).
214-
- See the simpler single-actor variant in the [Raw Custom Instruction](/smart-accounts/raw-custom-instruction).
214+
- See the simpler single-actor variant in the [Memo Field Custom Instruction](/smart-accounts/memo-field-custom-instruction).
215215
- Compare the two flows in the [Custom Instruction Comparison](/smart-accounts/custom-instruction-comparison).
216216
- Dig into `IMasterAccountController` in the [reference](/smart-accounts/reference/IMasterAccountController).

docs/smart-accounts/4-raw-custom-instruction.mdx renamed to docs/smart-accounts/4-memo-field-custom-instruction.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
sidebar_position: 1
3-
slug: raw-custom-instruction
4-
title: Raw Custom Instruction
3+
slug: memo-field-custom-instruction
4+
title: Memo Field Custom Instruction
55
authors: [nikerzetic]
66
description: Performing custom function calls in the Flare Smart Accounts by carrying the full PackedUserOperation in the XRPL memo.
77
tags: [intermediate, ethereum, flare-smart-accounts]
@@ -16,11 +16,11 @@ keywords:
1616
]
1717
---
1818

19-
The **raw custom instruction** (memo opcode `0xFF`) is a single-actor variant of the [Custom Instruction](/smart-accounts/custom-instruction): instead of committing to a `keccak256(userOp)` hash and relying on an executor to deliver the bytes, the XRPL `Payment` memo carries the entire ABI-encoded `PackedUserOperation` inline immediately after a 10-byte header.
19+
The **memo field custom instruction** (memo opcode `0xFF`) is a single-actor variant of the [Custom Instruction](/smart-accounts/custom-instruction): instead of committing to a `keccak256(userOp)` hash and relying on an executor to deliver the bytes, the XRPL `Payment` memo carries the entire ABI-encoded `PackedUserOperation` inline immediately after a 10-byte header.
2020
The user signs the XRPL `Payment`, ships the payload on XRPL, and the smart account replays the user operation on Flare with no further off-chain data.
2121

2222
The recommended path is the [Custom Instruction](/smart-accounts/custom-instruction) - it lifts the XRPL memo size cap and is what the rest of the smart-accounts tooling defaults to.
23-
Reach for the raw variant when you do not want to operate or coordinate with an executor and your call batch fits inside the XRPL memo cap.
23+
Reach for the memo field variant when you do not want to operate or coordinate with an executor and your call batch fits inside the XRPL memo cap.
2424
The [comparison guide](/smart-accounts/custom-instruction-comparison) breaks down when each is appropriate.
2525

2626
This page covers only what differs from the [Custom Instruction](/smart-accounts/custom-instruction).
@@ -37,7 +37,7 @@ The XRPL memo carries a 10-byte instruction header followed by the ABI-encoded `
3737

3838
| Bytes | Field | Meaning |
3939
| ----- | ---------------- | --------------------------------------------------------------------------- |
40-
| `0` | `instructionId` | `0xFF` - raw custom instruction |
40+
| `0` | `instructionId` | `0xFF` - memo field custom instruction |
4141
| `1` | `walletId` | One-byte wallet identifier assigned by Flare; `0` if not registered |
4242
| `2-9` | `executorFeeUBA` | Executor fee in the FAsset's smallest unit, big-endian `uint64` |
4343
| `10+` | `userOpData` | `abi.encode(PackedUserOperation)` - the call payload the controller decodes |
@@ -70,7 +70,7 @@ The freshly minted FXRP remains in the personal account, and the user can either
7070

7171
## Next Steps
7272

73-
- Walk through a Viem implementation in the [Raw Custom Instruction TypeScript guide](/smart-accounts/guides/typescript-viem/raw-custom-instruction-ts).
73+
- Walk through a Viem implementation in the [Memo Field Custom Instruction TypeScript guide](/smart-accounts/guides/typescript-viem/memo-field-custom-instruction-ts).
7474
- Read the [Custom Instruction](/smart-accounts/custom-instruction) for the recommended hash-commitment variant.
7575
- Compare the two flows in the [Custom Instruction Comparison](/smart-accounts/custom-instruction-comparison).
7676
- Dig into `IMasterAccountController` in the [reference](/smart-accounts/reference/IMasterAccountController).

docs/smart-accounts/5-custom-instruction-comparison.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ sidebar_position: 1
33
slug: custom-instruction-comparison
44
title: Custom Instruction Comparison
55
authors: [nikerzetic]
6-
description: Comparing the raw (0xFF) and hash-based (0xFE) custom instruction flows for Flare Smart Accounts.
6+
description: Comparing the memo field (0xFF) and hash-based (0xFE) custom instruction flows for Flare Smart Accounts.
77
tags: [intermediate, ethereum, flare-smart-accounts]
88
keywords:
99
[
@@ -20,7 +20,7 @@ Flare Smart Accounts expose two custom instruction memo opcodes that ultimately
2020

2121
- [**Custom Instruction**](/smart-accounts/custom-instruction) - opcode `0xFE`.
2222
The XRPL memo carries only `keccak256(userOp)` in fixed 42 bytes; an off-chain executor delivers the ABI-encoded custom instruction (`userOp`) via `executeDirectMintingWithData`.
23-
- [**Raw Custom Instruction**](/smart-accounts/raw-custom-instruction) - opcode `0xFF`.
23+
- [**Memo Field Custom Instruction**](/smart-accounts/memo-field-custom-instruction) - opcode `0xFF`.
2424
The XRPL memo contains the ABI-encoded `PackedUserOperation` in full.
2525

2626
Both flows are validated on-chain against the same `(sender, nonce)` rules and emit the same [`UserOperationExecuted`](/smart-accounts/reference/IMasterAccountController#useroperationexecuted) event.
@@ -31,7 +31,7 @@ The `0xFE` memo is a constant 42 bytes regardless of the user's operation size,
3131

3232
## Comparison
3333

34-
| Dimension | [Custom Instruction](/smart-accounts/custom-instruction) (`0xFE`) | [Raw Custom Instruction](/smart-accounts/raw-custom-instruction) (`0xFF`) |
34+
| Dimension | [Custom Instruction](/smart-accounts/custom-instruction) (`0xFE`) | [Memo Field Custom Instruction](/smart-accounts/memo-field-custom-instruction) (`0xFF`) |
3535
| ---------------------------------- | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
3636
| XRPL memo payload | 10-byte header + `keccak256(userOp)` (fixed 42 bytes) | 10-byte header + `abi.encode(PackedUserOperation)` |
3737
| XRPL memo size | Constant 42 bytes regardless of batch size | Grows linearly with batch and argument sizes; capped at ~1024 bytes |
@@ -41,7 +41,7 @@ The `0xFE` memo is a constant 42 bytes regardless of the user's operation size,
4141
| AssetManager entry point | `executeDirectMintingWithData(proof, data)` | `executeDirectMinting(proof)` |
4242
| `msg.value` on the inner call | Whatever the executor attaches; forwarded to `executeUserOp` | Whatever the relayer attaches; forwarded to `executeUserOp` |
4343
| Confirmation | Same event lives in the executor's transaction receipt | Watch for `UserOperationExecuted` after the `MasterAccountController` dispatches the memo |
44-
| Replay protection | Same as raw - plus the on-chain hash check pins `_data` to the memo's commitment | Personal account nonce + `usedTransactionIds` |
44+
| Replay protection | Same as memo field - plus the on-chain hash check pins `_data` to the memo's commitment | Personal account nonce + `usedTransactionIds` |
4545
| Failure modes specific to the flow | `CustomInstructionHashMismatch` if `keccak256(_data)` differs from the commitment | None beyond shared ones |
4646

4747
**Use the custom instruction (`0xFE`) when**
@@ -52,15 +52,15 @@ The `0xFE` memo is a constant 42 bytes regardless of the user's operation size,
5252
- You already operate an executor that observes XRPL payments and submits Flare transactions - the custom instruction lets that executor batch deliveries or rate-limit submissions without splitting user operations into multiple XRPL payments.
5353
- You need fee predictability: the XRPL memo is always 42 bytes, so the XRPL fee is constant regardless of how complex the user operation is.
5454

55-
**Use the raw custom instruction (`0xFF`) when**
55+
**Use the memo field custom instruction (`0xFF`) when**
5656

5757
- The call batch fits comfortably inside the XRPL ~1024-byte memo (most single-call user operations and small batches do).
5858
- You do not need to hide the call payload from public XRPL observers.
5959
- You do not want to operate or coordinate with an executor service.
6060
- You want the simplest possible on-chain integration: a single FAssets transaction `executeDirectMinting(proof)` carries the whole thing.
6161

6262
In short, the custom instruction trades a small amount of off-chain coordination (and one extra on-chain proof-binding check) for a fixed memo size and private payloads.
63-
The raw custom instruction trades memo bandwidth for end-to-end simplicity.
63+
The memo field custom instruction trades memo bandwidth for end-to-end simplicity.
6464

6565
## Similarities
6666

@@ -78,13 +78,13 @@ The two flows share more than they differ:
7878
The example helpers in [`flare-viem-starter`](https://github.com/flare-foundation/flare-viem-starter) mirror the two flows directly:
7979

8080
- Custom Instruction: [`sendHashInstruction`](/smart-accounts/guides/typescript-viem/custom-instruction-ts#step-1-send-the-hash-memo-on-xrpl) + [`executeDirectMintingWithData`](/smart-accounts/guides/typescript-viem/custom-instruction-ts#step-2-executor-submits-the-proof-and-the-bytes) + [`findUserOperationExecuted`](/smart-accounts/guides/typescript-viem/custom-instruction-ts#step-3-confirm-execution-from-the-receipt) - three calls, one per actor.
81-
- Raw Custom Instruction: [`sendMemoFieldInstruction`](/smart-accounts/guides/typescript-viem/raw-custom-instruction-ts#sending-the-user-operation) - one call, waits for the event.
81+
- Memo Field Custom Instruction: [`sendMemoFieldInstruction`](/smart-accounts/guides/typescript-viem/memo-field-custom-instruction-ts#sending-the-user-operation) - one call, waits for the event.
8282

8383
A practical decision rule when integrating:
8484

8585
1. Default to the custom instruction (`0xFE`).
8686
It fits every call batch and keeps the call payload off the public XRPL ledger.
87-
2. Reach for the raw custom instruction (`0xFF`) only when you do not want to operate or coordinate with an executor service, and you can guarantee `abi.encode(userOp)` stays well under ~900 bytes (leaving room for the 10-byte header and XRPL framing).
87+
2. Reach for the memo field custom instruction (`0xFF`) only when you do not want to operate or coordinate with an executor service, and you can guarantee `abi.encode(userOp)` stays well under ~900 bytes (leaving room for the 10-byte header and XRPL framing).
8888

8989
## Reference
9090

0 commit comments

Comments
 (0)