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

Testnet fix icon path #10

Open
wants to merge 3 commits into
base: testnet
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion common/prove/change_pub_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func toCryptoChangePubKeyTx(txInfo *txtypes.ChangePubKeyInfo) (info *cryptoTypes
AccountIndex: txInfo.AccountIndex,
L1Address: common.AddressStrToBytes(txInfo.L1Address),
PubKey: pk,
Nonce: txInfo.Nonce,
GasFeeAssetId: txInfo.GasFeeAssetId,
GasFeeAssetAmount: packedFee,
}
Expand Down
2 changes: 0 additions & 2 deletions common/prove/create_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ func toCryptoCreateCollectionTx(txInfo *txtypes.CreateCollectionTxInfo) (info *c
GasAccountIndex: txInfo.GasAccountIndex,
GasFeeAssetId: txInfo.GasFeeAssetId,
GasFeeAssetAmount: packedFee,
ExpiredAt: txInfo.ExpiredAt,
Nonce: txInfo.Nonce,
}
return info, nil
}
1 change: 0 additions & 1 deletion common/prove/mint_nft.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func toCryptoMintNftTx(txInfo *txtypes.MintNftTxInfo) (info *cryptoTypes.MintNft
GasFeeAssetId: txInfo.GasFeeAssetId,
GasFeeAssetAmount: packedFee,
CollectionId: txInfo.NftCollectionId,
ExpiredAt: txInfo.ExpiredAt,
NftContentType: txInfo.NftContentType,
}
return info, nil
Expand Down
5 changes: 1 addition & 4 deletions common/prove/withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package prove

