1
// automatically generated by the FlatBuffers compiler, do not modify
2

            
3

            
4
// @generated
5

            
6
use crate::input_type_generated::*;
7
use core::mem;
8
use core::cmp::Ordering;
9

            
10
extern crate flatbuffers;
11
use self::flatbuffers::{EndianScalar, Follow};
12

            
13
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
14
pub const ENUM_MIN_PROVER_VERSION: u16 = 0;
15
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
16
pub const ENUM_MAX_PROVER_VERSION: u16 = 9;
17
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
18
#[allow(non_camel_case_types)]
19
pub const ENUM_VALUES_PROVER_VERSION: [ProverVersion; 3] = [
20
  ProverVersion::DEFAULT,
21
  ProverVersion::V1_0_1,
22
  ProverVersion::V1_2_1,
23
];
24

            
25
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
26
#[repr(transparent)]
27
pub struct ProverVersion(pub u16);
28
#[allow(non_upper_case_globals)]
29
impl ProverVersion {
30
  pub const DEFAULT: Self = Self(0);
31
  pub const V1_0_1: Self = Self(1);
32
  pub const V1_2_1: Self = Self(9);
33

            
34
  pub const ENUM_MIN: u16 = 0;
35
  pub const ENUM_MAX: u16 = 9;
36
  pub const ENUM_VALUES: &'static [Self] = &[
37
    Self::DEFAULT,
38
    Self::V1_0_1,
39
    Self::V1_2_1,
40
  ];
41
  /// Returns the variant's name or "" if unknown.
42
  pub fn variant_name(self) -> Option<&'static str> {
43
    match self {
44
      Self::DEFAULT => Some("DEFAULT"),
45
      Self::V1_0_1 => Some("V1_0_1"),
46
      Self::V1_2_1 => Some("V1_2_1"),
47
      _ => None,
48
    }
49
  }
50
}
51
impl core::fmt::Debug for ProverVersion {
52
  fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
53
    if let Some(name) = self.variant_name() {
54
      f.write_str(name)
55
    } else {
56
      f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
57
    }
58
  }
59
}
60
impl<'a> flatbuffers::Follow<'a> for ProverVersion {
61
  type Inner = Self;
62
  #[inline]
63
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
64
    let b = flatbuffers::read_scalar_at::<u16>(buf, loc);
65
    Self(b)
66
  }
67
}
68

            
69
impl flatbuffers::Push for ProverVersion {
70
    type Output = ProverVersion;
71
    #[inline]
72
    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
73
        flatbuffers::emplace_scalar::<u16>(dst, self.0);
74
    }
75
}
76

            
77
impl flatbuffers::EndianScalar for ProverVersion {
78
  type Scalar = u16;
79
  #[inline]
80
  fn to_little_endian(self) -> u16 {
81
    self.0.to_le()
82
  }
83
  #[inline]
84
  #[allow(clippy::wrong_self_convention)]
85
  fn from_little_endian(v: u16) -> Self {
86
    let b = u16::from_le(v);
87
    Self(b)
88
  }
89
}
90

            
91
impl<'a> flatbuffers::Verifiable for ProverVersion {
92
  #[inline]
93
  fn run_verifier(
94
    v: &mut flatbuffers::Verifier, pos: usize
95
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
96
    use self::flatbuffers::Verifiable;
97
    u16::run_verifier(v, pos)
98
  }
99
}
100

            
101
impl flatbuffers::SimpleToVerifyInSlice for ProverVersion {}
102
// struct Account, aligned to 8
103
#[repr(transparent)]
104
#[derive(Clone, Copy, PartialEq)]
105
pub struct Account(pub [u8; 40]);
106
impl Default for Account { 
107
  fn default() -> Self { 
108
    Self([0; 40])
109
  }
110
}
111
impl core::fmt::Debug for Account {
112
  fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
113
    f.debug_struct("Account")
114
      .field("writable", &self.writable())
115
      .field("pubkey", &self.pubkey())
116
      .finish()
117
  }
