diff --git a/channel/asset.go b/channel/asset.go index 9490627..aa55a26 100644 --- a/channel/asset.go +++ b/channel/asset.go @@ -49,8 +49,8 @@ func MakeChainID(id *big.Int) ChainID { return ChainID{id} } -// MakeAssetID makes a AssetID for the given id. -func MakeAssetID(id *big.Int) multi.AssetID { +// MakeLedgerBackendID makes a AssetID for the given id. +func MakeLedgerBackendID(id *big.Int) multi.LedgerBackendID { if id.Sign() < 0 { panic("must not be smaller than zero") } @@ -66,7 +66,7 @@ func (id *ChainID) UnmarshalBinary(data []byte) error { // MarshalBinary marshals the chainID into its binary representation. func (id ChainID) MarshalBinary() (data []byte, err error) { if id.Sign() == -1 { - return nil, errors.New("cannot marshal negative AssetID") + return nil, errors.New("cannot marshal negative LedgerBackendID") } return id.Bytes(), nil } @@ -108,8 +108,8 @@ func (id AssetID) LedgerID() multi.LedgerID { return &id.ledgerID } -// AssetID returns the asset ID of the asset. -func (a Asset) AssetID() multi.AssetID { +// LedgerBackendID returns the asset ID of the asset. +func (a Asset) LedgerBackendID() multi.LedgerBackendID { return a.assetID } @@ -141,12 +141,12 @@ func (a *Asset) UnmarshalBinary(data []byte) error { // LedgerID returns the ledger ID the asset lives on. func (a Asset) LedgerID() multi.LedgerID { - return a.AssetID().LedgerID() + return a.LedgerBackendID().LedgerID() } // NewAsset creates a new asset from an chainID and the AssetHolder address. func NewAsset(chainID *big.Int, assetHolder common.Address) *Asset { - id := MakeAssetID(chainID).(AssetID) //nolint: forcetypeassert // AssetID implements multi.AssetID + id := MakeLedgerBackendID(chainID).(AssetID) //nolint: forcetypeassert // LedgerBackendID implements multi.LedgerBackendID return &Asset{assetID: id, AssetHolder: *wallet.AsWalletAddr(assetHolder)} } diff --git a/channel/test/randomizer.go b/channel/test/randomizer.go index 7a725a7..d7ad0f7 100644 --- a/channel/test/randomizer.go +++ b/channel/test/randomizer.go @@ -38,9 +38,9 @@ func NewRandomAsset(rng *rand.Rand) *ethchannel.Asset { return ethchannel.NewAsset(chainID.ChainID(), common.Address(asset)) } -// NewRandomChainID returns a new random AssetID. +// NewRandomChainID returns a new random LedgerBackendID. func NewRandomChainID(rng *rand.Rand) ethchannel.AssetID { r := rng.Uint64() id := new(big.Int).SetUint64(r) - return ethchannel.MakeAssetID(id).(ethchannel.AssetID) + return ethchannel.MakeLedgerBackendID(id).(ethchannel.AssetID) } diff --git a/client/test/multiledger.go b/client/test/multiledger.go index a7bba59..0364fed 100644 --- a/client/test/multiledger.go +++ b/client/test/multiledger.go @@ -101,8 +101,8 @@ type testLedger struct { } // AssetID returns the asset ID of the ledger. -func (l testLedger) AssetID() multi.AssetID { - return ethchannel.MakeAssetID(ethchannel.MakeChainID(l.simSetup.SimBackend.ChainID()).Int) +func (l testLedger) AssetID() multi.LedgerBackendID { + return ethchannel.MakeLedgerBackendID(ethchannel.MakeChainID(l.simSetup.SimBackend.ChainID()).Int) } func setupLedger(ctx context.Context, t *testing.T, rng *rand.Rand, chainID *big.Int) testLedger { diff --git a/go.mod b/go.mod index 4e6942e..124ccf0 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - perun.network/go-perun v0.12.1-0.20250114072911-f46b0c55fe65 + perun.network/go-perun v0.12.1-0.20250128081648-21d0af4e234b polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 ) diff --git a/go.sum b/go.sum index 301db34..947b32a 100644 --- a/go.sum +++ b/go.sum @@ -646,8 +646,8 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -perun.network/go-perun v0.12.1-0.20250114072911-f46b0c55fe65 h1:kJ3AS374fe23a/9puoaOwCr9Bx2L/WJ5p2npDql3m4A= -perun.network/go-perun v0.12.1-0.20250114072911-f46b0c55fe65/go.mod h1:uH8iwi75alXDizxxDzH0A+6uqXPbagCpKfl8ECMv/cA= +perun.network/go-perun v0.12.1-0.20250128081648-21d0af4e234b h1:6FeodthJZB10aWGk/DgtV2VicacyUnLaUoT8OUcwSms= +perun.network/go-perun v0.12.1-0.20250128081648-21d0af4e234b/go.mod h1:uH8iwi75alXDizxxDzH0A+6uqXPbagCpKfl8ECMv/cA= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 h1:iA5GzEa/hHfVlQpimEjPV09NATwHXxSjWNB0VVodtew= polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37/go.mod h1:XUBrNtqgEhN3EEOP/5gh7IBd3xVHKidCjXDZfl9+kMU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=