-
Notifications
You must be signed in to change notification settings - Fork 118
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
add data in genesis #3062
base: future/peggy2
Are you sure you want to change the base?
add data in genesis #3062
Conversation
Codecov Report
@@ Coverage Diff @@
## future/peggy2 #3062 +/- ##
=================================================
+ Coverage 47.96% 48.18% +0.22%
=================================================
Files 169 169
Lines 15024 15120 +96
=================================================
+ Hits 7206 7286 +80
- Misses 7385 7395 +10
- Partials 433 439 +6
|
Can we switch
to also use bigendian? If we use bigendian here, there's no littleendian in our code at all. |
yes, it is better to use bigendian. will update it. |
Curious, why is bigEndian better? |
just use the same endian in the code, I have other PR #2748 to use the protobuf. I think it is better solution, can avoid some mistake for different endian usage. |
message GenesisState { string crosschain_fee_receive_account = 1; } | ||
message GenesisState { | ||
string crosschain_fee_receive_account = 1; | ||
map<string, uint64> ethereum_lock_burn_sequence = 2; |
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.
Is it necessary to include ethereum_lock_burn_sequence in genesis?
If the entry doesn't exist in keeper, keeper returns 0, which is our desired behavior
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.
- if ethereum_lock_burn_sequence not set before, then no data will be included in genesis, it doesn't generate any empty/default value
- 0 is expected if no vallue exists, to avoid such confusion, we set the lockBurnSequence starting from 1, also in contract
@@ -62,4 +62,9 @@ enum ClaimType { | |||
} | |||
|
|||
// GenesisState for ethbridge | |||
message GenesisState { string crosschain_fee_receive_account = 1; } | |||
message GenesisState { |
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.
Need to update x/ethbridge/genesis.go::ValidateGenesis function
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.
CrosschainFeeReceiveAccount already checked, for other three items, they are map, so that they are empty is correct if no any data before in peggy1.0. Do you mean we should check each entry in these maps?
} | ||
|
||
// SetSequenceViaRawKey used in import sequence from genesis | ||
func (k Keeper) SetSequenceViaRawKey(ctx sdk.Context, key []byte, newSequence uint64) { |
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.
This looks very error prone.
I suggest write a function to extract NetworkDescriptor and ValidatorAddress, and use those to call SetEthereumLockBurnSequence
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.
Ok, will add extract method.
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.
Are these comments still current?
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.
I implemented a new method DecodeKey to extract NetworkDescriptor and ValidatorAddress according to comment. please check.
…ort import on non-empty EthereumLockBurn, and GlobalSequence
…lock number mapping
…eToBlockNumber. Code style
need deal with map issue first. |
No description provided.