Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPV maintainer compatible with Bitcoin testnet and SepoliaLightRelay contract #3742

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/client-start-help
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Flags:
--tbtc.preParamsGenerationTimeout duration tECDSA pre-parameters generation timeout. (default 2m0s)
--tbtc.preParamsGenerationDelay duration tECDSA pre-parameters generation delay. (default 10s)
--tbtc.preParamsGenerationConcurrency int tECDSA pre-parameters generation concurrency. (default 1)
--tbtc.keyGenerationConcurrency int tECDSA key generation concurrency. (default number of cores)
--tbtc.keyGenerationConcurrency int tECDSA key generation concurrency. (default 10)
--developer.bridgeAddress string Address of the Bridge smart contract
--developer.maintainerProxyAddress string Address of the MaintainerProxy smart contract
--developer.lightRelayAddress string Address of the LightRelay smart contract
Expand Down
7 changes: 4 additions & 3 deletions pkg/beacon/registry/gen/pb/message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/chain/ethereum/beacon/gen/_address/RandomBeacon
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x02CBA6D77CF9fB019e322c55b34c9d42f2eF4D74
1 change: 1 addition & 0 deletions pkg/chain/ethereum/ecdsa/gen/_address/WalletRegistry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x2DfC89675AB5Fb5Be7c2A86d373Daac3E795fc25
40 changes: 40 additions & 0 deletions pkg/chain/ethereum/tbtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type TbtcChain struct {
walletRegistry *ecdsacontract.WalletRegistry
sortitionPool *ecdsacontract.EcdsaSortitionPool
walletCoordinator *tbtccontract.WalletCoordinator
lightRelay *tbtccontract.LightRelay
}

// NewTbtcChain construct a new instance of the TBTC-specific Ethereum
Expand Down Expand Up @@ -194,13 +195,42 @@ func newTbtcChain(
)
}

lightRelayAddress, err := config.ContractAddress(
LightRelayContractName,
)
if err != nil {
return nil, fmt.Errorf(
"failed to attach to LightRelay contract: [%w]",
err,
)
}

lightRelay, err :=
tbtccontract.NewLightRelay(
lightRelayAddress,
baseChain.chainID,
baseChain.key,
baseChain.client,
baseChain.nonceManager,
baseChain.miningWaiter,
baseChain.blockCounter,
baseChain.transactionMutex,
)
if err != nil {
return nil, fmt.Errorf(
"failed to attach to LightRelay contract: [%w]",
err,
)
}

return &TbtcChain{
baseChain: baseChain,
bridge: bridge,
maintainerProxy: maintainerProxy,
walletRegistry: walletRegistry,
sortitionPool: sortitionPool,
walletCoordinator: walletCoordinator,
lightRelay: lightRelay,
}, nil
}

Expand Down Expand Up @@ -1449,6 +1479,11 @@ func (tc *TbtcChain) SubmitRedemptionProofWithReimbursement(
TxOutputValue: uint64(mainUTXO.Value),
}

_, err := tc.lightRelay.SetDifficultyFromHeaders(sweepProof.BitcoinHeaders)
if err != nil {
return err
}

gasEstimate, err := tc.maintainerProxy.SubmitRedemptionProofGasEstimate(
bitcoinTxInfo,
sweepProof,
Expand Down Expand Up @@ -1525,6 +1560,11 @@ func (tc *TbtcChain) SubmitDepositSweepProofWithReimbursement(
TxOutputValue: uint64(mainUTXO.Value),
}

_, err := tc.lightRelay.SetDifficultyFromHeaders(sweepProof.BitcoinHeaders)
if err != nil {
return err
}

gasEstimate, err := tc.maintainerProxy.SubmitDepositSweepProofGasEstimate(
bitcoinTxInfo,
sweepProof,
Expand Down
1 change: 1 addition & 0 deletions pkg/chain/ethereum/tbtc/gen/_address/Bridge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x9b1a7fE5a16A15F2f9475C5B231750598b113403
1 change: 1 addition & 0 deletions pkg/chain/ethereum/tbtc/gen/_address/LightRelay
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x998D17122dA4ed98e558198665984E08D1cEAA8d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xA669AC294BCf04CEeB5EBC26d9E1bF4fc4574e06
1 change: 1 addition & 0 deletions pkg/chain/ethereum/tbtc/gen/_address/MaintainerProxy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xCE85405123Ed0DC2596B4FCB9a2Fe15Bc59ff886
2 changes: 1 addition & 1 deletion pkg/chain/ethereum/tbtc/gen/_address/WalletCoordinator
Original file line number Diff line number Diff line change
@@ -1 +1 @@

0x4ABE632d4fb69b895A242616b09C5596D6D8de7F
23 changes: 22 additions & 1 deletion pkg/chain/ethereum/tbtc/gen/abi/LightRelay.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions pkg/chain/ethereum/tbtc/gen/cmd/LightRelay.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading