Skip to content

[execution, contracts] Introduce Relayer and non-enshrined tokens #867

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

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

Conversation

shermike
Copy link
Contributor

@shermike shermike commented Apr 28, 2025

  • Replaced enshrined tokens with contracted tokens, introducing the TokenManager to manage token balances within each shard.
  • TokenManager is deployed on each shard and holds the balances for all tokens within that shard.
  • Introduced a new Relayer contract to handle Cross-Shard Transactions (CST). The Relayer:
    • Calls the TokenManager before and after CSTs to ensure token transfers and consistency.
    • Handles bounce, response, and request transactions.

Key Issues with the New Approach:

  • Increased costs: CSTs and token manipulations are now more expensive.
  • Token removal inefficiency: Tokens are not removed from accounts if the balance becomes zero due to high costs.
  • Limited nested request support: Nested requests (sending a request from a response handler) are not supported.
  • Compilation issues: Previous contract compilation settings caused a "too deep stack" error. Resolved by using via-ir and optimize options for all contract compilations.
  • Test issues: Some tests were disabled due to incomplete support for gas forwarding and bounce messages.

@shermike shermike force-pushed the relayer-and-pure-tokens branch 2 times, most recently from 0debf67 to b60446e Compare April 28, 2025 18:51
@shermike shermike force-pushed the relayer-and-pure-tokens branch from b60446e to 6d5f673 Compare April 28, 2025 19:58
@shermike shermike force-pushed the relayer-and-pure-tokens branch from 6d5f673 to bc57d1a Compare April 28, 2025 20:16
@shermike shermike force-pushed the relayer-and-pure-tokens branch from 68ea02b to 37e5a5b Compare April 29, 2025 07:13
- Replaced enshrined tokens with contracted tokens, introducing the `TokenManager` to manage token
  balances within each shard.
- `TokenManager` is deployed on each shard and holds the balances for all tokens within that shard.
- Introduced a new `Relayer` contract to handle Cross-Shard Transactions (CST). The `Relayer`:
  - Calls the `TokenManager` before and after CSTs to ensure token transfers and consistency.
  - Handles bounce, response, and request transactions.

Key Issues with the new approach:
- Increased costs: CSTs and token manipulations are now more expensive.
- Token removal inefficiency: Tokens are not removed from accounts if the balance becomes zero due
  to high costs.
- Limited nested request support: Nested requests (sending a request from a response handler) are
  not supported.
- Compilation issues: Previous contract compilation settings caused a "too deep stack" error.
  Resolved by using `via-ir` and `optimize` options for all contract compilations.
- Test issues: Some tests were disabled due to incomplete support for gas forwarding and bounce messages.
Copy link
Contributor

@dmtrskv dmtrskv left a comment

Choose a reason for hiding this comment

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

There is too much to comprehend it completely.
Is it possible to make separate pull requests for the refactoring and deletion, and for the new features.

// s.Require().Equal("Counter", result[1]["Contract"])
// s.Require().Equal("get()", result[1]["CallData"])
// s.Require().Equal("Counter", result[1]["Contract"])
// s.Contains(out, "└ eventValue: [0]")
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the future of this code?

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.

2 participants