From 19e10e70bf5acf0e0031034d5b0c2a6d99166f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20P=C5=82askonka?= Date: Tue, 15 Jul 2025 11:05:27 +0200 Subject: [PATCH 1/3] Delegating and rewards. --- .../docs/advanced/08-delegating-cspr.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docusaurus/docs/advanced/08-delegating-cspr.md b/docusaurus/docs/advanced/08-delegating-cspr.md index be9aa58d7..957801e44 100644 --- a/docusaurus/docs/advanced/08-delegating-cspr.md +++ b/docusaurus/docs/advanced/08-delegating-cspr.md @@ -124,3 +124,30 @@ specific to the network or backend. We used `currently_delegated_amount` in the example, it uses `delegated_amount` method from ContractEnv, but it is also possible to query this information from the HostEnv using `delegated_amount` method. + +## Implementation details + +To keep the parity of behaviour between Odra VM and Casper VM, +we implemented some not-so-obvious behaviours and parameters that +can influence your code. + +### Minimum delegation amount + +Each validator can define the minimum delegation amount. Delegator +cannot delegate a smaller amount but can increase the delegation +in smaller steps. + +If the delegation amount falls below it, all the delegated +funds will be undelegated. + +By default, the Odra VM and Casper VM are booted up with +5 validators, each with `MINIMUM_DELEGATION_AMOUNT` set to +500 CSPR. + +### Rewards calculation + +As mentioned above, VMs are started with 5 validators, each +is delegating `DEFAULT_BID_AMOUNT`, which is set to `5_000_000_000_000_000_000u64` (5 000 000 000 CSPR). + +At each auction `DEFAULT_REWARD_AMOUNT` (2500 CSPR) is divided equally between +all validators and delegators based on their share in the pool. \ No newline at end of file From 53eb93b20be405a34373c233cfdc3641c9451e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20P=C5=82askonka?= Date: Tue, 15 Jul 2025 13:10:08 +0200 Subject: [PATCH 2/3] More host functions in testing --- docusaurus/docs/basics/07-testing.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docusaurus/docs/basics/07-testing.md b/docusaurus/docs/basics/07-testing.md index 6f7cffa74..ed7bc2272 100644 --- a/docusaurus/docs/basics/07-testing.md +++ b/docusaurus/docs/basics/07-testing.md @@ -121,11 +121,16 @@ the function we are calling inside the contract. - `fn set_caller(&self, address: Address)` - you've seen it in action just now - `fn balance_of(&self, addr: &T) -> U512` - returns the balance of the account associated with the given address -- `fn advance_block_time(&self, time_diff: u64)` - increases the current value of `block_time` +- `fn block_time(&self) -> u64` - returns the current value of `block_time` in milliseconds, alias: `block_time_millis` +- `fn block_time_secs(&self) -> u64` - retuns the current value of `block_time` in seconds +- `fn advance_block_time(&self, time_diff: u64)` - increases the current value of `block_time` by `time_diff` in milliseconds - `fn get_account(&self, n: usize) -> Address` - returns an n-th address that was prepared for you by Odra in advance; by default, you start with the 0-th account - `fn emitted_event(&self, contract_address: &R, event: T) -> bool` - verifies if the event was emitted by the contract +It also exposes functions that help discover the host's configuration: + + Full list of functions can be found in the [`HostEnv`] documentation. ## What's next From 62f7d0d7e7085c8fe6519542795b6e157eced2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20P=C5=82askonka?= Date: Mon, 10 Nov 2025 09:14:54 +0100 Subject: [PATCH 3/3] Removed unneeded line from testing. --- docusaurus/docs/basics/07-testing.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docusaurus/docs/basics/07-testing.md b/docusaurus/docs/basics/07-testing.md index ed7bc2272..c1032edc5 100644 --- a/docusaurus/docs/basics/07-testing.md +++ b/docusaurus/docs/basics/07-testing.md @@ -128,9 +128,6 @@ the function we are calling inside the contract. by default, you start with the 0-th account - `fn emitted_event(&self, contract_address: &R, event: T) -> bool` - verifies if the event was emitted by the contract -It also exposes functions that help discover the host's configuration: - - Full list of functions can be found in the [`HostEnv`] documentation. ## What's next