Skip to content

Commit 250711c

Browse files
committed
update sigverify to store data in the slashing instruction data
1 parent 245bd01 commit 250711c

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

proposals/0204-slashable-event-verification.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ This slashing program supports two instructions `DuplicateBlockProof`, and
7373
0. `proof_account`, expected to be previously initialized with the proof data.
7474
1. `instructions`, Instructions sysvar
7575

76-
`DuplicateBlockProof` has an instruction data of 81 bytes, containing:
76+
`DuplicateBlockProof` has an instruction data of 273 bytes, containing:
7777

7878
- `0x00`, a fixed-value byte acting as the instruction discriminator
7979
- `offset`, an unaligned eight-byte little-endian unsigned integer indicating
@@ -85,6 +85,14 @@ This slashing program supports two instructions `DuplicateBlockProof`, and
8585
- `destination`, an unaligned 32 byte array representing the account to reclaim
8686
the lamports if a successful slashing report account is created and then later
8787
closed.
88+
- `shred_1_merkle_root`, an unaligned 32 byte array representing the merkle root
89+
of the first shred in the `proof_account`
90+
- `shred_1_signature`, an unaligned 64 byte array representing the signature
91+
of `node_pubkey` on the first shred in the `proof_account`
92+
- `shred_2_merkle_root`, an unaligned 32 byte array representing the merkle root
93+
of the second shred in the `proof_account`
94+
- `shred_2_signature`, an unaligned 64 byte array representing the signature
95+
of `node_pubkey` on the second shred in the `proof_account`
8896

8997
We expect the contents of the `proof_account` when read from `offset` to
9098
deserialize to two byte arrays representing the duplicate shreds.
@@ -148,17 +156,17 @@ eligible for slashing.
148156
In order to verify that `shred1` and `shred2` were correctly signed by
149157
`node_pubkey` we use instruction introspection.
150158

151-
Using the `Instructions` sysvar we verify that the previous two instructions of
159+
Using the `Instructions` sysvar we verify that the previous instruction of
152160
this transaction are for the program ID
153161
`Ed25519SigVerify111111111111111111111111111`
154162

155-
For each of these instructions, verify the instruction data:
163+
For this instruction, verify the instruction data:
156164

157-
- The first byte is `0x01`
165+
- The first byte is `0x02`
158166
- The second byte (padding) is `0x00`
159167

160-
And then deserialize the remaining instruction data as 2 byte little-endian
161-
unsigned integers:
168+
Verify that the remaining instruction data represents two signature offsets
169+
which is specified as 2 byte little-endian unsigned integers:
162170

163171
```rust
164172
struct Ed25519SignatureOffsets {
@@ -184,6 +192,9 @@ We use the deserialized offsets to calculate [\[3\]](#notes) the `pubkey`,
184192
`message`, and `signature` of each instruction and verify that they correspond
185193
to the `node_pubkey`, `merkle_root`, and `signature` specified by the shred payload.
186194

195+
The instruction indices must point to the `DuplicateBlockProof` instruction and
196+
the offsets into the instruction data where these values are stored.
197+
187198
If both proof and signer verification succeed, we continue on to store the incident.
188199

189200
---

0 commit comments

Comments
 (0)