Skip to content

Commit

Permalink
fix contract transmitter
Browse files Browse the repository at this point in the history
  • Loading branch information
makramkd committed Jul 15, 2024
1 parent cc17481 commit e4ac271
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 138 deletions.
2 changes: 1 addition & 1 deletion core/services/ccipcapability/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/test-go/testify/require"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets"
kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry"
Expand Down
1 change: 1 addition & 0 deletions core/services/ccipcapability/configs/evm/chain_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
"github.com/smartcontractkit/chainlink/v2/common/txmgr"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"github.com/ethereum/go-ethereum/accounts/abi"

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_multi_offramp"
Expand Down
3 changes: 2 additions & 1 deletion core/services/ccipcapability/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"fmt"
"time"

ragep2ptypes "github.com/smartcontractkit/libocr/ragep2p/types"

ccipreaderpkg "github.com/smartcontractkit/chainlink-ccip/pkg/reader"
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
"github.com/smartcontractkit/chainlink-common/pkg/types"
ragep2ptypes "github.com/smartcontractkit/libocr/ragep2p/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm"
"github.com/smartcontractkit/chainlink/v2/core/config"
Expand Down
53 changes: 35 additions & 18 deletions core/services/ccipcapability/ocrimpls/contract_transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,54 @@ import (
"math/big"

"github.com/google/uuid"
"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
"github.com/smartcontractkit/chainlink-common/pkg/types"
commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/libocr/offchainreporting2/chains/evmutil"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
"github.com/smartcontractkit/chainlink-common/pkg/types"
commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"
)

type ToCalldataFunc func(rawReportCtx [3][32]byte, report []byte, rs, ss [][32]byte, vs [32]byte) any
type Calldata interface {
ToAny() any
}

type commitCalldata struct {
ReportContext [3][32]byte
Report []byte
Rs [][32]byte
Ss [][32]byte
RawVs [32]byte
}

func (c commitCalldata) ToAny() any {
return c
}

type execCalldata struct {
ReportContext [3][32]byte
Report []byte
}

func (e execCalldata) ToAny() any {
return e
}

type ToCalldataFunc func(rawReportCtx [3][32]byte, report []byte, rs, ss [][32]byte, vs [32]byte) Calldata

func ToCommitCalldata(rawReportCtx [3][32]byte, report []byte, rs, ss [][32]byte, vs [32]byte) any {
return struct {
ReportContext [3][32]byte
Report []byte
Rs [][32]byte
Ss [][32]byte
Vs [32]byte
}{
func ToCommitCalldata(rawReportCtx [3][32]byte, report []byte, rs, ss [][32]byte, vs [32]byte) Calldata {
return commitCalldata{
ReportContext: rawReportCtx,
Report: report,
Rs: rs,
Ss: ss,
Vs: vs,
RawVs: vs,
}
}

func ToExecCalldata(rawReportCtx [3][32]byte, report []byte, _, _ [][32]byte, _ [32]byte) any {
return struct {
ReportContext [3][32]byte
Report []byte
}{
func ToExecCalldata(rawReportCtx [3][32]byte, report []byte, _, _ [][32]byte, _ [32]byte) Calldata {
return execCalldata{
ReportContext: rawReportCtx,
Report: report,
}
Expand Down
Loading

0 comments on commit e4ac271

Please sign in to comment.