diff --git a/benchmark/main.go b/benchmark/main.go index d684622d..20d2e8d4 100644 --- a/benchmark/main.go +++ b/benchmark/main.go @@ -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" diff --git a/cmd/blobstream/deploy/cmd.go b/cmd/blobstream/deploy/cmd.go index 68d214b8..cf1c6b14 100644 --- a/cmd/blobstream/deploy/cmd.go +++ b/cmd/blobstream/deploy/cmd.go @@ -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) @@ -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 @@ -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 + } +} diff --git a/cmd/blobstream/relayer/cmd.go b/cmd/blobstream/relayer/cmd.go index 48cfe795..e4e35c32 100644 --- a/cmd/blobstream/relayer/cmd.go +++ b/cmd/blobstream/relayer/cmd.go @@ -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" diff --git a/e2e/go.mod b/e2e/go.mod index 8a244536..3cef398d 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -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 diff --git a/e2e/go.sum b/e2e/go.sum index eaf961da..5dfbf304 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -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= diff --git a/e2e/qgb_network.go b/e2e/qgb_network.go index 01be1f53..08e09002 100644 --- a/e2e/qgb_network.go +++ b/e2e/qgb_network.go @@ -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" diff --git a/evm/evm_client.go b/evm/evm_client.go index 70a81814..9b4384fe 100644 --- a/evm/evm_client.go +++ b/evm/evm_client.go @@ -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" ) @@ -85,7 +85,7 @@ 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 } @@ -93,7 +93,7 @@ func (ec *Client) DeployBlobstreamContract( 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 } diff --git a/evm/evm_client_test.go b/evm/evm_client_test.go index 4f537752..d3bb5a0b 100644 --- a/evm/evm_client_test.go +++ b/evm/evm_client_test.go @@ -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" diff --git a/go.mod b/go.mod index ab48283d..5e3eea16 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 804aa119..a80c1650 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/relayer/relayer.go b/relayer/relayer.go index f8f55417..0fd031e1 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -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"