Skip to content

Commit

Permalink
Zns 2 l2 (#77)
Browse files Browse the repository at this point in the history
* exodo exist

* exodo exist

* exodo exist

* exodus exit

* exodus exit

* apiserversenttx  add redis lock

* exodus exit

* exodus exit

* exodus exit

* set the value to redis cache with pk and account name

* test l1 register zns

* exodus exit

* exodus exit

* exodus exit

* fix

* fix

* fix

* zns l2

* exodus exit

* fix

* ``fix``

* change pub key

* change pub key

* change pub key

* change pub key

* ants panic,crush service

* ants panic,crush service

* change pub key

* change pub key

* nft witness

* add fromindex and toindex

* add fromindex and toindex

* change pub key

* change pub key

* change pub key

* change pub key

* full exit

* PublicKey:txDetail.Balance

* remove registerZNS

* full exit

* full exit

* if account is new ,set index:types.NilAccountIndex

* change pub key

* update PublicKey

* change pub key

* change pub key

* change pub key

* change pub key

* change pub key

* update CollectionNonce: txDetail.CollectionNonce

* change pub key

* change pub key

* update L1Address string to []byte

* change pub key

* update account l1Address

* update account l1Address

* update account l1Address

* update oTx TxType

* change pub key

* change pub key

* update l1 Signature

* change pub key

* add GetPubKey

* add system gas fee

* change pub key

* change pub key

* change pub key

* change pub key

* change pub key

* change pub key

* update l1 Signature

* Adjustment for double signature

* update l1 Signature

* add applicationDev

* change pub key

* change pub key

* update nft content type

* change pub key

* change pub key

* check l1 sig

* modify update nft params

* check l1 sig

* change pub key

* change pub key

* change pub key

* change pub key

* update version

* change pub key

* change pub key

* change pub key

* change pub key

* change pub key

* update version

* update pool tx

* change pub key

* update doc

* update doc

* update doc

* update doc

* update doc

* update offer (#74)

Co-authored-by: toni.x <toni.x@binance.com>

* Zns 2 l2 offer (#75)

* update offer

* update offer

---------

Co-authored-by: toni.x <toni.x@binance.com>

* check  full exit asset info not nil

* update protocol

* update protocol

---------

Co-authored-by: markc <mark.c@binance.com>
Co-authored-by: gary <502238410@qq.com>
Co-authored-by: toni.x <toni.x@binance.com>
Co-authored-by: Smith S <smith.s@binance.com>
  • Loading branch information
5 people authored Mar 23, 2023
1 parent 059106e commit a018315
Show file tree
Hide file tree
Showing 128 changed files with 6,657 additions and 1,967 deletions.
10 changes: 10 additions & 0 deletions cmd/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,14 @@ var (
Usage: "Metrics HTTP server listening port",
Value: 6060,
}
CommandFlag = &cli.StringFlag{
Name: "command",
Aliases: []string{"m"},
Usage: "the config file",
}
RecoveryFromHistoryFlag = &cli.BoolFlag{
Name: "recoveryFromHistory",
Value: true,
Usage: "read account and nft history record from the database, or read account and nft from the database",
}
)
59 changes: 59 additions & 0 deletions cmd/zkbnb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package main

import (
"fmt"
"github.com/bnb-chain/zkbnb/tools/exodusexit/generateproof"
"github.com/bnb-chain/zkbnb/tools/exodusexit/performexodus"
"github.com/bnb-chain/zkbnb/tools/query"
"os"
"runtime"
Expand Down Expand Up @@ -184,6 +186,59 @@ func main() {
return apiserver.Run(cCtx.String(flags.ConfigFlag.Name))
},
},
{
Name: "generateproof",
Usage: "Run generateproof service",
Flags: []cli.Flag{
flags.CommandFlag,
flags.ConfigFlag,
},
Action: func(cCtx *cli.Context) error {
if !cCtx.IsSet(flags.CommandFlag.Name) {
return cli.ShowSubcommandHelp(cCtx)
}
if !cCtx.IsSet(flags.ConfigFlag.Name) {
return cli.ShowSubcommandHelp(cCtx)
}
if cCtx.String(flags.CommandFlag.Name) == "init" {
return dbinitializer.InitializeExodusExit(
cCtx.String(flags.ConfigFlag.Name),
)
}
if cCtx.String(flags.CommandFlag.Name) == "run" {
err := dbinitializer.InitializeExodusExit(
cCtx.String(flags.ConfigFlag.Name),
)
if err != nil {
return err
}
return generateproof.Run(cCtx.String(flags.ConfigFlag.Name))
}
if cCtx.String(flags.CommandFlag.Name) == "continue" {
return generateproof.Run(cCtx.String(flags.ConfigFlag.Name))
}
return nil
},
},
{
Name: "performexodus",
Usage: "Run performexodus service",
Flags: []cli.Flag{
flags.CommandFlag,
flags.ConfigFlag,
},
Action: func(cCtx *cli.Context) error {
if !cCtx.IsSet(flags.CommandFlag.Name) {
return cli.ShowSubcommandHelp(cCtx)
}
if !cCtx.IsSet(flags.ConfigFlag.Name) {
return cli.ShowSubcommandHelp(cCtx)
}
return performexodus.Run(cCtx.String(flags.ConfigFlag.Name))

return nil
},
},
// tools
{
Name: "db",
Expand Down Expand Up @@ -226,6 +281,7 @@ func main() {
flags.BlockHeightFlag,
flags.ServiceNameFlag,
flags.BatchSizeFlag,
flags.RecoveryFromHistoryFlag,
},
Action: func(cCtx *cli.Context) error {
if !cCtx.IsSet(flags.ServiceNameFlag.Name) ||
Expand All @@ -238,6 +294,7 @@ func main() {
cCtx.Int64(flags.BlockHeightFlag.Name),
cCtx.String(flags.ServiceNameFlag.Name),
cCtx.Int(flags.BatchSizeFlag.Name),
cCtx.Bool(flags.RecoveryFromHistoryFlag.Name),
)
return nil
},
Expand All @@ -256,6 +313,7 @@ func main() {
flags.BlockHeightFlag,
flags.ServiceNameFlag,
flags.BatchSizeFlag,
flags.RecoveryFromHistoryFlag,
},
Action: func(cCtx *cli.Context) error {
if !cCtx.IsSet(flags.ServiceNameFlag.Name) ||
Expand All @@ -268,6 +326,7 @@ func main() {
cCtx.Int64(flags.BlockHeightFlag.Name),
cCtx.String(flags.ServiceNameFlag.Name),
cCtx.Int(flags.BatchSizeFlag.Name),
cCtx.Bool(flags.RecoveryFromHistoryFlag.Name),
)
return nil
},
Expand Down
66 changes: 66 additions & 0 deletions common/abicoder/abicoder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package abicoder

import (
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
)

func (d *ABIDecoder) getArguments(name string, data []byte) (Arguments, error) {
// since there can't be naming collisions with contracts and events,
// we need to decide whether we're calling a method or an event
args := make([]Argument, 0)
if method, ok := d.myabi.Methods[name]; ok {
if len(data)%32 != 0 {
return nil, fmt.Errorf("abicoder: improperly formatted output: %s - Bytes: [%+v]", string(data), data)
}
for _, input := range method.Inputs {
newInput := Argument{Name: input.Name, Type: input.Type, Indexed: input.Indexed}
args = append(args, newInput)
}
}
if args == nil {
return nil, fmt.Errorf("abicoder: could not locate named method or event: %s", name)
}
return args, nil
}

//
// Unpack unpacks the output according to the abicoder specification.
func (d *ABIDecoder) Unpack(name string, data []byte) ([]interface{}, error) {
args, err := d.getArguments(name, data)
if err != nil {
return nil, err
}
return args.Unpack(data)
}

func (d *ABIDecoder) UnpackIntoInterface(v interface{}, name string, data []byte) error {
args, err := d.getArguments(name, data)
if err != nil {
return err
}
unpacked, err := args.Unpack(data)
if err != nil {
return err
}
return args.Copy(v, unpacked)
}

//
// UnpackIntoMap unpacks a log into the provided map[string]interface{}.
func (d *ABIDecoder) UnpackIntoMap(v map[string]interface{}, name string, data []byte) (err error) {
args, err := d.getArguments(name, data)
if err != nil {
return err
}
return args.UnpackIntoMap(v, data)
}

// ABIDecoder ethereum transaction data decoder
type ABIDecoder struct {
myabi abi.ABI
}

func NewABIDecoder(abi abi.ABI) *ABIDecoder {
return &ABIDecoder{myabi: abi}
}
Loading

0 comments on commit a018315

Please sign in to comment.