118
}
119

            
120
impl flatbuffers::SimpleToVerifyInSlice for Account {}
121
impl<'a> flatbuffers::Follow<'a> for Account {
122
  type Inner = &'a Account;
123
  #[inline]
124
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
125
    <&'a Account>::follow(buf, loc)
126
  }
127
}
128
impl<'a> flatbuffers::Follow<'a> for &'a Account {
129
  type Inner = &'a Account;
130
  #[inline]
131
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
132
    flatbuffers::follow_cast_ref::<Account>(buf, loc)
133
  }
134
}
135
impl<'b> flatbuffers::Push for Account {
136
    type Output = Account;
137
    #[inline]
138
    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
139
        let src = ::core::slice::from_raw_parts(self as *const Account as *const u8, Self::size());
140
        dst.copy_from_slice(src);
141
    }
142
}
143

            
144
impl<'a> flatbuffers::Verifiable for Account {
145
  #[inline]
146
  fn run_verifier(
147
    v: &mut flatbuffers::Verifier, pos: usize
148
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
149
    use self::flatbuffers::Verifiable;
150
    v.in_buffer::<Self>(pos)
151
  }
152
}
153

            
154
impl<'a> Account {
155
  #[allow(clippy::too_many_arguments)]
156
  pub fn new(
157
    writable: u8,
158
    pubkey: &[u8; 32],
159
  ) -> Self {
160
    let mut s = Self([0; 40]);
161
    s.set_writable(writable);
162
    s.set_pubkey(pubkey);
163
    s
164
  }
165

            
166
  pub fn writable(&self) -> u8 {
167
    let mut mem = core::mem::MaybeUninit::<<u8 as EndianScalar>::Scalar>::uninit();
168
    // Safety:
169
    // Created from a valid Table for this object
170
    // Which contains a valid value in this slot
171
    EndianScalar::from_little_endian(unsafe {
172
      core::ptr::copy_nonoverlapping(
173
        self.0[0..].as_ptr(),
174
        mem.as_mut_ptr() as *mut u8,
175
        core::mem::size_of::<<u8 as EndianScalar>::Scalar>(),
176
      );
177
      mem.assume_init()
178
    })
179
  }
180

            
181
  pub fn set_writable(&mut self, x: u8) {
182
    let x_le = x.to_little_endian();
183
    // Safety:
184
    // Created from a valid Table for this object
185
    // Which contains a valid value in this slot
186
    unsafe {
187
      core::ptr::copy_nonoverlapping(
188
        &x_le as *const _ as *const u8,
189
        self.0[0..].as_mut_ptr(),
190
        core::mem::size_of::<<u8 as EndianScalar>::Scalar>(),
191
      );
192
    }
193
  }
194

            
195
  pub fn pubkey(&'a self) -> flatbuffers::Array<'a, u8, 32> {
196
    // Safety:
197
    // Created from a valid Table for this object
198
    // Which contains a valid array in this slot
199
    unsafe { flatbuffers::Array::follow(&self.0, 1) }
200
  }
201

            
202
  pub fn set_pubkey(&mut self, items: &[u8; 32]) {
203
    // Safety:
204
    // Created from a valid Table for this object
205
    // Which contains a valid array in this slot
206
    unsafe { flatbuffers::emplace_scalar_array(&mut self.0, 1, items) };
207
  }
208

            
209
  pub fn unpack(&self) -> AccountT {
210
    AccountT {
211
      writable: self.writable(),
212
      pubkey: self.pubkey().into(),
213
    }
214
  }
215
}
216

            
217
#[derive(Debug, Clone, PartialEq, Default)]
218
pub struct AccountT {
219
  pub writable: u8,
220
  pub pubkey: [u8; 32],
221
}
222
impl AccountT {
223
  pub fn pack(&self) -> Account {
224
    Account::new(
225
      self.writable,
226
      &self.pubkey,
227
    )
228
  }
229
}
230

            
231
pub enum ExecutionRequestV1Offset {}
232
#[derive(Copy, Clone, PartialEq)]
233

            
234
pub struct ExecutionRequestV1<'a> {
235
  pub _tab: flatbuffers::Table<'a>,
236
}
237

            
238
impl<'a> flatbuffers::Follow<'a> for ExecutionRequestV1<'a> {
239
  type Inner = ExecutionRequestV1<'a>;
240
  #[inline]
241
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
242
    Self { _tab: flatbuffers::Table::new(buf, loc) }
243
  }
244
}
245

            
246
impl<'a> ExecutionRequestV1<'a> {
247
  pub const VT_TIP: flatbuffers::VOffsetT = 4;
248
  pub const VT_EXECUTION_ID: flatbuffers::VOffsetT = 6;
249
  pub const VT_IMAGE_ID: flatbuffers::VOffsetT = 8;
250
  pub const VT_CALLBACK_PROGRAM_ID: flatbuffers::VOffsetT = 10;
251
  pub const VT_CALLBACK_INSTRUCTION_PREFIX: flatbuffers::VOffsetT = 12;
252
  pub const VT_FORWARD_OUTPUT: flatbuffers::VOffsetT = 14;
253
  pub const VT_VERIFY_INPUT_HASH: flatbuffers::VOffsetT = 16;
254
  pub const VT_INPUT: flatbuffers::VOffsetT = 18;
255
  pub const VT_INPUT_DIGEST: flatbuffers::VOffsetT = 20;
256
  pub const VT_MAX_BLOCK_HEIGHT: flatbuffers::VOffsetT = 22;
257
  pub const VT_CALLBACK_EXTRA_ACCOUNTS: flatbuffers::VOffsetT = 24;
258
  pub const VT_PROVER_VERSION: flatbuffers::VOffsetT = 26;
259

            
260
  #[inline]
261
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
262
    ExecutionRequestV1 { _tab: table }
263
  }
264
  #[allow(unused_mut)]
265
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
266
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
267
    args: &'args ExecutionRequestV1Args<'args>
268
  ) -> flatbuffers::WIPOffset<ExecutionRequestV1<'bldr>> {
269
    let mut builder = ExecutionRequestV1Builder::new(_fbb);
270
    builder.add_max_block_height(args.max_block_height);
271
    builder.add_tip(args.tip);
272
    if let Some(x) = args.callback_extra_accounts { builder.add_callback_extra_accounts(x); }
273
    if let Some(x) = args.input_digest { builder.add_input_digest(x); }
274
    if let Some(x) = args.input { builder.add_input(x); }
275
    if let Some(x) = args.callback_instruction_prefix { builder.add_callback_instruction_prefix(x); }
276
    if let Some(x) = args.callback_program_id { builder.add_callback_program_id(x); }
277
    if let Some(x) = args.image_id { builder.add_image_id(x); }
278
    if let Some(x) = args.execution_id { builder.add_execution_id(x); }
279
    builder.add_prover_version(args.prover_version);
280
    builder.add_verify_input_hash(args.verify_input_hash);
281
    builder.add_forward_output(args.forward_output);
282
    builder.finish()
283
  }
