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

log: fix the wrong logs #79

Merged
merged 2 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
log: fix the wrong logs
  • Loading branch information
yutianwu committed Aug 24, 2022
commit 49dafa4090cba75156c679905dd3b2753bfc54a9
2 changes: 1 addition & 1 deletion common/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"errors"
"math/big"

"github.com/bnb-chain/zkbas-crypto/zero/twistededwards/tebn254/zero"
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas-crypto/zero/twistededwards/tebn254/zero"
"github.com/bnb-chain/zkbas/types"
)

Expand Down
2 changes: 1 addition & 1 deletion common/chain/balance_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ package chain
import (
"errors"

"github.com/bnb-chain/zkbas-crypto/ffmath"
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas-crypto/ffmath"
"github.com/bnb-chain/zkbas/types"
)

Expand Down
4 changes: 2 additions & 2 deletions common/chain/block_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"bytes"
"math/big"

"github.com/ethereum/go-ethereum/common"

curve "github.com/bnb-chain/zkbas-crypto/ecc/ztwistededwards/tebn254"
"github.com/bnb-chain/zkbas-crypto/ffmath"
zkbas "github.com/bnb-chain/zkbas-eth-rpc/zkbas/core/legend"
"github.com/ethereum/go-ethereum/common"

common2 "github.com/bnb-chain/zkbas/common"
"github.com/bnb-chain/zkbas/dao/block"
)
Expand Down
4 changes: 2 additions & 2 deletions common/chain/block_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
"math/big"
"testing"

curve "github.com/bnb-chain/zkbas-crypto/ecc/ztwistededwards/tebn254"
"github.com/bnb-chain/zkbas-crypto/ffmath"
"github.com/consensys/gnark-crypto/ecc/bn254/fr/mimc"
"github.com/ethereum/go-ethereum/common"

curve "github.com/bnb-chain/zkbas-crypto/ecc/ztwistededwards/tebn254"
"github.com/bnb-chain/zkbas-crypto/ffmath"
common2 "github.com/bnb-chain/zkbas/common"
)

Expand Down
4 changes: 2 additions & 2 deletions common/chain/liquidity_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"errors"
"math/big"

