Giter Club home page Giter Club logo

light-godwoken's People

Contributors

classicalliu avatar dependabot[bot] avatar flouse avatar frmachao avatar homura avatar i-am-sam-codes avatar miaosun009 avatar oriole-pub avatar shooklyngs avatar sighwang avatar spectremercury avatar tarvos21 avatar zhangyouxin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

light-godwoken's Issues

Network switching strategy is too aggressive

The problem

Currently, whenever the current network changes from a supported network to an unsupported network, godwoken-bridge requests to switch the current network to a supported one, which can be too aggressive as it can be triggered even if the user was focusing on other apps.

Maybe when we detect a network change, we should notify and ask the user to switch the network first, instead of requesting the switch directly. An example of the process:

  1. Detect if the current network changes to an unsupported network
  2. If it does, ask to switch the network via confirm dialog
  3. If confirmed, request to switch the network

Contributors

Thanks to @gpBlockchain @Dawn-githup for pointing out the issue.

V1 deposit history will display the withdrawal data of v0

####Steps to reproduce the behavior:
1.V0 initiates a withdrawal to v1
2.The transaction history will be displayed in both v0WithdrawalHistory and v1DepositHistory

####According to the light-godoken display rule, only one item needs to be displayed

This data is obtained from scan
getDepositHistories:

