From 141796f158dfb1abe2c9580dbf8026d42e17ac10 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 12 Jun 2024 01:36:29 +0800 Subject: [PATCH 1/3] use chaincfg.MakeCoinForGasDenom --- migrate/utils/periodic_vesting_reset_test.go | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/migrate/utils/periodic_vesting_reset_test.go b/migrate/utils/periodic_vesting_reset_test.go index 5424eb93..b7cde17f 100644 --- a/migrate/utils/periodic_vesting_reset_test.go +++ b/migrate/utils/periodic_vesting_reset_test.go @@ -42,7 +42,7 @@ func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -65,7 +65,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -98,7 +98,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { } func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ @@ -126,25 +126,25 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing } func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(4e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(4e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +30 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } @@ -160,36 +160,36 @@ func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { expectedPeriods := []vestingtypes.Period{ { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, { Length: 15 * 24 * 60 * 60, // 15 days - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") assert.Equal(t, newVestingStartTime.Unix(), vacc.StartTime, "expected vesting start time to be updated") assert.Equal(t, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period") assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } @@ -199,35 +199,35 @@ func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testin newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") } func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) { - balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6))) + balance := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(3e6))) vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past periods := vestingtypes.Periods{ vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // -15 days - vested - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, vestingtypes.Period{ Length: 15 * 24 * 60 * 60, // +15 days - vesting - Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), + Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), }, } vacc := createVestingAccount(balance, vestingStartTime, periods) - vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))) + vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6)))) newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) ResetPeriodicVestingAccount(vacc, newVestingStartTime) assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified") - assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") + assert.Equal(t, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") } From d2acd8bf7953778985dba81e767028169f2578d1 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 12 Jun 2024 01:47:42 +0800 Subject: [PATCH 2/3] recover "rename denoms" in 3 files --- client/docs/cosmos-swagger.yml | 10 +++++----- client/docs/ibc-go-swagger.yml | 20 +++++++++---------- client/docs/swagger-ui/swagger.yaml | 30 ++++++++++++++--------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/client/docs/cosmos-swagger.yml b/client/docs/cosmos-swagger.yml index dccd95c2..1fa424c0 100644 --- a/client/docs/cosmos-swagger.yml +++ b/client/docs/cosmos-swagger.yml @@ -3121,7 +3121,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -3328,7 +3328,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35597,7 +35597,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with exponent + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35764,7 +35764,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -35920,7 +35920,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string diff --git a/client/docs/ibc-go-swagger.yml b/client/docs/ibc-go-swagger.yml index a6cabe17..c750fda6 100644 --- a/client/docs/ibc-go-swagger.yml +++ b/client/docs/ibc-go-swagger.yml @@ -129,9 +129,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -265,9 +265,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -13499,9 +13499,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens and + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -13557,9 +13557,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -13583,9 +13583,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 412e9e5e..803f7418 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -16331,7 +16331,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -16538,7 +16538,7 @@ paths: base: type: string description: >- - base represents the evm denom (should be the DenomUnit + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -39228,9 +39228,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -39364,9 +39364,9 @@ paths: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -58047,7 +58047,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with exponent + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -58214,7 +58214,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -58370,7 +58370,7 @@ definitions: base: type: string description: >- - base represents the evm denom (should be the DenomUnit with + base represents the base denom (should be the DenomUnit with exponent = 0). display: type: string @@ -81239,9 +81239,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens and + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -81297,9 +81297,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. @@ -81323,9 +81323,9 @@ definitions: source of the fungible token. base_denom: type: string - description: evm denomination of the relayed fungible token. + description: base denomination of the relayed fungible token. description: >- - DenomTrace contains the evm denomination for ICS20 fungible tokens + DenomTrace contains the base denomination for ICS20 fungible tokens and the source tracing information path. From b8ed70c775b8a30ed5ccbae5a8e4d3ba07ccdb42 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 12 Jun 2024 02:00:16 +0800 Subject: [PATCH 3/3] keep the EthSecp256k1 from cosmos for compatible --- cmd/0gchaind/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/0gchaind/root.go b/cmd/0gchaind/root.go index d4e3f5a0..fab91152 100644 --- a/cmd/0gchaind/root.go +++ b/cmd/0gchaind/root.go @@ -31,8 +31,8 @@ import ( func customKeyringOptions() keyring.Option { return func(options *keyring.Options) { - options.SupportedAlgos = append(options.SupportedAlgos, vrf.VrfAlgo, hd.EthSecp256k1) - options.SupportedAlgosLedger = append(options.SupportedAlgosLedger, vrf.VrfAlgo, hd.EthSecp256k1) + options.SupportedAlgos = append(hd.SupportedAlgorithms, vrf.VrfAlgo) + options.SupportedAlgosLedger = append(hd.SupportedAlgorithmsLedger, vrf.VrfAlgo) } }