-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CCIP 3388 - add commit store and RMN proxy state generation (#14551)
* CCIP 3388 - add commit store and RMN proxy state generation * update ARM to RMN
- Loading branch information
1 parent
0e35bc7
commit 86a9363
Showing
5 changed files
with
167 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
package view | ||
|
||
import ( | ||
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view/v1_0" | ||
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view/v1_2" | ||
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view/v1_5" | ||
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view/v1_6" | ||
) | ||
|
||
type ChainView struct { | ||
// v1.0 | ||
RMNProxy map[string]v1_0.RMNProxyView `json:"rmnProxy,omitempty"` | ||
// v1.2 | ||
Router map[string]v1_2.RouterView `json:"router,omitempty"` | ||
// v1.5 | ||
TokenAdminRegistry map[string]v1_5.TokenAdminRegistryView `json:"tokenAdminRegistry,omitempty"` | ||
FeeQuoter map[string]v1_6.FeeQuoterView `json:"feeQuoter,omitempty"` | ||
NonceManager map[string]v1_6.NonceManagerView `json:"nonceManager,omitempty"` | ||
Router map[string]v1_2.RouterView `json:"router,omitempty"` | ||
RMN map[string]v1_6.RMNRemoteView `json:"rmn,omitempty"` | ||
OnRamp map[string]v1_6.OnRampView `json:"onRamp,omitempty"` | ||
OffRamp map[string]v1_6.OffRampView `json:"offRamp,omitempty"` | ||
CommitStore map[string]v1_5.CommitStoreView `json:"commitStore,omitempty"` | ||
// v1.6 | ||
FeeQuoter map[string]v1_6.FeeQuoterView `json:"feeQuoter,omitempty"` | ||
NonceManager map[string]v1_6.NonceManagerView `json:"nonceManager,omitempty"` | ||
RMN map[string]v1_6.RMNRemoteView `json:"rmn,omitempty"` | ||
OnRamp map[string]v1_6.OnRampView `json:"onRamp,omitempty"` | ||
OffRamp map[string]v1_6.OffRampView `json:"offRamp,omitempty"` | ||
} | ||
|
||
func NewChain() ChainView { | ||
return ChainView{ | ||
// v1.0 | ||
RMNProxy: make(map[string]v1_0.RMNProxyView), | ||
// v1.2 | ||
Router: make(map[string]v1_2.RouterView), | ||
// v1.5 | ||
TokenAdminRegistry: make(map[string]v1_5.TokenAdminRegistryView), | ||
NonceManager: make(map[string]v1_6.NonceManagerView), | ||
Router: make(map[string]v1_2.RouterView), | ||
RMN: make(map[string]v1_6.RMNRemoteView), | ||
OnRamp: make(map[string]v1_6.OnRampView), | ||
OffRamp: make(map[string]v1_6.OffRampView), | ||
FeeQuoter: make(map[string]v1_6.FeeQuoterView), | ||
CommitStore: make(map[string]v1_5.CommitStoreView), | ||
// v1.6 | ||
FeeQuoter: make(map[string]v1_6.FeeQuoterView), | ||
NonceManager: make(map[string]v1_6.NonceManagerView), | ||
RMN: make(map[string]v1_6.RMNRemoteView), | ||
OnRamp: make(map[string]v1_6.OnRampView), | ||
OffRamp: make(map[string]v1_6.OffRampView), | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
integration-tests/deployment/ccip/view/v1_0/rmn_proxy_contract.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package v1_0 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
|
||
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view/types" | ||
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_proxy_contract" | ||
) | ||
|
||
type RMNProxyView struct { | ||
types.ContractMetaData | ||
RMN common.Address `json:"rmn"` | ||
} | ||
|
||
func GenerateRMNProxyView(r *rmn_proxy_contract.RMNProxyContract) (RMNProxyView, error) { | ||
if r == nil { | ||
return RMNProxyView{}, fmt.Errorf("cannot generate view for nil RMNProxy") | ||
} | ||
meta, err := types.NewContractMetaData(r, r.Address()) | ||
if err != nil { | ||
return RMNProxyView{}, fmt.Errorf("failed to generate contract metadata for RMNProxy: %w", err) | ||
} | ||
rmn, err := r.GetARM(nil) | ||
if err != nil { | ||
return RMNProxyView{}, fmt.Errorf("failed to get ARM: %w", err) | ||
} | ||
return RMNProxyView{ | ||
ContractMetaData: meta, | ||
RMN: rmn, | ||
}, nil | ||
} |
81 changes: 81 additions & 0 deletions
81
integration-tests/deployment/ccip/view/v1_5/commit_store.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package v1_5 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
|
||
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view/types" | ||
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/commit_store" | ||
) | ||
|
||
type CommitStoreView struct { | ||
types.ContractMetaData | ||
DynamicConfig commit_store.CommitStoreDynamicConfig `json:"dynamicConfig"` | ||
ExpectedNextSequenceNumber uint64 `json:"expectedNextSequenceNumber"` | ||
LatestPriceEpochAndRound uint64 `json:"latestPriceEpochAndRound"` | ||
StaticConfig commit_store.CommitStoreStaticConfig `json:"staticConfig"` | ||
Transmitters []common.Address `json:"transmitters"` | ||
IsUnpausedAndNotCursed bool `json:"isUnpausedAndNotCursed"` | ||
LatestConfigDetails commit_store.LatestConfigDetails `json:"latestConfigDetails"` | ||
LatestConfigDigestAndEpoch commit_store.LatestConfigDigestAndEpoch `json:"latestConfigDigestAndEpoch"` | ||
Paused bool `json:"paused"` | ||
} | ||
|
||
func GenerateCommitStoreView(c *commit_store.CommitStore) (CommitStoreView, error) { | ||
if c == nil { | ||
return CommitStoreView{}, fmt.Errorf("cannot generate view for nil CommitStore") | ||
} | ||
meta, err := types.NewContractMetaData(c, c.Address()) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to generate contract metadata for CommitStore: %w", err) | ||
} | ||
dynamicConfig, err := c.GetDynamicConfig(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get dynamic config: %w", err) | ||
} | ||
expectedNextSequenceNumber, err := c.GetExpectedNextSequenceNumber(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get expected next sequence number: %w", err) | ||
} | ||
latestPriceEpochAndRound, err := c.GetLatestPriceEpochAndRound(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get latest price epoch and round: %w", err) | ||
} | ||
staticConfig, err := c.GetStaticConfig(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get static config: %w", err) | ||
} | ||
transmitters, err := c.GetTransmitters(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get transmitters: %w", err) | ||
} | ||
isUnpausedAndNotCursed, err := c.IsUnpausedAndNotCursed(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get is unpaused and not cursed: %w", err) | ||
} | ||
latestConfigDetails, err := c.LatestConfigDetails(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get latest config details: %w", err) | ||
} | ||
latestConfigDigestAndEpoch, err := c.LatestConfigDigestAndEpoch(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get latest config digest and epoch: %w", err) | ||
} | ||
paused, err := c.Paused(nil) | ||
if err != nil { | ||
return CommitStoreView{}, fmt.Errorf("failed to get paused: %w", err) | ||
} | ||
return CommitStoreView{ | ||
ContractMetaData: meta, | ||
DynamicConfig: dynamicConfig, | ||
ExpectedNextSequenceNumber: expectedNextSequenceNumber, | ||
LatestPriceEpochAndRound: latestPriceEpochAndRound, | ||
StaticConfig: staticConfig, | ||
Transmitters: transmitters, | ||
IsUnpausedAndNotCursed: isUnpausedAndNotCursed, | ||
LatestConfigDetails: latestConfigDetails, | ||
LatestConfigDigestAndEpoch: latestConfigDigestAndEpoch, | ||
Paused: paused, | ||
}, nil | ||
} |