From 7b17dacb098ce79f442a0b0749fdad6b8b6f9ce9 Mon Sep 17 00:00:00 2001 From: connorwstein Date: Fri, 6 Dec 2024 13:06:04 -0500 Subject: [PATCH] Comments --- deployment/address_book.go | 2 +- deployment/common/changeset/state.go | 7 ++++--- deployment/common/view/v1_0/link_token.go | 10 +++++----- deployment/common/view/v1_0/static_link_token.go | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/deployment/address_book.go b/deployment/address_book.go index 5bdffa7e584..6f605013011 100644 --- a/deployment/address_book.go +++ b/deployment/address_book.go @@ -282,7 +282,7 @@ func AddressesContainBundle(addrs map[string]TypeAndVersion, wantTypes map[TypeA if wantType == haveType { counts[wantType]++ if counts[wantType] > 1 { - return false, fmt.Errorf("found more than one instance of a contract") + return false, fmt.Errorf("found more than one instance of contract %s", wantType) } } } diff --git a/deployment/common/changeset/state.go b/deployment/common/changeset/state.go index 98471f9fe6a..0055c908f8d 100644 --- a/deployment/common/changeset/state.go +++ b/deployment/common/changeset/state.go @@ -2,6 +2,7 @@ package changeset import ( "errors" + "fmt" "github.com/ethereum/go-ethereum/common" owner_helpers "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" @@ -91,7 +92,7 @@ func MaybeLoadMCMSWithTimelockState(chain deployment.Chain, addresses map[string timelock: {}, proposer: {}, canceller: {}, bypasser: {}, }) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to check MCMS contracts on chain %s error: %w", chain.Name(), err) } for address, tvStr := range addresses { @@ -142,7 +143,7 @@ func MaybeLoadLinkTokenState(chain deployment.Chain, addresses map[string]deploy // Perhaps revisit if we have a use case for multiple. _, err := deployment.AddressesContainBundle(addresses, map[deployment.TypeAndVersion]struct{}{linkToken: {}}) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to check link token on chain %s error: %w", chain.Name(), err) } for address, tvStr := range addresses { switch tvStr { @@ -174,7 +175,7 @@ func MaybeLoadStaticLinkTokenState(chain deployment.Chain, addresses map[string] // Perhaps revisit if we have a use case for multiple. _, err := deployment.AddressesContainBundle(addresses, map[deployment.TypeAndVersion]struct{}{staticLinkToken: {}}) if err != nil { - return nil, err + return nil, fmt.Errorf("unable to check static link token on chain %s error: %w", chain.Name(), err) } for address, tvStr := range addresses { switch tvStr { diff --git a/deployment/common/view/v1_0/link_token.go b/deployment/common/view/v1_0/link_token.go index 7f45b6f0473..6dd1a00be3b 100644 --- a/deployment/common/view/v1_0/link_token.go +++ b/deployment/common/view/v1_0/link_token.go @@ -23,23 +23,23 @@ type LinkTokenView struct { func GenerateLinkTokenView(lt *link_token.LinkToken) (LinkTokenView, error) { owner, err := lt.Owner(nil) if err != nil { - return LinkTokenView{}, fmt.Errorf("failed to get owner: %w", err) + return LinkTokenView{}, fmt.Errorf("failed to get owner %s: %w", lt.Address(), err) } decimals, err := lt.Decimals(nil) if err != nil { - return LinkTokenView{}, fmt.Errorf("failed to get decimals: %w", err) + return LinkTokenView{}, fmt.Errorf("failed to get decimals %s: %w", lt.Address(), err) } totalSupply, err := lt.TotalSupply(nil) if err != nil { - return LinkTokenView{}, fmt.Errorf("failed to get total supply: %w", err) + return LinkTokenView{}, fmt.Errorf("failed to get total supply %s: %w", lt.Address(), err) } minters, err := lt.GetMinters(nil) if err != nil { - return LinkTokenView{}, fmt.Errorf("failed to get minters: %w", err) + return LinkTokenView{}, fmt.Errorf("failed to get minters %s: %w", lt.Address(), err) } burners, err := lt.GetBurners(nil) if err != nil { - return LinkTokenView{}, fmt.Errorf("failed to get burners: %w", err) + return LinkTokenView{}, fmt.Errorf("failed to get burners %s: %w", lt.Address(), err) } return LinkTokenView{ ContractMetaData: types.ContractMetaData{ diff --git a/deployment/common/view/v1_0/static_link_token.go b/deployment/common/view/v1_0/static_link_token.go index 3d36a0f4b30..525f1a9f0c5 100644 --- a/deployment/common/view/v1_0/static_link_token.go +++ b/deployment/common/view/v1_0/static_link_token.go @@ -19,11 +19,11 @@ type StaticLinkTokenView struct { func GenerateStaticLinkTokenView(lt *link_token_interface.LinkToken) (StaticLinkTokenView, error) { decimals, err := lt.Decimals(nil) if err != nil { - return StaticLinkTokenView{}, fmt.Errorf("failed to get decimals: %w", err) + return StaticLinkTokenView{}, fmt.Errorf("failed to get decimals %s: %w", lt.Address(), err) } totalSupply, err := lt.TotalSupply(nil) if err != nil { - return StaticLinkTokenView{}, fmt.Errorf("failed to get total supply: %w", err) + return StaticLinkTokenView{}, fmt.Errorf("failed to get total supply %s: %w", lt.Address(), err) } return StaticLinkTokenView{ ContractMetaData: types.ContractMetaData{