284

            
285
  pub fn unpack(&self) -> ExecutionRequestV1T {
286
    let tip = self.tip();
287
    let execution_id = self.execution_id().map(|x| {
288
      x.to_string()
289
    });
290
    let image_id = self.image_id().map(|x| {
291
      x.to_string()
292
    });
293
    let callback_program_id = self.callback_program_id().map(|x| {
294
      x.into_iter().collect()
295
    });
296
    let callback_instruction_prefix = self.callback_instruction_prefix().map(|x| {
297
      x.into_iter().collect()
298
    });
299
    let forward_output = self.forward_output();
300
    let verify_input_hash = self.verify_input_hash();
301
    let input = self.input().map(|x| {
302
      x.iter().map(|t| t.unpack()).collect()
303
    });
304
    let input_digest = self.input_digest().map(|x| {
305
      x.into_iter().collect()
306
    });
307
    let max_block_height = self.max_block_height();
308
    let callback_extra_accounts = self.callback_extra_accounts().map(|x| {
309
      x.iter().map(|t| t.unpack()).collect()
310
    });
311
    let prover_version = self.prover_version();
312
    ExecutionRequestV1T {
313
      tip,
314
      execution_id,
315
      image_id,
316
      callback_program_id,
317
      callback_instruction_prefix,
318
      forward_output,
319
      verify_input_hash,
320
      input,
321
      input_digest,
322
      max_block_height,
323
      callback_extra_accounts,
324
      prover_version,
325
    }
326
  }
327

            
328
  #[inline]
329
  pub fn tip(&self) -> u64 {
330
    // Safety:
331
    // Created from valid Table for this object
332
    // which contains a valid value in this slot
333
    unsafe { self._tab.get::<u64>(ExecutionRequestV1::VT_TIP, Some(0)).unwrap()}
334
  }
335
  #[inline]
336
  pub fn execution_id(&self) -> Option<&'a str> {
337
    // Safety:
338
    // Created from valid Table for this object
339
    // which contains a valid value in this slot
340
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(ExecutionRequestV1::VT_EXECUTION_ID, None)}
341
  }
342
  #[inline]
343
  pub fn image_id(&self) -> Option<&'a str> {
344
    // Safety:
345
    // Created from valid Table for this object
346
    // which contains a valid value in this slot
347
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(ExecutionRequestV1::VT_IMAGE_ID, None)}
348
  }
349
  #[inline]
350
  pub fn callback_program_id(&self) -> Option<flatbuffers::Vector<'a, u8>> {
351
    // Safety:
352
    // Created from valid Table for this object
353
    // which contains a valid value in this slot
354
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(ExecutionRequestV1::VT_CALLBACK_PROGRAM_ID, None)}
355
  }
356
  #[inline]
357
  pub fn callback_instruction_prefix(&self) -> Option<flatbuffers::Vector<'a, u8>> {
358
    // Safety:
359
    // Created from valid Table for this object
360
    // which contains a valid value in this slot
361
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(ExecutionRequestV1::VT_CALLBACK_INSTRUCTION_PREFIX, None)}
362
  }
363
  #[inline]
364
  pub fn forward_output(&self) -> bool {
365
    // Safety:
366
    // Created from valid Table for this object
367
    // which contains a valid value in this slot
368
    unsafe { self._tab.get::<bool>(ExecutionRequestV1::VT_FORWARD_OUTPUT, Some(false)).unwrap()}
369
  }
370
  #[inline]
371
  pub fn verify_input_hash(&self) -> bool {
372
    // Safety:
373
    // Created from valid Table for this object
374
    // which contains a valid value in this slot
375
    unsafe { self._tab.get::<bool>(ExecutionRequestV1::VT_VERIFY_INPUT_HASH, Some(true)).unwrap()}
376
  }
377
  #[inline]
378
  pub fn input(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Input<'a>>>> {
379
    // Safety:
380
    // Created from valid Table for this object
381
    // which contains a valid value in this slot
382
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Input>>>>(ExecutionRequestV1::VT_INPUT, None)}
383
  }
384
  #[inline]
385
  pub fn input_digest(&self) -> Option<flatbuffers::Vector<'a, u8>> {
386
    // Safety:
387
    // Created from valid Table for this object
388
    // which contains a valid value in this slot
389
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(ExecutionRequestV1::VT_INPUT_DIGEST, None)}
390
  }
391
  #[inline]
