Skip to content

Commit 40c1fbc

Browse files
author
Ron Turetzky
committed
deps: re-pin jito restaking by rev + bump ncn-program-core to Phase 1 main; freeze VerifyCertificate seams
- jito-foundation/restaking deps pinned by rev=358fbc3c (dead v2.1-upgrade branch no longer referenced anywhere; fresh clones resolve by SHA), adding the sdk/core crates the counter-solana deployer uses - ncn-program-core bumped to main#9013404 (post phase1-dmsg merge) - VERIFY_CERTIFICATE_DISCRIMINATOR frozen at the generated client's value (byte 10); pinning test now differentially asserts the FULL instruction data against ncn_program_core::instruction::NCNProgramInstruction - JitoQuorum.generation now reads Snapshot.generation (was hardcoded 0) - consensus_threshold_bps now read from the on-chain NCN Config PDA in get_quorum (deployment JSON demoted to fallback when the PDA is missing) - counter-solana-deployer crate stub (workspace member, not default-members) Gates: fmt, clippy -D warnings (jito+examples+deployer), 41 jito tests, 8 example tests, EVM 43 tests, cargo check --workspace --all-targets.
1 parent 66ba081 commit 40c1fbc

10 files changed

Lines changed: 172 additions & 56 deletions

File tree

Cargo.lock

Lines changed: 30 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ members = [
88
"examples/counter/node",
99
"examples/counter/router",
1010
"examples/counter-solana/common",
11+
"examples/counter-solana/deployer",
1112
"examples/counter-solana/node",
1213
"examples/counter-solana/router",
1314
"jito",
@@ -83,12 +84,19 @@ url = { version = "2.5.4", features = ["serde"] }
8384
# workspace pins solana-program to the jito-solana fork below, so the solana
8485
# runtime crates here use the SAME git source to keep types unified.
8586
ncn-program-core = { git = "https://github.com/BreadchainCoop/jito-ncn-program", branch = "main" }
86-
# NOTE: branch v2.1-upgrade was DELETED upstream; its head 358fbc3 is what
87-
# jito-ncn-program pins and remains fetchable by SHA. The checked-in
88-
# Cargo.lock pins that rev, which is the ONLY thing keeping this source
89-
# resolvable — do not run a full `cargo update` for this source (see
90-
# jito/README section in the PR description).
91-
jito-bytemuck = { git = "https://github.com/jito-foundation/restaking", branch = "v2.1-upgrade" }
87+
# NOTE: branch v2.1-upgrade was DELETED upstream; its head 358fbc3c remains
88+
# fetchable by SHA, so these deps are pinned by `rev` (mirrors jito-ncn-program
89+
# main's own re-pin). This removes the fresh-clone dependency on the dead
90+
# branch ref that the previous `branch = "v2.1-upgrade"` + seeded-Cargo.lock
91+
# arrangement carried. The sdk/core crates are the programs' own instruction
92+
# builders + PDA derivations, used by the counter-solana deployer.
93+
jito-bytemuck = { git = "https://github.com/jito-foundation/restaking", rev = "358fbc3c20d947c977a136808f9fbf7f070e478b" }
94+
jito-restaking-core = { git = "https://github.com/jito-foundation/restaking", rev = "358fbc3c20d947c977a136808f9fbf7f070e478b" }
95+
jito-restaking-sdk = { git = "https://github.com/jito-foundation/restaking", rev = "358fbc3c20d947c977a136808f9fbf7f070e478b" }
96+
jito-vault-core = { git = "https://github.com/jito-foundation/restaking", rev = "358fbc3c20d947c977a136808f9fbf7f070e478b" }
97+
jito-vault-sdk = { git = "https://github.com/jito-foundation/restaking", rev = "358fbc3c20d947c977a136808f9fbf7f070e478b" }
98+
spl-token = "6.0.0"
99+
spl-associated-token-account = "6.0.0"
92100
solana-account-decoder = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "87dcd086af931d81a0a71ad49cbea38e9655f166" }
93101
solana-client = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "87dcd086af931d81a0a71ad49cbea38e9655f166" }
94102
solana-program = { git = "https://github.com/jito-foundation/jito-solana.git", rev = "87dcd086af931d81a0a71ad49cbea38e9655f166" }
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "counter-solana-deployer"
3+
version = { workspace = true }
4+
edition = "2021"
5+
publish = false
6+
7+
[[bin]]
8+
name = "counter-solana-deployer"
9+
path = "src/main.rs"
10+
11+
[dependencies]
12+
anyhow = { workspace = true }
13+
borsh = "0.10.3"
14+
clap = { workspace = true }
15+
hex = { workspace = true }
16+
jito-restaking-core = { workspace = true }
17+
jito-restaking-sdk = { workspace = true }
18+
jito-vault-core = { workspace = true }
19+
jito-vault-sdk = { workspace = true }
20+
ncn-program-core = { workspace = true }
21+
serde = { workspace = true }
22+
serde_json = { workspace = true }
23+
solana-client = { workspace = true }
24+
solana-program = { workspace = true }
25+
solana-sdk = { workspace = true }
26+
spl-associated-token-account = { workspace = true }
27+
spl-token = { workspace = true }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! Placeholder — the real deployer lands with the solana e2e driver.
2+
3+
fn main() {}

