From b7997d308d0aa722582ab7b8ea94d69a383ae563 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 4 Jan 2018 16:08:12 -0500 Subject: [PATCH 01/28] Mid client refactor Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 5b9e5d615412f5dd4cbf09aa4f4675fa1403dfb2 Source-Scope: eth/client.go:setContracts --- eth/client.go | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 eth/client.go diff --git a/eth/client.go b/eth/client.go new file mode 100644 index 0000000..6bfeb3b --- /dev/null +++ b/eth/client.go @@ -0,0 +1,124 @@ +package eth + +func (c *client) setContracts(opts *bind.TransactOpts) error { + controller, err := contracts.NewController(c.controllerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating Controller binding: %v", err) + return err + } + + c.ControllerSession = &contracts.ControllerSession{ + Contract: controller, + TransactOpts: *opts, + } + + glog.Infof("Controller: %v", c.controllerAddr.Hex()) + + tokenAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerToken"))) + if err != nil { + glog.Errorf("Error getting LivepeerToken address: %v", err) + return err + } + + c.tokenAddr = tokenAddr + + token, err := contracts.NewLivepeerToken(tokenAddr, c.backend) + if err != nil { + glog.Errorf("Error creating LivpeerToken binding: %v", err) + return err + } + + c.LivepeerTokenSession = &contracts.LivepeerTokenSession{ + Contract: token, + TransactOpts: *opts, + } + + glog.Infof("LivepeerToken: %v", c.tokenAddr.Hex()) + + bondingManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("BondingManager"))) + if err != nil { + glog.Errorf("Error getting BondingManager address: %v", err) + return err + } + + c.bondingManagerAddr = bondingManagerAddr + + bondingManager, err := contracts.NewBondingManager(bondingManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating BondingManager binding: %v", err) + return err + } + + c.BondingManagerSession = &contracts.BondingManagerSession{ + Contract: bondingManager, + TransactOpts: *opts, + } + + glog.Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) + + jobsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("JobsManager"))) + if err != nil { + glog.Errorf("Error getting JobsManager address: %v", err) + return err + } + + c.jobsManagerAddr = jobsManagerAddr + + jobsManager, err := contracts.NewJobsManager(jobsManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating JobsManager binding: %v", err) + return err + } + + c.JobsManagerSession = &contracts.JobsManagerSession{ + Contract: jobsManager, + TransactOpts: *opts, + } + + glog.Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) + + roundsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("RoundsManager"))) + if err != nil { + glog.Errorf("Error getting RoundsManager address: %v", err) + return err + } + + c.roundsManagerAddr = roundsManagerAddr + + roundsManager, err := contracts.NewRoundsManager(roundsManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating RoundsManager binding: %v", err) + return err + } + + c.RoundsManagerSession = &contracts.RoundsManagerSession{ + Contract: roundsManager, + TransactOpts: *opts, + } + + glog.Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) + + faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) + if err != nil { + glog.Errorf("Error getting LivepeerTokenFaucet address: %v", err) + return err + } + + c.faucetAddr = faucetAddr + + faucet, err := contracts.NewLivepeerTokenFaucet(faucetAddr, c.backend) + if err != nil { + glog.Errorf("Error creating LivepeerTokenFaucet binding: %v", err) + return err + } + + c.LivepeerTokenFaucetSession = &contracts.LivepeerTokenFaucetSession{ + Contract: faucet, + TransactOpts: *opts, + } + + glog.Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) + + return nil +} + From 8e14135a54af3557273578747323e3e420d7e041 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 11 Jan 2018 12:01:32 -0500 Subject: [PATCH 02/28] View protocol parameters in the CLI Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: d8c313f2a4b5c865b3003cfde7f2ed5bbabdfd5b Source-Scope: eth/client.go:setContracts --- eth/client.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/eth/client.go b/eth/client.go index 6bfeb3b..49ed40f 100644 --- a/eth/client.go +++ b/eth/client.go @@ -98,6 +98,48 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) + minterAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Minter"))) + if err != nil { + glog.Errorf("Error getting Minter address: %v", err) + return err + } + + c.minterAddr = minterAddr + + minter, err := contracts.NewMinter(minterAddr, c.backend) + if err != nil { + glog.Errorf("Error creating Minter binding: %v", err) + return err + } + + // Client should never transact with the Minter directly so we don't include transact opts + c.MinterSession = &contracts.MinterSession{ + Contract: minter, + } + + glog.Infof("Minter: %v", c.minterAddr.Hex()) + + verifierAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Verifier"))) + if err != nil { + glog.Errorf("Error getting Verifier address: %v", err) + return err + } + + c.verifierAddr = verifierAddr + + verifier, err := contracts.NewLivepeerVerifier(verifierAddr, c.backend) + if err != nil { + glog.Errorf("Error creating LivepeerVerifier binding: %v", err) + return err + } + + // Client should never transact with the Verifier directly so we don't include transact opts + c.LivepeerVerifierSession = &contracts.LivepeerVerifierSession{ + Contract: verifier, + } + + glog.Infof("Verifier: %v", c.verifierAddr.Hex()) + faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) if err != nil { glog.Errorf("Error getting LivepeerTokenFaucet address: %v", err) From e0d43cf74b974b40ecd2846ab5d821305c3eed3f Mon Sep 17 00:00:00 2001 From: Eric Tang Date: Sat, 28 Apr 2018 16:37:02 -0400 Subject: [PATCH 03/28] clean up log Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 0206872169a5cd748f61ca23d0507d7bac62546a Source-Scope: eth/client.go:setContracts --- eth/client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eth/client.go b/eth/client.go index 49ed40f..91ac0c6 100644 --- a/eth/client.go +++ b/eth/client.go @@ -12,7 +12,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("Controller: %v", c.controllerAddr.Hex()) + glog.V(common.SHORT).Infof("Controller: %v", c.controllerAddr.Hex()) tokenAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerToken"))) if err != nil { @@ -33,7 +33,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("LivepeerToken: %v", c.tokenAddr.Hex()) + glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) bondingManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("BondingManager"))) if err != nil { @@ -54,7 +54,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) + glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) jobsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("JobsManager"))) if err != nil { @@ -75,7 +75,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) + glog.V(common.SHORT).Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) roundsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("RoundsManager"))) if err != nil { @@ -96,7 +96,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) + glog.V(common.SHORT).Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) minterAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Minter"))) if err != nil { @@ -117,7 +117,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { Contract: minter, } - glog.Infof("Minter: %v", c.minterAddr.Hex()) + glog.V(common.SHORT).Infof("Minter: %v", c.minterAddr.Hex()) verifierAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Verifier"))) if err != nil { @@ -138,7 +138,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { Contract: verifier, } - glog.Infof("Verifier: %v", c.verifierAddr.Hex()) + glog.V(common.SHORT).Infof("Verifier: %v", c.verifierAddr.Hex()) faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) if err != nil { @@ -159,7 +159,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) + glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) return nil } From 84dac3928eec59c967cf2a108a0930cf85d5bfcf Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Tue, 5 Jun 2018 15:58:45 -0400 Subject: [PATCH 04/28] Client code for ServiceRegistry. Add ability to set service URI in CLI Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 94d8edca933350d9587e76ef5a83066dccfcfd05 Source-Scope: eth/client.go:setContracts --- eth/client.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/eth/client.go b/eth/client.go index 91ac0c6..0dea16a 100644 --- a/eth/client.go +++ b/eth/client.go @@ -35,6 +35,27 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) + serviceRegistryAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + if err != nil { + glog.Errorf("Error getting ServiceRegistry address: %v", err) + return err + } + + c.serviceRegistryAddr = serviceRegistryAddr + + serviceRegistry, err := contracts.NewServiceRegistry(serviceRegistryAddr, c.backend) + if err != nil { + glog.Errorf("Error creating ServiceRegistry binding: %v", err) + return err + } + + c.ServiceRegistrySession = &contracts.ServiceRegistrySession{ + Contract: serviceRegistry, + TransactOpts: *opts, + } + + glog.V(common.SHORT).Infof("ServiceRegistry: %v", c.serviceRegistryAddr.Hex()) + bondingManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("BondingManager"))) if err != nil { glog.Errorf("Error getting BondingManager address: %v", err) From 0c9c2588f1b62051d8e6532ba2b0315bc168b928 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 27 Dec 2018 18:16:01 -0500 Subject: [PATCH 05/28] eth: update contract bindings - Introduces LivepeerETHTicketBroker - Code cleanup: Remove job related code Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 26435c28edf62e40dbd6cfea97cdb750ff51abb5 Source-Scope: eth/client.go:setContracts --- eth/client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eth/client.go b/eth/client.go index 0dea16a..502f260 100644 --- a/eth/client.go +++ b/eth/client.go @@ -77,26 +77,26 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) - jobsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("JobsManager"))) + brokerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("TicketBroker"))) if err != nil { - glog.Errorf("Error getting JobsManager address: %v", err) + glog.Errorf("Error getting TicketBroker address: %v", err) return err } - c.jobsManagerAddr = jobsManagerAddr + c.ticketBrokerAddr = brokerAddr - jobsManager, err := contracts.NewJobsManager(jobsManagerAddr, c.backend) + broker, err := contracts.NewLivepeerETHTicketBroker(brokerAddr, c.backend) if err != nil { - glog.Errorf("Error creating JobsManager binding: %v", err) + glog.Errorf("Error creating TicketBroker binding: %v", err) return err } - c.JobsManagerSession = &contracts.JobsManagerSession{ - Contract: jobsManager, + c.LivepeerETHTicketBrokerSession = &contracts.LivepeerETHTicketBrokerSession{ + Contract: broker, TransactOpts: *opts, } - glog.V(common.SHORT).Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) + glog.V(common.SHORT).Infof("TicketBroker: %v", c.ticketBrokerAddr.Hex()) roundsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("RoundsManager"))) if err != nil { From fe964904a08e2dff898c555bbfaccfe16fc763eb Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Mon, 20 May 2019 17:20:45 -0400 Subject: [PATCH 06/28] Update TicketBroker contract binding Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: ffcefd6341d14696e2718c1a42875428cd2cc953 Source-Scope: eth/client.go:setContracts --- eth/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/client.go b/eth/client.go index 502f260..513ef3b 100644 --- a/eth/client.go +++ b/eth/client.go @@ -85,13 +85,13 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { c.ticketBrokerAddr = brokerAddr - broker, err := contracts.NewLivepeerETHTicketBroker(brokerAddr, c.backend) + broker, err := contracts.NewTicketBroker(brokerAddr, c.backend) if err != nil { glog.Errorf("Error creating TicketBroker binding: %v", err) return err } - c.LivepeerETHTicketBrokerSession = &contracts.LivepeerETHTicketBrokerSession{ + c.TicketBrokerSession = &contracts.TicketBrokerSession{ Contract: broker, TransactOpts: *opts, } From b9acc0c8f419d01c4b3b1ec6d0e372d417f2e9b9 Mon Sep 17 00:00:00 2001 From: Nico Vergauwen Date: Sat, 5 Oct 2019 04:20:59 +0200 Subject: [PATCH 07/28] eth: remove LivepeerVerifier references Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: ebdaed880f96e07b72288090e54f1141e8b404ab Source-Scope: eth/client.go:setContracts --- eth/client.go | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/eth/client.go b/eth/client.go index 513ef3b..a6b11bf 100644 --- a/eth/client.go +++ b/eth/client.go @@ -140,27 +140,6 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("Minter: %v", c.minterAddr.Hex()) - verifierAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Verifier"))) - if err != nil { - glog.Errorf("Error getting Verifier address: %v", err) - return err - } - - c.verifierAddr = verifierAddr - - verifier, err := contracts.NewLivepeerVerifier(verifierAddr, c.backend) - if err != nil { - glog.Errorf("Error creating LivepeerVerifier binding: %v", err) - return err - } - - // Client should never transact with the Verifier directly so we don't include transact opts - c.LivepeerVerifierSession = &contracts.LivepeerVerifierSession{ - Contract: verifier, - } - - glog.V(common.SHORT).Infof("Verifier: %v", c.verifierAddr.Hex()) - faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) if err != nil { glog.Errorf("Error getting LivepeerTokenFaucet address: %v", err) From 8cf6926ad25541c75e0da4f6f6c4f0697f6e7c61 Mon Sep 17 00:00:00 2001 From: Rafal Leszko Date: Mon, 24 Jan 2022 17:09:31 +0100 Subject: [PATCH 08/28] eth,server: Support both L1 and L2 contract interfaces Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 35d719cf8634152d381e03fe95e80fa8ce51a6e6 Source-Scope: eth/client.go:setContracts --- eth/client.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/eth/client.go b/eth/client.go index a6b11bf..685237c 100644 --- a/eth/client.go +++ b/eth/client.go @@ -75,6 +75,18 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } + // for L1 contracts backwards-compatibility + l1BondingManager, err := contracts.NewL1BondingManager(bondingManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating L1BondingManager binding: %v", err) + return err + } + + c.l1BondingManagerSession = &contracts.L1BondingManagerSession{ + Contract: l1BondingManager, + TransactOpts: *opts, + } + glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) brokerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("TicketBroker"))) From 4252f7b69e9952cf207fe94b596eca4548b795a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Thu, 3 Feb 2022 17:00:25 +0100 Subject: [PATCH 09/28] eth: Fix nil pointer in client.Vote() Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 8efdade723c1ab3a7d25e8345c7e8fdade013083 Source-Scope: eth/client.go:setContracts --- eth/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eth/client.go b/eth/client.go index 685237c..ed5ea9b 100644 --- a/eth/client.go +++ b/eth/client.go @@ -1,6 +1,8 @@ package eth func (c *client) setContracts(opts *bind.TransactOpts) error { + c.transactOpts = opts + controller, err := contracts.NewController(c.controllerAddr, c.backend) if err != nil { glog.Errorf("Error creating Controller binding: %v", err) From 47bab92a63c5d4e4489ee7d09c11106dc2ae3401 Mon Sep 17 00:00:00 2001 From: Rafal Leszko Date: Fri, 7 Jan 2022 17:25:22 +0100 Subject: [PATCH 10/28] eth: Set GasFeeCap in each tx to maxGasPrice defined by the user Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 9803e912541cde2433e1f90fb4818491f9f4584b Source-Scope: eth/client.go:setContracts --- eth/client.go | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/eth/client.go b/eth/client.go index ed5ea9b..1afefa3 100644 --- a/eth/client.go +++ b/eth/client.go @@ -1,7 +1,7 @@ package eth func (c *client) setContracts(opts *bind.TransactOpts) error { - c.transactOpts = opts + c.setTransactOpts(*opts) controller, err := contracts.NewController(c.controllerAddr, c.backend) if err != nil { @@ -9,9 +9,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.ControllerSession = &contracts.ControllerSession{ - Contract: controller, - TransactOpts: *opts, + c.controllerSess = &contracts.ControllerSession{ + Contract: controller, } glog.V(common.SHORT).Infof("Controller: %v", c.controllerAddr.Hex()) @@ -30,9 +29,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.LivepeerTokenSession = &contracts.LivepeerTokenSession{ - Contract: token, - TransactOpts: *opts, + c.livepeerTokenSess = &contracts.LivepeerTokenSession{ + Contract: token, } glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) @@ -51,9 +49,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.ServiceRegistrySession = &contracts.ServiceRegistrySession{ - Contract: serviceRegistry, - TransactOpts: *opts, + c.serviceRegistrySess = &contracts.ServiceRegistrySession{ + Contract: serviceRegistry, } glog.V(common.SHORT).Infof("ServiceRegistry: %v", c.serviceRegistryAddr.Hex()) @@ -72,9 +69,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.BondingManagerSession = &contracts.BondingManagerSession{ - Contract: bondingManager, - TransactOpts: *opts, + c.bondingManagerSess = &contracts.BondingManagerSession{ + Contract: bondingManager, } // for L1 contracts backwards-compatibility @@ -84,9 +80,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.l1BondingManagerSession = &contracts.L1BondingManagerSession{ - Contract: l1BondingManager, - TransactOpts: *opts, + c.l1BondingManagerSess = &contracts.L1BondingManagerSession{ + Contract: l1BondingManager, } glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) @@ -105,9 +100,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.TicketBrokerSession = &contracts.TicketBrokerSession{ - Contract: broker, - TransactOpts: *opts, + c.ticketBrokerSess = &contracts.TicketBrokerSession{ + Contract: broker, } glog.V(common.SHORT).Infof("TicketBroker: %v", c.ticketBrokerAddr.Hex()) @@ -126,9 +120,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.RoundsManagerSession = &contracts.RoundsManagerSession{ - Contract: roundsManager, - TransactOpts: *opts, + c.roundsManagerSess = &contracts.RoundsManagerSession{ + Contract: roundsManager, } glog.V(common.SHORT).Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) @@ -148,7 +141,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { } // Client should never transact with the Minter directly so we don't include transact opts - c.MinterSession = &contracts.MinterSession{ + c.minterSess = &contracts.MinterSession{ Contract: minter, } @@ -168,9 +161,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.LivepeerTokenFaucetSession = &contracts.LivepeerTokenFaucetSession{ - Contract: faucet, - TransactOpts: *opts, + c.livepeerTokenFaucetSess = &contracts.LivepeerTokenFaucetSession{ + Contract: faucet, } glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) From 34d3fa6ee333c6f68b31e56a52489ae50591376d Mon Sep 17 00:00:00 2001 From: Rafal Leszko Date: Thu, 24 Feb 2022 13:20:14 +0100 Subject: [PATCH 11/28] eth: Refactor client to not include contract sessions Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 3209dd946bb0376308044055b6caf262fd25cf61 Source-Scope: eth/client.go:setContracts --- eth/client.go | 46 +++++++++------------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/eth/client.go b/eth/client.go index 1afefa3..e2d279c 100644 --- a/eth/client.go +++ b/eth/client.go @@ -8,10 +8,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating Controller binding: %v", err) return err } - - c.controllerSess = &contracts.ControllerSession{ - Contract: controller, - } + c.controller = controller glog.V(common.SHORT).Infof("Controller: %v", c.controllerAddr.Hex()) @@ -28,10 +25,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating LivpeerToken binding: %v", err) return err } - - c.livepeerTokenSess = &contracts.LivepeerTokenSession{ - Contract: token, - } + c.livepeerToken = token glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) @@ -48,10 +42,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating ServiceRegistry binding: %v", err) return err } - - c.serviceRegistrySess = &contracts.ServiceRegistrySession{ - Contract: serviceRegistry, - } + c.serviceRegistry = serviceRegistry glog.V(common.SHORT).Infof("ServiceRegistry: %v", c.serviceRegistryAddr.Hex()) @@ -68,10 +59,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating BondingManager binding: %v", err) return err } - - c.bondingManagerSess = &contracts.BondingManagerSession{ - Contract: bondingManager, - } + c.bondingManager = bondingManager // for L1 contracts backwards-compatibility l1BondingManager, err := contracts.NewL1BondingManager(bondingManagerAddr, c.backend) @@ -79,10 +67,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating L1BondingManager binding: %v", err) return err } - - c.l1BondingManagerSess = &contracts.L1BondingManagerSession{ - Contract: l1BondingManager, - } + c.l1BondingManager = l1BondingManager glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) @@ -99,10 +84,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating TicketBroker binding: %v", err) return err } - - c.ticketBrokerSess = &contracts.TicketBrokerSession{ - Contract: broker, - } + c.ticketBroker = broker glog.V(common.SHORT).Infof("TicketBroker: %v", c.ticketBrokerAddr.Hex()) @@ -119,10 +101,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating RoundsManager binding: %v", err) return err } - - c.roundsManagerSess = &contracts.RoundsManagerSession{ - Contract: roundsManager, - } + c.roundsManager = roundsManager glog.V(common.SHORT).Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) @@ -139,11 +118,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating Minter binding: %v", err) return err } - - // Client should never transact with the Minter directly so we don't include transact opts - c.minterSess = &contracts.MinterSession{ - Contract: minter, - } + c.minter = minter glog.V(common.SHORT).Infof("Minter: %v", c.minterAddr.Hex()) @@ -160,10 +135,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating LivepeerTokenFaucet binding: %v", err) return err } - - c.livepeerTokenFaucetSess = &contracts.LivepeerTokenFaucetSession{ - Contract: faucet, - } + c.livepeerTokenFaucet = faucet glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) From 694005871038b55000674b4175a1d202f510bdbc Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Thu, 18 Apr 2024 20:23:35 +0200 Subject: [PATCH 12/28] feat(ai): enable AI orchestrator discovery (#3004) * feat(ai): enable AI orchestrator discovery This commit incorporates the AIServiceRegistry contract address, superseding the conventional ServiceRegistry contract address. This strategic alteration streamlines the discovery process of AI Orchestrators within the AI Subnet, thereby bolstering network accessibility and interaction. While this approach serves as a swift workaround to enable the feature without extensive code modification, it's important to note that it may disrupt the existing transcoding discovery mechanism. We have to fix this if we want to merge the two networks in the future. * docs(ai): improve discovery documentation This commit ensures that people are aware that they have to interact with the `AIServiceRegistry` using their main Orch wallet. * fix: fix 'AIServiceRegistry' devnet and testnet issue This commit ensure that the hardcoded `AIServiceRegistry` contract doesn't break the go-livepeer binary on local devnets or testnets. Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: e9258f301ca923d2acca9bdc8cd6d3263f4a2dbc Source-Scope: eth/client.go:setContracts --- eth/client.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/eth/client.go b/eth/client.go index e2d279c..022aa9c 100644 --- a/eth/client.go +++ b/eth/client.go @@ -29,12 +29,25 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) - serviceRegistryAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + chainID, err := c.backend.ChainID(context.Background()) if err != nil { - glog.Errorf("Error getting ServiceRegistry address: %v", err) + glog.Errorf("Failed to get chain ID from remote ethereum node: %v", err) return err } + // TODO: This is a temporary setup for a separate AIServiceRegistry. Revise this when AI subnet merges with the mainnet. + var serviceRegistryAddr ethcommon.Address + arbitrumOneChainID := big.NewInt(42161) + if chainID.Cmp(arbitrumOneChainID) == 0 { + serviceRegistryAddr = ethcommon.HexToAddress("0x04C0b249740175999E5BF5c9ac1dA92431EF34C5") + } else { + serviceRegistryAddr, err = c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + if err != nil { + glog.Errorf("Error getting ServiceRegistry address: %v", err) + return err + } + } + c.serviceRegistryAddr = serviceRegistryAddr serviceRegistry, err := contracts.NewServiceRegistry(serviceRegistryAddr, c.backend) From edc755c527937565a126a6ca91dc83ae51b8916d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Tue, 22 Oct 2024 14:38:29 +0200 Subject: [PATCH 13/28] Add flag to use AI ServiceRegistry contract address for Livepeer AI Subnet (#3186) Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: f3fd9121ad95e1e8b89a75721ae536d60a3d1b84 Source-Scope: eth/client.go:setContracts --- eth/client.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/eth/client.go b/eth/client.go index 022aa9c..ff4bcf7 100644 --- a/eth/client.go +++ b/eth/client.go @@ -29,28 +29,15 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) - chainID, err := c.backend.ChainID(context.Background()) - if err != nil { - glog.Errorf("Failed to get chain ID from remote ethereum node: %v", err) - return err - } - - // TODO: This is a temporary setup for a separate AIServiceRegistry. Revise this when AI subnet merges with the mainnet. - var serviceRegistryAddr ethcommon.Address - arbitrumOneChainID := big.NewInt(42161) - if chainID.Cmp(arbitrumOneChainID) == 0 { - serviceRegistryAddr = ethcommon.HexToAddress("0x04C0b249740175999E5BF5c9ac1dA92431EF34C5") - } else { - serviceRegistryAddr, err = c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + if c.serviceRegistryAddr == (ethcommon.Address{}) { + c.serviceRegistryAddr, err = c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) if err != nil { glog.Errorf("Error getting ServiceRegistry address: %v", err) return err } } - c.serviceRegistryAddr = serviceRegistryAddr - - serviceRegistry, err := contracts.NewServiceRegistry(serviceRegistryAddr, c.backend) + serviceRegistry, err := contracts.NewServiceRegistry(c.serviceRegistryAddr, c.backend) if err != nil { glog.Errorf("Error creating ServiceRegistry binding: %v", err) return err From ea4881ef221867fd81af94015f7f65177c67c740 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Sun, 9 Mar 2025 11:11:38 +0100 Subject: [PATCH 14/28] feat(CLI): add proposal vote cli arg (#3275) This commit adds functionality to the `go-livepeer` CLI, allowing orchestrators to vote on active treasury proposals directly. Additionally, it provides an option to include a reason for their vote, enhancing transparency and accountability in the decision-making process. Co-authored-by: Victor Elias Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 89d9ebc7fff0004aab11bbb733035327da7b2e1b Source-Scope: eth/client.go:setContracts --- eth/client.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eth/client.go b/eth/client.go index ff4bcf7..9c48321 100644 --- a/eth/client.go +++ b/eth/client.go @@ -139,6 +139,23 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) + livepeerGovernorAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerGovernor"))) + if err != nil { + glog.Errorf("Error getting Governor address: %v", err) + return err + } + + c.livepeerGovernorAddr = livepeerGovernorAddr + + governor, err := contracts.NewGovernor(livepeerGovernorAddr, c.backend) + if err != nil { + glog.Errorf("Error creating Governor binding: %v", err) + return err + } + c.livepeerGovernor = governor + + glog.V(common.SHORT).Infof("LivepeerGovernor: %v", c.livepeerGovernorAddr.Hex()) + return nil } From de6f68bfcaccccd1611a9455ecf899a52959d77f Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 4 Jan 2018 16:08:12 -0500 Subject: [PATCH 15/28] Mid client refactor Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 5b9e5d615412f5dd4cbf09aa4f4675fa1403dfb2 Source-Scope: eth/client.go:setContracts --- eth/client.go | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 eth/client.go diff --git a/eth/client.go b/eth/client.go new file mode 100644 index 0000000..6bfeb3b --- /dev/null +++ b/eth/client.go @@ -0,0 +1,124 @@ +package eth + +func (c *client) setContracts(opts *bind.TransactOpts) error { + controller, err := contracts.NewController(c.controllerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating Controller binding: %v", err) + return err + } + + c.ControllerSession = &contracts.ControllerSession{ + Contract: controller, + TransactOpts: *opts, + } + + glog.Infof("Controller: %v", c.controllerAddr.Hex()) + + tokenAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerToken"))) + if err != nil { + glog.Errorf("Error getting LivepeerToken address: %v", err) + return err + } + + c.tokenAddr = tokenAddr + + token, err := contracts.NewLivepeerToken(tokenAddr, c.backend) + if err != nil { + glog.Errorf("Error creating LivpeerToken binding: %v", err) + return err + } + + c.LivepeerTokenSession = &contracts.LivepeerTokenSession{ + Contract: token, + TransactOpts: *opts, + } + + glog.Infof("LivepeerToken: %v", c.tokenAddr.Hex()) + + bondingManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("BondingManager"))) + if err != nil { + glog.Errorf("Error getting BondingManager address: %v", err) + return err + } + + c.bondingManagerAddr = bondingManagerAddr + + bondingManager, err := contracts.NewBondingManager(bondingManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating BondingManager binding: %v", err) + return err + } + + c.BondingManagerSession = &contracts.BondingManagerSession{ + Contract: bondingManager, + TransactOpts: *opts, + } + + glog.Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) + + jobsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("JobsManager"))) + if err != nil { + glog.Errorf("Error getting JobsManager address: %v", err) + return err + } + + c.jobsManagerAddr = jobsManagerAddr + + jobsManager, err := contracts.NewJobsManager(jobsManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating JobsManager binding: %v", err) + return err + } + + c.JobsManagerSession = &contracts.JobsManagerSession{ + Contract: jobsManager, + TransactOpts: *opts, + } + + glog.Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) + + roundsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("RoundsManager"))) + if err != nil { + glog.Errorf("Error getting RoundsManager address: %v", err) + return err + } + + c.roundsManagerAddr = roundsManagerAddr + + roundsManager, err := contracts.NewRoundsManager(roundsManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating RoundsManager binding: %v", err) + return err + } + + c.RoundsManagerSession = &contracts.RoundsManagerSession{ + Contract: roundsManager, + TransactOpts: *opts, + } + + glog.Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) + + faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) + if err != nil { + glog.Errorf("Error getting LivepeerTokenFaucet address: %v", err) + return err + } + + c.faucetAddr = faucetAddr + + faucet, err := contracts.NewLivepeerTokenFaucet(faucetAddr, c.backend) + if err != nil { + glog.Errorf("Error creating LivepeerTokenFaucet binding: %v", err) + return err + } + + c.LivepeerTokenFaucetSession = &contracts.LivepeerTokenFaucetSession{ + Contract: faucet, + TransactOpts: *opts, + } + + glog.Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) + + return nil +} + From eecbf190e848e2e81720f3edfd1f8a27584377c1 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 11 Jan 2018 12:01:32 -0500 Subject: [PATCH 16/28] View protocol parameters in the CLI Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: d8c313f2a4b5c865b3003cfde7f2ed5bbabdfd5b Source-Scope: eth/client.go:setContracts --- eth/client.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/eth/client.go b/eth/client.go index 6bfeb3b..49ed40f 100644 --- a/eth/client.go +++ b/eth/client.go @@ -98,6 +98,48 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) + minterAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Minter"))) + if err != nil { + glog.Errorf("Error getting Minter address: %v", err) + return err + } + + c.minterAddr = minterAddr + + minter, err := contracts.NewMinter(minterAddr, c.backend) + if err != nil { + glog.Errorf("Error creating Minter binding: %v", err) + return err + } + + // Client should never transact with the Minter directly so we don't include transact opts + c.MinterSession = &contracts.MinterSession{ + Contract: minter, + } + + glog.Infof("Minter: %v", c.minterAddr.Hex()) + + verifierAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Verifier"))) + if err != nil { + glog.Errorf("Error getting Verifier address: %v", err) + return err + } + + c.verifierAddr = verifierAddr + + verifier, err := contracts.NewLivepeerVerifier(verifierAddr, c.backend) + if err != nil { + glog.Errorf("Error creating LivepeerVerifier binding: %v", err) + return err + } + + // Client should never transact with the Verifier directly so we don't include transact opts + c.LivepeerVerifierSession = &contracts.LivepeerVerifierSession{ + Contract: verifier, + } + + glog.Infof("Verifier: %v", c.verifierAddr.Hex()) + faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) if err != nil { glog.Errorf("Error getting LivepeerTokenFaucet address: %v", err) From 95c565f3e726a29801310ca40ccb7268bf81871b Mon Sep 17 00:00:00 2001 From: Eric Tang Date: Sat, 28 Apr 2018 16:37:02 -0400 Subject: [PATCH 17/28] clean up log Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 0206872169a5cd748f61ca23d0507d7bac62546a Source-Scope: eth/client.go:setContracts --- eth/client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eth/client.go b/eth/client.go index 49ed40f..91ac0c6 100644 --- a/eth/client.go +++ b/eth/client.go @@ -12,7 +12,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("Controller: %v", c.controllerAddr.Hex()) + glog.V(common.SHORT).Infof("Controller: %v", c.controllerAddr.Hex()) tokenAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerToken"))) if err != nil { @@ -33,7 +33,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("LivepeerToken: %v", c.tokenAddr.Hex()) + glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) bondingManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("BondingManager"))) if err != nil { @@ -54,7 +54,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) + glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) jobsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("JobsManager"))) if err != nil { @@ -75,7 +75,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) + glog.V(common.SHORT).Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) roundsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("RoundsManager"))) if err != nil { @@ -96,7 +96,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) + glog.V(common.SHORT).Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) minterAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Minter"))) if err != nil { @@ -117,7 +117,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { Contract: minter, } - glog.Infof("Minter: %v", c.minterAddr.Hex()) + glog.V(common.SHORT).Infof("Minter: %v", c.minterAddr.Hex()) verifierAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Verifier"))) if err != nil { @@ -138,7 +138,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { Contract: verifier, } - glog.Infof("Verifier: %v", c.verifierAddr.Hex()) + glog.V(common.SHORT).Infof("Verifier: %v", c.verifierAddr.Hex()) faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) if err != nil { @@ -159,7 +159,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } - glog.Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) + glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) return nil } From 580c283049d94ea051981a916e3ea81393f5ba38 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Tue, 5 Jun 2018 15:58:45 -0400 Subject: [PATCH 18/28] Client code for ServiceRegistry. Add ability to set service URI in CLI Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 94d8edca933350d9587e76ef5a83066dccfcfd05 Source-Scope: eth/client.go:setContracts --- eth/client.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/eth/client.go b/eth/client.go index 91ac0c6..0dea16a 100644 --- a/eth/client.go +++ b/eth/client.go @@ -35,6 +35,27 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) + serviceRegistryAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + if err != nil { + glog.Errorf("Error getting ServiceRegistry address: %v", err) + return err + } + + c.serviceRegistryAddr = serviceRegistryAddr + + serviceRegistry, err := contracts.NewServiceRegistry(serviceRegistryAddr, c.backend) + if err != nil { + glog.Errorf("Error creating ServiceRegistry binding: %v", err) + return err + } + + c.ServiceRegistrySession = &contracts.ServiceRegistrySession{ + Contract: serviceRegistry, + TransactOpts: *opts, + } + + glog.V(common.SHORT).Infof("ServiceRegistry: %v", c.serviceRegistryAddr.Hex()) + bondingManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("BondingManager"))) if err != nil { glog.Errorf("Error getting BondingManager address: %v", err) From 475425e0786d6c3900b197f0771ca2c4fd9a3a85 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 27 Dec 2018 18:16:01 -0500 Subject: [PATCH 19/28] eth: update contract bindings - Introduces LivepeerETHTicketBroker - Code cleanup: Remove job related code Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 26435c28edf62e40dbd6cfea97cdb750ff51abb5 Source-Scope: eth/client.go:setContracts --- eth/client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eth/client.go b/eth/client.go index 0dea16a..502f260 100644 --- a/eth/client.go +++ b/eth/client.go @@ -77,26 +77,26 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) - jobsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("JobsManager"))) + brokerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("TicketBroker"))) if err != nil { - glog.Errorf("Error getting JobsManager address: %v", err) + glog.Errorf("Error getting TicketBroker address: %v", err) return err } - c.jobsManagerAddr = jobsManagerAddr + c.ticketBrokerAddr = brokerAddr - jobsManager, err := contracts.NewJobsManager(jobsManagerAddr, c.backend) + broker, err := contracts.NewLivepeerETHTicketBroker(brokerAddr, c.backend) if err != nil { - glog.Errorf("Error creating JobsManager binding: %v", err) + glog.Errorf("Error creating TicketBroker binding: %v", err) return err } - c.JobsManagerSession = &contracts.JobsManagerSession{ - Contract: jobsManager, + c.LivepeerETHTicketBrokerSession = &contracts.LivepeerETHTicketBrokerSession{ + Contract: broker, TransactOpts: *opts, } - glog.V(common.SHORT).Infof("JobsManager: %v", c.jobsManagerAddr.Hex()) + glog.V(common.SHORT).Infof("TicketBroker: %v", c.ticketBrokerAddr.Hex()) roundsManagerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("RoundsManager"))) if err != nil { From 1b84a284f35b81e64901a79920f414298dac7ec6 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Mon, 20 May 2019 17:20:45 -0400 Subject: [PATCH 20/28] Update TicketBroker contract binding Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: ffcefd6341d14696e2718c1a42875428cd2cc953 Source-Scope: eth/client.go:setContracts --- eth/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/client.go b/eth/client.go index 502f260..513ef3b 100644 --- a/eth/client.go +++ b/eth/client.go @@ -85,13 +85,13 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { c.ticketBrokerAddr = brokerAddr - broker, err := contracts.NewLivepeerETHTicketBroker(brokerAddr, c.backend) + broker, err := contracts.NewTicketBroker(brokerAddr, c.backend) if err != nil { glog.Errorf("Error creating TicketBroker binding: %v", err) return err } - c.LivepeerETHTicketBrokerSession = &contracts.LivepeerETHTicketBrokerSession{ + c.TicketBrokerSession = &contracts.TicketBrokerSession{ Contract: broker, TransactOpts: *opts, } From e79562c63a5dbf2388e314609d4f982af172759c Mon Sep 17 00:00:00 2001 From: Nico Vergauwen Date: Sat, 5 Oct 2019 04:20:59 +0200 Subject: [PATCH 21/28] eth: remove LivepeerVerifier references Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: ebdaed880f96e07b72288090e54f1141e8b404ab Source-Scope: eth/client.go:setContracts --- eth/client.go | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/eth/client.go b/eth/client.go index 513ef3b..a6b11bf 100644 --- a/eth/client.go +++ b/eth/client.go @@ -140,27 +140,6 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("Minter: %v", c.minterAddr.Hex()) - verifierAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("Verifier"))) - if err != nil { - glog.Errorf("Error getting Verifier address: %v", err) - return err - } - - c.verifierAddr = verifierAddr - - verifier, err := contracts.NewLivepeerVerifier(verifierAddr, c.backend) - if err != nil { - glog.Errorf("Error creating LivepeerVerifier binding: %v", err) - return err - } - - // Client should never transact with the Verifier directly so we don't include transact opts - c.LivepeerVerifierSession = &contracts.LivepeerVerifierSession{ - Contract: verifier, - } - - glog.V(common.SHORT).Infof("Verifier: %v", c.verifierAddr.Hex()) - faucetAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerTokenFaucet"))) if err != nil { glog.Errorf("Error getting LivepeerTokenFaucet address: %v", err) From c3d37e045734b7aa61ec9640e5af42963a2a3626 Mon Sep 17 00:00:00 2001 From: Rafal Leszko Date: Mon, 24 Jan 2022 17:09:31 +0100 Subject: [PATCH 22/28] eth,server: Support both L1 and L2 contract interfaces Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 35d719cf8634152d381e03fe95e80fa8ce51a6e6 Source-Scope: eth/client.go:setContracts --- eth/client.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/eth/client.go b/eth/client.go index a6b11bf..685237c 100644 --- a/eth/client.go +++ b/eth/client.go @@ -75,6 +75,18 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { TransactOpts: *opts, } + // for L1 contracts backwards-compatibility + l1BondingManager, err := contracts.NewL1BondingManager(bondingManagerAddr, c.backend) + if err != nil { + glog.Errorf("Error creating L1BondingManager binding: %v", err) + return err + } + + c.l1BondingManagerSession = &contracts.L1BondingManagerSession{ + Contract: l1BondingManager, + TransactOpts: *opts, + } + glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) brokerAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("TicketBroker"))) From 7a06cedb58aa43cd28b4555b463102b855da0a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Thu, 3 Feb 2022 17:00:25 +0100 Subject: [PATCH 23/28] eth: Fix nil pointer in client.Vote() Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 8efdade723c1ab3a7d25e8345c7e8fdade013083 Source-Scope: eth/client.go:setContracts --- eth/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eth/client.go b/eth/client.go index 685237c..ed5ea9b 100644 --- a/eth/client.go +++ b/eth/client.go @@ -1,6 +1,8 @@ package eth func (c *client) setContracts(opts *bind.TransactOpts) error { + c.transactOpts = opts + controller, err := contracts.NewController(c.controllerAddr, c.backend) if err != nil { glog.Errorf("Error creating Controller binding: %v", err) From 0675576ceb8ecdfc67d82d49a5d49d57821e87e5 Mon Sep 17 00:00:00 2001 From: Rafal Leszko Date: Fri, 7 Jan 2022 17:25:22 +0100 Subject: [PATCH 24/28] eth: Set GasFeeCap in each tx to maxGasPrice defined by the user Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 9803e912541cde2433e1f90fb4818491f9f4584b Source-Scope: eth/client.go:setContracts --- eth/client.go | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/eth/client.go b/eth/client.go index ed5ea9b..1afefa3 100644 --- a/eth/client.go +++ b/eth/client.go @@ -1,7 +1,7 @@ package eth func (c *client) setContracts(opts *bind.TransactOpts) error { - c.transactOpts = opts + c.setTransactOpts(*opts) controller, err := contracts.NewController(c.controllerAddr, c.backend) if err != nil { @@ -9,9 +9,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.ControllerSession = &contracts.ControllerSession{ - Contract: controller, - TransactOpts: *opts, + c.controllerSess = &contracts.ControllerSession{ + Contract: controller, } glog.V(common.SHORT).Infof("Controller: %v", c.controllerAddr.Hex()) @@ -30,9 +29,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.LivepeerTokenSession = &contracts.LivepeerTokenSession{ - Contract: token, - TransactOpts: *opts, + c.livepeerTokenSess = &contracts.LivepeerTokenSession{ + Contract: token, } glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) @@ -51,9 +49,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.ServiceRegistrySession = &contracts.ServiceRegistrySession{ - Contract: serviceRegistry, - TransactOpts: *opts, + c.serviceRegistrySess = &contracts.ServiceRegistrySession{ + Contract: serviceRegistry, } glog.V(common.SHORT).Infof("ServiceRegistry: %v", c.serviceRegistryAddr.Hex()) @@ -72,9 +69,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.BondingManagerSession = &contracts.BondingManagerSession{ - Contract: bondingManager, - TransactOpts: *opts, + c.bondingManagerSess = &contracts.BondingManagerSession{ + Contract: bondingManager, } // for L1 contracts backwards-compatibility @@ -84,9 +80,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.l1BondingManagerSession = &contracts.L1BondingManagerSession{ - Contract: l1BondingManager, - TransactOpts: *opts, + c.l1BondingManagerSess = &contracts.L1BondingManagerSession{ + Contract: l1BondingManager, } glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) @@ -105,9 +100,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.TicketBrokerSession = &contracts.TicketBrokerSession{ - Contract: broker, - TransactOpts: *opts, + c.ticketBrokerSess = &contracts.TicketBrokerSession{ + Contract: broker, } glog.V(common.SHORT).Infof("TicketBroker: %v", c.ticketBrokerAddr.Hex()) @@ -126,9 +120,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.RoundsManagerSession = &contracts.RoundsManagerSession{ - Contract: roundsManager, - TransactOpts: *opts, + c.roundsManagerSess = &contracts.RoundsManagerSession{ + Contract: roundsManager, } glog.V(common.SHORT).Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) @@ -148,7 +141,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { } // Client should never transact with the Minter directly so we don't include transact opts - c.MinterSession = &contracts.MinterSession{ + c.minterSess = &contracts.MinterSession{ Contract: minter, } @@ -168,9 +161,8 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { return err } - c.LivepeerTokenFaucetSession = &contracts.LivepeerTokenFaucetSession{ - Contract: faucet, - TransactOpts: *opts, + c.livepeerTokenFaucetSess = &contracts.LivepeerTokenFaucetSession{ + Contract: faucet, } glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) From 8e78d4f19a866c32ff23321c182469fe2c7af733 Mon Sep 17 00:00:00 2001 From: Rafal Leszko Date: Thu, 24 Feb 2022 13:20:14 +0100 Subject: [PATCH 25/28] eth: Refactor client to not include contract sessions Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 3209dd946bb0376308044055b6caf262fd25cf61 Source-Scope: eth/client.go:setContracts --- eth/client.go | 46 +++++++++------------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/eth/client.go b/eth/client.go index 1afefa3..e2d279c 100644 --- a/eth/client.go +++ b/eth/client.go @@ -8,10 +8,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating Controller binding: %v", err) return err } - - c.controllerSess = &contracts.ControllerSession{ - Contract: controller, - } + c.controller = controller glog.V(common.SHORT).Infof("Controller: %v", c.controllerAddr.Hex()) @@ -28,10 +25,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating LivpeerToken binding: %v", err) return err } - - c.livepeerTokenSess = &contracts.LivepeerTokenSession{ - Contract: token, - } + c.livepeerToken = token glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) @@ -48,10 +42,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating ServiceRegistry binding: %v", err) return err } - - c.serviceRegistrySess = &contracts.ServiceRegistrySession{ - Contract: serviceRegistry, - } + c.serviceRegistry = serviceRegistry glog.V(common.SHORT).Infof("ServiceRegistry: %v", c.serviceRegistryAddr.Hex()) @@ -68,10 +59,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating BondingManager binding: %v", err) return err } - - c.bondingManagerSess = &contracts.BondingManagerSession{ - Contract: bondingManager, - } + c.bondingManager = bondingManager // for L1 contracts backwards-compatibility l1BondingManager, err := contracts.NewL1BondingManager(bondingManagerAddr, c.backend) @@ -79,10 +67,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating L1BondingManager binding: %v", err) return err } - - c.l1BondingManagerSess = &contracts.L1BondingManagerSession{ - Contract: l1BondingManager, - } + c.l1BondingManager = l1BondingManager glog.V(common.SHORT).Infof("BondingManager: %v", c.bondingManagerAddr.Hex()) @@ -99,10 +84,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating TicketBroker binding: %v", err) return err } - - c.ticketBrokerSess = &contracts.TicketBrokerSession{ - Contract: broker, - } + c.ticketBroker = broker glog.V(common.SHORT).Infof("TicketBroker: %v", c.ticketBrokerAddr.Hex()) @@ -119,10 +101,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating RoundsManager binding: %v", err) return err } - - c.roundsManagerSess = &contracts.RoundsManagerSession{ - Contract: roundsManager, - } + c.roundsManager = roundsManager glog.V(common.SHORT).Infof("RoundsManager: %v", c.roundsManagerAddr.Hex()) @@ -139,11 +118,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating Minter binding: %v", err) return err } - - // Client should never transact with the Minter directly so we don't include transact opts - c.minterSess = &contracts.MinterSession{ - Contract: minter, - } + c.minter = minter glog.V(common.SHORT).Infof("Minter: %v", c.minterAddr.Hex()) @@ -160,10 +135,7 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.Errorf("Error creating LivepeerTokenFaucet binding: %v", err) return err } - - c.livepeerTokenFaucetSess = &contracts.LivepeerTokenFaucetSession{ - Contract: faucet, - } + c.livepeerTokenFaucet = faucet glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) From 92e2bd2f84fc71a9478b08854da0e7146be249ec Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Thu, 18 Apr 2024 20:23:35 +0200 Subject: [PATCH 26/28] feat(ai): enable AI orchestrator discovery (#3004) * feat(ai): enable AI orchestrator discovery This commit incorporates the AIServiceRegistry contract address, superseding the conventional ServiceRegistry contract address. This strategic alteration streamlines the discovery process of AI Orchestrators within the AI Subnet, thereby bolstering network accessibility and interaction. While this approach serves as a swift workaround to enable the feature without extensive code modification, it's important to note that it may disrupt the existing transcoding discovery mechanism. We have to fix this if we want to merge the two networks in the future. * docs(ai): improve discovery documentation This commit ensures that people are aware that they have to interact with the `AIServiceRegistry` using their main Orch wallet. * fix: fix 'AIServiceRegistry' devnet and testnet issue This commit ensure that the hardcoded `AIServiceRegistry` contract doesn't break the go-livepeer binary on local devnets or testnets. Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: e9258f301ca923d2acca9bdc8cd6d3263f4a2dbc Source-Scope: eth/client.go:setContracts --- eth/client.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/eth/client.go b/eth/client.go index e2d279c..022aa9c 100644 --- a/eth/client.go +++ b/eth/client.go @@ -29,12 +29,25 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) - serviceRegistryAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + chainID, err := c.backend.ChainID(context.Background()) if err != nil { - glog.Errorf("Error getting ServiceRegistry address: %v", err) + glog.Errorf("Failed to get chain ID from remote ethereum node: %v", err) return err } + // TODO: This is a temporary setup for a separate AIServiceRegistry. Revise this when AI subnet merges with the mainnet. + var serviceRegistryAddr ethcommon.Address + arbitrumOneChainID := big.NewInt(42161) + if chainID.Cmp(arbitrumOneChainID) == 0 { + serviceRegistryAddr = ethcommon.HexToAddress("0x04C0b249740175999E5BF5c9ac1dA92431EF34C5") + } else { + serviceRegistryAddr, err = c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + if err != nil { + glog.Errorf("Error getting ServiceRegistry address: %v", err) + return err + } + } + c.serviceRegistryAddr = serviceRegistryAddr serviceRegistry, err := contracts.NewServiceRegistry(serviceRegistryAddr, c.backend) From 9513d4653a915d6b281d6d5bed43a4cc74b01edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Tue, 22 Oct 2024 14:38:29 +0200 Subject: [PATCH 27/28] Add flag to use AI ServiceRegistry contract address for Livepeer AI Subnet (#3186) Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: f3fd9121ad95e1e8b89a75721ae536d60a3d1b84 Source-Scope: eth/client.go:setContracts --- eth/client.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/eth/client.go b/eth/client.go index 022aa9c..ff4bcf7 100644 --- a/eth/client.go +++ b/eth/client.go @@ -29,28 +29,15 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerToken: %v", c.tokenAddr.Hex()) - chainID, err := c.backend.ChainID(context.Background()) - if err != nil { - glog.Errorf("Failed to get chain ID from remote ethereum node: %v", err) - return err - } - - // TODO: This is a temporary setup for a separate AIServiceRegistry. Revise this when AI subnet merges with the mainnet. - var serviceRegistryAddr ethcommon.Address - arbitrumOneChainID := big.NewInt(42161) - if chainID.Cmp(arbitrumOneChainID) == 0 { - serviceRegistryAddr = ethcommon.HexToAddress("0x04C0b249740175999E5BF5c9ac1dA92431EF34C5") - } else { - serviceRegistryAddr, err = c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) + if c.serviceRegistryAddr == (ethcommon.Address{}) { + c.serviceRegistryAddr, err = c.GetContract(crypto.Keccak256Hash([]byte("ServiceRegistry"))) if err != nil { glog.Errorf("Error getting ServiceRegistry address: %v", err) return err } } - c.serviceRegistryAddr = serviceRegistryAddr - - serviceRegistry, err := contracts.NewServiceRegistry(serviceRegistryAddr, c.backend) + serviceRegistry, err := contracts.NewServiceRegistry(c.serviceRegistryAddr, c.backend) if err != nil { glog.Errorf("Error creating ServiceRegistry binding: %v", err) return err From e1a867c4d5a32ca19a14fa35d2cd709af4ff8511 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Sun, 9 Mar 2025 11:11:38 +0100 Subject: [PATCH 28/28] feat(CLI): add proposal vote cli arg (#3275) This commit adds functionality to the `go-livepeer` CLI, allowing orchestrators to vote on active treasury proposals directly. Additionally, it provides an option to include a reason for their vote, enhancing transparency and accountability in the decision-making process. Co-authored-by: Victor Elias Source-Repository: https://github.com/livepeer/go-livepeer Original-Commit: 89d9ebc7fff0004aab11bbb733035327da7b2e1b Source-Scope: eth/client.go:setContracts --- eth/client.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eth/client.go b/eth/client.go index ff4bcf7..9c48321 100644 --- a/eth/client.go +++ b/eth/client.go @@ -139,6 +139,23 @@ func (c *client) setContracts(opts *bind.TransactOpts) error { glog.V(common.SHORT).Infof("LivepeerTokenFaucet: %v", c.faucetAddr.Hex()) + livepeerGovernorAddr, err := c.GetContract(crypto.Keccak256Hash([]byte("LivepeerGovernor"))) + if err != nil { + glog.Errorf("Error getting Governor address: %v", err) + return err + } + + c.livepeerGovernorAddr = livepeerGovernorAddr + + governor, err := contracts.NewGovernor(livepeerGovernorAddr, c.backend) + if err != nil { + glog.Errorf("Error creating Governor binding: %v", err) + return err + } + c.livepeerGovernor = governor + + glog.V(common.SHORT).Infof("LivepeerGovernor: %v", c.livepeerGovernorAddr.Hex()) + return nil }