392
  pub fn max_block_height(&self) -> u64 {
393
    // Safety:
394
    // Created from valid Table for this object
395
    // which contains a valid value in this slot
396
    unsafe { self._tab.get::<u64>(ExecutionRequestV1::VT_MAX_BLOCK_HEIGHT, Some(0)).unwrap()}
397
  }
398
  #[inline]
399
  pub fn callback_extra_accounts(&self) -> Option<flatbuffers::Vector<'a, Account>> {
400
    // Safety:
401
    // Created from valid Table for this object
402
    // which contains a valid value in this slot
403
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Account>>>(ExecutionRequestV1::VT_CALLBACK_EXTRA_ACCOUNTS, None)}
404
  }
405
  #[inline]
406
  pub fn prover_version(&self) -> ProverVersion {
407
    // Safety:
408
    // Created from valid Table for this object
409
    // which contains a valid value in this slot
410
    unsafe { self._tab.get::<ProverVersion>(ExecutionRequestV1::VT_PROVER_VERSION, Some(ProverVersion::DEFAULT)).unwrap()}
411
  }
412
}
413

            
414
impl flatbuffers::Verifiable for ExecutionRequestV1<'_> {
415
  #[inline]
416
  fn run_verifier(
417
    v: &mut flatbuffers::Verifier, pos: usize
418
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
419
    use self::flatbuffers::Verifiable;
420
    v.visit_table(pos)?
421
     .visit_field::<u64>("tip", Self::VT_TIP, false)?
422
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("execution_id", Self::VT_EXECUTION_ID, false)?
423
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("image_id", Self::VT_IMAGE_ID, false)?
424
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("callback_program_id", Self::VT_CALLBACK_PROGRAM_ID, false)?
425
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("callback_instruction_prefix", Self::VT_CALLBACK_INSTRUCTION_PREFIX, false)?
426
     .visit_field::<bool>("forward_output", Self::VT_FORWARD_OUTPUT, false)?
427
     .visit_field::<bool>("verify_input_hash", Self::VT_VERIFY_INPUT_HASH, false)?
428
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Input>>>>("input", Self::VT_INPUT, false)?
429
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("input_digest", Self::VT_INPUT_DIGEST, false)?
430
     .visit_field::<u64>("max_block_height", Self::VT_MAX_BLOCK_HEIGHT, false)?
431
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, Account>>>("callback_extra_accounts", Self::VT_CALLBACK_EXTRA_ACCOUNTS, false)?
432
     .visit_field::<ProverVersion>("prover_version", Self::VT_PROVER_VERSION, false)?
433
     .finish();
434
    Ok(())
435
  }
436
}
437
pub struct ExecutionRequestV1Args<'a> {
438
    pub tip: u64,
439
    pub execution_id: Option<flatbuffers::WIPOffset<&'a str>>,
440
    pub image_id: Option<flatbuffers::WIPOffset<&'a str>>,
441
    pub callback_program_id: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
442
    pub callback_instruction_prefix: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
443
    pub forward_output: bool,
444
    pub verify_input_hash: bool,
445
    pub input: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Input<'a>>>>>,
446
    pub input_digest: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
447
    pub max_block_height: u64,
448
    pub callback_extra_accounts: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Account>>>,
449
    pub prover_version: ProverVersion,
450
}
451
impl<'a> Default for ExecutionRequestV1Args<'a> {
452
  #[inline]
453
  fn default() -> Self {
454
    ExecutionRequestV1Args {
455
      tip: 0,
456
      execution_id: None,
457
      image_id: None,
458
      callback_program_id: None,
459
      callback_instruction_prefix: None,
460
      forward_output: false,
461
      verify_input_hash: true,
462
      input: None,
463
      input_digest: None,
464
      max_block_height: 0,
465
      callback_extra_accounts: None,
466
      prover_version: ProverVersion::DEFAULT,
467
    }
468
  }
469
}
470

            
471
pub struct ExecutionRequestV1Builder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
472
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
473
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
474
}
475
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ExecutionRequestV1Builder<'a, 'b, A> {
476
  #[inline]
477
  pub fn add_tip(&mut self, tip: u64) {
478
    self.fbb_.push_slot::<u64>(ExecutionRequestV1::VT_TIP, tip, 0);
479
  }
480
  #[inline]
481
  pub fn add_execution_id(&mut self, execution_id: flatbuffers::WIPOffset<&'b  str>) {
482
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ExecutionRequestV1::VT_EXECUTION_ID, execution_id);
483
  }
