Skip to content

Commit

Permalink
Rename Index to Offset
Browse files Browse the repository at this point in the history
  • Loading branch information
techraed committed Nov 29, 2023
1 parent 5c4cea3 commit 85f51eb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions utils/wasm-gen/src/config/syscalls/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl SysCallsParamsConfig {
[
ParamType::Length,
ParamType::Gas,
ParamType::Index,
ParamType::Offset,
ParamType::DurationBlockNumber,
ParamType::DelayBlockNumber,
ParamType::Handler,
Expand Down Expand Up @@ -92,7 +92,7 @@ impl Default for SysCallsParamsConfig {
// There are no rules for memory arrays and pointers as they are chosen
// in accordance to memory pages config.
(ParamType::Gas, (0..=250_000_000_000).into()),
(ParamType::Index, (0..=10).into()),
(ParamType::Offset, (0..=10).into()),
(ParamType::DurationBlockNumber, (1..=8).into()),
(ParamType::DelayBlockNumber, (0..=4).into()),
(ParamType::Handler, (0..=100).into()),
Expand Down
2 changes: 1 addition & 1 deletion utils/wasm-gen/src/generator/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl InvocableSysCall {
HashType::ActorId,
))),
// An offset defining starting index in the received payload (related to `gr_send_input`).
ParamType::Index,
ParamType::Offset,
// Length of the slice of the received message payload (related to `gr_send_input`).
ParamType::Length,
// Delay (related to `gr_send_input`).
Expand Down
22 changes: 12 additions & 10 deletions utils/wasm-instrument/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl SysCallName {
SysCallSignature::gr([Version, Ptr(PtrInfo::new_mutable(PtrType::BufferStart))])
}
Self::Read => SysCallSignature::gr([
Index,
Offset,
Length,
Ptr(PtrInfo::new_mutable(PtrType::SizedBufferStart {
length_param_idx: 1,
Expand All @@ -317,7 +317,7 @@ impl SysCallName {
))),
]),
Self::ReplyInput => SysCallSignature::gr([
Index,
Offset,
Length,
Ptr(PtrInfo::new_immutable(PtrType::Value)),
Ptr(PtrInfo::new_mutable(PtrType::ErrorWithHash(
Expand All @@ -336,7 +336,7 @@ impl SysCallName {
))),
]),
Self::ReplyInputWGas => SysCallSignature::gr([
Index,
Offset,
Length,
Gas,
Ptr(PtrInfo::new_immutable(PtrType::Value)),
Expand Down Expand Up @@ -384,9 +384,11 @@ impl SysCallName {
Length,
Ptr(PtrInfo::new_mutable(PtrType::ErrorCode)),
]),
Self::ReplyPushInput => {
SysCallSignature::gr([Index, Length, Ptr(PtrInfo::new_mutable(PtrType::ErrorCode))])
}
Self::ReplyPushInput => SysCallSignature::gr([
Offset,
Length,
Ptr(PtrInfo::new_mutable(PtrType::ErrorCode)),
]),
Self::ReplyTo => SysCallSignature::gr([Ptr(PtrInfo::new_mutable(
PtrType::ErrorWithHash(HashType::MessageId),
))]),
Expand All @@ -410,7 +412,7 @@ impl SysCallName {
Ptr(PtrInfo::new_immutable(PtrType::HashWithValue(
HashType::ActorId,
))),
Index,
Offset,
Length,
DelayBlockNumber,
Ptr(PtrInfo::new_mutable(PtrType::ErrorWithHash(
Expand All @@ -435,7 +437,7 @@ impl SysCallName {
Ptr(PtrInfo::new_immutable(PtrType::HashWithValue(
HashType::ActorId,
))),
Index,
Offset,
Length,
Gas,
DelayBlockNumber,
Expand Down Expand Up @@ -477,7 +479,7 @@ impl SysCallName {
]),
Self::SendPushInput => SysCallSignature::gr([
Handler,
Index,
Offset,
Length,
Ptr(PtrInfo::new_mutable(PtrType::ErrorCode)),
]),
Expand Down Expand Up @@ -611,7 +613,7 @@ pub enum ParamType {
Length, // i32 buffers length
Ptr(PtrInfo), // i32 pointer
Gas, // i64 gas amount
Index, // i32 offset in the input buffer (message payload)
Offset, // i32 offset in the input buffer (message payload)
DurationBlockNumber, // i32 duration in blocks
DelayBlockNumber, // i32 delay in blocks
Handler, // i32 handler number
Expand Down

0 comments on commit 85f51eb

Please sign in to comment.