async getDepositHistories(page?: number): Promise<DepositResult[]> {
const ethAddress = this.provider.getL2Address();
const histories = await this.godwokenScannerClient.getDepositHistories(ethAddress, page);

getWithdrawalHistories

async getWithdrawalHistories(page?: number): Promise<WithdrawResultV0[]> {
const ownerLockHash = await this.provider.getLayer1LockScriptHash();
return await this.getWithdrawalHistoriesByOwnerLockHash(ownerLockHash, page);
}

Request change [Estimated time left] of a normal withdrawal

When making a withdrawal to L1 from Godwoken Bridge, the default time is always 7 days. But in practice it is usually longer, around 10 days.

Screenshot_20221105-161701_Discord

In the Godwoken documentation (https://docs.godwoken.io/gwchangelog/v0difv1) there is a remaining time interval between 8 and 12 days, depending on the status of the network.

Some ideas:

  • Show as estimated remaining time the minimum possible, 8 days + third proposal.

  • Show as estimated remaining time the average time between 8 and 12, which would be 10 days + third proposal.

  • Introduce a textbox that informs the user that the remaining time is variable and not fixed and therefore it can take between 8/12 days. Inside [Pending], for example.

Screenshot_20221105-161433_MetaMask

Thank you!

Refactor Godwoken Bridge UI with TailwindCSS

The Godwoken Bridge UI could use some time to do the refactor work, such as refactoring from using StyledComponents to using TailwindCSS. But before this, there are actually tons of UI/CSS frameworks to be selected:

  • TaildwindCSS
  • Maintine
  • RedwoodJS
  • Charkra

Sorry about mixing them together, I will take some time to look these frameworks out.
Aside with these UI/CSS frameworks, we also have @ricons that can be used as our SVG icon library.

Also, the version of React can be updated to Vite+React18.

Bug: Request withdrawal does not appear in pending.

A user has reported a strange issue. He had four request withdrawals with active countdowns, and today one of them, the last one, has disappeared. He can't see it in either YokaiSwap or Godwoken Bridge.

Looking how to reproduce the problem, I have made several test request withdrawals with 400 CKB through https://bridge.godwoken.io/ and they do not appear in pending, but the 400 CKB disappear from the L2 balance. The user has also done it to test it and the same thing happens to him.

Screenshot_20221201-190421_MetaMask

Screenshot_20221201-190626_MetaMask

Bug: funds locked in Godwoken v0 legacy withdrawals generated by Safepal

I have a user with the following problem:

Made a CKB withdrawal from L2 Godwoken V0 to L1 Nervos using Safepal CKB Bridge. That is, he did not use the YokaiSwap interface to make the withdrawal, but the Safepal interface. That interface, CKB Bridge, no longer exists today. After many attempts, he managed to activate the withdrawal manually but the funds never arrived at L1 and it disappeared from the Safepal withdrawal history, which makes me think that the withdrawal was not really activated and is still blocked (in the TXID it can be seen that the funds are in a middleware address). The user contacted Safepal support but they have not been able to fix it. He has checked if his withdrawal appears on Godwoken Bridge and YokaiSwap, and it does not appear on the interface.

The problem reminds me a lot of that of this other user. The main difference is that he made the withdrawal through YokaiSwap and not from Safepal CKB Bridge.

https://discord.com/channels/657799690070523914/671648403071172619/1022503232498585670

I thought that perhaps we can apply the same solution as to the other user, and he can finally access his funds.

I have sent you a DM via discord @Flouse with the TXID and the addresses of the user to safeguard his privacy, my tag is AlejandroR # 9014 in discord.

Thank you.

The intra-application network switching strategy is too radical

Steps to reproduce the behavior:
1.Currently applied to network mismatch
2.Turn off the prompt of switching network within the application and switch to other pages within the application
3.You should not prompt frequently when switching pages within the application

image

'Get 1000 Test Token (TTKN) on L1' Data duplication error occurs after two consecutive operations

Describe the bug

'Get 1000 Test Token (TTKN) on L1' Data duplication error occurs after two consecutive operations

Steps to reproduce the behavior:

  1. "Get 1000 Test Tokens (TTKN) on L1" twice in a row

Error prompt appears

 JSONRPCError: server error {"code":-1107,"message":"PoolRejectedDuplicatedTransaction: Transaction(Byte32(0xe233d9171f944bd43e145cf98d45f19e6c03483112a0338323e62632fcc42690)) already exist in transaction_pool","data":"Duplicated(Byte32(0xe233d9171f944bd43e145cf98d45f19e6c03483112a0338323e62632fcc42690))"}

Can godwoken-bridge work without adding a network to the provider?

The feature

We've found a difference behaviour in LightGodwokenV0 and LightGodwokenV1:

  • V0 - The app works without adding a v0 network to the provider (the connected wallet)
  • V1 - The app needs to get L2 balance from the provider, therefore it has to add a v1 network to the provider

This single difference between v0 and v1 can be erased if we can just request the L2 balance from L2 RPC directly in v0 and v1, instead of requesting from the provider. But there might be other methods with the same issue.

So we need to spend more time reviewing the light-godwoken SDK, and think about how to make the SDK better from a larger perspective. If we could remove all dependencies on the provider (except for signing messages), maybe we don't have to add any network to the provider. This can be the next thing we do.

But on the other hand, if the app does not add a network to the provider, when the user wants to transfer L2 assets to others, do they have to add the network by themselves? It seems like a downside to the feature. @Flouse

Related segments

Prevent double-spending when constructing L1 transactions

The issue

The current version of godwoken-bridge can easily trigger a double spend error when constructing an L1 transaction (deposit/l1-transfer/claim-test-sudt). Here's how to reproduce one:

  1. Open Godwoken Bridge Testnet
  2. Deposit a certain amount of CKB to L2
  3. Deposit again after sending the fist deposit (do it fast)

How it happens

Note that to reproduce the error, the second deposit needs to be sent fast, and then you should receive an error that indicates the transaction was double-spent. More detailed speaking, some inputs in the second transaction was double-spent.

But why would any cell in the inputs of a transaction trigger a double-spend error? Let's see how the construction works. When an L1 transaction is constructing, it collects live cells from the sender's address to build outputs and pay transaction fee:

  • Collect pure CKB cells
  • Collect sUDT cells if transferring sUDT
  • Collect sUDT cells with free CKB in them

Normally when constructing the first transaction, everthing should be fine. But CKB needs time to handle the first transaction, and when you construct the second transaction too fast, while constructing, light-godwoken could collect repeated input cells just like in the first transaction. This is how double-spending works in L1 transactions, you're literally trying to spend the same cell twice.

How to solve it

  1. Mange a spent cells list
    We can manage a spent cells list locally, and exclude those spent cells when collecting input cells. This is an simple idea of how we can do it, in the actual designing/coding phase it could be more difficult to control, as a transaction can be rejected after it is sent.
  2. Freeze the page when processing a transaction
    Or there's another way, we can simply disable L1 transaction features when there is any L1 transaction processing on-chain. However, none of these methods prevent double-spending triggered from multiple tabs.
  3. Use ckb-lumos/transaction-manager
    This method is relatively similar to the first method, only it is controlled by the ckb-lumos library automatically. Since we're using ckb-lumos everywhere in light-godwoken, and the package is easy to replace things in our code, I think this is the best solution for us. Check the link of the package for more details: @ckb-lumos/transaction-manager.

The failed withdrawal transaction will remain in the history record

Steps to reproduce the behavior:

1.Continuously submitting multiple withdrawal requests.
2.Unprocessed withdrawal requests (e.g. failed over withdrawal) will remain in the history record.

image

Transaction hash: 0x81dd4415e37eee1d7581f1f5e9c18e9a388a9606d8984715cb10d6bcca3a7ad5

feat: refactor the `Withdrawal Pending List`

After sending a withdrawal_request, the Withdrawal Pending List took about 5 minutes to display the new pending withdrawal.
It would be better to show the status of the new pending withdrawal as soon as possible.

image

Suggested solution

We could use gw_get_withdrawal RPC to get the status of a new withdrawal request.

echo '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "gw_get_withdrawal",
    "params": ["Withdrawal Tx HASH"]
}' \
| tr -d '\n' \
| curl -H 'content-type: application/json' -d @- \
https://godwoken-testnet-v1.ckbapp.dev

UX improvements on godwoken-bridge

Some low priority features from the previous season are still on hold, and I think we can finish them before the next release:

  • Link addresses to certain explorers
  • Add friendly-tips for users with Javascript disabled

The page cannot be closed due to insufficient withdrawal token sent

Describe the bug

The page cannot be closed due to insufficient withdrawal token sent

To Reproduce

Steps to reproduce the behavior:

  1. Select withdelawal
  2. Select all ckbs
  3. Select a Token 'pckb= 20'
  4. Request Withdrawal

Expected behavior
error messang: Finalized simple UDT custodian cell is not enough to withdraw
Confirm Request page can be closed

Screenshots or Logs

no error message
The confirmation request page cannot be closed

Error: JSONRPCError: server error {"code":-32007,"message":"Withdrawal fund are still finalizing, please try again later. error: Finalized simple UDT custodian cell is not enough to withdraw"}

Feature request: withdrawal from L1 Wallet address to other L1 addresses (CEXs, wallets, etc)

Currently a user who uses https://bridge.godwoken.io/ to perform the withdrawal from L2 to L1 has to use YokaiSwap (https://v1.yokaiswap.com/bridge/transfer) or another third-party app to send from L1 Wallet address to a deposit address of a CEX or their Wallet (PortalWallet, Neuron, etc). In my opinion, users should be able to do all the withdrawal steps, including sending to their CEX or wallet or other L1 address from the public architecture and not depend on third parties/apps. It also involves an extra step (change app), which decreases the user experience. I wonder if it is possible to add this functionality to the bridge.

In this way we could avoid this:

Screenshot_20220916-180326_Telegram

Thank you!

Suggest to optimize double-spending error prompt

Steps to reproduce the behavior:

1.Initiate multiple transactions in succession
2.Error prompt:Unknown Error, Please try again later

Error: {"code":-301,"message":"TransactionFailedToResolve: Resolve failed Unknown(OutPoint(0x716d254d7cf85b26e83664a0ef89820126e344cfa8b3288855d3bcc10464928a01000000))","data":"Resolve(Unknown(OutPoint(0x716d254d7cf85b26e83664a0ef89820126e344cfa8b3288855d3bcc10464928a01000000)))"}

The current error prompt is not detailed enough, and the prompt information needs to be optimized

Missing Force Bridge tokens on mainnet and testnet bridge

Expected: Bridge allows to withdraw from Godwoken v0 all tokens that are available in Force Bridge (both on testnet and mainnet).

Actual: Only ETH (from Force Bridge), TAI and USDC (not from Force Bridge) are possible to withdraw.

Screenshot from mainnet deployment:

image

Use advanced Settings to test cancel deposit feature

Background:

  • A feature: The User can cancel a deposit if the deposit is not packed by roll-up after a range of time, which is determined by the deposit lock contract. For godwoken v0, it's 20 minutes, and for v1, it's 7 days.

Why:

  • We have already supported the "cancel deposit" functionality, but it's a problem for testers to test this feature since it takes too long to wait for the deposit to expire. If a user can configure expiration time, it's great to test cancel deposit.

How:

  1. go to Godwoken Bridge: https://light-godwoken-git-advanced-settings-cryptape.vercel.app/#/v1
  2. open developer tools in browser and navigate to Application, find local storage in left panel:

image

3. change `MIN_CANCEL_DEPOSIT_TIME` to an acceptable time(I change it to `1`) to wait for the deposit to expire. The time unit is seconds. Then you can **refresh** the page and fire a deposit. After a short time, the deposit should be cancelable.

image

FAQ:

  • Why other deposit histories are gone after I changed this setting?
    • Modifying cancel_timeout will change the deposit lock for the current account, so that the assets deposited to the original deposit lock can't be indexed here. Reset(or remove) the advanced settings to go back to normal mode.

Some tokens have no logo

Describe the bug

Some tokens have no logo

To Reproduce

Steps to reproduce the behavior:

  1. Select Token
  2. Token without logo 'YOK,COOP,TAI'

image

Withdrawal history list might need pagination

We use gwscan api to query the user's withdrawal history, and recently I found out that the withdrawal_histories api that we're using, has a pagination. We should take a look at the details around it.

feat: refactor to monorepo

Right now, light-godwoken (the repo) is a normal repo with two parts of code mixed together:

  • LightGodwoken (package)
  • GodwokenBridge (app)

We think it's time to separate the two parts of code for better management, here's how:

  1. Refactor the repo to a monorepo
  2. Separate packages and apps into specific folders
  3. Publish LightGodwoken as an SDK library for developers to use

Display git commit hash on godwoken-bridge

Right now it is difficult for us to know what specific version we are running on godwoken-bridge's testnet/mainnet.

We want to change that, and here we have an example: ForceBridge.
On ForceBridge there is an "About" button that shows the current commit hash for the site, I think we can do it like they do, too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.