Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaRedHand committed Jan 27, 2025
1 parent 9ead4b5 commit 14b1c1c
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions chainio/clients/elcontracts/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,39 @@ func TestRegisterAndDeregisterFromOperatorSets(t *testing.T) {

func TestEncodeRegistrationParams(t *testing.T) {
// Values are random
signatureX, ok := new(big.Int).SetString("756874975973566196338995715738218418291193261429375530560923897690728869289", 10)
signatureX, ok := new(
big.Int,
).SetString("756874975973566196338995715738218418291193261429375530560923897690728869289", 10)
require.True(t, ok)
signatureY, ok := new(big.Int).SetString("444340189040315797681399101731743234568891767085799644128199800550863908703", 10)
signatureY, ok := new(
big.Int,
).SetString("444340189040315797681399101731743234568891767085799644128199800550863908703", 10)
require.True(t, ok)

g1PubkeyX, ok := new(big.Int).SetString("10371454967541283327403832945957227913391851874635485454053224012738342927470", 10)
g1PubkeyX, ok := new(
big.Int,
).SetString("10371454967541283327403832945957227913391851874635485454053224012738342927470", 10)
require.True(t, ok)
g1PubkeyY, ok := new(big.Int).SetString("5591557118325006940652332791312874698324071372762903093203759620236776485604", 10)
g1PubkeyY, ok := new(
big.Int,
).SetString("5591557118325006940652332791312874698324071372762903093203759620236776485604", 10)
require.True(t, ok)

g2PubkeyX0, ok := new(big.Int).SetString("1357671944470767405259541876666418155809079857448568479000932998534484593852", 10)
g2PubkeyX0, ok := new(
big.Int,
).SetString("1357671944470767405259541876666418155809079857448568479000932998534484593852", 10)
require.True(t, ok)
g2PubkeyX1, ok := new(big.Int).SetString("5283708918582394678225755661661470830476341241033602812294790796852421312310", 10)
g2PubkeyX1, ok := new(
big.Int,
).SetString("5283708918582394678225755661661470830476341241033602812294790796852421312310", 10)
require.True(t, ok)
g2PubkeyY0, ok := new(big.Int).SetString("17411007011468414688052176335308121672943440336543041782092111920184779631952", 10)
g2PubkeyY0, ok := new(
big.Int,
).SetString("17411007011468414688052176335308121672943440336543041782092111920184779631952", 10)
require.True(t, ok)
g2PubkeyY1, ok := new(big.Int).SetString("6486088401181402728530570019430319265466049090881984123818353102069786218525", 10)
g2PubkeyY1, ok := new(
big.Int,
).SetString("6486088401181402728530570019430319265466049090881984123818353102069786218525", 10)
require.True(t, ok)

registrationParams := regcoord.IBLSApkRegistryPubkeyRegistrationParams{
Expand All @@ -274,11 +290,17 @@ func TestEncodeRegistrationParams(t *testing.T) {
Y: [2]*big.Int{g2PubkeyY0, g2PubkeyY1},
},
}
result, err := elcontracts.AbiEncodeRegistrationParams(elcontracts.RegistrationTypeNormal, "unused", registrationParams)
result, err := elcontracts.AbiEncodeRegistrationParams(
elcontracts.RegistrationTypeNormal,
"unused",
registrationParams,
)
require.NoError(t, err)

// This value was generated by running `abi.encode(...)` on the Solidity equivalent of the above struct
expected, err := hex.DecodeString("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014001ac6045296d64b31ed644e53ce1a1c4f72f67a2d47b06b652ca8167f1b2ada900fb7cd59f322f4dffa18360bfcdc15f1f6cd09aea573efa919dc828dfabaf5f16ee091592629fc566636de7b3d53322f4833014b4655dd57279cfb2828bbc6e0c5cb58c8d572dc9dcf5f5999501533e22243fac4f8ee4452a6dd0d4bcaeb2e403006a43453d56eafa7dc4ddcbd41b2330031f58e437ee3806c50a9e554a0cbc0bae792831463d56a1a9983647b77fcdbae38a6621ceef9e147614bb4869bf36267e47def74c144f8e7238dd088097943d1007f8ce7cab028151e9a1beac6d500e56fef5ea67a586d1fbb03dcc0a268f6c4835ad1c215eadc77cc676c378101d0000000000000000000000000000000000000000000000000000000000000006756e757365640000000000000000000000000000000000000000000000000000")
expected, err := hex.DecodeString(
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014001ac6045296d64b31ed644e53ce1a1c4f72f67a2d47b06b652ca8167f1b2ada900fb7cd59f322f4dffa18360bfcdc15f1f6cd09aea573efa919dc828dfabaf5f16ee091592629fc566636de7b3d53322f4833014b4655dd57279cfb2828bbc6e0c5cb58c8d572dc9dcf5f5999501533e22243fac4f8ee4452a6dd0d4bcaeb2e403006a43453d56eafa7dc4ddcbd41b2330031f58e437ee3806c50a9e554a0cbc0bae792831463d56a1a9983647b77fcdbae38a6621ceef9e147614bb4869bf36267e47def74c144f8e7238dd088097943d1007f8ce7cab028151e9a1beac6d500e56fef5ea67a586d1fbb03dcc0a268f6c4835ad1c215eadc77cc676c378101d0000000000000000000000000000000000000000000000000000000000000006756e757365640000000000000000000000000000000000000000000000000000",
)
require.NoError(t, err)

require.Equal(t, expected, result)
Expand Down

0 comments on commit 14b1c1c

Please sign in to comment.