Skip to content
Merged
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
13 changes: 7 additions & 6 deletions ccip/devenv/eds.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
cldfdeployment "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
"github.com/smartcontractkit/go-daml/pkg/types"

"github.com/smartcontractkit/chainlink-canton/contracts"
"github.com/smartcontractkit/chainlink-canton/deployment"
Expand Down Expand Up @@ -112,7 +113,7 @@ func (c *Chain) GetExecutorSendDisclosure(ctx context.Context, message oapiCommo
return edsTesthelpers.GetExecutorSendDisclosure(ctx, executorAPIClient, message, executorAddress, ccvAddresses)
}

func (c *Chain) GetTokenPoolExecuteDisclosure(ctx context.Context, encodedMessageHex string, tokenPoolAddress contracts.InstanceAddress) (*edsTesthelpers.TokenPoolExecuteDisclosure, error) {
func (c *Chain) GetTokenPoolExecuteDisclosure(ctx context.Context, encodedMessageHex string, tokenPoolAddress contracts.InstanceAddress, receiver types.PARTY) (*edsTesthelpers.TokenPoolExecuteDisclosure, error) {
edsURL, err := deployment.GetEDSURL(c.e.DataStore)
if err != nil {
return nil, err
Expand All @@ -122,10 +123,10 @@ func (c *Chain) GetTokenPoolExecuteDisclosure(ctx context.Context, encodedMessag
return nil, fmt.Errorf("failed to create Token Pool EDS client: %w", err)
}

return edsTesthelpers.GetTokenPoolExecuteDisclosure(ctx, tokenPoolAPIClient, encodedMessageHex, tokenPoolAddress)
return edsTesthelpers.GetTokenPoolExecuteDisclosure(ctx, tokenPoolAPIClient, encodedMessageHex, tokenPoolAddress, receiver)
}

func (c *Chain) GetCCIPExecuteDisclosure(ctx context.Context, encodedMessageHex string) (*edsTesthelpers.CCIPExecuteDisclosure, error) {
func (c *Chain) GetCCIPExecuteDisclosure(ctx context.Context, encodedMessageHex string, receiver types.PARTY) (*edsTesthelpers.CCIPExecuteDisclosure, error) {
edsURL, err := deployment.GetEDSURL(c.e.DataStore)
if err != nil {
return nil, err
Expand All @@ -135,10 +136,10 @@ func (c *Chain) GetCCIPExecuteDisclosure(ctx context.Context, encodedMessageHex
return nil, fmt.Errorf("failed to create CCIP EDS client: %w", err)
}

return edsTesthelpers.GetCCIPExecuteDisclosure(ctx, ccipAPIClient, encodedMessageHex)
return edsTesthelpers.GetCCIPExecuteDisclosure(ctx, ccipAPIClient, encodedMessageHex, receiver)
}

func (c *Chain) GetCCVExecuteDisclosure(ctx context.Context, encodedMessageHex string, ccvAddress contracts.InstanceAddress) (*edsTesthelpers.CCVExecuteDisclosure, error) {
func (c *Chain) GetCCVExecuteDisclosure(ctx context.Context, encodedMessageHex string, ccvAddress contracts.InstanceAddress, receiver types.PARTY) (*edsTesthelpers.CCVExecuteDisclosure, error) {
edsURL, err := deployment.GetEDSURL(c.e.DataStore)
if err != nil {
return nil, err
Expand All @@ -148,7 +149,7 @@ func (c *Chain) GetCCVExecuteDisclosure(ctx context.Context, encodedMessageHex s
return nil, fmt.Errorf("failed to create CCV EDS client: %w", err)
}

return edsTesthelpers.GetCCVExecuteDisclosure(ctx, ccvAPIClient, encodedMessageHex, ccvAddress)
return edsTesthelpers.GetCCVExecuteDisclosure(ctx, ccvAPIClient, encodedMessageHex, ccvAddress, receiver)
}

const (
Expand Down
1 change: 1 addition & 0 deletions ccip/devenv/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,7 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint
Type oapiCommon.MessageExecutorType `json:"type"`
}{Type: oapiCommon.Empty}, // Using default Executor
Payload: hex.EncodeToString(fields.Data),
Sender: party,
Receiver: hex.EncodeToString(fields.Receiver),
}
if hasTokenTransfer {
Expand Down
7 changes: 4 additions & 3 deletions ccip/devenv/manual_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes
if err != nil {
return cciptestinterfaces.ExecutionStateChangedEvent{}, fmt.Errorf("no canton participants configured: %w", err)
}
receiverParty := types.PARTY(participant.PartyID)

// Ensure that the message receiver is the party we're executing with
executingParty := participant.PartyID
Expand Down Expand Up @@ -346,7 +347,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes

// Collect disclosures
// CCIP
ccipExecuteDisclosure, err := c.GetCCIPExecuteDisclosure(ctx, encodedMessageHex)
ccipExecuteDisclosure, err := c.GetCCIPExecuteDisclosure(ctx, encodedMessageHex, receiverParty)
if err != nil {
return cciptestinterfaces.ExecutionStateChangedEvent{}, fmt.Errorf("failed to get CCIP execute disclosure: %w", err)
}
Expand All @@ -365,7 +366,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes
}
for i, vr := range verifierResults {
verifier := ccvs[i]
ccvExecuteDisclosure, err := c.GetCCVExecuteDisclosure(ctx, encodedMessageHex, verifier)
ccvExecuteDisclosure, err := c.GetCCVExecuteDisclosure(ctx, encodedMessageHex, verifier, receiverParty)
if err != nil {
return cciptestinterfaces.ExecutionStateChangedEvent{}, fmt.Errorf("failed to get CCV execute disclosure for verifier %s: %w", verifier.String(), err)
}
Expand All @@ -386,7 +387,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes
return cciptestinterfaces.ExecutionStateChangedEvent{}, fmt.Errorf("failed to get token pool for token %s: %w", hashedInstrumentId.String(), err)
}

tokenPoolDisclosure, err := c.GetTokenPoolExecuteDisclosure(ctx, encodedMessageHex, tokenPoolAddress.InstanceAddress())
tokenPoolDisclosure, err := c.GetTokenPoolExecuteDisclosure(ctx, encodedMessageHex, tokenPoolAddress.InstanceAddress(), receiverParty)
if err != nil {
return cciptestinterfaces.ExecutionStateChangedEvent{}, fmt.Errorf("failed to get token pool execute disclosure: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion deployment/operations/services/eds/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ var BuildConfig = operations.NewOperation(
PoolOwner: participant.PartyID,
}
if tokenPoolType == edsConfig.TokenPoolTypeLockRelease {
pool.TransferFactory = &edsConfig.TransferFactory{
pool.Factory = &edsConfig.Factory{
Type: edsConfig.FactoryTypeURL,
TokenStandardURL: tokenStandardURL,
TokenStandardAuthConfig: tokenStandardAuthConfig,
Expand Down
29 changes: 9 additions & 20 deletions eds/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,21 @@ const (
type FactoryType string

const (
FactoryTypeDisabled FactoryType = ""
FactoryTypeAddress FactoryType = "address"
FactoryTypeURL FactoryType = "url"
FactoryTypeDisabled FactoryType = ""
FactoryTypeAddress FactoryType = "address"
FactoryTypeURL FactoryType = "url"
FactoryTypeURLRequests FactoryType = "urlRequests"
)

type TransferFactory struct {
Type FactoryType `toml:"type" validate:"oneof='' address url"`
type Factory struct {
Type FactoryType `toml:"type" validate:"oneof='' address url urlRequests"`

TemplateId *string `toml:"template_id" validate:"required_if=Type address"`
Party *string `toml:"party" validate:"required_if=Type address"`
InstanceAddress *contracts.InstanceAddress `toml:"instance_address" validate:"required_if=Type address"`

TokenStandardURL *string `toml:"token_standard_url" validate:"excluded_unless=Type url,required_if=Type url,omitnil,url"`
TokenStandardAuthConfig *commonconfig.AuthConfig `toml:"token_standard_auth" validate:"excluded_unless=Type url"`
}

type BurnMintFactory struct {
Type FactoryType `toml:"type" validate:"oneof='' address url"`

TemplateId *string `toml:"template_id" validate:"required_if=Type address"`
Party *string `toml:"party" validate:"required_if=Type address"`
InstanceAddress *contracts.InstanceAddress `toml:"instance_address" validate:"required_if=Type address"`

TokenStandardURL *string `toml:"token_standard_url" validate:"excluded_unless=Type url,required_if=Type url,omitnil,url"`
TokenStandardAuthConfig *commonconfig.AuthConfig `toml:"token_standard_auth" validate:"excluded_unless=Type url"`
TokenStandardURL *string `toml:"token_standard_url" validate:"excluded_unless=Type url|excluded_unless=Type urlRequests,required_if=Type url,required_if=Type urlRequests,omitnil,url"`
TokenStandardAuthConfig *commonconfig.AuthConfig `toml:"token_standard_auth" validate:"excluded_unless=Type url|excluded_unless=Type urlRequests"`
}

type TokenPool struct {
Expand All @@ -148,8 +138,7 @@ type TokenPool struct {
// The owner party of the token pool.
PoolOwner string `toml:"pool_owner" validate:"required"`

TransferFactory *TransferFactory `toml:"transfer_factory" validate:"excluded_unless=Type lockRelease"`
BurnMintFactory *BurnMintFactory `toml:"burn_mint_factory" validate:"excluded_unless=Type burnMint"`
Factory *Factory `toml:"factory" validate:"omitnil"`
TransferPreapproval *TransferPreapproval `toml:"transfer_preapproval" validate:"omitnil"`
}

Expand Down
20 changes: 10 additions & 10 deletions eds/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ chain_selector = "8706591216959472610"
party_id = "tokenPoolOwner"
instance_address = "0xcd5fe3362a873da7d7ac7b0ae7aa23761d2c8ea7c3872dcfbc715fc8e92f0dec"
pool_owner = "tokenPoolOwner"
[token_pool_api.token_pools."0xcd5fe3362a873da7d7ac7b0ae7aa23761d2c8ea7c3872dcfbc715fc8e92f0dec".transfer_factory]
[token_pool_api.token_pools."0xcd5fe3362a873da7d7ac7b0ae7aa23761d2c8ea7c3872dcfbc715fc8e92f0dec".factory]
type = "url"
token_standard_url = "localhost:8545"
[token_pool_api.token_pools."0xcd5fe3362a873da7d7ac7b0ae7aa23761d2c8ea7c3872dcfbc715fc8e92f0dec".transfer_factory.token_standard_auth]
[token_pool_api.token_pools."0xcd5fe3362a873da7d7ac7b0ae7aa23761d2c8ea7c3872dcfbc715fc8e92f0dec".factory.token_standard_auth]
type = "insecureStatic"
jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30"
[token_pool_api.token_pools."0x44f3b1f70058285992aaffa899d0015ea4d9c0b5cba4ed3a90f2c99b5ca30011"]
type = "burnMint"
party_id = "tokenPoolOwner"
instance_address = "0x44f3b1f70058285992aaffa899d0015ea4d9c0b5cba4ed3a90f2c99b5ca30011"
pool_owner = "tokenPoolOwner"
[token_pool_api.token_pools."0x44f3b1f70058285992aaffa899d0015ea4d9c0b5cba4ed3a90f2c99b5ca30011".burn_mint_factory]
[token_pool_api.token_pools."0x44f3b1f70058285992aaffa899d0015ea4d9c0b5cba4ed3a90f2c99b5ca30011".factory]
type = "address"
instance_address = "0x44f3b1f70058285992aaffa899d0015ea4d9c0b5cba4ed3a90f2c99b5ca30011"
template_id = "#link:Link.Token:LinkToken"
Expand Down Expand Up @@ -185,7 +185,7 @@ chain_selector = "8706591216959472610"
InstanceAddress: contracts.HexToInstanceAddress("0xcd5fe3362a873da7d7ac7b0ae7aa23761d2c8ea7c3872dcfbc715fc8e92f0dec"),
},
PoolOwner: "tokenPoolOwner",
TransferFactory: &TransferFactory{
Factory: &Factory{
Type: FactoryTypeURL,
TokenStandardURL: new("localhost:8545"),
TokenStandardAuthConfig: &commonconfig.AuthConfig{
Expand All @@ -201,7 +201,7 @@ chain_selector = "8706591216959472610"
InstanceAddress: contracts.HexToInstanceAddress("0x44f3b1f70058285992aaffa899d0015ea4d9c0b5cba4ed3a90f2c99b5ca30011"),
},
PoolOwner: "tokenPoolOwner",
BurnMintFactory: &BurnMintFactory{
Factory: &Factory{
Type: FactoryTypeAddress,
TemplateId: new("#link:Link.Token:LinkToken"),
Party: new("linkOwner"),
Expand Down Expand Up @@ -313,7 +313,7 @@ func TestConfig_Merge(t *testing.T) {
InstanceAddress: poolAddrA,
},
PoolOwner: "tokenPoolOwner",
TransferFactory: &TransferFactory{
Factory: &Factory{
Type: FactoryTypeURL,
TokenStandardURL: new("http://validator/a/v0/scan-proxy"),
},
Expand Down Expand Up @@ -344,7 +344,7 @@ func TestConfig_Merge(t *testing.T) {
PartyID: "tokenPoolOwner",
InstanceAddress: poolAddrA,
},
TransferFactory: &TransferFactory{
Factory: &Factory{
TokenStandardAuthConfig: &commonconfig.AuthConfig{
Type: commonconfig.AuthTypeInsecureStatic,
JWT: "jwt-token-pool-a",
Expand All @@ -356,7 +356,7 @@ func TestConfig_Merge(t *testing.T) {
PartyID: "tokenPoolOwner",
InstanceAddress: poolAddrB,
},
BurnMintFactory: &BurnMintFactory{
Factory: &Factory{
Type: FactoryTypeAddress,
TemplateId: new("#link:Link.Token:LinkToken"),
Party: new("linkOwner"),
Expand Down Expand Up @@ -392,7 +392,7 @@ func TestConfig_Merge(t *testing.T) {
InstanceAddress: poolAddrA,
},
PoolOwner: "tokenPoolOwner",
TransferFactory: &TransferFactory{
Factory: &Factory{
Type: FactoryTypeURL,
TokenStandardURL: new("http://validator/a/v0/scan-proxy"),
TokenStandardAuthConfig: &commonconfig.AuthConfig{
Expand All @@ -408,7 +408,7 @@ func TestConfig_Merge(t *testing.T) {
InstanceAddress: poolAddrB,
},
PoolOwner: "tokenPoolOwner",
BurnMintFactory: &BurnMintFactory{
Factory: &Factory{
Type: FactoryTypeAddress,
TemplateId: new("#link:Link.Token:LinkToken"),
Party: new("linkOwner"),
Expand Down
Loading
Loading