Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
silaslenihan committed Oct 9, 2024
1 parent 64e9300 commit 58db544
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions core/services/relay/evm/read/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (c *defaultEvmBatchCaller) unpackBatchResults(

if rpcBatchCalls[idx].Error != nil {
results[idx].err = newErrorFromCall(
fmt.Errorf("%w: rpc call error: %s", types.ErrInternal, rpcBatchCalls[idx].Error),
fmt.Errorf("%w: rpc call error: %w", types.ErrInternal, rpcBatchCalls[idx].Error),
call, block, true,
)

Expand Down Expand Up @@ -249,7 +249,7 @@ func (c *defaultEvmBatchCaller) unpackBatchResults(
); err != nil {
if len(packedBytes) == 0 {
callErr := newErrorFromCall(
fmt.Errorf("%w: %s: %s", types.ErrInternal, errEmptyOutput, err.Error()),
fmt.Errorf("%w: %w: %s", types.ErrInternal, errEmptyOutput, err.Error()),
call, block, true,
)

Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/read/batch_caller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestDefaultEvmBatchCaller_batchCallLimit(t *testing.T) {
var returnVal MethodReturn
calls[j] = read.Call{
ContractName: contractName,
ReadName: methodName,
ReadName: methodName,
Params: &params,
ReturnVal: &returnVal,
}
Expand Down
14 changes: 7 additions & 7 deletions core/services/relay/evm/read/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ func (b *BindingsRegistry) GetReader(readIdentifier string) (Reader, string, err

values, ok := b.contractLookup.getContractForReadName(readIdentifier)
if !ok {
return nil, "", fmt.Errorf("%w: %s", commontypes.ErrInvalidType, newMissingReadIdentifierErr(readIdentifier))
return nil, "", fmt.Errorf("%w: %w", commontypes.ErrInvalidType, newMissingReadIdentifierErr(readIdentifier))
}

cb, cbExists := b.contractBindings[values.contract]
if !cbExists {
return nil, "", fmt.Errorf("%w: %s", commontypes.ErrInvalidType, newMissingContractErr(readIdentifier, values.contract))
return nil, "", fmt.Errorf("%w: %w", commontypes.ErrInvalidType, newMissingContractErr(readIdentifier, values.contract))
}

binding, rbExists := cb.GetReaderNamed(values.readName)
if !rbExists {
return nil, "", fmt.Errorf("%w: %s", commontypes.ErrInvalidType, newMissingReadNameErr(readIdentifier, values.contract, values.readName))
return nil, "", fmt.Errorf("%w: %w", commontypes.ErrInvalidType, newMissingReadNameErr(readIdentifier, values.contract, values.readName))
}

return binding, values.address, nil
Expand Down Expand Up @@ -127,7 +127,7 @@ func (b *BindingsRegistry) Bind(ctx context.Context, reg Registrar, bindings []c
for _, binding := range bindings {
contract, exists := b.contractBindings[binding.Name]
if !exists {
return fmt.Errorf("%w: %s", commontypes.ErrInvalidConfig, newMissingContractErr("binding contract", binding.Name))
return fmt.Errorf("%w: %w", commontypes.ErrInvalidConfig, newMissingContractErr("binding contract", binding.Name))
}

b.contractLookup.bindAddressForContract(binding.Name, binding.Address)
Expand Down Expand Up @@ -157,12 +157,12 @@ func (b *BindingsRegistry) BatchGetLatestValues(ctx context.Context, request com

values, ok := b.contractLookup.getContractForReadName(binding.ReadIdentifier(req.ReadName))
if !ok {
return nil, fmt.Errorf("%w: %s", commontypes.ErrInvalidConfig, newMissingReadNameErr(binding.ReadIdentifier(req.ReadName), binding.Name, req.ReadName))
return nil, fmt.Errorf("%w: %w", commontypes.ErrInvalidConfig, newMissingReadNameErr(binding.ReadIdentifier(req.ReadName), binding.Name, req.ReadName))
}

rdr, exists := cb.GetReaderNamed(values.readName)
if !exists {
return nil, fmt.Errorf("%w: %s", commontypes.ErrInvalidConfig, newMissingReadNameErr(binding.ReadIdentifier(req.ReadName), binding.Name, req.ReadName))
return nil, fmt.Errorf("%w: %w", commontypes.ErrInvalidConfig, newMissingReadNameErr(binding.ReadIdentifier(req.ReadName), binding.Name, req.ReadName))
}

call, err := rdr.BatchCall(common.HexToAddress(values.address), req.Params, req.ReturnVal)
Expand Down Expand Up @@ -270,7 +270,7 @@ func (b *BindingsRegistry) SetFilter(name string, filter logpoller.Filter) error

contract, ok := b.contractBindings[name]
if !ok {
return fmt.Errorf("%w: %s", commontypes.ErrInvalidConfig, newMissingContractErr("set filter", name))
return fmt.Errorf("%w: %w", commontypes.ErrInvalidConfig, newMissingContractErr("set filter", name))
}

contract.SetFilter(filter)
Expand Down
10 changes: 5 additions & 5 deletions core/services/relay/evm/read/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (b *EventBinding) GetLatestValue(ctx context.Context, address common.Addres
callErr := newErrorFromCall(err, Call{
ContractAddress: address,
ContractName: b.contractName,
ReadName: b.eventName,
ReadName: b.eventName,
Params: params,
ReturnVal: into,
}, strconv.Itoa(int(confs)), false)
Expand Down Expand Up @@ -309,7 +309,7 @@ func (b *EventBinding) QueryKey(ctx context.Context, address common.Address, fil
err = newErrorFromCall(err, Call{
ContractAddress: address,
ContractName: b.contractName,
ReadName: b.eventName,
ReadName: b.eventName,
ReturnVal: sequenceDataType,
}, "", false)
}
Expand Down Expand Up @@ -617,7 +617,7 @@ func (b *EventBinding) encodeValComparatorDataWord(dwTypeID string, value any) (

packedArgs, err := dwTypes.Args().Pack(value)
if err != nil {
return common.Hash{}, fmt.Errorf("%w: failed to pack values: %s", commontypes.ErrInternal, err)
return common.Hash{}, fmt.Errorf("%w: failed to pack values: %w", commontypes.ErrInternal, err)
}

return common.BytesToHash(packedArgs), nil
Expand All @@ -636,7 +636,7 @@ func (b *EventBinding) encodeValComparatorTopic(topicTypeID string, value any) (
func (b *EventBinding) toNativeOnChainType(itemType string, value any) (any, error) {
offChain, err := b.codec.CreateType(itemType, true)
if err != nil {
return nil, fmt.Errorf("%w: failed to create type: %s", commontypes.ErrInvalidType, err)
return nil, fmt.Errorf("%w: failed to create type: %w", commontypes.ErrInvalidType, err)
}

// apply map struct evm hooks to correct incoming values
Expand Down Expand Up @@ -672,7 +672,7 @@ func (b *EventBinding) validateBound(address common.Address) error {

bound, exists := b.bound[address]
if !exists || !bound {
return fmt.Errorf("%w: %s", commontypes.ErrInvalidConfig, newUnboundAddressErr(address.String(), b.contractName, b.eventName))
return fmt.Errorf("%w: %w", commontypes.ErrInvalidConfig, newUnboundAddressErr(address.String(), b.contractName, b.eventName))
}

return nil
Expand Down
10 changes: 5 additions & 5 deletions core/services/relay/evm/read/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (b *MethodBinding) BatchCall(address common.Address, params, retVal any) (C
return Call{
ContractAddress: address,
ContractName: b.contractName,
ReadName: b.method,
ReadName: b.method,
Params: params,
ReturnVal: retVal,
}, nil
Expand All @@ -138,7 +138,7 @@ func (b *MethodBinding) GetLatestValue(ctx context.Context, addr common.Address,
Call{
ContractAddress: addr,
ContractName: b.contractName,
ReadName: b.method,
ReadName: b.method,
Params: params,
ReturnVal: returnVal,
}, block.String(), false)
Expand All @@ -159,7 +159,7 @@ func (b *MethodBinding) GetLatestValue(ctx context.Context, addr common.Address,
Call{
ContractAddress: addr,
ContractName: b.contractName,
ReadName: b.method,
ReadName: b.method,
Params: params,
ReturnVal: returnVal,
}, block.String(), false)
Expand All @@ -173,7 +173,7 @@ func (b *MethodBinding) GetLatestValue(ctx context.Context, addr common.Address,
Call{
ContractAddress: addr,
ContractName: b.contractName,
ReadName: b.method,
ReadName: b.method,
Params: params,
ReturnVal: returnVal,
}, block.String(), false)
Expand Down Expand Up @@ -215,7 +215,7 @@ func (b *MethodBinding) blockNumberFromConfidence(ctx context.Context, confidenc

_, finalized, err := b.ht.LatestAndFinalizedBlock(ctx)
if err != nil {
return nil, fmt.Errorf("%w: head tracker: %s", commontypes.ErrInternal, err.Error())
return nil, fmt.Errorf("%w: head tracker: %w", commontypes.ErrInternal, err)
}

if confirmations == evmtypes.Finalized {
Expand Down

0 comments on commit 58db544

Please sign in to comment.