"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas-crypto/ffmath"
"github.com/bnb-chain/zkbas-crypto/util"
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas/common"
"github.com/bnb-chain/zkbas/types"
)
Expand Down
2 changes: 1 addition & 1 deletion common/chain/pubdata_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ package chain
import (
"errors"

"github.com/bnb-chain/zkbas-crypto/wasm/legend/legendTxTypes"
"github.com/consensys/gnark-crypto/ecc/bn254/twistededwards/eddsa"
"github.com/ethereum/go-ethereum/common"
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas-crypto/wasm/legend/legendTxTypes"
common2 "github.com/bnb-chain/zkbas/common"
"github.com/bnb-chain/zkbas/types"
)
Expand Down
18 changes: 9 additions & 9 deletions common/prove/add_liquidity.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ import (
func (w *WitnessHelper) constructAddLiquidityCryptoTx(cryptoTx *CryptoTx, oTx *Tx) (*CryptoTx, error) {
txInfo, err := types.ParseAddLiquidityTxInfo(oTx.TxInfo)
if err != nil {
logx.Errorf("[ConstructAddLiquidityCryptoTx] unable to parse register zns tx info:%s", err.Error())
logx.Errorf("unable to parse add liquidity tx info:%s", err.Error())
return nil, err
}
cryptoTxInfo, err := ToCryptoAddLiquidityTx(txInfo)
if err != nil {
logx.Errorf("[ConstructAddLiquidityCryptoTx] unable to convert to crypto register zns tx: %s", err.Error())
logx.Errorf("unable to convert to crypto add liquidity tx: %s", err.Error())
return nil, err
}
cryptoTx.AddLiquidityTxInfo = cryptoTxInfo
cryptoTx.ExpiredAt = txInfo.ExpiredAt
cryptoTx.Signature = new(eddsa.Signature)
_, err = cryptoTx.Signature.SetBytes(txInfo.Sig)
if err != nil {
logx.Errorf("[ConstructAddLiquidityCryptoTx] invalid sig bytes: %s", err.Error())
logx.Errorf("invalid sig bytes: %s", err.Error())
return nil, err
}
return cryptoTx, nil
Expand All @@ -50,32 +50,32 @@ func (w *WitnessHelper) constructAddLiquidityCryptoTx(cryptoTx *CryptoTx, oTx *T
func ToCryptoAddLiquidityTx(txInfo *types.AddLiquidityTxInfo) (info *CryptoAddLiquidityTx, err error) {
packedAAmount, err := common.ToPackedAmount(txInfo.AssetAAmount)
if err != nil {
logx.Errorf("[ToCryptoAddLiquidityTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
packedBAmount, err := common.ToPackedAmount(txInfo.AssetBAmount)
if err != nil {
logx.Errorf("[ToCryptoAddLiquidityTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
packedLpAmount, err := common.ToPackedAmount(txInfo.LpAmount)
if err != nil {
logx.Errorf("[ToCryptoAddLiquidityTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
packedTreasuryAmount, err := common.ToPackedAmount(txInfo.TreasuryAmount)
if err != nil {
logx.Errorf("[ToCryptoAddLiquidityTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
packedKLast, err := common.ToPackedAmount(txInfo.KLast)
if err != nil {
logx.Errorf("[ToCryptoAddLiquidityTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
packedFee, err := common.ToPackedFee(txInfo.GasFeeAssetAmount)
if err != nil {
logx.Errorf("[ToCryptoAddLiquidityTx] unable to convert to packed fee: %s", err.Error())
logx.Errorf("unable to convert to packed fee: %s", err.Error())
return nil, err
}
info = &CryptoAddLiquidityTx{
Expand Down
1 change: 1 addition & 0 deletions common/prove/add_liquidity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/bnb-chain/bas-smt/database/memory"

"github.com/bnb-chain/zkbas/dao/account"
"github.com/bnb-chain/zkbas/dao/basic"
"github.com/bnb-chain/zkbas/dao/liquidity"
Expand Down
14 changes: 7 additions & 7 deletions common/prove/atomic_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ import (
func (w *WitnessHelper) constructAtomicMatchCryptoTx(cryptoTx *CryptoTx, oTx *Tx) (*CryptoTx, error) {
txInfo, err := types.ParseAtomicMatchTxInfo(oTx.TxInfo)
if err != nil {
logx.Errorf("[ConstructAtomicMatchCryptoTx] unable to parse register zns tx info:%s", err.Error())
logx.Errorf("unable to parse atomic match tx info:%s", err.Error())
return nil, err
}
cryptoTxInfo, err := ToCryptoAtomicMatchTx(txInfo)
if err != nil {
logx.Errorf("[ConstructAtomicMatchCryptoTx] unable to convert to crypto register zns tx: %s", err.Error())
logx.Errorf("unable to convert to crypto atomic match tx: %s", err.Error())
return nil, err
}
cryptoTx.AtomicMatchTxInfo = cryptoTxInfo
cryptoTx.ExpiredAt = txInfo.ExpiredAt
cryptoTx.Signature = new(eddsa.Signature)
_, err = cryptoTx.Signature.SetBytes(txInfo.Sig)
if err != nil {
logx.Errorf("[ConstructAtomicMatchCryptoTx] invalid sig bytes: %s", err.Error())
logx.Errorf("invalid sig bytes: %s", err.Error())
return nil, err
}
return cryptoTx, nil
Expand All @@ -50,22 +50,22 @@ func (w *WitnessHelper) constructAtomicMatchCryptoTx(cryptoTx *CryptoTx, oTx *Tx
func ToCryptoAtomicMatchTx(txInfo *types.AtomicMatchTxInfo) (info *CryptoAtomicMatchTx, err error) {
packedFee, err := common.ToPackedFee(txInfo.GasFeeAssetAmount)
if err != nil {
logx.Errorf("[ToCryptoSwapTx] unable to convert to packed fee: %s", err.Error())
logx.Errorf("unable to convert to packed fee: %s", err.Error())
return nil, err
}
packedAmount, err := common.ToPackedAmount(txInfo.BuyOffer.AssetAmount)
if err != nil {
logx.Errorf("[ToCryptoSwapTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
packedCreatorAmount, err := common.ToPackedAmount(txInfo.CreatorAmount)
if err != nil {
logx.Errorf("[ToCryptoSwapTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
packedTreasuryAmount, err := common.ToPackedAmount(txInfo.TreasuryAmount)
if err != nil {
logx.Errorf("[ToCryptoSwapTx] unable to convert to packed amount: %s", err.Error())
logx.Errorf("unable to convert to packed amount: %s", err.Error())
return nil, err
}
buySig := new(eddsa.Signature)
Expand Down
1 change: 1 addition & 0 deletions common/prove/atomic_match_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/bnb-chain/bas-smt/database/memory"

"github.com/bnb-chain/zkbas/dao/account"
"github.com/bnb-chain/zkbas/dao/basic"
"github.com/bnb-chain/zkbas/dao/liquidity"
Expand Down
8 changes: 4 additions & 4 deletions common/prove/cancel_offer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ import (
func (w *WitnessHelper) constructCancelOfferCryptoTx(cryptoTx *CryptoTx, oTx *Tx) (*CryptoTx, error) {
txInfo, err := types.ParseCancelOfferTxInfo(oTx.TxInfo)
if err != nil {
logx.Errorf("[ConstructCancelOfferCryptoTx] unable to parse register zns tx info:%s", err.Error())
logx.Errorf("unable to parse cancel offer tx info:%s", err.Error())
return nil, err
}
cryptoTxInfo, err := ToCryptoCancelOfferTx(txInfo)
if err != nil {
logx.Errorf("[ConstructCancelOfferCryptoTx] unable to convert to crypto register zns tx: %s", err.Error())
logx.Errorf("unable to convert to crypto cancel offer tx: %s", err.Error())
return nil, err
}
cryptoTx.CancelOfferTxInfo = cryptoTxInfo
cryptoTx.ExpiredAt = txInfo.ExpiredAt
cryptoTx.Signature = new(eddsa.Signature)
_, err = cryptoTx.Signature.SetBytes(txInfo.Sig)
if err != nil {
logx.Errorf("[ConstructCancelOfferCryptoTx] invalid sig bytes: %s", err.Error())
logx.Errorf("invalid sig bytes: %s", err.Error())
return nil, err
}
return cryptoTx, nil
Expand All @@ -50,7 +50,7 @@ func (w *WitnessHelper) constructCancelOfferCryptoTx(cryptoTx *CryptoTx, oTx *Tx
func ToCryptoCancelOfferTx(txInfo *types.CancelOfferTxInfo) (info *CryptoCancelOfferTx, err error) {
packedFee, err := common.ToPackedFee(txInfo.GasFeeAssetAmount)
if err != nil {
logx.Errorf("[ToCryptoSwapTx] unable to convert to packed fee: %s", err.Error())
logx.Errorf("unable to convert to packed fee: %s", err.Error())
return nil, err
}
info = &CryptoCancelOfferTx{
Expand Down
1 change: 1 addition & 0 deletions common/prove/cancel_offer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/bnb-chain/bas-smt/database/memory"

"github.com/bnb-chain/zkbas/dao/account"
"github.com/bnb-chain/zkbas/dao/basic"
"github.com/bnb-chain/zkbas/dao/liquidity"
Expand Down
8 changes: 4 additions & 4 deletions common/prove/create_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ import (
func (w *WitnessHelper) constructCreateCollectionCryptoTx(cryptoTx *CryptoTx, oTx *Tx) (*CryptoTx, error) {
txInfo, err := types.ParseCreateCollectionTxInfo(oTx.TxInfo)
if err != nil {
logx.Errorf("[ConstructCreateCollectionCryptoTx] unable to parse register zns tx info:%s", err.Error())
logx.Errorf("unable to parse create collection tx info:%s", err.Error())
return nil, err
}
cryptoTxInfo, err := ToCryptoCreateCollectionTx(txInfo)
if err != nil {
logx.Errorf("[ConstructCreateCollectionCryptoTx] unable to convert to crypto register zns tx: %s", err.Error())
logx.Errorf("unable to convert to crypto create collection tx: %s", err.Error())
return nil, err
}
cryptoTx.CreateCollectionTxInfo = cryptoTxInfo
cryptoTx.ExpiredAt = txInfo.ExpiredAt
cryptoTx.Signature = new(eddsa.Signature)
_, err = cryptoTx.Signature.SetBytes(txInfo.Sig)
if err != nil {
logx.Errorf("[ConstructCreateCollectionCryptoTx] invalid sig bytes: %s", err.Error())
logx.Errorf("invalid sig bytes: %s", err.Error())
return nil, err
}
return cryptoTx, nil
Expand All @@ -50,7 +50,7 @@ func (w *WitnessHelper) constructCreateCollectionCryptoTx(cryptoTx *CryptoTx, oT
func ToCryptoCreateCollectionTx(txInfo *types.CreateCollectionTxInfo) (info *CryptoCreateCollectionTx, err error) {
packedFee, err := common.ToPackedFee(txInfo.GasFeeAssetAmount)
if err != nil {
logx.Errorf("[ToCryptoSwapTx] unable to convert to packed fee: %s", err.Error())
logx.Errorf("unable to convert to packed fee: %s", err.Error())
return nil, err
}
info = &CryptoCreateCollectionTx{
Expand Down
1 change: 1 addition & 0 deletions common/prove/create_collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/bnb-chain/bas-smt/database/memory"

"github.com/bnb-chain/zkbas/dao/account"
"github.com/bnb-chain/zkbas/dao/basic"
"github.com/bnb-chain/zkbas/dao/liquidity"
Expand Down
8 changes: 4 additions & 4 deletions common/prove/create_pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
package prove

import (
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas-crypto/legend/circuit/bn254/std"
"github.com/bnb-chain/zkbas-crypto/wasm/legend/legendTxTypes"
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas/types"
)

func (w *WitnessHelper) constructCreatePairCryptoTx(cryptoTx *CryptoTx, oTx *Tx) (*CryptoTx, error) {
txInfo, err := types.ParseCreatePairTxInfo(oTx.TxInfo)
if err != nil {
logx.Errorf("[ConstructCreatePairCryptoTx] unable to parse register zns tx info:%s", err.Error())
logx.Errorf("unable to parse create pair tx info:%s", err.Error())
return nil, err
}
cryptoTxInfo, err := ToCryptoCreatePairTx(txInfo)
if err != nil {
logx.Errorf("[ConstructCreatePairCryptoTx] unable to convert to crypto register zns tx: %s", err.Error())
logx.Errorf("unable to convert to crypto create pair tx: %s", err.Error())
return nil, err
}
cryptoTx.CreatePairTxInfo = cryptoTxInfo
Expand Down
1 change: 1 addition & 0 deletions common/prove/create_pair_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/bnb-chain/bas-smt/database/memory"

"github.com/bnb-chain/zkbas/dao/account"
"github.com/bnb-chain/zkbas/dao/basic"
"github.com/bnb-chain/zkbas/dao/liquidity"
Expand Down
8 changes: 4 additions & 4 deletions common/prove/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
package prove

import (
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas-crypto/legend/circuit/bn254/std"
"github.com/bnb-chain/zkbas-crypto/wasm/legend/legendTxTypes"
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas/types"
)

func (w *WitnessHelper) constructDepositCryptoTx(cryptoTx *CryptoTx, oTx *Tx) (*CryptoTx, error) {
txInfo, err := types.ParseDepositTxInfo(oTx.TxInfo)
if err != nil {
logx.Errorf("[ConstructDepositCryptoTx] unable to parse register zns tx info:%s", err.Error())
logx.Errorf("unable to parse deposit tx info:%s", err.Error())
return nil, err
}
cryptoTxInfo, err := ToCryptoDepositTx(txInfo)
if err != nil {
logx.Errorf("[ConstructDepositCryptoTx] unable to convert to crypto register zns tx: %s", err.Error())
logx.Errorf("unable to convert to crypto deposit tx: %s", err.Error())
return nil, err
}
cryptoTx.DepositTxInfo = cryptoTxInfo
Expand Down
8 changes: 4 additions & 4 deletions common/prove/deposit_nft.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
package prove

import (
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas-crypto/legend/circuit/bn254/std"
"github.com/bnb-chain/zkbas-crypto/wasm/legend/legendTxTypes"
"github.com/zeromicro/go-zero/core/logx"

"github.com/bnb-chain/zkbas/types"
)

func (w *WitnessHelper) constructDepositNftCryptoTx(cryptoTx *CryptoTx, oTx *Tx) (*CryptoTx, error) {
txInfo, err := types.ParseDepositNftTxInfo(oTx.TxInfo)
if err != nil {
logx.Errorf("[ConstructDepositNftCryptoTx] unable to parse register zns tx info:%s", err.Error())
logx.Errorf("unable to parse deposit nft tx info:%s", err.Error())
return nil, err
}
cryptoTxInfo, err := ToCryptoDepositNftTx(txInfo)
if err != nil {
logx.Errorf("[ConstructDepositNftCryptoTx] unable to convert to crypto register zns tx: %s", err.Error())
logx.Errorf("unable to convert to crypto deposit nft tx: %s", err.Error())
return nil, err
}
cryptoTx.DepositNftTxInfo = cryptoTxInfo
Expand Down
1 change: 1 addition & 0 deletions common/prove/deposit_nft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/bnb-chain/bas-smt/database/memory"

"github.com/bnb-chain/zkbas/dao/account"
"github.com/bnb-chain/zkbas/dao/basic"
"github.com/bnb-chain/zkbas/dao/liquidity"
Expand Down
1 change: 1 addition & 0 deletions common/prove/deposit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/bnb-chain/bas-smt/database/memory"

"github.com/bnb-chain/zkbas/dao/account"
"github.com/bnb-chain/zkbas/dao/basic"
"github.com/bnb-chain/zkbas/dao/liquidity"
Expand Down
Loading