Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
chore(deps): bump blobstream to v4 (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id authored Nov 9, 2023
1 parent 68b3325 commit 29598b1
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 16 deletions.
2 changes: 1 addition & 1 deletion benchmark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"syscall"
"time"

wrappers "github.com/celestiaorg/blobstream-contracts/v3/wrappers/Blobstream.sol"
wrappers "github.com/celestiaorg/blobstream-contracts/v4/wrappers/Blobstream.sol"
"github.com/celestiaorg/celestia-app/x/qgb/types"
"github.com/celestiaorg/orchestrator-relayer/evm"
"github.com/celestiaorg/orchestrator-relayer/store"
Expand Down
29 changes: 28 additions & 1 deletion cmd/blobstream/deploy/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ func Command() *cobra.Command {
)
}

startingNonce, err := parseStartingNonce(cmd.Context(), appQuerier, config.startingNonce)
if err != nil {
return err
}

// creating the data store
openOptions := store.OpenOptions{HasEVMKeyStore: true}
s, err := store.OpenStore(logger, config.Home, openOptions)
Expand Down Expand Up @@ -123,7 +128,7 @@ func Command() *cobra.Command {
}
defer backend.Close()

address, tx, _, err := evmClient.DeployBlobstreamContract(txOpts, backend, *vs, vs.Nonce, false)
address, tx, _, err := evmClient.DeployBlobstreamContract(txOpts, backend, *vs, startingNonce, false)
if err != nil {
logger.Error("failed to deploy Blobstream contract")
return err
Expand Down Expand Up @@ -196,3 +201,25 @@ func getStartingValset(ctx context.Context, tmQuerier rpc.TmQuerier, appQuerier
}
return nil, ErrNotFound
}

// parseStartingNonce parse the provided starting nonce.
func parseStartingNonce(ctx context.Context, appQuerier *rpc.AppQuerier, startingNonce string) (uint64, error) {
switch startingNonce {
case "latest":
nonce, err := appQuerier.QueryLatestAttestationNonce(ctx)
if err != nil {
if err != nil {
return 0, err
}
}
return nonce, nil
case "earliest":
return 1, nil
default:
nonce, err := strconv.ParseUint(startingNonce, 10, 0)
if err != nil {
return 0, err
}
return nonce, nil
}
}
2 changes: 1 addition & 1 deletion cmd/blobstream/relayer/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"time"

blobstreamwrapper "github.com/celestiaorg/blobstream-contracts/v3/wrappers/Blobstream.sol"
blobstreamwrapper "github.com/celestiaorg/blobstream-contracts/v4/wrappers/Blobstream.sol"

evm2 "github.com/celestiaorg/orchestrator-relayer/cmd/blobstream/keys/evm"
"github.com/celestiaorg/orchestrator-relayer/p2p"
Expand Down
2 changes: 1 addition & 1 deletion e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
)

