diff --git a/rust-lite/src/rust_lite/__main__.py b/rust-lite/src/rust_lite/__main__.py
index 30824e1..d6fd02b 100644
--- a/rust-lite/src/rust_lite/__main__.py
+++ b/rust-lite/src/rust_lite/__main__.py
@@ -76,11 +76,11 @@ def exec_erc20() -> None:
trigger_exec_run(stripped_args)
def exec_staking() -> None:
- stripped_args = {'command': 'run', 'input_file': Path('../tests/syntax/lending.rs')}
+ stripped_args = {'command': 'run', 'input_file': Path('../tests/syntax/staking.rs')}
trigger_exec_run(stripped_args)
def exec_lending() -> None:
- stripped_args = {'command': 'run', 'input_file': Path('../tests/syntax/staking.rs')}
+ stripped_args = {'command': 'run', 'input_file': Path('../tests/syntax/lending.rs')}
trigger_exec_run(stripped_args)
diff --git a/rust-lite/src/rust_lite/manager.py b/rust-lite/src/rust_lite/manager.py
index ae7f67d..25bec09 100644
--- a/rust-lite/src/rust_lite/manager.py
+++ b/rust-lite/src/rust_lite/manager.py
@@ -32,7 +32,7 @@ def _init_cterm(self) -> None:
def load_program(self, program_path: str) -> None:
- returned_process = _kast(file=program_path, definition_dir=f'../.build/rust-execution-kompiled')
+ returned_process = _kast(file=program_path, definition_dir=f'../.build/rust-preprocessing-kompiled')
program = returned_process.stdout
@@ -59,3 +59,12 @@ def print_k_top_element(self) -> None:
_PPRINT.pprint(top_cell)
else:
print('Cell is empty.')
+
+
+ def print_constants_cell(self) -> None:
+ cell = self.cterm.cell('CONSTANTS_CELL')
+
+ print('--------------------------------------------------')
+ print('CONSTANTS CELL ELEMENT: ')
+ _PPRINT.pprint(cell)
+
\ No newline at end of file
diff --git a/rust-semantics/expression.md b/rust-semantics/expression.md
index 0ecb4be..644f674 100644
--- a/rust-semantics/expression.md
+++ b/rust-semantics/expression.md
@@ -1,4 +1,5 @@
```k
+requires "expression/constants.md"
requires "expression/casts.md"
requires "expression/literals.md"
requires "expression/variables.md"
@@ -7,5 +8,6 @@ module RUST-EXPRESSION
imports private RUST-CASTS
imports private RUST-EXPRESSION-LITERALS
imports private RUST-EXPRESSION-VARIABLES
+ imports private RUST-EXPRESSION-CONSTANTS
endmodule
```
diff --git a/rust-semantics/expression/constants.md b/rust-semantics/expression/constants.md
new file mode 100644
index 0000000..cb66638
--- /dev/null
+++ b/rust-semantics/expression/constants.md
@@ -0,0 +1,14 @@
+```k
+
+module RUST-EXPRESSION-CONSTANTS
+ imports private COMMON-K-CELL
+ imports private RUST-SHARED-SYNTAX
+ imports private RUST-REPRESENTATION
+ imports private RUST-PREPROCESSING-CONFIGURATION
+
+ rule Name:Identifier::.PathExprSegments => V ...
+ Name
+ V:Value
+
+endmodule
+```
\ No newline at end of file
diff --git a/rust-semantics/targets/preprocessing/rust.md b/rust-semantics/targets/preprocessing/rust.md
index 9d58471..12b9a70 100644
--- a/rust-semantics/targets/preprocessing/rust.md
+++ b/rust-semantics/targets/preprocessing/rust.md
@@ -4,6 +4,7 @@ requires "configuration.md"
requires "../../preprocessing.md"
requires "../../representation.md"
requires "../../expression/casts.md"
+requires "../../expression/constants.md"
requires "../../expression/literals.md"
requires "../../rust-common-syntax.md"
@@ -13,6 +14,7 @@ endmodule
module RUST
imports private RUST-EXPRESSION-LITERALS
+ imports private RUST-EXPRESSION-CONSTANTS
imports private RUST-PREPROCESSING
imports private RUST-RUNNING-CONFIGURATION
endmodule
diff --git a/tests/execution/constant-lookup.1.run b/tests/execution/constant-lookup.1.run
new file mode 100644
index 0000000..ee4f961
--- /dev/null
+++ b/tests/execution/constant-lookup.1.run
@@ -0,0 +1,4 @@
+new ConstantValueLookup;
+call ConstantValueLookup.lookup_constant;
+return_value;
+check_eq 7_000_u64
\ No newline at end of file
diff --git a/tests/execution/constant-lookup.2.run b/tests/execution/constant-lookup.2.run
new file mode 100644
index 0000000..2767362
--- /dev/null
+++ b/tests/execution/constant-lookup.2.run
@@ -0,0 +1,4 @@
+new ConstantValueLookup;
+call ConstantValueLookup.lookup_constant_with_type;
+return_value;
+check_eq 7100_u64
\ No newline at end of file
diff --git a/tests/execution/constant-lookup.rs b/tests/execution/constant-lookup.rs
new file mode 100644
index 0000000..4ac713f
--- /dev/null
+++ b/tests/execution/constant-lookup.rs
@@ -0,0 +1,24 @@
+#![no_std]
+
+#[allow(unused_imports)]
+use multiversx_sc::imports::*;
+
+pub const SAMPLE_CONSTANT: u64 = 7_000;
+
+#[multiversx_sc::contract]
+pub trait ConstantValueLookup {
+ #[init]
+ fn init(&self) {
+ }
+
+ #[upgrade]
+ fn upgrade(&self) {}
+
+ fn lookup_constant(&self) -> u64 { SAMPLE_CONSTANT }
+
+ fn lookup_constant_with_type(&self) -> u64 {
+ let x = 100_u64 + SAMPLE_CONSTANT;
+ x
+ }
+
+}
diff --git a/tests/syntax/staking.rs b/tests/syntax/staking.rs
index ad9cb42..ded9ff7 100644
--- a/tests/syntax/staking.rs
+++ b/tests/syntax/staking.rs
@@ -9,7 +9,7 @@ use multiversx_sc::imports::*;
pub const YEARLY_INTEREST: u64 = 7_000;
pub const BPS: u64 = 100_000;
pub const SECONDS_IN_DAY: u64 = 24 * 60 * 60;
-pub const SECONDS_IN_YEAR: u64 = 365 * SECONDS_IN_DAY;
+pub const SECONDS_IN_YEAR: u64 = 365_u64 * SECONDS_IN_DAY;
#[multiversx_sc::contract]
pub trait Staking {