Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web][UMA-1034] hints in modals for Beacon and WC #2338

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dianasavvatina
Copy link
Contributor

@dianasavvatina dianasavvatina commented Jan 24, 2025

Proposed changes

Umami modals for both Beacon and WalletConnect should be more helpful.
A user can easily make a mistake or hesitate confirming a transaction without understanding of the consequences of the operation.

Task: UMA-1034

Types of changes

  • Bugfix
  • New feature
  • Refactor
  • Breaking change
  • UI fix

Steps to reproduce

  1. Connect https://taquito-test-dapp.pages.dev/
  2. run operations:
  • delegate
  • undelegate
  • stake
  • unstake
  • finalize
  1. see the hint and the details description

Other operations are covered in #2340

Screenshots

Add the screenshots of how the app used to look like and how it looks now

Operation Before Now
DelegationRequest image image
accordion opened image
Undelegation Request image image
accordion opened image
Stake image image
accordion opened image
Unstake image image
accordion opened image
Finalize Unstake Request image image
accordion opened image

Checklist

  • Tests that prove my fix is effective or that my feature works have been added
  • Documentation has been added (if appropriate)
  • Screenshots are added (if any UI changes have been made)
  • All TODOs have a corresponding task created (and the link is attached to it)

Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umami-embed-iframe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 0:16am
umami-embed-iframe-ghostnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 0:16am
umami-v2-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 0:16am
umami-v2-web-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 0:16am

@germanD
Copy link

germanD commented Jan 24, 2025

@dianasavvatina made a first pass with several nits/suggestions. Will make another after these are addressed.

Also, opened #2339 which would complement this (great) effort to improve UX!

Copy link

@germanD germanD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some suggestions.

@dianasavvatina I asked the L1 team to answer some of the doubts regarding unstaked tez. That should help clarify the information for tooltips, and will take that into account for a second round!

This is much welcome UX progress 🚀

