From 558c0ff7a03519501702d7b2a73ac21a3b1dc04b Mon Sep 17 00:00:00 2001 From: Joe Huang Date: Fri, 3 Jan 2025 15:21:26 -0600 Subject: [PATCH] update --- .../ccip/ccipsolana/executecodec.go | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/core/capabilities/ccip/ccipsolana/executecodec.go b/core/capabilities/ccip/ccipsolana/executecodec.go index eff5a614df4..4b2ca112030 100644 --- a/core/capabilities/ccip/ccipsolana/executecodec.go +++ b/core/capabilities/ccip/ccipsolana/executecodec.go @@ -96,6 +96,7 @@ func (e *ExecutePluginCodecV1) Encode(ctx context.Context, report cciptypes.Exec Message: message, OffchainTokenData: offchainTokenData, Proofs: solanaProofs, + //TODO: add TokenIndexes in the cciptypes.ExecutePluginReport } var buf bytes.Buffer @@ -116,11 +117,6 @@ func (e *ExecutePluginCodecV1) Decode(ctx context.Context, encodedReport []byte) return cciptypes.ExecutePluginReport{}, fmt.Errorf("unpack encoded report: %w", err) } - proofs := make([]cciptypes.Bytes32, 0, len(executeReport.Proofs)) - for _, proof := range executeReport.Proofs { - proofs = append(proofs, proof) - } - tokenAmounts := make([]cciptypes.RampTokenAmount, 0, len(executeReport.Message.TokenAmounts)) for _, tokenAmount := range executeReport.Message.TokenAmounts { destData := make([]byte, 4) @@ -142,32 +138,37 @@ func (e *ExecutePluginCodecV1) Decode(ctx context.Context, encodedReport []byte) return cciptypes.ExecutePluginReport{}, fmt.Errorf("unpack encoded report: %w", err) } - messages := make([]cciptypes.Message, 0, 1) - message := cciptypes.Message{ - Header: cciptypes.RampMessageHeader{ - MessageID: executeReport.Message.Header.MessageId, - SourceChainSelector: cciptypes.ChainSelector(executeReport.Message.Header.SourceChainSelector), - DestChainSelector: cciptypes.ChainSelector(executeReport.Message.Header.DestChainSelector), - SequenceNumber: cciptypes.SeqNum(executeReport.Message.Header.SequenceNumber), - Nonce: executeReport.Message.Header.Nonce, - MsgHash: cciptypes.Bytes32{}, // todo: info not available, but not required atm - OnRamp: cciptypes.UnknownAddress{}, // todo: info not available, but not required atm + messages := []cciptypes.Message{ + { + Header: cciptypes.RampMessageHeader{ + MessageID: executeReport.Message.Header.MessageId, + SourceChainSelector: cciptypes.ChainSelector(executeReport.Message.Header.SourceChainSelector), + DestChainSelector: cciptypes.ChainSelector(executeReport.Message.Header.DestChainSelector), + SequenceNumber: cciptypes.SeqNum(executeReport.Message.Header.SequenceNumber), + Nonce: executeReport.Message.Header.Nonce, + MsgHash: cciptypes.Bytes32{}, // todo: info not available, but not required atm + OnRamp: cciptypes.UnknownAddress{}, // todo: info not available, but not required atm + }, + Sender: executeReport.Message.Sender, + Data: executeReport.Message.Data, + Receiver: cciptypes.UnknownAddress(executeReport.Message.Receiver.String()), + ExtraArgs: buf.Bytes(), + FeeToken: cciptypes.UnknownAddress{}, // <-- todo: info not available, but not required atm + FeeTokenAmount: cciptypes.BigInt{}, // <-- todo: info not available, but not required atm + TokenAmounts: tokenAmounts, }, - Sender: executeReport.Message.Sender, - Data: executeReport.Message.Data, - Receiver: cciptypes.UnknownAddress(executeReport.Message.Receiver.String()), - ExtraArgs: buf.Bytes(), - FeeToken: cciptypes.UnknownAddress{}, // <-- todo: info not available, but not required atm - FeeTokenAmount: cciptypes.BigInt{}, // <-- todo: info not available, but not required atm - TokenAmounts: tokenAmounts, } - messages = append(messages, message) offchainTokenData := make([][][]byte, 0, 1) if executeReport.OffchainTokenData != nil { offchainTokenData = append(offchainTokenData, executeReport.OffchainTokenData) } + proofs := make([]cciptypes.Bytes32, 0, len(executeReport.Proofs)) + for _, proof := range executeReport.Proofs { + proofs = append(proofs, proof) + } + chainReport := cciptypes.ExecutePluginReportSingleChain{ SourceChainSelector: cciptypes.ChainSelector(executeReport.SourceChainSelector), Messages: messages,