Commit 109ae137 authored by suyanlong's avatar suyanlong

rename word

parent f4f2b289
...@@ -16,4 +16,4 @@ Please answer these questions before submitting your issue. Thanks! ...@@ -16,4 +16,4 @@ Please answer these questions before submitting your issue. Thanks!
### 3. What did you see instead? ### 3. What did you see instead?
### 4. What version of BitXHub are you using? (`bitxhub version` on BitXHub) ### 4. What version of link33 are you using? (`link33 version` on BitXHub)
...@@ -9,7 +9,7 @@ Before you submit your Pull Request (PR) consider the following guidelines: ...@@ -9,7 +9,7 @@ Before you submit your Pull Request (PR) consider the following guidelines:
that relates to your submission. You don't want to duplicate effort. that relates to your submission. You don't want to duplicate effort.
1. Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add. 1. Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add.
Discussing the design up front helps to ensure that we're ready to accept your work. Discussing the design up front helps to ensure that we're ready to accept your work.
1. Fork the meshplus/bitxhub repo. 1. Fork the meshplus/link33 repo.
1. Make your changes in a new git branch: 1. Make your changes in a new git branch:
```shell ```shell
...@@ -35,7 +35,7 @@ Before you submit your Pull Request (PR) consider the following guidelines: ...@@ -35,7 +35,7 @@ Before you submit your Pull Request (PR) consider the following guidelines:
git push origin my-fix-branch git push origin my-fix-branch
``` ```
1. In GitHub, send a pull request to `bitxhub:master`. 1. In GitHub, send a pull request to `link33:master`.
* If we suggest changes then: * If we suggest changes then:
* Make the required updates. * Make the required updates.
......
...@@ -19,13 +19,13 @@ import ( ...@@ -19,13 +19,13 @@ import (
var appchainBxhCMD = cli.Command{ var appchainBxhCMD = cli.Command{
Name: "appchain", Name: "appchain",
Usage: "Command about appchain in bitxhub", Usage: "Command about appchain in link33",
Subcommands: []cli.Command{ Subcommands: []cli.Command{
methodCommand, methodCommand,
didCommand, didCommand,
{ {
Name: "register", Name: "register",
Usage: "Register sidecar to bitxhub", Usage: "Register sidecar to link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
methodFlag, methodFlag,
}, },
...@@ -33,7 +33,7 @@ var appchainBxhCMD = cli.Command{ ...@@ -33,7 +33,7 @@ var appchainBxhCMD = cli.Command{
}, },
{ {
Name: "update", Name: "update",
Usage: "update appchain in bitxhub", Usage: "update appchain in link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
adminKeyPathFlag, adminKeyPathFlag,
cli.StringFlag{ cli.StringFlag{
...@@ -86,7 +86,7 @@ var appchainBxhCMD = cli.Command{ ...@@ -86,7 +86,7 @@ var appchainBxhCMD = cli.Command{
}, },
{ {
Name: "freeze", Name: "freeze",
Usage: "freeze appchain in bitxhub", Usage: "freeze appchain in link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
adminKeyPathFlag, adminKeyPathFlag,
cli.StringFlag{ cli.StringFlag{
...@@ -99,7 +99,7 @@ var appchainBxhCMD = cli.Command{ ...@@ -99,7 +99,7 @@ var appchainBxhCMD = cli.Command{
}, },
{ {
Name: "activate", Name: "activate",
Usage: "activate appchain in bitxhub", Usage: "activate appchain in link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
adminKeyPathFlag, adminKeyPathFlag,
cli.StringFlag{ cli.StringFlag{
...@@ -112,7 +112,7 @@ var appchainBxhCMD = cli.Command{ ...@@ -112,7 +112,7 @@ var appchainBxhCMD = cli.Command{
}, },
{ {
Name: "logout", Name: "logout",
Usage: "logout appchain in bitxhub", Usage: "logout appchain in link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
adminKeyPathFlag, adminKeyPathFlag,
cli.StringFlag{ cli.StringFlag{
......
...@@ -15,7 +15,7 @@ import ( ...@@ -15,7 +15,7 @@ import (
) )
const ( const (
bitxhubRootPrefix = "did:bitxhub" link33RootPrefix = "did:link33"
relayRootSubMethod = "relayroot" relayRootSubMethod = "relayroot"
fakeSignature = "fake signature" fakeSignature = "fake signature"
fakeDocAddr = "/ipfs/QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi" fakeDocAddr = "/ipfs/QmQVxzUqN2Yv2UHUQXYwH8dSNkM8ReJ9qPqwJsf8zzoNUi"
...@@ -33,7 +33,7 @@ var methodCommand = cli.Command{ ...@@ -33,7 +33,7 @@ var methodCommand = cli.Command{
Subcommands: []cli.Command{ Subcommands: []cli.Command{
{ {
Name: "register", Name: "register",
Usage: "Register appchain did method and info to bitxhub", Usage: "Register appchain did method and info to link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
adminKeyPathFlag, adminKeyPathFlag,
methodFlag, methodFlag,
...@@ -57,7 +57,7 @@ var didCommand = cli.Command{ ...@@ -57,7 +57,7 @@ var didCommand = cli.Command{
Subcommands: []cli.Command{ Subcommands: []cli.Command{
{ {
Name: "register", Name: "register",
Usage: "Register appchain did in bitxhub", Usage: "Register appchain did in link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
adminKeyPathFlag, adminKeyPathFlag,
didFlag, didFlag,
...@@ -66,7 +66,7 @@ var didCommand = cli.Command{ ...@@ -66,7 +66,7 @@ var didCommand = cli.Command{
}, },
{ {
Name: "audit", Name: "audit",
Usage: "Audit registered appchain did info in bitxhub", Usage: "Audit registered appchain did info in link33",
Flags: []cli.Flag{ Flags: []cli.Flag{
adminKeyPathFlag, adminKeyPathFlag,
didFlag, didFlag,
...@@ -102,8 +102,8 @@ func registerMethod(ctx *cli.Context) error { ...@@ -102,8 +102,8 @@ func registerMethod(ctx *cli.Context) error {
if err != nil { if err != nil {
return err return err
} }
appchainAdminDID := fmt.Sprintf("%s:%s:%s", bitxhubRootPrefix, method, address.String()) appchainAdminDID := fmt.Sprintf("%s:%s:%s", link33RootPrefix, method, address.String())
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
// init method registry with this admin key // init method registry with this admin key
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.AppchainMgrContractAddr.Address(), constant.AppchainMgrContractAddr.Address(),
...@@ -138,7 +138,7 @@ func registerDID(ctx *cli.Context) error { ...@@ -138,7 +138,7 @@ func registerDID(ctx *cli.Context) error {
} }
appchainDID := bitxid.DID(did) appchainDID := bitxid.DID(did)
method := appchainDID.GetRootMethod() method := appchainDID.GetRootMethod()
appchainAdminDID := fmt.Sprintf("%s:%s:%s", bitxhubRootPrefix, method, address.String()) appchainAdminDID := fmt.Sprintf("%s:%s:%s", link33RootPrefix, method, address.String())
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.DIDRegistryContractAddr.Address(), constant.DIDRegistryContractAddr.Address(),
"Register", nil, rpcx.String(appchainAdminDID), "Register", nil, rpcx.String(appchainAdminDID),
...@@ -156,7 +156,7 @@ func registerDID(ctx *cli.Context) error { ...@@ -156,7 +156,7 @@ func registerDID(ctx *cli.Context) error {
} }
func auditDID(ctx *cli.Context) error { func auditDID(ctx *cli.Context) error {
// todo: wait for audit did info api in bitxhub to implement // todo: wait for audit did info api in link33 to implement
return nil return nil
} }
......
...@@ -5,7 +5,7 @@ import "github.com/urfave/cli" ...@@ -5,7 +5,7 @@ import "github.com/urfave/cli"
var ( var (
bxhAddrFlag = cli.StringFlag{ bxhAddrFlag = cli.StringFlag{
Name: "addr", Name: "addr",
Usage: "Specific bitxhub node address", Usage: "Specific link33 node address",
Value: "localhost:60011", Value: "localhost:60011",
Required: false, Required: false,
} }
...@@ -21,7 +21,7 @@ var ( ...@@ -21,7 +21,7 @@ var (
} }
didFlag = cli.StringFlag{ didFlag = cli.StringFlag{
Name: "did", Name: "did",
Usage: "Specific full did name(like did:bitxhub:appchain1:0xc7F999b83Af6DF9e67d0a37Ee7e900bF38b3D013)", Usage: "Specific full did name(like did:link33:appchain1:0xc7F999b83Af6DF9e67d0a37Ee7e900bF38b3D013)",
Required: true, Required: true,
} }
statusFlag = cli.IntFlag{ statusFlag = cli.IntFlag{
......
...@@ -81,11 +81,11 @@ func deployRule(ctx *cli.Context) error { ...@@ -81,11 +81,11 @@ func deployRule(ctx *cli.Context) error {
color.Red("Deploy rule error: %w", err) color.Red("Deploy rule error: %w", err)
return nil return nil
} else { } else {
color.Green(fmt.Sprintf("Deploy rule to bitxhub for appchain %s successfully: %s", method, contractAddr.String())) color.Green(fmt.Sprintf("Deploy rule to link33 for appchain %s successfully: %s", method, contractAddr.String()))
} }
// 2. register // 2. register
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.RuleManagerContractAddr.Address(), constant.RuleManagerContractAddr.Address(),
"RegisterRule", nil, "RegisterRule", nil,
...@@ -95,13 +95,13 @@ func deployRule(ctx *cli.Context) error { ...@@ -95,13 +95,13 @@ func deployRule(ctx *cli.Context) error {
} }
if !receipt.IsSuccess() { if !receipt.IsSuccess() {
color.Red(fmt.Sprintf("Register rule to bitxhub for appchain %s error: %s", appchainMethod, string(receipt.Ret))) color.Red(fmt.Sprintf("Register rule to link33 for appchain %s error: %s", appchainMethod, string(receipt.Ret)))
} else { } else {
proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String() proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String()
if proposalId != "" { if proposalId != "" {
color.Green(fmt.Sprintf("Register rule to bitxhub for appchain %s successfully, the bind request was submitted successfully, wait for proposal %s to finish.", appchainMethod, proposalId)) color.Green(fmt.Sprintf("Register rule to link33 for appchain %s successfully, the bind request was submitted successfully, wait for proposal %s to finish.", appchainMethod, proposalId))
} else { } else {
color.Green(fmt.Sprintf("Register rule to bitxhub for appchain %s successfully.", appchainMethod)) color.Green(fmt.Sprintf("Register rule to link33 for appchain %s successfully.", appchainMethod))
} }
} }
...@@ -119,7 +119,7 @@ func updateMasterRule(ctx *cli.Context) error { ...@@ -119,7 +119,7 @@ func updateMasterRule(ctx *cli.Context) error {
return fmt.Errorf("Load client: %w", err) return fmt.Errorf("Load client: %w", err)
} }
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.RuleManagerContractAddr.Address(), constant.RuleManagerContractAddr.Address(),
"UpdateMasterRule", nil, "UpdateMasterRule", nil,
...@@ -129,10 +129,10 @@ func updateMasterRule(ctx *cli.Context) error { ...@@ -129,10 +129,10 @@ func updateMasterRule(ctx *cli.Context) error {
} }
if !receipt.IsSuccess() { if !receipt.IsSuccess() {
color.Red(fmt.Sprintf("Update master rule to bitxhub for appchain %s error: %s", appchainMethod, string(receipt.Ret))) color.Red(fmt.Sprintf("Update master rule to link33 for appchain %s error: %s", appchainMethod, string(receipt.Ret)))
} else { } else {
proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String() proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String()
color.Green(fmt.Sprintf("Update master rule to bitxhub for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId)) color.Green(fmt.Sprintf("Update master rule to link33 for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId))
} }
return nil return nil
...@@ -149,7 +149,7 @@ func bindRule(ctx *cli.Context) error { ...@@ -149,7 +149,7 @@ func bindRule(ctx *cli.Context) error {
return fmt.Errorf("Load client: %w", err) return fmt.Errorf("Load client: %w", err)
} }
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.RuleManagerContractAddr.Address(), constant.RuleManagerContractAddr.Address(),
"BindRule", nil, "BindRule", nil,
...@@ -159,10 +159,10 @@ func bindRule(ctx *cli.Context) error { ...@@ -159,10 +159,10 @@ func bindRule(ctx *cli.Context) error {
} }
if !receipt.IsSuccess() { if !receipt.IsSuccess() {
color.Red(fmt.Sprintf("Bind rule to bitxhub for appchain %s error: %s", appchainMethod, string(receipt.Ret))) color.Red(fmt.Sprintf("Bind rule to link33 for appchain %s error: %s", appchainMethod, string(receipt.Ret)))
} else { } else {
proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String() proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String()
color.Green(fmt.Sprintf("Bind rule to bitxhub for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId)) color.Green(fmt.Sprintf("Bind rule to link33 for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId))
} }
return nil return nil
...@@ -178,7 +178,7 @@ func unbindRule(ctx *cli.Context) error { ...@@ -178,7 +178,7 @@ func unbindRule(ctx *cli.Context) error {
return fmt.Errorf("Load client: %w", err) return fmt.Errorf("Load client: %w", err)
} }
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.RuleManagerContractAddr.Address(), constant.RuleManagerContractAddr.Address(),
"UnbindRule", nil, "UnbindRule", nil,
...@@ -188,10 +188,10 @@ func unbindRule(ctx *cli.Context) error { ...@@ -188,10 +188,10 @@ func unbindRule(ctx *cli.Context) error {
} }
if !receipt.IsSuccess() { if !receipt.IsSuccess() {
color.Red(fmt.Sprintf("Unbind rule to bitxhub for appchain %s error: %s", appchainMethod, string(receipt.Ret))) color.Red(fmt.Sprintf("Unbind rule to link33 for appchain %s error: %s", appchainMethod, string(receipt.Ret)))
} else { } else {
proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String() proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String()
color.Green(fmt.Sprintf("Unbind rule to bitxhub for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId)) color.Green(fmt.Sprintf("Unbind rule to link33 for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId))
} }
return nil return nil
...@@ -207,7 +207,7 @@ func freezeRule(ctx *cli.Context) error { ...@@ -207,7 +207,7 @@ func freezeRule(ctx *cli.Context) error {
return fmt.Errorf("Load client: %w", err) return fmt.Errorf("Load client: %w", err)
} }
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.RuleManagerContractAddr.Address(), constant.RuleManagerContractAddr.Address(),
"FreezeRule", nil, "FreezeRule", nil,
...@@ -217,10 +217,10 @@ func freezeRule(ctx *cli.Context) error { ...@@ -217,10 +217,10 @@ func freezeRule(ctx *cli.Context) error {
} }
if !receipt.IsSuccess() { if !receipt.IsSuccess() {
color.Red(fmt.Sprintf("Freeze rule to bitxhub for appchain %s error: %s", appchainMethod, string(receipt.Ret))) color.Red(fmt.Sprintf("Freeze rule to link33 for appchain %s error: %s", appchainMethod, string(receipt.Ret)))
} else { } else {
proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String() proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String()
color.Green(fmt.Sprintf("Freeze rule to bitxhub for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId)) color.Green(fmt.Sprintf("Freeze rule to link33 for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId))
} }
return nil return nil
...@@ -236,7 +236,7 @@ func activateRule(ctx *cli.Context) error { ...@@ -236,7 +236,7 @@ func activateRule(ctx *cli.Context) error {
return fmt.Errorf("Load client: %w", err) return fmt.Errorf("Load client: %w", err)
} }
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.RuleManagerContractAddr.Address(), constant.RuleManagerContractAddr.Address(),
"ActivateRule", nil, "ActivateRule", nil,
...@@ -246,7 +246,7 @@ func activateRule(ctx *cli.Context) error { ...@@ -246,7 +246,7 @@ func activateRule(ctx *cli.Context) error {
} }
if !receipt.IsSuccess() { if !receipt.IsSuccess() {
color.Red(fmt.Sprintf("Activate rule to bitxhub for appchain %s error: %s", appchainMethod, string(receipt.Ret))) color.Red(fmt.Sprintf("Activate rule to link33 for appchain %s error: %s", appchainMethod, string(receipt.Ret)))
} else { } else {
proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String() proposalId := gjson.Get(string(receipt.Ret), "proposal_id").String()
color.Green(fmt.Sprintf("Activate rule to bitxhub for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId)) color.Green(fmt.Sprintf("Activate rule to bitxhub for appchain %s successfully, wait for proposal %s to finish.", appchainMethod, proposalId))
...@@ -265,7 +265,7 @@ func logoutRule(ctx *cli.Context) error { ...@@ -265,7 +265,7 @@ func logoutRule(ctx *cli.Context) error {
return fmt.Errorf("Load client: %w", err) return fmt.Errorf("Load client: %w", err)
} }
appchainMethod := fmt.Sprintf("%s:%s:.", bitxhubRootPrefix, method) appchainMethod := fmt.Sprintf("%s:%s:.", link33RootPrefix, method)
receipt, err := client.InvokeBVMContract( receipt, err := client.InvokeBVMContract(
constant.RuleManagerContractAddr.Address(), constant.RuleManagerContractAddr.Address(),
"LogoutRule", nil, "LogoutRule", nil,
......
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"time" "time"
"github.com/fatih/color" "github.com/fatih/color"
"github.com/link33/sidecar/cmd/sidecar/client"
"github.com/meshplus/bitxhub-kit/log" "github.com/meshplus/bitxhub-kit/log"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
...@@ -26,14 +25,14 @@ func main() { ...@@ -26,14 +25,14 @@ func main() {
}, },
cli.BoolFlag{ cli.BoolFlag{
Name: "tls", Name: "tls",
Usage: "enable tls between sidecar and bitxhub or not", Usage: "enable tls between sidecar and link33 or not",
}, },
} }
app.Commands = []cli.Command{ app.Commands = []cli.Command{
appchainBxhCMD, //appchainBxhCMD,
client.LoadClientCMD(), //client.LoadClientCMD(),
idCMD, //idCMD,
initCMD, initCMD,
interchainCMD, interchainCMD,
p2pCMD, p2pCMD,
......
...@@ -16,60 +16,60 @@ const ( ...@@ -16,60 +16,60 @@ const (
//go:generate mockgen -destination mock_client/mock_client.go -package mock_client -source client.go //go:generate mockgen -destination mock_client/mock_client.go -package mock_client -source client.go
type Client interface { type Client interface {
//Close all connections between BitXHub and the client. //Close all connections between link33 and the client.
Stop() error Stop() error
//Reset ecdsa key. //Reset ecdsa key.
SetPrivateKey(crypto.PrivateKey) SetPrivateKey(crypto.PrivateKey)
//Send a readonly transaction to BitXHub. If the transaction is writable, //Send a readonly transaction to link33. If the transaction is writable,
// this transaction will not be executed and error wil be returned. // this transaction will not be executed and error wil be returned.
SendView(tx *pb.BxhTransaction) (*pb.Receipt, error) SendView(tx *pb.BxhTransaction) (*pb.Receipt, error)
//Send a signed transaction to BitXHub. If the signature is illegal, //Send a signed transaction to link33. If the signature is illegal,
//the transaction hash will be obtained but the transaction receipt is illegal. //the transaction hash will be obtained but the transaction receipt is illegal.
SendTransaction(tx *pb.BxhTransaction, opts *TransactOpts) (string, error) SendTransaction(tx *pb.BxhTransaction, opts *TransactOpts) (string, error)
//Send transaction to BitXHub and get the receipt. //Send transaction to link33 and get the receipt.
SendTransactionWithReceipt(tx *pb.BxhTransaction, opts *TransactOpts) (*pb.Receipt, error) SendTransactionWithReceipt(tx *pb.BxhTransaction, opts *TransactOpts) (*pb.Receipt, error)
//Get the receipt by transaction hash, //Get the receipt by transaction hash,
//the status of the receipt is a sign of whether the transaction is successful. //the status of the receipt is a sign of whether the transaction is successful.
GetReceipt(hash string) (*pb.Receipt, error) GetReceipt(hash string) (*pb.Receipt, error)
//Get transaction from BitXHub by transaction hash. //Get transaction from link33 by transaction hash.
GetTransaction(hash string) (*pb.GetTransactionResponse, error) GetTransaction(hash string) (*pb.GetTransactionResponse, error)
//Get the current blockchain situation of BitXHub. //Get the current blockchain situation of link33.
GetChainMeta() (*pb.ChainMeta, error) GetChainMeta() (*pb.ChainMeta, error)
//Get blocks of the specified block height range. //Get blocks of the specified block height range.
GetBlocks(start uint64, end uint64) (*pb.GetBlocksResponse, error) GetBlocks(start uint64, end uint64) (*pb.GetBlocksResponse, error)
//Obtain block information from BitXHub. //Obtain block information from link33.
//The block header contains the basic information of the block, //The block header contains the basic information of the block,
//and the block body contains all the transactions packaged. //and the block body contains all the transactions packaged.
GetBlock(value string, blockType pb.GetBlockRequest_Type) (*pb.Block, error) GetBlock(value string, blockType pb.GetBlockRequest_Type) (*pb.Block, error)
//Get the status of the blockchain from BitXHub, normal or abnormal. //Get the status of the blockchain from link33, normal or abnormal.
GetChainStatus() (*pb.Response, error) GetChainStatus() (*pb.Response, error)
//Get the validators from BitXHub. //Get the validators from link33.
GetValidators() (*pb.Response, error) GetValidators() (*pb.Response, error)
//Get the current network situation of BitXHub. //Get the current network situation of link33.
GetNetworkMeta() (*pb.Response, error) GetNetworkMeta() (*pb.Response, error)
//Get account balance from BitXHub by address. //Get account balance from link33 by address.
GetAccountBalance(address string) (*pb.Response, error) GetAccountBalance(address string) (*pb.Response, error)
//Get the missing block header from BitXHub. //Get the missing block header from link33.
GetBlockHeader(ctx context.Context, begin, end uint64, ch chan<- *pb.BlockHeader) error GetBlockHeader(ctx context.Context, begin, end uint64, ch chan<- *pb.BlockHeader) error
//Get the missing block header from BitXHub. //Get the missing block header from link33.
GetInterchainTxWrappers(ctx context.Context, pid string, begin, end uint64, ch chan<- *pb.InterchainTxWrappers) error GetInterchainTxWrappers(ctx context.Context, pid string, begin, end uint64, ch chan<- *pb.InterchainTxWrappers) error
//Subscribe to event notifications from BitXHub. //Subscribe to event notifications from link33.
Subscribe(context.Context, pb.SubscriptionRequest_Type, []byte) (<-chan interface{}, error) Subscribe(context.Context, pb.SubscriptionRequest_Type, []byte) (<-chan interface{}, error)
//Deploy the contract, the contract address will be returned when the deployment is successful. //Deploy the contract, the contract address will be returned when the deployment is successful.
...@@ -85,16 +85,16 @@ type Client interface { ...@@ -85,16 +85,16 @@ type Client interface {
//contract method, and contract method parameters //contract method, and contract method parameters
InvokeContract(vmType pb.TransactionData_VMType, address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error) InvokeContract(vmType pb.TransactionData_VMType, address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error)
//Invoke the BVM contract, BVM is BitXHub's blot contract. //Invoke the BVM contract, BVM is link33's blot contract.
InvokeBVMContract(address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error) InvokeBVMContract(address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error)
//Invoke the XVM contract, XVM is WebAssembly contract. //Invoke the XVM contract, XVM is WebAssembly contract.
InvokeXVMContract(address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error) InvokeXVMContract(address *types.Address, method string, opts *TransactOpts, args ...*pb.Arg) (*pb.Receipt, error)
// Get BitXHub's signatures specified by id and type. // Get link33's signatures specified by id and type.
GetMultiSigns(id string, typ pb.GetMultiSignsRequest_Type) (*pb.SignResponse, error) GetMultiSigns(id string, typ pb.GetMultiSignsRequest_Type) (*pb.SignResponse, error)
// Get BitXHub TPS during block [begin, end] // Get link33 TPS during block [begin, end]
GetTPS(begin, end uint64) (uint64, error) GetTPS(begin, end uint64) (uint64, error)
// GetPendingNonceByAccount returns the latest nonce of an account in the pending status, // GetPendingNonceByAccount returns the latest nonce of an account in the pending status,
...@@ -112,10 +112,10 @@ type Client interface { ...@@ -112,10 +112,10 @@ type Client interface {
// IPFSGetToLocal gets from ipfs and saves to local file path // IPFSGetToLocal gets from ipfs and saves to local file path
IPFSGetToLocal(path string, localfPath string) (*pb.Response, error) IPFSGetToLocal(path string, localfPath string) (*pb.Response, error)
//Check whethe there is a master sidecar connect to the BitXHub. //Check whethe there is a master sidecar connect to the link33.
CheckMasterSidecar(address string) (*pb.Response, error) CheckMasterSidecar(address string) (*pb.Response, error)
//Set the master sidecar connect to the BitXHub. //Set the master sidecar connect to the link33.
SetMasterSidecar(address string, index string, timeout int64) (*pb.Response, error) SetMasterSidecar(address string, index string, timeout int64) (*pb.Response, error)
//Update the master sidecar status //Update the master sidecar status
......
...@@ -80,7 +80,7 @@ func checkConfig(config *config) error { ...@@ -80,7 +80,7 @@ func checkConfig(config *config) error {
} }
if len(config.nodesInfo) == 0 { if len(config.nodesInfo) == 0 {
return fmt.Errorf("bitxhub addrs cant not be 0") return fmt.Errorf("link33 addrs cant not be 0")
} }
if config.logger == nil { if config.logger == nil {
......
...@@ -74,7 +74,7 @@ sidecar 作用主要是路由转发,路由可以由用户设定。 ...@@ -74,7 +74,7 @@ sidecar 作用主要是路由转发,路由可以由用户设定。
## Syncer ## Syncer
主要是同步bitxhub里数据。 主要是同步link33里数据。
WrapperSyncer represents the necessary data for sync tx wrappers from bitxhub WrapperSyncer represents the necessary data for sync tx wrappers from bitxhub
放到插件里面去实现。可以作为每个input、output 里面client公共接口 放到插件里面去实现。可以作为每个input、output 里面client公共接口
......
...@@ -47,8 +47,8 @@ const ( ...@@ -47,8 +47,8 @@ const (
// API name // API name
APIName = "api" APIName = "api"
// Bitxhub type // link33 type
BitxhubType = "link33" Link33Type = "link33"
) )
var RootPath string var RootPath string
......
...@@ -23,7 +23,7 @@ const ( ...@@ -23,7 +23,7 @@ const (
) )
var ( var (
ErrIBTPNotFound = fmt.Errorf("receipt from bitxhub failed") ErrIBTPNotFound = fmt.Errorf("receipt from link33 failed")
ErrMetaOutOfDate = fmt.Errorf("interchain meta is out of date") ErrMetaOutOfDate = fmt.Errorf("interchain meta is out of date")
) )
......
...@@ -22,7 +22,7 @@ var _ Syncer = (*WrapperSyncer)(nil) ...@@ -22,7 +22,7 @@ var _ Syncer = (*WrapperSyncer)(nil)
const maxChSize = 1 << 10 const maxChSize = 1 << 10
// WrapperSyncer represents the necessary data for sync tx wrappers from bitxhub // WrapperSyncer represents the necessary data for sync tx wrappers from link33
type WrapperSyncer struct { type WrapperSyncer struct {
client rpcx.Client // hub 客户端。 client rpcx.Client // hub 客户端。
storage storage.Storage storage storage.Storage
...@@ -47,8 +47,8 @@ type SubscriptionKey struct { ...@@ -47,8 +47,8 @@ type SubscriptionKey struct {
AppchainDID string `json:"appchain_did"` AppchainDID string `json:"appchain_did"`
} }
// New creates instance of WrapperSyncer given agent interacting with bitxhub, // New creates instance of WrapperSyncer given agent interacting with link33,
// validators addresses of bitxhub and local storage // validators addresses of link33 and local storage
func New(sidecarID, appchainDID string, mode string, opts ...Option) (*WrapperSyncer, error) { func New(sidecarID, appchainDID string, mode string, opts ...Option) (*WrapperSyncer, error) {
cfg, err := GenerateConfig(opts...) cfg, err := GenerateConfig(opts...)
if err != nil { if err != nil {
...@@ -77,7 +77,7 @@ func (syncer *WrapperSyncer) Start() error { ...@@ -77,7 +77,7 @@ func (syncer *WrapperSyncer) Start() error {
meta, err := syncer.client.GetChainMeta() meta, err := syncer.client.GetChainMeta()
if err != nil { if err != nil {
return fmt.Errorf("get chain meta from bitxhub: %w", err) return fmt.Errorf("get chain meta from link33: %w", err)
} }
// recover the block height which has latest unfinished interchain tx // recover the block height which has latest unfinished interchain tx
...@@ -96,7 +96,7 @@ func (syncer *WrapperSyncer) Start() error { ...@@ -96,7 +96,7 @@ func (syncer *WrapperSyncer) Start() error {
syncer.logger.WithFields(logrus.Fields{ syncer.logger.WithFields(logrus.Fields{
"current_height": syncer.height, "current_height": syncer.height,
"bitxhub_height": meta.Height, "link33_height": meta.Height,
}).Info("Syncer started") }).Info("Syncer started")
return nil return nil
...@@ -137,9 +137,9 @@ func (syncer *WrapperSyncer) Stop() error { ...@@ -137,9 +137,9 @@ func (syncer *WrapperSyncer) Stop() error {
return nil return nil
} }
// syncInterchainTxWrappers queries to bitxhub and syncs confirmed interchain txs // syncInterchainTxWrappers queries to link33 and syncs confirmed interchain txs
// whose destination is the same as AppchainDID. // whose destination is the same as AppchainDID.
// Note: only interchain txs generated after the connection to bitxhub // Note: only interchain txs generated after the connection to link33
// being established will be sent to syncer // being established will be sent to syncer
func (syncer *WrapperSyncer) syncInterchainTxWrappers() { func (syncer *WrapperSyncer) syncInterchainTxWrappers() {
loop := func(ch <-chan *pb.InterchainTxWrappers) { loop := func(ch <-chan *pb.InterchainTxWrappers) {
...@@ -318,7 +318,7 @@ func (syncer *WrapperSyncer) handleInterchainTxWrapper(w *pb.InterchainTxWrapper ...@@ -318,7 +318,7 @@ func (syncer *WrapperSyncer) handleInterchainTxWrapper(w *pb.InterchainTxWrapper
syncer.logger.WithFields(logrus.Fields{ syncer.logger.WithFields(logrus.Fields{
"ibtp_id": ibtp.ID(), "ibtp_id": ibtp.ID(),
"type": ibtp.Type, "type": ibtp.Type,
}).Debugf("Sync IBTP from bitxhub") }).Debugf("Sync IBTP from link33")
syncer.ibtpC <- wIBTP syncer.ibtpC <- wIBTP
} }
...@@ -356,7 +356,7 @@ func (syncer *WrapperSyncer) RegisterRollbackHandler(handler RollbackHandler) er ...@@ -356,7 +356,7 @@ func (syncer *WrapperSyncer) RegisterRollbackHandler(handler RollbackHandler) er
return nil return nil
} }
// verifyWrapper verifies the basic of merkle wrapper from bitxhub // verifyWrapper verifies the basic of merkle wrapper from link33
func (syncer *WrapperSyncer) verifyWrapper(w *pb.InterchainTxWrapper) (bool, error) { func (syncer *WrapperSyncer) verifyWrapper(w *pb.InterchainTxWrapper) (bool, error) {
if w.Height != syncer.getDemandHeight() { if w.Height != syncer.getDemandHeight() {
return false, fmt.Errorf("wrong height of wrapper from bitxhub") return false, fmt.Errorf("wrong height of wrapper from bitxhub")
......
...@@ -30,9 +30,9 @@ import ( ...@@ -30,9 +30,9 @@ import (
) )
const ( const (
appchainMethod = "did:bitxhub:etherappchain:." appchainMethod = "did:link33:etherappchain:."
hash = "0x9f41dd84524bf8a42f8ab58ecfca6e1752d6fd93fe8dc00af4c71963c97db59f" hash = "0x9f41dd84524bf8a42f8ab58ecfca6e1752d6fd93fe8dc00af4c71963c97db59f"
from = "did:bitxhub:testappchain:." from = "did:link33:testappchain:."
) )
// 1. test normal interchain wrapper // 1. test normal interchain wrapper
......
...@@ -52,7 +52,7 @@ type Client interface { //业务实现委托接口。需要实现的那有些。 ...@@ -52,7 +52,7 @@ type Client interface { //业务实现委托接口。需要实现的那有些。
// executed callback txs for each receiving chain // executed callback txs for each receiving chain
GetCallbackMeta() (map[string]uint64, error) GetCallbackMeta() (map[string]uint64, error)
// CommitCallback is a callback function when get receipt from bitxhub success // CommitCallback is a callback function when get receipt from link33 success
CommitCallback(ibtp *pb.IBTP) error CommitCallback(ibtp *pb.IBTP) error
// GetReceipt gets receipt of an executed IBTP // GetReceipt gets receipt of an executed IBTP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment