-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New actions integration tests #32
Closed
Closed
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
c1f3e6d
integration tests for staking
najlachamseddine 12a816f
tests for staking
najlachamseddine 0ac3470
Merge branch 'dev' into new-actions-integration-tests
najlachamseddine 06046f5
delete 2d file and current test file keep only staking test (for debu…
najlachamseddine bb5963d
delete unit tests second file
najlachamseddine df29b23
use It
najlachamseddine dfdcd11
set parallelism to 5
najlachamseddine 33790e7
remove sleep time
najlachamseddine 63c40a8
change factories for nodes
najlachamseddine 9e88267
transfer to node address
najlachamseddine 99de97a
test balance
najlachamseddine b6acd99
transfer and register
najlachamseddine 45a47cc
transfer and register
najlachamseddine 70cd8ce
transfer and register
najlachamseddine 49364d3
add print
najlachamseddine fad8a0a
add print
najlachamseddine 5e9b959
uncomment tokenvm tests
najlachamseddine fc585d8
emission instances
najlachamseddine 52fca7f
transfer works and register is called
najlachamseddine 305eb67
add import function
najlachamseddine eff65cd
clean code
najlachamseddine 4d53839
create interface to be able to mock emission
najlachamseddine 6dff2aa
register validator stake and get staked validators tests pass
najlachamseddine 7458851
height
najlachamseddine 0a48b16
delegate user stake
najlachamseddine ad9f85c
user delegate claim
najlachamseddine 2630622
test same block is accepted
najlachamseddine 8a8b8c9
clean up
najlachamseddine 1184790
set initial code int tests
najlachamseddine 9d90a25
update
najlachamseddine b2e3aa4
deactivated initial integration tests for now
najlachamseddine f3c7058
Merge branch 'dev' into new-actions-integration-tests
najlachamseddine 77a2752
add gossiper
najlachamseddine 2d3129c
no need for gossiping (the current vm is the proposer/builder)
najlachamseddine 7840f97
no need to delegatorsLastClaim to be public
najlachamseddine 876da14
add staked validators test
najlachamseddine a7f84d7
fund node 0
najlachamseddine 8ad0c98
register validator stake node 0
najlachamseddine 48e2d7b
delegate user stake to node 0
najlachamseddine ccca0bf
user delegate passes
najlachamseddine d5079d7
delegate user passes (unstable test)
najlachamseddine 3322320
delegate user passes (unstable test)
najlachamseddine ce5e475
passes
najlachamseddine 7506eb4
should pass till before claim delegation reward
najlachamseddine c04bd5e
By -> It
najlachamseddine 9cb51fa
merge dev
najlachamseddine 2490422
update tests with start/end block
najlachamseddine 2126c8e
update tests with start/end block
najlachamseddine 64763e0
claim user reward
najlachamseddine edb54ed
undelegate stake user
najlachamseddine 28ae444
Made rewardamount to be equal to 0
kpachhai f533cc6
claim validator rewards
najlachamseddine 86cdea4
Merge branch 'new-actions-integration-tests' of github.com:Nuklai/nuk…
najlachamseddine 21625ee
claim validator stake reward
najlachamseddine 44149d7
withdraw validator
najlachamseddine 9902cec
desc
najlachamseddine 7382b51
merge dev
najlachamseddine 1e967db
withdraw stake
najlachamseddine 83686e5
reward not required
najlachamseddine 1d6443b
FIt -> It
najlachamseddine c568b59
int test
najlachamseddine 6a26217
integration tests
najlachamseddine bbe3fae
add TODO
najlachamseddine 0c4e2f3
remove println
najlachamseddine d61bc74
rename file
najlachamseddine 56d21fd
restore integration tests file
najlachamseddine aad1945
put integration tests in one file
najlachamseddine 84d536d
remove println
najlachamseddine cc72208
fmt
najlachamseddine 6ac613b
space
najlachamseddine 5d5800d
space
najlachamseddine 6065476
println
najlachamseddine 46c73da
update manual
najlachamseddine 56e5316
integration tests pass in one file
najlachamseddine 7abfae9
integration tests pass in one file
najlachamseddine 9768e47
remove old file
najlachamseddine c66d1f4
update
najlachamseddine a9e0362
e2e tests should pass
najlachamseddine dc03de1
linter
najlachamseddine 93ae68a
linter e2e
najlachamseddine 1b21f33
rename file from manual to mock
najlachamseddine 57dbc2c
merge main
najlachamseddine f775941
lint
najlachamseddine dd9bc05
fix lint: golangci-lint run --fix
najlachamseddine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package emission | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/ava-labs/avalanchego/ids" | ||
"github.com/ava-labs/hypersdk/codec" | ||
) | ||
|
||
var ( | ||
once sync.Once | ||
emission Tracker | ||
) | ||
|
||
type Validator struct { | ||
IsActive bool `json:"isActive"` // Indicates if the validator is currently active | ||
NodeID ids.NodeID `json:"nodeID"` // Node ID of the validator | ||
PublicKey []byte `json:"publicKey"` // Public key of the validator | ||
StakedAmount uint64 `json:"stakedAmount"` // Total amount staked by the validator | ||
UnclaimedStakedReward uint64 `json:"stakedReward"` // Total rewards accumulated by the validator | ||
DelegationFeeRate float64 `json:"delegationFeeRate"` // Fee rate for delegations | ||
DelegatedAmount uint64 `json:"delegatedAmount"` // Total amount delegated to the validator | ||
UnclaimedDelegatedReward uint64 `json:"delegatedReward"` // Total rewards accumulated by the delegators | ||
|
||
delegatorsLastClaim map[codec.Address]uint64 // Map of delegator addresses to their last claim block height | ||
epochRewards map[uint64]uint64 // Rewards per epoch | ||
stakeStartBlock uint64 // Start block of the stake | ||
stakeEndBlock uint64 // End block of the stake | ||
} | ||
|
||
type EmissionAccount struct { | ||
Address codec.Address `json:"address"` | ||
UnclaimedBalance uint64 `json:"unclaimedBalance"` | ||
} | ||
|
||
type EpochTracker struct { | ||
BaseAPR float64 `json:"baseAPR"` // Base APR to use | ||
BaseValidators uint64 `json:"baseValidators"` // Base number of validators to use | ||
EpochLength uint64 `json:"epochLength"` // Number of blocks per reward epoch | ||
} | ||
|
||
func distributeValidatorRewards(totalValidatorReward uint64, delegationFeeRate float64, delegatedAmount uint64) (uint64, uint64) { | ||
delegationRewards := uint64(0) | ||
if delegatedAmount > 0 { | ||
delegationRewards = uint64(float64(totalValidatorReward) * delegationFeeRate) | ||
} | ||
validatorRewards := totalValidatorReward - delegationRewards | ||
return validatorRewards, delegationRewards | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanna get your thought process on why we chose to have this not be a pointer like previously. Any specific reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracker
is an interface, then a pointervar _ Tracker = (*Emission)(nil)
as defined inemission/emission.go
The creation
tracker = emission.NewEmission(c, c.inner, c.genesis.EmissionBalancer.TotalSupply, c.genesis.EmissionBalancer.MaxSupply, emissionAddr)
of the emission instance hasn't changed and it is still returning a pointer*Emission