export const Hints: Record<SignPage, HintData> = {
TezSignPage: {
header:
"A confirmation takes 1 block (10 seconds). The transaction becomes final and irreversible after 2 blocks (20 seconds).",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"A confirmation takes 1 block (10 seconds). The transaction becomes final and irreversible after 2 blocks (20 seconds).",
"A confirmation takes 1 block (8 seconds). The transaction becomes final and irreversible after 2 blocks (16 seconds).",

header:
"A confirmation takes 1 block (10 seconds). The transaction becomes final and irreversible after 2 blocks (20 seconds).",
description:
"A confirmation means that the block is confirmed by the network but the operation can still be canceled in the unlikely case of a crypto attack. Finality means that the operation is irreversible.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"A confirmation means that the block is confirmed by the network but the operation can still be canceled in the unlikely case of a crypto attack. Finality means that the operation is irreversible.",
"A confirmation means that the block is confirmed by the network but the operation can still be cancelled due to chain reorganizations. Finality means that the operation is irreversible.",

Attack is incorrect here. With Tenderbake, you can have a alternative heads scenario, where a block payload proposal generated on (levl n, round k+1) is not confirmed and the chosen chain is a block on (level n+1, usually round 0) which is a succesor of (level n, round k (or earlier)).

This might just happen out of slow consensus/ degraded health / network congestion scenarios -- which they don't necessarily entail an attack.

Comment on lines 27 to 30
"A confirmation takes 1 block (10 seconds). The transaction becomes final and irreversible after 2 blocks (20 seconds).",
description:
"A confirmation means that the block is confirmed by the network but the operation can still be canceled in the unlikely case of a crypto attack. Finality means that the operation is irreversible.",
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remarks above

DelegationSignPage: {
header: "It takes 4 cycles (~6 days) to start receiving delegation rewards.",
description:
"Delegation rewards are distributed every 2 cycles (~3 days). Ensure that the delegation fee offered by the baker is less than 100%; otherwise, you will not receive rewards. Delegation means that all your funds are delegated to one baker. The funds are still spendable, and you can cancel or change the delegation at any time.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Delegation rewards are distributed every 2 cycles (~3 days). Ensure that the delegation fee offered by the baker is less than 100%; otherwise, you will not receive rewards. Delegation means that all your funds are delegated to one baker. The funds are still spendable, and you can cancel or change the delegation at any time.",
"Bakers usually distribute delegation rewards every cycle (~2.8 days). Ensure that the delegation fee offered by the baker is less than 100%; otherwise, you might not receive rewards. Delegation means that all your funds are delegated to one baker. The funds are still spendable, and you can cancel or change the delegation at any time.",

Delegation rewards are allocated to the baker during the cycle, they usually pay them a number of cycles in delay. This is not mandated by the protocol. Bakers might pool rewards and pay them each k cycles, for instance

},
UndelegationSignPage: {
header:
"Immediately stops delegation and initiates unstaking. Restoring delegation rewards takes 4 cycles (~6 days). Unstaking takes 4 cycles (~10 days).",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Immediately stops delegation and initiates unstaking. Restoring delegation rewards takes 4 cycles (~6 days). Unstaking takes 4 cycles (~10 days).",
"Immediately stops delegation and initiates unstaking. Restoring delegation rewards takes 4 cycles (~10 days). After 4 cycles (~10 days), unstaked tez can be finalized and made avaialable",

I need to confirm the math for the unstakes and delegation.

Also notice that in the case of a change of baker, any current liquid balance will be delegated to the new baker, but unstaked tez will keep being delegated to the old one. This is a bit of a corner case where funds end. delegated to two bakers on an overlap of a few cycles . Which is a headache. And not something you want to add to hint :)

Copy link
Contributor Author

@dianasavvatina dianasavvatina Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can create a web page (maybe it already exists) and link it from the hint. Then we can explain all in details including corner cases

Comment on lines 44 to 47
"A confirmation takes 1 block (10 seconds). The transaction becomes final and irreversible after 2 blocks (20 seconds).",
description:
"A confirmation means that the block is confirmed by the network but the operation can still be canceled in the unlikely case of a crypto attack. Finality means that the operation is irreversible.",
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remarks above

},
StakeSignPage: {
header:
"Your balance will be reduced by the staked amount. You will start receiving rewards within 1 cycle (~3 days) max.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Your balance will be reduced by the staked amount. You will start receiving rewards within 1 cycle (~3 days) max.",
"Your available balance will be reduced by the amount staked. You will start accruing staking rewards within 1 cycle (~3 days) max. Note that staking rewards are compounded on your staked balance",

header:
"Your balance will be reduced by the staked amount. You will start receiving rewards within 1 cycle (~3 days) max.",
description:
"By staking, your balance will be automatically reduced by the staked amount. Rewards are calculated and sent to your balance automatically every time your delegated baker produces a new block and at the end of each cycle (~3 days). If you decide to cancel staking, it will take approximately 4 cycles (~10 days) to unlock your funds and return them to your balance.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"By staking, your balance will be automatically reduced by the staked amount. Rewards are calculated and sent to your balance automatically every time your delegated baker produces a new block and at the end of each cycle (~3 days). If you decide to cancel staking, it will take approximately 4 cycles (~10 days) to unlock your funds and return them to your balance.",
"By staking, the chosen amount will automatically deducted from your available balance. Rewards are allocated to your staked balance automatically every time your chosen baker produces a new block and at the end of each cycle (~3 days). If you decide to cancel staking, it will take approximately 4 cycles (~10 days) to unlock your funds before you can make them available.",

Comment on lines 60 to 63
header: "Finalizing unstake takes 1 block (10 seconds).",
description:
"Finalizing unstake is a process that takes 1 block (10 seconds) to complete. After finalizing unstake, your funds will be returned to your balance. You can then stake them again or spend them.",
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should match above!

Comment on lines 55 to 57
header: "Unstaking takes 4 cycles (~10 days) to complete.",
description:
"Unstaking is a process that takes approximately 4 cycles (~10 days) to complete. During this time, your funds are locked, and you will not receive rewards. After the unstaking process is complete, you need to finalize unstaking, after which your funds will be returned to your balance.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
header: "Unstaking takes 4 cycles (~10 days) to complete.",
description:
"Unstaking is a process that takes approximately 4 cycles (~10 days) to complete. During this time, your funds are locked, and you will not receive rewards. After the unstaking process is complete, you need to finalize unstaking, after which your funds will be returned to your balance.",
header: "Unstaking takes 4 cycles (~10 days) to complete.",
description:
"Unstaking is a process that takes at least 4 cycles (~10 days) to complete. During this time, your funds are locked, and you will not receive staking rewards. After 4 cycles, you need to finalize unstaked tez in order to make these funds available.",

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be part of packages, as the contents (hints) will be common among web/desktop and other platforms.

@dianasavvatina
Copy link
Contributor Author

Updated based on this example:

image

Copy link

@germanD germanD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dianasavvatina LGTM modulo remarks. Depending on the space, some hints and modals can be expanded. But this is imho enough for the current iteration

const basicOperationDescription = undefined;

const finalizationConsequences =
"Finalized funds are returned to your balance, allowing you to spend them or stake them again to earn rewards. Delegation rewards for these funds stop once they are finalized.";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delegation rewards for these funds stop once they are finalized.

This is incorrect. Both spendable and unstaked balances are delegated. So moving from one to the other doesn't affect delegations.

Suggested change
"Finalized funds are returned to your balance, allowing you to spend them or stake them again to earn rewards. Delegation rewards for these funds stop once they are finalized.";
"Finalizing unstaked funds makes them available on your spendable balance. They can now be spent or staken again to earn more rewards.";


const finalizationConsequences =
"Finalized funds are returned to your balance, allowing you to spend them or stake them again to earn rewards. Delegation rewards for these funds stop once they are finalized.";
const unstakingConsequences = `The unstaking process takes 4 cycles (~10 days) to unlock your staked funds, making them finalizable on request. You will receive delegation rewards for finalizable funds. ${finalizationConsequences}`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const unstakingConsequences = `The unstaking process takes 4 cycles (~10 days) to unlock your staked funds, making them finalizable on request. You will receive delegation rewards for finalizable funds. ${finalizationConsequences}`;
const unstakingConsequences = `Unstaked tez immediately stop accruing staking rewards, but sill give rights to delegation rewards. Unstaked tez remain locked for up to 4 cycles (~11 days), after which they can be finalized on request. ${finalizationConsequences}`;

If we wanted to be less contrieved : an unstake request on cycle n because finalizable at the beginning of cycle n+4. This means we need to wait at least 3 full cycles, and up to 4.

See the diagram here

https://docs.tezos.com/using/staking#staking-periods-and-delays

description: basicOperationDescription,
},
DelegationSignPage: {
header: "It takes 2 cycles (~6 days) to start receiving delegation rewards.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
header: "It takes 2 cycles (~6 days) to start receiving delegation rewards.",
header: "It takes at least 3 full cycles (~9 days) to start receiving delegation rewards. The actual delay will depend on your chosen baker payout strategy",

It takes at least 2 full cycles + we need to wait until the end of the cycles to get rewards:

  • user delegates on cycle n.
  • delegation is taken into account for cycle n+3, and delegation rewards are allocated to the baker during the cycle
  • at the beginning of cycle n+4, baker can pay the rewards for the previous cycle,

Note that many bakers pay delegation rewards with further delays. This is off protocols

description: `Undelegation takes effect immediately. However, you will still receive delegation rewards for the current and the next 2 cycles, as baking rights are computed 2 cycles in advance. By undelegating, you also initiate the unstaking process if you have staked. ${unstakingConsequences}`,
},
StakeSignPage: {
header: "You will start receiving rewards within 1 cycle (~3 days).",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
header: "You will start receiving rewards within 1 cycle (~3 days).",
header: "You will start receiving rewards immediately (within the current cycle)",

You can earn rewards from the same next block.

},
StakeSignPage: {
header: "You will start receiving rewards within 1 cycle (~3 days).",
description: `Your spendable balance will be reduced by the amount staked. You will start accruing staking rewards within 1 cycle (~3 days). Staking rewards are compounded on your staked balance. You can cancel staking any time. ${unstakingConsequences}`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: `Your spendable balance will be reduced by the amount staked. You will start accruing staking rewards within 1 cycle (~3 days). Staking rewards are compounded on your staked balance. You can cancel staking any time. ${unstakingConsequences}`,
description: `Your spendable balance will be reduced by the amount staked. You will start accruing staking rewards immediately (within the current cycle). Staking rewards are compounded on your staked balance. You can cancel staking any time. ${unstakingConsequences}`,

description: `Your spendable balance will be reduced by the amount staked. You will start accruing staking rewards within 1 cycle (~3 days). Staking rewards are compounded on your staked balance. You can cancel staking any time. ${unstakingConsequences}`,
},
UnstakeSignPage: {
header: "Takes at least 4 cycles (~10 days) to complete.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
header: "Takes at least 4 cycles (~10 days) to complete.",
header: "Unstake request take effect immediately, but funds remain frozen for up to 4 cycles (~10 days)",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants