Merge pull request #29 from Solovyov1796/pr28

for review of Pr28
This commit is contained in:
Solovyov1796 2024-06-12 10:25:49 +08:00 committed by GitHub
commit 0f2f82d98f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 55 additions and 55 deletions

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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)
}
}

View File

@ -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")
}