484
  #[inline]
485
  pub fn add_image_id(&mut self, image_id: flatbuffers::WIPOffset<&'b  str>) {
486
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ExecutionRequestV1::VT_IMAGE_ID, image_id);
487
  }
488
  #[inline]
489
  pub fn add_callback_program_id(&mut self, callback_program_id: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
490
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ExecutionRequestV1::VT_CALLBACK_PROGRAM_ID, callback_program_id);
491
  }
492
  #[inline]
493
  pub fn add_callback_instruction_prefix(&mut self, callback_instruction_prefix: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
494
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ExecutionRequestV1::VT_CALLBACK_INSTRUCTION_PREFIX, callback_instruction_prefix);
495
  }
496
  #[inline]
497
  pub fn add_forward_output(&mut self, forward_output: bool) {
498
    self.fbb_.push_slot::<bool>(ExecutionRequestV1::VT_FORWARD_OUTPUT, forward_output, false);
499
  }
500
  #[inline]
501
  pub fn add_verify_input_hash(&mut self, verify_input_hash: bool) {
502
    self.fbb_.push_slot::<bool>(ExecutionRequestV1::VT_VERIFY_INPUT_HASH, verify_input_hash, true);
503
  }
504
  #[inline]
505
  pub fn add_input(&mut self, input: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Input<'b >>>>) {
506
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ExecutionRequestV1::VT_INPUT, input);
507
  }
508
  #[inline]
509
  pub fn add_input_digest(&mut self, input_digest: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
510
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ExecutionRequestV1::VT_INPUT_DIGEST, input_digest);
511
  }
512
  #[inline]
513
  pub fn add_max_block_height(&mut self, max_block_height: u64) {
514
    self.fbb_.push_slot::<u64>(ExecutionRequestV1::VT_MAX_BLOCK_HEIGHT, max_block_height, 0);
515
  }
516
  #[inline]
517
  pub fn add_callback_extra_accounts(&mut self, callback_extra_accounts: flatbuffers::WIPOffset<flatbuffers::Vector<'b , Account>>) {
518
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(ExecutionRequestV1::VT_CALLBACK_EXTRA_ACCOUNTS, callback_extra_accounts);
519
  }
520
  #[inline]
521
  pub fn add_prover_version(&mut self, prover_version: ProverVersion) {
522
    self.fbb_.push_slot::<ProverVersion>(ExecutionRequestV1::VT_PROVER_VERSION, prover_version, ProverVersion::DEFAULT);
523
  }
524
  #[inline]
525
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ExecutionRequestV1Builder<'a, 'b, A> {
526
    let start = _fbb.start_table();
527
    ExecutionRequestV1Builder {
528
      fbb_: _fbb,
529
      start_: start,
530
    }
531
  }
532
  #[inline]
533
  pub fn finish(self) -> flatbuffers::WIPOffset<ExecutionRequestV1<'a>> {
534
    let o = self.fbb_.end_table(self.start_);
535
    flatbuffers::WIPOffset::new(o.value())
536
  }
537
}
538

            
539
impl core::fmt::Debug for ExecutionRequestV1<'_> {
540
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
541
    let mut ds = f.debug_struct("ExecutionRequestV1");
542
      ds.field("tip", &self.tip());
543
      ds.field("execution_id", &self.execution_id());
544
      ds.field("image_id", &self.image_id());
545
      ds.field("callback_program_id", &self.callback_program_id());
