Skip to content

Commit

Permalink
populate core node from address for registry (#12291)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixFan1992 authored and friedemannf committed Mar 8, 2024
1 parent 8d768cb commit 671de53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

const (
zeroAddress = "0x0000000000000000000000000000000000000000"
)

type Lookup interface {
Lookup(ctx context.Context, checkResults []ocr2keepers.CheckResult) []ocr2keepers.CheckResult
}
Expand Down Expand Up @@ -208,6 +212,7 @@ func (s *streams) CheckCallback(ctx context.Context, values [][]byte, lookup *me
func (s *streams) makeCallbackEthCall(ctx context.Context, payload []byte, lookup *mercury.StreamsLookup, checkResults []ocr2keepers.CheckResult, i int) error {
var responseBytes hexutil.Bytes
args := map[string]interface{}{
"from": zeroAddress,
"to": s.registry.Address().Hex(),
"data": hexutil.Bytes(payload),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-common/pkg/types"

"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/encoding"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury"
Expand Down Expand Up @@ -243,6 +244,7 @@ func TestStreams_CheckErrorHandler(t *testing.T) {
require.Nil(t, err)

args := map[string]interface{}{
"from": zeroAddress,
"to": s.registry.Address().Hex(),
"data": hexutil.Bytes(payload),
}
Expand Down Expand Up @@ -397,6 +399,7 @@ func TestStreams_CheckCallback(t *testing.T) {
payload, err := s.abi.Pack("checkCallback", tt.lookup.UpkeepId, values, tt.lookup.ExtraData)
require.Nil(t, err)
args := map[string]interface{}{
"from": zeroAddress,
"to": s.registry.Address().Hex(),
"data": hexutil.Bytes(payload),
}
Expand Down Expand Up @@ -948,6 +951,7 @@ func TestStreams_StreamsLookup(t *testing.T) {
payload, err := s.abi.Pack("checkCallback", upkeepId, tt.values, tt.extraData)
require.Nil(t, err)
args := map[string]interface{}{
"from": zeroAddress,
"to": s.registry.Address().Hex(),
"data": hexutil.Bytes(payload),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
// checkBlockTooOldRange is the number of blocks that can be behind the latest block before
// we return a CheckBlockTooOld error
checkBlockTooOldRange = 128
zeroAddress = "0x0000000000000000000000000000000000000000"
)

type checkResult struct {
Expand Down Expand Up @@ -233,6 +234,7 @@ func (r *EvmRegistry) checkUpkeeps(ctx context.Context, payloads []ocr2keepers.U
Method: "eth_call",
Args: []interface{}{
map[string]interface{}{
"from": zeroAddress,
"to": r.addr.Hex(),
"data": hexutil.Bytes(payload),
},
Expand Down Expand Up @@ -320,6 +322,7 @@ func (r *EvmRegistry) simulatePerformUpkeeps(ctx context.Context, checkResults [
Method: "eth_call",
Args: []interface{}{
map[string]interface{}{
"from": zeroAddress,
"to": r.addr.Hex(),
"data": hexutil.Bytes(payload),
},
Expand Down

0 comments on commit 671de53

Please sign in to comment.