import (
"math/big"

"github.com/consensys/gnark-crypto/ecc/bn254/twistededwards/eddsa"

cryptoTypes "github.com/bnb-chain/zkbnb-crypto/circuit/types"
Expand Down Expand Up @@ -53,15 +51,14 @@ func toCryptoWithdrawTx(txInfo *txtypes.WithdrawTxInfo) (info *cryptoTypes.Withd
if err != nil {
return nil, err
}
addrBytes := txtypes.PaddingAddressToBytes32(txInfo.ToAddress)
info = &cryptoTypes.WithdrawTx{
FromAccountIndex: txInfo.FromAccountIndex,
AssetId: txInfo.AssetId,
AssetAmount: txInfo.AssetAmount,
GasAccountIndex: txInfo.GasAccountIndex,
GasFeeAssetId: txInfo.GasFeeAssetId,
GasFeeAssetAmount: packedFee,
ToAddress: new(big.Int).SetBytes(addrBytes),
ToAddress: common.AddressStrToBytes(txInfo.ToAddress),
}
return info, nil
}
2 changes: 1 addition & 1 deletion common/prove/withdraw_nft.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func toCryptoWithdrawNftTx(txInfo *txtypes.WithdrawNftTxInfo) (info *cryptoTypes
RoyaltyRate: txInfo.RoyaltyRate,
NftIndex: txInfo.NftIndex,
NftContentHash: txInfo.NftContentHash,
ToAddress: txInfo.ToAddress,
ToAddress: common.AddressStrToBytes(txInfo.ToAddress),
GasAccountIndex: txInfo.GasAccountIndex,
GasFeeAssetId: txInfo.GasFeeAssetId,
GasFeeAssetAmount: packedFee,
Expand Down
2 changes: 2 additions & 0 deletions common/prove/witness_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ func (w *WitnessHelper) constructAccountWitness(
w.gasAccountInfo.Nonce = nonce
w.gasAccountInfo.CollectionNonce = collectionNonce
w.gasAccountInfo.AssetRoot = common.Bytes2Hex(w.assetTrees.Get(accountKey).Root())
w.gasAccountInfo.PublicKey = nPubKey
}

// set account info before
Expand Down Expand Up @@ -841,6 +842,7 @@ func (w *WitnessHelper) ResetCache(height int64) error {
gasAccount.CollectionNonce = history.CollectionNonce
gasAccount.AssetInfo = history.AssetInfo
gasAccount.AssetRoot = history.AssetRoot
gasAccount.PublicKey = history.PublicKey
formatGasAccount, err := chain.ToFormatAccountInfo(gasAccount)
if err != nil {
return err
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ require (
)

require (
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230605064829-ad6dbe39b843
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230627022843-b2a562cd2f69
github.com/bnb-chain/zkbnb-eth-rpc v0.0.3-0.20230605074525-1c3e46d3b694
github.com/bnb-chain/zkbnb-smt v0.0.3-0.20230519064631-0f9993341ee0
github.com/consensys/gnark v0.8.0
Expand All @@ -217,5 +217,4 @@ require (
replace (
github.com/consensys/gnark => github.com/bnb-chain/gnark v0.7.2-0.20230425010344-8e482963e1ae
github.com/consensys/gnark-crypto => github.com/bnb-chain/gnark-crypto v0.8.1-0.20230412133626-30223a679fb7

)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ github.com/bnb-chain/gnark v0.7.2-0.20230425010344-8e482963e1ae h1:4b/b0pp1RAWQ6
github.com/bnb-chain/gnark v0.7.2-0.20230425010344-8e482963e1ae/go.mod h1:fmHUzzss1n32K3COWMvrQj7uo7GjIeIr1wXzjj5gmj8=
github.com/bnb-chain/gnark-crypto v0.8.1-0.20230412133626-30223a679fb7 h1:ME5Nif4WgGgWKH2omB6ybic5bsU22bHy43xBsgMBHgM=
github.com/bnb-chain/gnark-crypto v0.8.1-0.20230412133626-30223a679fb7/go.mod h1:a2DQL4+5ywF6safEeZFEPGRiiGbjzGFRUN2sg06VuU4=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230605064829-ad6dbe39b843 h1:mR62qjgA0HzH+Gal5DzjEYZ79zDGSwypko/LlwCIWhg=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230605064829-ad6dbe39b843/go.mod h1:Bi+kI5RYhV3Fgu6upQyAXz2HVxp+Ah9AzvwIBuBDYMM=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230627022843-b2a562cd2f69 h1:Nqt3ttCcUFVVl2rYRcfamIPGUpDVL/LEeURD57RtFRQ=
github.com/bnb-chain/zkbnb-crypto v0.0.8-0.20230627022843-b2a562cd2f69/go.mod h1:Bi+kI5RYhV3Fgu6upQyAXz2HVxp+Ah9AzvwIBuBDYMM=
github.com/bnb-chain/zkbnb-eth-rpc v0.0.3-0.20230605074525-1c3e46d3b694 h1:UeTRF5m2TmCXFTaMxbwhY5PYp5QYFyXv5+MGCCb1L28=
github.com/bnb-chain/zkbnb-eth-rpc v0.0.3-0.20230605074525-1c3e46d3b694/go.mod h1:zZ9uTj1GJOc5OxgojQbA8TZjEQhESUnp4MEWOYk/OVs=
github.com/bnb-chain/zkbnb-go-sdk v1.0.7-0.20230522134048-bcfa8070ef7e h1:jwUKimro0Rgv0kO7yenoVvL5BaEXxGZ7JZddX45m+FY=
Expand Down
3 changes: 2 additions & 1 deletion service/apiserver/internal/logic/asset/getassetlogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const (
queryBySymbol = "symbol"

// iconBaseUrl is used for showing icons for assets, asset owners should upload png files to the github repo
iconBaseUrl = "https://teststatic.zkbnbchain.org/shared/icon/coin/%s.svg"
//iconBaseUrl = "https://teststatic.zkbnbchain.org/shared/icon/coin/%s.svg"
iconBaseUrl = "https://zkbnb-static-cdn.bnbchain.org/shared/icon/coin/%s.svg"
)

type GetAssetLogic struct {
Expand Down
4 changes: 2 additions & 2 deletions service/sender/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -1467,13 +1467,13 @@ func (s *Sender) getZkBnbClient(cli *rpc.ProviderClient) *zkbnb.ZkBNBClient {
logx.Severef("fatal error, GenerateConstructorForCommit raises error:%v", err)
panic("fatal error, GenerateConstructorForCommit raises error:" + err.Error())
}
logx.Info("commit address from CommitKeyId,value is :%s", commitConstructor.GetL1Address().Hex())
logx.Infof("commit address from CommitKeyId,value is :%s", commitConstructor.GetL1Address().Hex())
verifyConstructor, err := s.GenerateConstructorForVerifyAndExecute()
if err != nil {
logx.Severef("fatal error, GenerateConstructorForVerifyAndExecute raises error:%v", err)
panic("fatal error, GenerateConstructorForVerifyAndExecute raises error:" + err.Error())
}
logx.Info("verify address from VerifyKeyId,value is :%s", verifyConstructor.GetL1Address().Hex())
logx.Infof("verify address from VerifyKeyId,value is :%s", verifyConstructor.GetL1Address().Hex())

zkBnbClient, err := zkbnb.NewZkBNBClient(cli, s.ZkBNBContractAddress)
if err != nil {
Expand Down
15 changes: 8 additions & 7 deletions tools/desertexit/desertexit/perform_desert.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ func (m *PerformDesert) WithdrawPendingBalance(owner common.Address, token commo
logx.Errorf("failed to get pending balance: %v", err)
return err
}
logx.Infof("get pending balance,pendingBalanceBefore=%d", pendingBalanceBefore.Int64())
logx.Infof("get pending balance,pendingBalanceBefore=%s", pendingBalanceBefore.String())

balanceBefore, err := m.GetBalance(owner, token)
if err != nil {
logx.Errorf("failed to get balance: %v", err)
return err
}
logx.Infof("get balance,balanceBefore=%d", balanceBefore.Int64())
logx.Infof("get balance,balanceBefore=%s", balanceBefore.String())

gasPrice, err := m.cli.SuggestGasPrice(context.Background())
if err != nil {
Expand All @@ -202,15 +202,15 @@ func (m *PerformDesert) WithdrawPendingBalance(owner common.Address, token commo
logx.Errorf("failed to get pending balance: %v", err)
return err
}
logx.Infof("get pending balance,pendingBalanceAfter=%d", pendingBalanceAfter.Int64())
logx.Infof("get pending balance,pendingBalanceAfter=%s", pendingBalanceAfter.String())

//time.Sleep(30 * time.Second)
balanceAfter, err := m.GetBalance(owner, token)
if err != nil {
logx.Errorf("failed to get balance: %v", err)
return err
}
logx.Infof("get balance,balanceAfter=%d", balanceAfter.Int64())
logx.Infof("get balance,balanceAfter=%s", balanceAfter.String())
return nil
}

Expand Down Expand Up @@ -356,7 +356,7 @@ func (m *PerformDesert) GetBalance(address common.Address, assetAddr common.Addr
if err != nil {
return nil, err
}
logx.Infof("get balance,balance=%d", amount.Int64())
logx.Infof("get balance,balance=%s", amount.String())
return amount, nil
}

Expand All @@ -370,7 +370,7 @@ func (m *PerformDesert) GetBalance(address common.Address, assetAddr common.Addr
if err != nil {
return nil, err
}
logx.Infof("get balance,balance=%d", amount.Int64())
logx.Infof("get balance,balance=%s", amount.String())
return amount, nil
}

Expand All @@ -380,7 +380,7 @@ func (m *PerformDesert) GetPendingBalance(address common.Address, token common.A
logx.Errorf("failed to get pending balance: %v", err)
return nil, err
}
logx.Infof("get pending balance,pendingBalance=%d", amount.Int64())
logx.Infof("get pending balance,pendingBalance=%s", amount.String())
return amount, nil
}

Expand Down Expand Up @@ -414,6 +414,7 @@ func (m *PerformDesert) checkTxSuccess(txHash string) error {
if time.Now().After(startDate.Add(time.Duration(m.Config.ChainConfig.MaxWaitingTime) * time.Second)) {
return fmt.Errorf("failed to sent tx, tx_hash=%s,error=%s", txHash, err)
}
time.Sleep(3*time.Second)
continue
}

Expand Down
12 changes: 9 additions & 3 deletions tools/desertexit/desertexit/witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"

"github.com/bnb-chain/zkbnb-crypto/circuit"
"github.com/bnb-chain/zkbnb-crypto/circuit/desert"
desertTypes "github.com/bnb-chain/zkbnb-crypto/circuit/desert/types"
Expand Down Expand Up @@ -161,6 +163,10 @@ func (c *GenerateProof) generateWitness(blockHeight int64, accountIndex int64, n
pubData = GenerateExitPubData(exitTxInfo)
} else {
nftInfo, err := c.bc.DB().L2NftModel.GetNft(nftIndex)
if err != nil {
logx.Errorf("get nft failed: %s", err)
return desertInfo, pubData, err
}
nft = &cryptoTypes.Nft{
NftIndex: nftInfo.NftIndex,
NftContentHash: common.FromHex(nftInfo.NftContentHash),
Expand All @@ -170,9 +176,9 @@ func (c *GenerateProof) generateWitness(blockHeight int64, accountIndex int64, n
CollectionId: nftInfo.CollectionId,
NftContentType: nftInfo.NftContentType,
}
if err != nil {
logx.Errorf("get nft failed: %s", err)
return desertInfo, pubData, err
if nftInfo.NftContentHash == "0" {
logx.Errorf("nft %d is already withdrawed to L1", nft.NftIndex)
return desertInfo, pubData, errors.New(fmt.Sprintf("Nft %d Already withdrawed to L1", nft.NftIndex))
}
nftMerkleProofs, err := nftTree.GetProof(uint64(nftIndex))
if err != nil {
Expand Down