Skip to content

Commit 1c0e1f7

Browse files
committed
sui-sdk-types: add support for MoveVectorElemTooBig and MoveRawValueTooBig execution error variants
1 parent 7d485ab commit 1c0e1f7

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

crates/sui-sdk-types/src/execution_status.rs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,22 @@ pub enum ExecutionError {
256256

257257
/// Certificate is canceled because randomness could not be generated this epoch
258258
ExecutionCanceledDueToRandomnessUnavailable,
259+
260+
/// Move vector element (passed to MakeMoveVec) with size {value_size} is larger \
261+
/// than the maximum size {max_scaled_size}. Note that this maximum is scaled based on the \
262+
/// type of the vector element.
263+
MoveVectorElemTooBig {
264+
value_size: u64,
265+
max_scaled_size: u64,
266+
},
267+
268+
/// Move value (possibly an upgrade ticket or a dev-inspect value) with size {value_size} \
269+
/// is larger than the maximum size {max_scaled_size}. Note that this maximum is scaled based \
270+
/// on the type of the value.
271+
MoveRawValueTooBig {
272+
value_size: u64,
273+
max_scaled_size: u64,
274+
},
259275
}
260276

261277
/// Location in move bytecode where an error occurred
@@ -632,6 +648,16 @@ mod serialization {
632648
},
633649

634650
ExecutionCanceledDueToRandomnessUnavailable,
651+
652+
MoveVectorElemTooBig {
653+
value_size: u64,
654+
max_scaled_size: u64,
655+
},
656+
657+
MoveRawValueTooBig {
658+
value_size: u64,
659+
max_scaled_size: u64,
660+
},
635661
}
636662

637663
#[derive(serde_derive::Serialize, serde_derive::Deserialize)]
@@ -715,6 +741,16 @@ mod serialization {
715741
},
716742

717743
ExecutionCanceledDueToRandomnessUnavailable,
744+
745+
MoveVectorElemTooBig {
746+
value_size: u64,
747+
max_scaled_size: u64,
748+
},
749+
750+
MoveRawValueTooBig {
751+
value_size: u64,
752+
max_scaled_size: u64,
753+
},
718754
}
719755

720756
impl Serialize for ExecutionError {
@@ -833,6 +869,20 @@ mod serialization {
833869
Self::ExecutionCanceledDueToRandomnessUnavailable => {
834870
ReadableExecutionError::ExecutionCanceledDueToRandomnessUnavailable
835871
}
872+
Self::MoveVectorElemTooBig {
873+
value_size,
874+
max_scaled_size,
875+
} => ReadableExecutionError::MoveVectorElemTooBig {
876+
value_size,
877+
max_scaled_size,
878+
},
879+
Self::MoveRawValueTooBig {
880+
value_size,
881+
max_scaled_size,
882+
} => ReadableExecutionError::MoveRawValueTooBig {
883+
value_size,
884+
max_scaled_size,
885+
},
836886
};
837887
readable.serialize(serializer)
838888
} else {
@@ -942,6 +992,20 @@ mod serialization {
942992
Self::ExecutionCanceledDueToRandomnessUnavailable => {
943993
BinaryExecutionError::ExecutionCanceledDueToRandomnessUnavailable
944994
}
995+
Self::MoveVectorElemTooBig {
996+
value_size,
997+
max_scaled_size,
998+
} => BinaryExecutionError::MoveVectorElemTooBig {
999+
value_size,
1000+
max_scaled_size,
1001+
},
1002+
Self::MoveRawValueTooBig {
1003+
value_size,
1004+
max_scaled_size,
1005+
} => BinaryExecutionError::MoveRawValueTooBig {
1006+
value_size,
1007+
max_scaled_size,
1008+
},
9451009
};
9461010
binary.serialize(serializer)
9471011
}
@@ -1062,6 +1126,20 @@ mod serialization {
10621126
ReadableExecutionError::ExecutionCanceledDueToRandomnessUnavailable => {
10631127
Self::ExecutionCanceledDueToRandomnessUnavailable
10641128
}
1129+
ReadableExecutionError::MoveVectorElemTooBig {
1130+
value_size,
1131+
max_scaled_size,
1132+
} => Self::MoveVectorElemTooBig {
1133+
value_size,
1134+
max_scaled_size,
1135+
},
1136+
ReadableExecutionError::MoveRawValueTooBig {
1137+
value_size,
1138+
max_scaled_size,
1139+
} => Self::MoveRawValueTooBig {
1140+
value_size,
1141+
max_scaled_size,
1142+
},
10651143
})
10661144
} else {
10671145
BinaryExecutionError::deserialize(deserializer).map(|binary| match binary {
@@ -1168,6 +1246,20 @@ mod serialization {
11681246
BinaryExecutionError::ExecutionCanceledDueToRandomnessUnavailable => {
11691247
Self::ExecutionCanceledDueToRandomnessUnavailable
11701248
}
1249+
BinaryExecutionError::MoveVectorElemTooBig {
1250+
value_size,
1251+
max_scaled_size,
1252+
} => Self::MoveVectorElemTooBig {
1253+
value_size,
1254+
max_scaled_size,
1255+
},
1256+
BinaryExecutionError::MoveRawValueTooBig {
1257+
value_size,
1258+
max_scaled_size,
1259+
} => Self::MoveRawValueTooBig {
1260+
value_size,
1261+
max_scaled_size,
1262+
},
11711263
})
11721264
}
11731265
}

0 commit comments

Comments
 (0)