Skip to content

Commit

Permalink
Update RelayKey type to uint32 (#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim authored Dec 5, 2024
1 parent 5a487e2 commit 8ded1ec
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions core/chainio.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ type Reader interface {
GetOnDemandPaymentByAccount(ctx context.Context, blockNumber uint32, accountID string) (OnDemandPayment, error)

// GetRelayURL returns the relay URL address for the given key.
GetRelayURL(ctx context.Context, key uint16) (string, error)
GetRelayURL(ctx context.Context, key uint32) (string, error)

// GetRelayURLs returns the relay URL addresses for all relays.
GetRelayURLs(ctx context.Context) (map[uint16]string, error)
GetRelayURLs(ctx context.Context) (map[uint32]string, error)
}

type Writer interface {
Expand Down
8 changes: 4 additions & 4 deletions core/eth/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ func (t *Reader) GetOperatorSocket(ctx context.Context, operatorId core.Operator
return socket, nil
}

func (t *Reader) GetRelayURL(ctx context.Context, key uint16) (string, error) {
func (t *Reader) GetRelayURL(ctx context.Context, key uint32) (string, error) {
if t.bindings.RelayRegistry == nil {
return "", errors.New("relay registry not deployed")
}
Expand All @@ -720,13 +720,13 @@ func (t *Reader) GetRelayURL(ctx context.Context, key uint16) (string, error) {
}, uint32(key))
}

func (t *Reader) GetRelayURLs(ctx context.Context) (map[uint16]string, error) {
func (t *Reader) GetRelayURLs(ctx context.Context) (map[uint32]string, error) {
if t.bindings.RelayRegistry == nil {
return nil, errors.New("relay registry not deployed")
}

res := make(map[uint16]string)
relayKey := uint16(0)
res := make(map[uint32]string)
relayKey := uint32(0)
for {
url, err := t.bindings.RelayRegistry.GetRelayURL(&bind.CallOpts{
Context: ctx,
Expand Down
6 changes: 3 additions & 3 deletions core/mock/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,18 @@ func (t *MockWriter) GetOperatorSocket(ctx context.Context, operatorID core.Oper
return result.(string), args.Error(1)
}

func (t *MockWriter) GetRelayURL(ctx context.Context, key uint16) (string, error) {
func (t *MockWriter) GetRelayURL(ctx context.Context, key uint32) (string, error) {
args := t.Called()
result := args.Get(0)
return result.(string), args.Error(1)
}

func (t *MockWriter) GetRelayURLs(ctx context.Context) (map[uint16]string, error) {
func (t *MockWriter) GetRelayURLs(ctx context.Context) (map[uint32]string, error) {
args := t.Called()
result := args.Get(0)
if result == nil {
return nil, args.Error(1)
}

return result.(map[uint16]string), args.Error(1)
return result.(map[uint32]string), args.Error(1)
}
2 changes: 1 addition & 1 deletion core/v2/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (c *BlobCertificate) Hash() ([32]byte, error) {
},
{
Name: "relayKeys",
Type: "uint16[]",
Type: "uint32[]",
},
})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (b *BlobHeader) GetEncodingParams(blobParams *core.BlobVersionParameters) (
}, nil
}

type RelayKey = uint16
type RelayKey = uint32

type BlobCertificate struct {
BlobHeader *BlobHeader
Expand Down

0 comments on commit 8ded1ec

Please sign in to comment.