546
      ds.field("callback_instruction_prefix", &self.callback_instruction_prefix());
547
      ds.field("forward_output", &self.forward_output());
548
      ds.field("verify_input_hash", &self.verify_input_hash());
549
      ds.field("input", &self.input());
550
      ds.field("input_digest", &self.input_digest());
551
      ds.field("max_block_height", &self.max_block_height());
552
      ds.field("callback_extra_accounts", &self.callback_extra_accounts());
553
      ds.field("prover_version", &self.prover_version());
554
      ds.finish()
555
  }
556
}
557
#[non_exhaustive]
558
#[derive(Debug, Clone, PartialEq)]
559
pub struct ExecutionRequestV1T {
560
  pub tip: u64,
561
  pub execution_id: Option<String>,
562
  pub image_id: Option<String>,
563
  pub callback_program_id: Option<Vec<u8>>,
564
  pub callback_instruction_prefix: Option<Vec<u8>>,
565
  pub forward_output: bool,
566
  pub verify_input_hash: bool,
567
  pub input: Option<Vec<InputT>>,
568
  pub input_digest: Option<Vec<u8>>,
569
  pub max_block_height: u64,
570
  pub callback_extra_accounts: Option<Vec<AccountT>>,
571
  pub prover_version: ProverVersion,
572
}
573
impl Default for ExecutionRequestV1T {
574
  fn default() -> Self {
575
    Self {
576
      tip: 0,
577
      execution_id: None,
578
      image_id: None,
579
      callback_program_id: None,
580
      callback_instruction_prefix: None,
581
      forward_output: false,
582
      verify_input_hash: true,
583
      input: None,
584
      input_digest: None,
585
      max_block_height: 0,
586
      callback_extra_accounts: None,
587
      prover_version: ProverVersion::DEFAULT,
588
    }
589
  }
590
}
591
impl ExecutionRequestV1T {
592
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
593
    &self,
594
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
595
  ) -> flatbuffers::WIPOffset<ExecutionRequestV1<'b>> {
596
    let tip = self.tip;
597
    let execution_id = self.execution_id.as_ref().map(|x|{
598
      _fbb.create_string(x)
599
    });
600
    let image_id = self.image_id.as_ref().map(|x|{
601
      _fbb.create_string(x)
602
    });
603
    let callback_program_id = self.callback_program_id.as_ref().map(|x|{
604
      _fbb.create_vector(x)
605
    });
606
    let callback_instruction_prefix = self.callback_instruction_prefix.as_ref().map(|x|{
607
      _fbb.create_vector(x)
608
    });
609
    let forward_output = self.forward_output;
610
    let verify_input_hash = self.verify_input_hash;
611
    let input = self.input.as_ref().map(|x|{
612
      let w: Vec<_> = x.iter().map(|t| t.pack(_fbb)).collect();_fbb.create_vector(&w)
613
    });
614
    let input_digest = self.input_digest.as_ref().map(|x|{
615
      _fbb.create_vector(x)
616
    });
617
    let max_block_height = self.max_block_height;
618
    let callback_extra_accounts = self.callback_extra_accounts.as_ref().map(|x|{
619
      let w: Vec<_> = x.iter().map(|t| t.pack()).collect();_fbb.create_vector(&w)
620
    });
621
    let prover_version = self.prover_version;
622
    ExecutionRequestV1::create(_fbb, &ExecutionRequestV1Args{
623
      tip,
624
      execution_id,
625
      image_id,
626
      callback_program_id,
627
      callback_instruction_prefix,
628
      forward_output,
629
      verify_input_hash,
630
      input,
631
      input_digest,
632
      max_block_height,
633
      callback_extra_accounts,
634
      prover_version,
635
    })
636
  }
637
}
638
#[inline]
639
/// Verifies that a buffer of bytes contains a `ExecutionRequestV1`
640
/// and returns it.
641
/// Note that verification is still experimental and may not
642
/// catch every error, or be maximally performant. For the
643
/// previous, unchecked, behavior use
644
/// `root_as_execution_request_v1_unchecked`.
645
pub fn root_as_execution_request_v1(buf: &[u8]) -> Result<ExecutionRequestV1, flatbuffers::InvalidFlatbuffer> {
646
  flatbuffers::root::<ExecutionRequestV1>(buf)
647
}
648
#[inline]
649
/// Verifies that a buffer of bytes contains a size prefixed
650
/// `ExecutionRequestV1` and returns it.
651
/// Note that verification is still experimental and may not
652
/// catch every error, or be maximally performant. For the
653
/// previous, unchecked, behavior use
654
/// `size_prefixed_root_as_execution_request_v1_unchecked`.
655
pub fn size_prefixed_root_as_execution_request_v1(buf: &[u8]) -> Result<ExecutionRequestV1, flatbuffers::InvalidFlatbuffer> {
656
  flatbuffers::size_prefixed_root::<ExecutionRequestV1>(buf)
657
}
658
#[inline]
659
/// Verifies, with the given options, that a buffer of bytes
660
/// contains a `ExecutionRequestV1` and returns it.
661
/// Note that verification is still experimental and may not
662
/// catch every error, or be maximally performant. For the
663
/// previous, unchecked, behavior use
664
/// `root_as_execution_request_v1_unchecked`.
665
pub fn root_as_execution_request_v1_with_opts<'b, 'o>(
666
  opts: &'o flatbuffers::VerifierOptions,
667
  buf: &'b [u8],
668
) -> Result<ExecutionRequestV1<'b>, flatbuffers::InvalidFlatbuffer> {
669
  flatbuffers::root_with_opts::<ExecutionRequestV1<'b>>(opts, buf)
670
}
671
#[inline]
672
/// Verifies, with the given verifier options, that a buffer of
673
/// bytes contains a size prefixed `ExecutionRequestV1` and returns
674
/// it. Note that verification is still experimental and may not
675
/// catch every error, or be maximally performant. For the
676
/// previous, unchecked, behavior use
677
/// `root_as_execution_request_v1_unchecked`.
678
pub fn size_prefixed_root_as_execution_request_v1_with_opts<'b, 'o>(
679
  opts: &'o flatbuffers::VerifierOptions,
680
  buf: &'b [u8],
681
) -> Result<ExecutionRequestV1<'b>, flatbuffers::InvalidFlatbuffer> {
682
  flatbuffers::size_prefixed_root_with_opts::<ExecutionRequestV1<'b>>(opts, buf)
683
}
684
#[inline]
685
/// Assumes, without verification, that a buffer of bytes contains a ExecutionRequestV1 and returns it.
686
/// # Safety
687
/// Callers must trust the given bytes do indeed contain a valid `ExecutionRequestV1`.
688
pub unsafe fn root_as_execution_request_v1_unchecked(buf: &[u8]) -> ExecutionRequestV1 {
689
  flatbuffers::root_unchecked::<ExecutionRequestV1>(buf)
690
}
691
#[inline]
692
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ExecutionRequestV1 and returns it.
693
/// # Safety
694
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ExecutionRequestV1`.
695
pub unsafe fn size_prefixed_root_as_execution_request_v1_unchecked(buf: &[u8]) -> ExecutionRequestV1 {
696
  flatbuffers::size_prefixed_root_unchecked::<ExecutionRequestV1>(buf)
697
}
698
#[inline]
699
pub fn finish_execution_request_v1_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
700
    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
701
    root: flatbuffers::WIPOffset<ExecutionRequestV1<'a>>) {
702
  fbb.finish(root, None);
703
}
704

            
705
#[inline]
706
pub fn finish_size_prefixed_execution_request_v1_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<ExecutionRequestV1<'a>>) {
707
  fbb.finish_size_prefixed(root, None);
708
}