require (
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0
github.com/celestiaorg/blobstream-contracts/v4 v4.0.0
github.com/celestiaorg/orchestrator-relayer v0.0.0-00010101000000-000000000000
github.com/cosmos/cosmos-sdk v0.46.14
github.com/libp2p/go-libp2p v0.32.0
Expand Down
4 changes: 2 additions & 2 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ github.com/bugsnag/panicwrap v1.2.0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywR
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 h1:h1Y4V3EMQ2mFmNtWt2sIhZIuyASInj1a9ExI8xOsTOw=
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0/go.mod h1:x4DKyfKOSv1ZJM9NwV+Pw01kH2CD7N5zTFclXIVJ6GQ=
github.com/celestiaorg/blobstream-contracts/v4 v4.0.0 h1:A1Sh1wyY8MYXdQZfuOqS4+3ainYPV+QpjSOxMj4cJaA=
github.com/celestiaorg/blobstream-contracts/v4 v4.0.0/go.mod h1:udhfU6Ocxnh4fEIFJ6GMVp2zAPM7uBSlneaqzgVD2Gw=
github.com/celestiaorg/celestia-app v1.3.0 h1:vW1zMc1tQ216utzDOYSC3wGO023sKVt8+zujVXnXlOc=
github.com/celestiaorg/celestia-app v1.3.0/go.mod h1:zhdQIFGFZRRxrDVtFE4OFIT7/12RE8DRyfvNZdW8ceM=
github.com/celestiaorg/celestia-core v1.29.0-tm-v0.34.29 h1:Fd7ymPUzExPGNl2gZw4i5S74arMw+iDHLE78M/cCxl4=
Expand Down
2 changes: 1 addition & 1 deletion e2e/qgb_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

blobstreamwrapper "github.com/celestiaorg/blobstream-contracts/v3/wrappers/Blobstream.sol"
blobstreamwrapper "github.com/celestiaorg/blobstream-contracts/v4/wrappers/Blobstream.sol"

"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
Expand Down
8 changes: 4 additions & 4 deletions evm/evm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
tmlog "github.com/tendermint/tendermint/libs/log"

blobstreamwrapper "github.com/celestiaorg/blobstream-contracts/v3/wrappers/Blobstream.sol"
proxywrapper "github.com/celestiaorg/blobstream-contracts/v3/wrappers/ERC1967Proxy.sol"
blobstreamwrapper "github.com/celestiaorg/blobstream-contracts/v4/wrappers/Blobstream.sol"
proxywrapper "github.com/celestiaorg/blobstream-contracts/v4/wrappers/ERC1967Proxy.sol"
"github.com/celestiaorg/celestia-app/x/qgb/types"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
)
Expand Down Expand Up @@ -85,15 +85,15 @@ func (ec *Client) DeployBlobstreamContract(
ec.logger.Info("deploying QGB implementation contract...", "address", impAddr.Hex(), "tx_hash", impTx.Hash().Hex())

// encode the Blobstream contract initialization data using the chain parameters
ethVsHash, err := contractInitValset.Hash()
ethVsCheckpoint, err := contractInitValset.SignBytes()
if err != nil {
return gethcommon.Address{}, nil, nil, err
}
blobStreamABI, err := blobstreamwrapper.WrappersMetaData.GetAbi()
if err != nil {
return gethcommon.Address{}, nil, nil, err
}
initData, err := blobStreamABI.Pack("initialize", big.NewInt(int64(contractInitNonce)), big.NewInt(int64(contractInitValset.TwoThirdsThreshold())), ethVsHash)
initData, err := blobStreamABI.Pack("initialize", big.NewInt(int64(contractInitNonce)), big.NewInt(int64(contractInitValset.TwoThirdsThreshold())), ethVsCheckpoint)
if err != nil {
return gethcommon.Address{}, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion evm/evm_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/keystore"

wrapper "github.com/celestiaorg/blobstream-contracts/v3/wrappers/Blobstream.sol"
wrapper "github.com/celestiaorg/blobstream-contracts/v4/wrappers/Blobstream.sol"
celestiatypes "github.com/celestiaorg/celestia-app/x/qgb/types"
"github.com/celestiaorg/orchestrator-relayer/evm"
"github.com/celestiaorg/orchestrator-relayer/types"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
)

require (
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0
github.com/celestiaorg/blobstream-contracts/v4 v4.0.0
github.com/cosmos/cosmos-sdk v0.46.14
github.com/cosmos/go-bip39 v1.0.0
github.com/dgraph-io/badger/v2 v2.2007.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0 h1:h1Y4V3EMQ2mFmNtWt2sIhZIuyASInj1a9ExI8xOsTOw=
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0/go.mod h1:x4DKyfKOSv1ZJM9NwV+Pw01kH2CD7N5zTFclXIVJ6GQ=
github.com/celestiaorg/blobstream-contracts/v4 v4.0.0 h1:A1Sh1wyY8MYXdQZfuOqS4+3ainYPV+QpjSOxMj4cJaA=
github.com/celestiaorg/blobstream-contracts/v4 v4.0.0/go.mod h1:udhfU6Ocxnh4fEIFJ6GMVp2zAPM7uBSlneaqzgVD2Gw=
github.com/celestiaorg/celestia-app v1.3.0 h1:vW1zMc1tQ216utzDOYSC3wGO023sKVt8+zujVXnXlOc=
github.com/celestiaorg/celestia-app v1.3.0/go.mod h1:zhdQIFGFZRRxrDVtFE4OFIT7/12RE8DRyfvNZdW8ceM=
github.com/celestiaorg/celestia-core v1.29.0-tm-v0.34.29 h1:Fd7ymPUzExPGNl2gZw4i5S74arMw+iDHLE78M/cCxl4=
Expand Down
2 changes: 1 addition & 1 deletion relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"

wrapper "github.com/celestiaorg/blobstream-contracts/v3/wrappers/Blobstream.sol"
wrapper "github.com/celestiaorg/blobstream-contracts/v4/wrappers/Blobstream.sol"
celestiatypes "github.com/celestiaorg/celestia-app/x/qgb/types"
"github.com/celestiaorg/orchestrator-relayer/evm"
"github.com/celestiaorg/orchestrator-relayer/p2p"
Expand Down

0 comments on commit 29598b1

Please sign in to comment.