From 1ede8f03a0993e81525503d9630d460281d84394 Mon Sep 17 00:00:00 2001 From: parketh Date: Fri, 5 Jul 2024 02:06:09 +0100 Subject: [PATCH] feat: refactor bitcoin rpc url to DA SDK btc config (#18) --- go.mod | 5 +++-- go.sum | 6 ++++-- op-node/rollup/finality/finalizer.go | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 142b173941ef..1e4d7a7a6729 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/andybalholm/brotli v1.1.0 - github.com/babylonchain/babylon-da-sdk v0.1.2-alpha + github.com/babylonchain/babylon-da-sdk v0.0.0-20240704160019-ec5dcf968c1e github.com/btcsuite/btcd v0.24.2 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/cockroachdb/pebble v1.1.0 @@ -94,6 +94,8 @@ require ( github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/btcsuite/btcd/btcutil v1.1.5 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect + github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect + github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -377,7 +379,6 @@ require ( replace ( github.com/babylonchain/babylon => ../babylon-private - github.com/babylonchain/babylon-da-sdk => github.com/babylonchain/babylon-da-sdk v0.0.0-20240703174540-4746669089a6 github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4 github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101315.3-rc.1 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index 3e3f60bdd6ac..2631e807c74e 100644 --- a/go.sum +++ b/go.sum @@ -292,8 +292,8 @@ github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX github.com/aws/aws-sdk-go v1.44.312 h1:llrElfzeqG/YOLFFKjg1xNpZCFJ2xraIi3PqSuP+95k= github.com/aws/aws-sdk-go v1.44.312/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/babylonchain/babylon-da-sdk v0.0.0-20240703174540-4746669089a6 h1:sysWOUVY0w2deUEtxcHivAUOxUoOhT2XvtTxHsZLJG4= -github.com/babylonchain/babylon-da-sdk v0.0.0-20240703174540-4746669089a6/go.mod h1:s508UvkWTk2jgsuDzpxzXjFxajK4gtJSe6dGFf3eB4E= +github.com/babylonchain/babylon-da-sdk v0.0.0-20240704160019-ec5dcf968c1e h1:qLJvnmv9OKeKFPuhswTyS/WFue+c1A3WasTwgdnQ+e4= +github.com/babylonchain/babylon-da-sdk v0.0.0-20240704160019-ec5dcf968c1e/go.mod h1:0kTt9a/njIMLOtiBlr7WMRYM8gTFuTEOnhK05oL/N5g= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= @@ -334,11 +334,13 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 h1:R8vQdOQdZ9Y3SkEwmHoWBmX1DNXhXZqlTpq6s4tyJGc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= diff --git a/op-node/rollup/finality/finalizer.go b/op-node/rollup/finality/finalizer.go index 1858bf56c261..c98a2046d7a3 100644 --- a/op-node/rollup/finality/finalizer.go +++ b/op-node/rollup/finality/finalizer.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum-optimism/optimism/op-node/rollup/engine" "github.com/ethereum-optimism/optimism/op-service/eth" + "github.com/babylonchain/babylon-da-sdk/btcclient" "github.com/babylonchain/babylon-da-sdk/sdk" ) @@ -215,10 +216,12 @@ func (fi *Finalizer) tryFinalize() { for _, fd := range fi.finalityData { if fd.L2Block.Number > finalizedL2.Number && fd.L1Block.Number <= fi.finalizedL1.Number { // Initialise new BabylonChain client + btcConfig := btcclient.DefaultBTCConfig() + btcConfig.RPCHost = fi.babylonConfig.BitcoinRpc config := &sdk.Config{ ChainType: fi.babylonConfig.ChainType, ContractAddr: fi.babylonConfig.ContractAddress, - BitcoinRpc: fi.babylonConfig.BitcoinRpc, + BTCConfig: btcConfig, } client, err := sdk.NewClient(config) if err != nil {