-
Notifications
You must be signed in to change notification settings - Fork 28
feat: on appeal or failure revert it to the previous value #1240
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
base: main
Are you sure you want to change the base?
feat: on appeal or failure revert it to the previous value #1240
Conversation
…ling - Implement value transfer between accounts in consensus - Add error handling for insufficient balance in transactions - Update GenVM to support transaction value parameter - Add automatic account funding when creating new accounts in frontend - Add error handling for transaction processing in RPC endpoints - Update frontend components to handle account creation asynchronously
… into 1028-feat-adjust-value-in-current_state-based-on-transaction-values
…d-on-transaction-values
… add value checks in testcase
…d-on-transaction-values
WalkthroughThis change set introduces unified and explicit handling of account balances and transaction values across the backend, frontend, smart contracts, and tests. It revises balance update logic, adds error handling, enables value transfer with contract calls, updates interfaces to support these features, and synchronizes contract and account state management in tests. Frontend components and services are extended to support account funding and value input for contract calls. Changes
Sequence Diagram(s)Value Transfer During Contract ExecutionsequenceDiagram
participant User
participant Frontend
participant Backend (RPC)
participant AccountsManager
participant Node
participant GenVMHost
User->>Frontend: Initiate contract call (with value)
Frontend->>Backend (RPC): send_raw_transaction / callWriteMethod (with value)
Backend (RPC)->>AccountsManager: update_account_balance(sender, -value)
AccountsManager-->>Backend (RPC): Success/Failure
Backend (RPC)->>Node: run_contract(..., transaction_value=value)
Node->>GenVMHost: run_contract(..., value)
GenVMHost-->>Node: Execution result
Node-->>Backend (RPC): Receipt
Backend (RPC)-->>Frontend: Response
Frontend-->>User: Show result
Account Creation and FundingsequenceDiagram
participant User
participant Frontend
participant JsonRpcService
participant Backend (RPC)
participant AccountsManager
participant ConsensusService
User->>Frontend: Create new account
Frontend->>JsonRpcService: generateNewAccount()
JsonRpcService->>Backend (RPC): Create account
Backend (RPC)->>AccountsManager: create_new_account_with_address()
AccountsManager->>ConsensusService: fund_hardhat_account(address, amount)
ConsensusService-->>AccountsManager: Done
AccountsManager-->>Backend (RPC): Account created
Backend (RPC)-->>JsonRpcService: Account info
JsonRpcService-->>Frontend: Account info
Frontend-->>User: Notify account created
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…saction-values into dxp-170-feat-on-appeal-or-failure-revert-it-to-the-previous-value
|


Fixes #DXP-170
What
restore_stuck_transactionsfunction to include balance restoration logic.test_base.pyto verify the new refund functionality.Why
To ensure that the recipient's account balance is correctly restored when a validator appeal is successful.
Testing done
Added and executed unit tests in
test_base.pyto verify that account balances are correctly restored after successful appeals.Decisions made
Checks
Reviewing tips
Focus on the changes.
Depends
This PR contains code from PR #1036
User facing release notes
Implemented restoring of the contract balance when appealed or recomputed.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Chores
Tests