Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app: fix builder registration and add teku integration test (#957)
- Fixes issue with builder registration domain calculation. - Also adds teku proposer config endpoint - Also fixes registration deadline issue - Adds integration test using teku/develop image. category: feature ticket: #849
- Loading branch information
1 parent
9202362
commit 62495dd
Showing
12 changed files
with
211 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright © 2022 Obol Labs Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation, either version 3 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along with | ||
// this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package validatorapi | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
) | ||
|
||
type TekuProposerConfigResponse struct { | ||
Proposers map[string]TekuProposerConfig `json:"proposer_config"` | ||
Default TekuProposerConfig `json:"default_config"` | ||
} | ||
|
||
type TekuProposerConfig struct { | ||
FeeRecipient string `json:"fee_recipient"` | ||
Builder TekuBuilder `json:"builder"` | ||
} | ||
|
||
type TekuBuilder struct { | ||
Enabled bool `json:"enabled"` | ||
Overrides map[string]string `json:"registration_overrides"` | ||
} | ||
|
||
const dead = "0x000000000000000000000000000000000000dead" | ||
|
||
type TekuProposerConfigProvider interface { | ||
TekuProposerConfig(ctx context.Context) (TekuProposerConfigResponse, error) | ||
} | ||
|
||
func (c Component) TekuProposerConfig(ctx context.Context) (TekuProposerConfigResponse, error) { | ||
resp := TekuProposerConfigResponse{ | ||
Proposers: make(map[string]TekuProposerConfig), | ||
Default: TekuProposerConfig{ // Default doesn't make sense, disable for now. | ||
FeeRecipient: dead, | ||
Builder: TekuBuilder{ | ||
Enabled: false, | ||
}, | ||
}, | ||
} | ||
|
||
genesis, err := c.eth2Cl.GenesisTime(ctx) | ||
if err != nil { | ||
return TekuProposerConfigResponse{}, nil | ||
} | ||
|
||
for pubkey, pubshare := range c.sharesByKey { | ||
resp.Proposers[string(pubshare)] = TekuProposerConfig{ | ||
FeeRecipient: dead, | ||
Builder: TekuBuilder{ | ||
Enabled: true, | ||
Overrides: map[string]string{ | ||
"timestamp": fmt.Sprint(genesis.Unix()), | ||
"public_key": string(pubkey), | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
return resp, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.