Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -euxo pipefail

PUBLISHER_PROFILE=default
# Use PUBLISHER_PROFILE from env for devnet/mainnet (e.g. PUBLISHER_PROFILE=devnet); default is default (local).
PUBLISHER_PROFILE=${PUBLISHER_PROFILE:-default}
PUBLISHER_ADDR=0x$(aptos config show-profiles --profile=$PUBLISHER_PROFILE | grep 'account' | sed -n 's/.*"account": \"\(.*\)\".*/\1/p')

# deploy platform forwarder
Expand Down
14 changes: 11 additions & 3 deletions contracts/scripts/set_config.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#!/usr/bin/env bash
set -euxo pipefail

PLATFORM_FORWARDER_ADDR=$(cat platform/contract_address.txt)
# Use PLATFORM_FORWARDER_ADDR from env or from platform/contract_address.txt (after publish.sh).
# Use PUBLISHER_PROFILE from env for devnet (e.g. PUBLISHER_PROFILE=devnet).
PLATFORM_FORWARDER_ADDR=${PLATFORM_FORWARDER_ADDR:-$(cat platform/contract_address.txt)}
PUBLISHER_PROFILE=${PUBLISHER_PROFILE:-default}

# forwarder::set_config
aptos move run --function-id "$PLATFORM_FORWARDER_ADDR::forwarder::set_config" --assume-yes --args u32:1 u32:1 u8:1 "hex:[$ORACLE_PUBKEYS]"
if [ -z "$ORACLE_PUBKEYS" ]; then
echo "ORACLE_PUBKEYS is required (comma-separated quoted hex keys, e.g. \"0xabc\",\"0xdef\")"
exit 1
fi

# forwarder::set_config(don_id, config_version, f, oracles)
aptos move run --function-id "$PLATFORM_FORWARDER_ADDR::forwarder::set_config" --profile "$PUBLISHER_PROFILE" --assume-yes --args u32:1 u32:1 u8:1 "hex:[$ORACLE_PUBKEYS]"
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ require (
github.com/prometheus/client_golang v1.23.2
github.com/shopspring/decimal v1.4.0
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82
github.com/smartcontractkit/chainlink-common v0.10.1-0.20260217160002-b56cb5356cc7
github.com/smartcontractkit/chainlink-protos/cre/go v1.0.0-beta
github.com/smartcontractkit/chainlink-common v0.10.1-0.20260226191628-ecce52da56c9
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260217043601-5cc966896c4f
github.com/stretchr/testify v1.11.1
github.com/valyala/fastjson v1.6.10
go.opentelemetry.io/otel v1.40.0
Expand Down Expand Up @@ -105,7 +105,7 @@ require (
github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b // indirect
github.com/smartcontractkit/freeport v0.1.3-0.20250716200817-cb5dfd0e369e // indirect
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
github.com/smartcontractkit/libocr v0.0.0-20250912173940-f3ab0246e23d // indirect
github.com/smartcontractkit/libocr v0.0.0-20251027221354-bdc84e1ed858 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/x448/float16 v0.8.4 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 h1:6C8qej6f
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82/go.mod h1:xe4pgH49k4SsmkQq5OT8abwhWmnzkhpgnXeekbx2efw=
github.com/smartcontractkit/chain-selectors v1.0.89 h1:L9oWZGqQXWyTPnC6ODXgu3b0DFyLmJ9eHv+uJrE9IZY=
github.com/smartcontractkit/chain-selectors v1.0.89/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w=
github.com/smartcontractkit/chainlink-common v0.10.1-0.20260217160002-b56cb5356cc7 h1:h5cmgzKpKn5N5ItpEDFhRcrtqs36nu9r/dciJub1hos=
github.com/smartcontractkit/chainlink-common v0.10.1-0.20260217160002-b56cb5356cc7/go.mod h1:HXgSKzmZ/bhSx8nHU7hHW6dR+BHSXkdcpFv2T8qJcS8=
github.com/smartcontractkit/chainlink-common v0.10.1-0.20260226191628-ecce52da56c9 h1:9rcOyYENSbzKzRFn1jeemsxMgUjrL0tfGo/SW3oN3bs=
github.com/smartcontractkit/chainlink-common v0.10.1-0.20260226191628-ecce52da56c9/go.mod h1:HXgSKzmZ/bhSx8nHU7hHW6dR+BHSXkdcpFv2T8qJcS8=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 h1:FJAFgXS9oqASnkS03RE1HQwYQQxrO4l46O5JSzxqLgg=
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10/go.mod h1:oiDa54M0FwxevWwyAX773lwdWvFYYlYHHQV1LQ5HpWY=
github.com/smartcontractkit/chainlink-protos/cre/go v1.0.0-beta h1:gwVxckLPTCPlzQS3aJBzYP21j6JZDI42odrzqzWIpJA=
github.com/smartcontractkit/chainlink-protos/cre/go v1.0.0-beta/go.mod h1:jUC52kZzEnWF9tddHh85zolKybmLpbQ1oNA4FjOHt1Q=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260217043601-5cc966896c4f h1:MHlgzqiDPyDV397bZkzS9TtWXb3FR9Pb8FR9cP9h0As=
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260217043601-5cc966896c4f/go.mod h1:Jqt53s27Tr0jDl8mdBXg1xhu6F8Fci8JOuq43tgHOM8=
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b h1:QuI6SmQFK/zyUlVWEf0GMkiUYBPY4lssn26nKSd/bOM=
github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY=
github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260205130626-db2a2aab956b h1:36knUpKHHAZ86K4FGWXtx8i/EQftGdk2bqCoEu/Cha8=
Expand All @@ -338,8 +338,8 @@ github.com/smartcontractkit/freeport v0.1.3-0.20250716200817-cb5dfd0e369e h1:Hv9
github.com/smartcontractkit/freeport v0.1.3-0.20250716200817-cb5dfd0e369e/go.mod h1:T4zH9R8R8lVWKfU7tUvYz2o2jMv1OpGCdpY2j2QZXzU=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
github.com/smartcontractkit/libocr v0.0.0-20250912173940-f3ab0246e23d h1:LokA9PoCNb8mm8mDT52c3RECPMRsGz1eCQORq+J3n74=
github.com/smartcontractkit/libocr v0.0.0-20250912173940-f3ab0246e23d/go.mod h1:Acy3BTBxou83ooMESLO90s8PKSu7RvLCzwSTbxxfOK0=
github.com/smartcontractkit/libocr v0.0.0-20251027221354-bdc84e1ed858 h1:dz+lxAW+B+PUq32ODppSq5UKw06+EF6+EO6kk684bcQ=
github.com/smartcontractkit/libocr v0.0.0-20251027221354-bdc84e1ed858/go.mod h1:oJkBKVn8zoBQm7Feah9CiuEHyCqAhnp1LJBzrvloQtM=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
27 changes: 17 additions & 10 deletions relayer/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Chain interface {
ID() string
Config() *config.TOMLConfig
DataSource() sqlutil.DataSource
KeyStore() loop.Keystore

TxManager() *txm.AptosTxm
LogPoller() *logpoller.AptosLogPoller
Expand Down Expand Up @@ -77,6 +78,7 @@ type chain struct {
cfg *config.TOMLConfig
lggr logger.Logger
ds sqlutil.DataSource
ks loop.Keystore

// Sub-services
txm *txm.AptosTxm
Expand Down Expand Up @@ -117,6 +119,7 @@ func newChain(cfg *config.TOMLConfig, loopKs loop.Keystore, lggr logger.Logger,
cfg: cfg,
lggr: logger.Named(lggr, "Chain"),
ds: ds,
ks: loopKs,
}

ch.txm, err = txm.New(lggr, loopKs, *cfg.TransactionManager, ch.GetClient)
Expand Down Expand Up @@ -165,6 +168,10 @@ func (c *chain) DataSource() sqlutil.DataSource {
return c.ds
}

func (c *chain) KeyStore() loop.Keystore {
return c.ks
}

func (c *chain) ChainID() string {
return c.id
}
Expand Down Expand Up @@ -261,16 +268,6 @@ func (c *chain) ID() string {
return c.id
}

func (c *chain) GetChainInfo(ctx context.Context) (types.ChainInfo, error) {
_ = ctx
return types.ChainInfo{
FamilyName: config.ChainFamilyName,
ChainID: c.id,
NetworkName: c.cfg.NetworkName,
NetworkNameFull: c.cfg.NetworkNameFull,
}, nil
}

// LatestHead returns the latest head for the underlying chain.
// TODO: should be replaced with a head tracker component
func (c *chain) LatestHead(ctx context.Context) (types.Head, error) {
Expand Down Expand Up @@ -306,6 +303,16 @@ func (c *chain) LatestHead(ctx context.Context) (types.Head, error) {
}, nil
}

func (c *chain) GetChainInfo(ctx context.Context) (types.ChainInfo, error) {
ci := c.chainInfo()
return types.ChainInfo{
FamilyName: ci.ChainFamilyName,
ChainID: ci.ChainID,
NetworkName: ci.NetworkName,
NetworkNameFull: ci.NetworkNameFull,
}, nil
}

// ChainService interface
func (c *chain) GetChainStatus(ctx context.Context) (types.ChainStatus, error) {
toml, err := c.cfg.TOMLString()
Expand Down
20 changes: 20 additions & 0 deletions relayer/chainreader/chainreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,26 @@ func (a *aptosChainReader) GetLatestValue(ctx context.Context, readIdentifier st
return codec.DecodeAptosJsonValue(transformedData, returnVal)
}

// GetLatestValueWithHeadData returns the latest value and the current chain head (block height, timestamp).
// It calls GetLatestValue to fill returnVal, then fetches ledger info from the Aptos client to build the Head.
func (a *aptosChainReader) GetLatestValueWithHeadData(ctx context.Context, readIdentifier string, confidenceLevel primitives.ConfidenceLevel, params, returnVal any) (*types.Head, error) {
if err := a.GetLatestValue(ctx, readIdentifier, confidenceLevel, params, returnVal); err != nil {
return nil, err
}
nodeInfo, err := a.client.Info()
if err != nil {
return nil, fmt.Errorf("failed to get ledger info for head data: %w", err)
}
// LedgerTimestamp is in microseconds; Head.Timestamp is Unix seconds.
timestampSecs := nodeInfo.LedgerTimestamp() / 1000000
head := &types.Head{
Height: strconv.FormatUint(nodeInfo.BlockHeight(), 10),
Hash: nil, // Aptos NodeInfo does not expose block hash; view reads are at latest state
Timestamp: timestampSecs,
}
return head, nil
}

func (a *aptosChainReader) BatchGetLatestValues(ctx context.Context, request types.BatchGetLatestValuesRequest) (types.BatchGetLatestValuesResult, error) {
result := make(types.BatchGetLatestValuesResult)

Expand Down
Loading
Loading