Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
fix: MUST use GENESIS_FORK_VERSION to sign BLSToExecutionChange message.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyWh1te committed Mar 12, 2023
1 parent b00af4c commit 3f2e02a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 21 deletions.
6 changes: 3 additions & 3 deletions HowToSignBaked.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class BLSToExecutionChange(Container):

Dc4bc contains itself list of validator indexes embedded in [payload.csv](./pkg/wc_rotation/payloads.csv). Also, dc4bc predefined other values hex formatted and unit tests for them, such as:

* [CapellaForkVersion](https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/fork.md#configuration):
* ``0x03000000``
* ``[4]byte{3, 0, 0, 0}``
* [GenesisForkVersion](https://github.com/ethereum/consensus-specs/blob/5337da5dff85cd584c4330b46a881510c1218ca3/specs/phase0/beacon-chain.md#genesis-settings):
* ``0x00000000``
* ``[4]byte{0, 0, 0, 0}``
* [DomainBlsToExecutionChange](https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#domain-types):
* ``0x0A000000``
* ``[4]byte{10, 0, 0, 0}``
Expand Down
4 changes: 2 additions & 2 deletions airgapped_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ while read -r sum _ ; do
[[ $sum == 0ffd6499f8e2bb31d5321a6ec1ed5c2fcfb22f917a49a2b0c2d8b6fd379a1e7f ]] && echo "Firefox checksum is correct." || echo "[WARN] Incorrect Firefox checksum!"
done

wget -q --show-progress https://github.com/lidofinance/dc4bc/releases/download/4.0.0/build-linux-amd64.tar
wget -q --show-progress https://github.com/lidofinance/dc4bc/releases/download/4.1.0/build-linux-amd64.tar
tar -xvf build-linux-amd64.tar
shasum ./build/dc4bc_airgapped |
while read -r sum _ ; do
[[ $sum == 6508c7fd3b055d90f0725b188a59ebf7060255b3 ]] && echo "Airgapped checksum is correct." || echo "[WARN] Incorrect Airgapped checksum!"
[[ $sum == 594cec4feaee5c909c63c5713b26c0b5346dffe6 ]] && echo "Airgapped checksum is correct." || echo "[WARN] Incorrect Airgapped checksum!"
done

cp ../qr_reader_bundle/qr-tool.html ./qr-tool.html
Expand Down
7 changes: 1 addition & 6 deletions pkg/wc_rotation/rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import (
)

var (
// CapellaForkVersion 0x03000000
//
// https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/fork.md#configuration
CapellaForkVersion = [4]byte{3, 0, 0, 0}

// GenesisForkVersion 0x00000000
//
// https://github.com/ethereum/consensus-specs/blob/5337da5dff85cd584c4330b46a881510c1218ca3/specs/phase0/beacon-chain.md#genesis-settings
Expand Down Expand Up @@ -44,7 +39,7 @@ var (
func GetSigningRoot(validatorIndex uint64) ([32]byte, error) {
domain, computeDomainErr := computeDomain(
DomainBlsToExecutionChange,
CapellaForkVersion,
GenesisForkVersion,
GenesisValidatorRoot,
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/wc_rotation/rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestGetSigningRoot(t *testing.T) {
args: args{
validatorIndex: 393395,
},
want: `5c57b22ed4078f4e4e8ec3188c8c25895154a55c62525488f40b37a3464da6fe`,
want: `23ccffc7767e1b9a54b3e18c986f00d0345825bcab21eae5fe92c849d6cfedb4`,
wantErr: false,
},
}
Expand All @@ -36,7 +36,7 @@ func TestGetSigningRoot(t *testing.T) {
actual := hex.EncodeToString(got[:])

if actual != tt.want {
t.Errorf("GetSigningRoot() got = %v, want %v", got, tt.want)
t.Errorf("GetSigningRoot() got = %v, want %v", actual, tt.want)
}
})
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/wc_rotation/variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ import (
)

func TestWCRotationVariables(t *testing.T) {
t.Run(`TestCapellaForkVersion`, func(t *testing.T) {
actual, _ := hex.DecodeString(`03000000`)

if bytes.Compare(actual, CapellaForkVersion[:]) != 0 {
t.Errorf("CapellaForkVersion is wrong got = %v, want %v", actual, CapellaForkVersion)
}
})

t.Run(`TestGenesisForkVersion`, func(t *testing.T) {
actual, _ := hex.DecodeString(`00000000`)

Expand Down

0 comments on commit 3f2e02a

Please sign in to comment.