examples/counter-solana/router/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ pub fn main() {
229229
scheme.clone(),
230230
quorum.operator_indices(),
231231
quorum.operators_registered,
232-
// Captured at quorum-assembly time (TODO-FREEZE: reads
233-
// snapshot.generation() once Phase 1 lands — see JitoQuorum docs).
232+
// Captured at quorum-assembly time from the on-chain
233+
// Snapshot.generation (bumped on register/remove/rotation).
234234
quorum.generation,
235235
handler,
236236
assignments.clone(),

jito/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Built against the cross-track interface contract in
1616
| `config` | `NcnDeployment` — the NCN deployment JSON (`NCN_DEPLOYMENT_PATH`), analog of the EVM `avs_deploy.json`, plus PDA derivations. |
1717
| `network` | `JitoStakingClient` — operators via `getProgramAccounts` memcmp on `NCNOperatorAccount` (ncn field; ip+port sockets), stake/APK from the `Snapshot` PDA, all reads at `confirmed` minimum. Produces `JitoQuorum`: index-aligned participant set / G1 keys / on-chain operator indices / stakes. |
1818
| `quorum` | Startup reconciliation (§5): the minimum total stake over all `(N−f)`-sized signer subsets must clear `consensus_threshold_bps`, else refuse to start. |
19-
| `instruction` | Manual `VerifyCertificate` instruction construction (frozen §2 shape; borsh cross-checked). Discriminator is a TODO-FREEZE const until the `phase1-dmsg` branch pushes the generated client. |
19+
| `instruction` | Manual `VerifyCertificate` instruction construction (frozen §2 shape; borsh cross-checked). Discriminator (byte `10`) is FROZEN and differentially pinned against `ncn_program_core::instruction::NCNProgramInstruction` — the enum the generated client derives from (Phase 1, merged to `main`). |
2020
| `submitter` | `JitoSubmitter` + the `SolanaCertificateHandler` trait (peer of the EVM `BlsSignatureVerificationHandler`). `VerifyCertificateHandler` sends the tx with a compute budget; `Resolution{Executed}` only at `finalized`; blockhash expiry → rebuild and resend. A settlement-program handler (INTERFACES §4, Track C `settlement_core`) plugs into the same seam. |
2121

2222
Participant indices (sorted G2 positions in the chassis `ordered::Set`) are
@@ -33,11 +33,14 @@ on-chain bitmap (padding bits set, byte-exact with
3333
jito-ncn-program patch set so ONE set of solana types flows through the
3434
whole graph. The patch is inert for the EVM path.
3535
- jito-foundation/restaking branch `v2.1-upgrade` was DELETED upstream; its
36-
head `358fbc3` (what jito-ncn-program pins) remains fetchable by SHA and is
37-
pinned in the checked-in `Cargo.lock`. A full `cargo update` (or
38-
`cargo update` of the restaking source) will fail against the dead branch —
39-
update surgically (`cargo update -p <pkg> --precise <ver>`) until upstream
40-
re-pins by rev.
36+
head `358fbc3c` (what jito-ncn-program pins) remains fetchable by SHA. The
37+
workspace therefore pins every restaking crate by
38+
`rev = "358fbc3c20d947c977a136808f9fbf7f070e478b"` (mirroring
39+
jito-ncn-program main's own re-pin), so fresh clones and `cargo update`
40+
never touch the dead branch ref. Update surgically
41+
(`cargo update -p <pkg> --precise <ver>`) all the same — the jito-solana
42+
fork rev and the restaking rev must move together with the
43+
`ncn-program-core` pin.
4144

4245
## Example
4346

jito/src/config.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ pub struct NcnDeployment {
6161
pub restaking_program_id: String,
6262
/// Stake-weighted consensus threshold in bps.
6363
///
64-
/// TODO-FREEZE(phase1-dmsg): Phase 1 adds `consensus_threshold_bps` to the
65-
/// NCN `Config` PDA (admin-settable, default 6667). Once the git dep on
66-
/// `ncn-program-core` picks that up, the on-chain value becomes the source
67-
/// of truth and this field is only a fallback.
64+
/// Phase 1 put `consensus_threshold_bps` on the NCN `Config` PDA
65+
/// (admin-settable, default 6667) and `get_quorum` reads THAT value — the
66+
/// one `VerifyCertificate` enforces. This field is only the fallback for
67+
/// the window where the Config PDA does not exist yet; a mismatch is
68+
/// logged and resolved in favor of the chain.
6869
#[serde(default = "default_threshold_bps")]
6970
pub consensus_threshold_bps: u64,
7071
/// Compute-unit limit for submitted transactions.

jito/src/instruction.rs

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ use solana_sdk::pubkey::Pubkey;
1212

1313
/// The instruction discriminator prefix for `VerifyCertificate`.
1414
///
15-
/// TODO-FREEZE(phase1-dmsg): Phase 1 is built in parallel on the
16-
/// `jito-ncn-program` branch `phase1-dmsg`, which is NOT pushed yet, so the
17-
/// shank/kinobi-generated discriminator is not knowable. The program's
18-
/// existing instructions use 1-byte borsh enum indices (kinobi
19-
/// `CastVoteInstructionData { discriminator: u8 } = 10`), NOT 8-byte
20-
/// anchor-style discriminators; `VerifyCertificate` replaces `CastVote`
21-
/// (INTERFACES.md §2), so index 10 is the best-known placeholder. The
22-
/// `discriminator_matches_generated_client` test below MUST be pointed at the
23-
/// generated `ncn-program-client` value (and this const frozen) before any
24-
/// live submission.
15+
/// FROZEN against Phase 1 (merged to jito-ncn-program `main`): the program
16+
/// uses 1-byte borsh enum indices (NOT 8-byte anchor-style discriminators)
17+
/// and `VerifyCertificate` sits at index 10 of `NCNProgramInstruction` — the
18+
/// `CastVote` slot it replaced. The generated client
19+
/// (`clients/rust/ncn_program/.../verify_certificate.rs`) emits the same
20+
/// `VerifyCertificateInstructionData { discriminator: 10 }`. The
21+
/// `discriminator_matches_generated_client` test below pins the FULL
22+
/// instruction-data encoding (discriminator ‖ borsh(args)) byte-for-byte
23+
/// against `ncn_program_core::instruction::NCNProgramInstruction`, the enum
24+
/// shank generates that client from, so any upstream reordering fails loudly
25+
/// on the next dep bump.
2526
pub const VERIFY_CERTIFICATE_DISCRIMINATOR: &[u8] = &[10];
2627

2728
/// The `VerifyCertificate` argument block (post-discriminator instruction
@@ -180,18 +181,33 @@ mod tests {
180181
assert_eq!(args.instruction_data(), expected);
181182
}
182183

183-
/// TODO-FREEZE(phase1-dmsg): once the `phase1-dmsg` branch pushes the
184-
/// generated `ncn-program-client`, replace the right-hand side with the
185-
/// client's `VerifyCertificateInstructionData` discriminator and delete
186-
/// this comment. Until then this pins the documented placeholder (the
187-
/// CastVote slot it replaces) so any silent change is caught.
184+
/// FROZEN: pins the const AND the complete instruction-data encoding to
185+
/// `ncn_program_core::instruction::NCNProgramInstruction` — the enum the
186+
/// shank/kinobi client generation reads, whose borsh serialization IS
187+
/// `discriminator ‖ args`. The generated client's
188+
/// `VerifyCertificateInstructionData` carries the same byte (10). If a
189+
/// dep bump reorders the enum, this fails before anything reaches a
190+
/// validator.
188191
#[test]
189192
fn discriminator_matches_generated_client() {
193+
let args = sample_args();
194+
let program_enum =
195+
ncn_program_core::instruction::NCNProgramInstruction::VerifyCertificate {
196+
digest: args.digest,
197+
aggregated_g2: args.aggregated_g2,
198+
aggregated_signature: args.aggregated_signature,
199+
operators_signature_bitmap: args.operators_signature_bitmap.clone(),
200+
expected_generation: args.expected_generation,
201+
};
202+
let canonical = program_enum.try_to_vec().expect("enum serializes");
203+
// First byte(s): the discriminator const, frozen at the generated
204+
// client's value (1-byte kinobi/borsh enum index, value 10).
205+
assert_eq!(VERIFY_CERTIFICATE_DISCRIMINATOR, &canonical[..1]);
190206
assert_eq!(VERIFY_CERTIFICATE_DISCRIMINATOR, &[10]);
191-
// The program uses 1-byte kinobi/borsh enum discriminators today; if
192-
// the frozen shape switches to 8-byte shank discriminators this length
193-
// assertion must be updated together with the const.
194207
assert_eq!(VERIFY_CERTIFICATE_DISCRIMINATOR.len(), 1);
208+
// Full differential: our hand-rolled encoding == the program enum's
209+
// borsh encoding, byte for byte.
210+
assert_eq!(args.instruction_data(), canonical);
195211
}
196212

197213
#[test]

jito/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
//! - [`quorum`]: startup reconciliation between the engine's count-based N3f1
1515
//! quorum and the program's stake-weighted threshold.
1616
//! - [`instruction`]: manual `VerifyCertificate` instruction construction
17-
//! (frozen §2 shape; discriminator TODO-FREEZE until `phase1-dmsg` pushes).
17+
//! (frozen §2 shape; discriminator pinned byte-for-byte against the Phase 1
18+
//! `NCNProgramInstruction` enum on `main`).
1819
//! - [`submitter`]: [`submitter::JitoSubmitter`] + the
1920
//! [`submitter::SolanaCertificateHandler`] seam (peer of the EVM
2021
//! `BlsSignatureVerificationHandler`), with finalized-only resolutions and

0 commit comments

Comments
 (0)