-
Notifications
You must be signed in to change notification settings - Fork 28
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
Problem: Account projection balance is relying on Cosmos real time data #383
Comments
Tired to get the balance via events in txs results but looks like some fee are not included for failed tx (but deducted from wallet) |
Account Usable BalanceAltering go deeper into cosmos-sdk and take some experimental implementation. Usable balance is proved can be only invoke inside the Genesis block account balanceAll initial balance stated inside genesis block
Accumulate balance by events emittedBegin Block EventsEvent emitted in here would not have any execution in term of the Block EventsEvent emitted would include all actually actions taken for every tx inside the blocks. Events related to usable balance would be:
End Block EventsEvent emitted would include all the actually actions after txs was executed inside the blocks. Things like release unbonded tokens. Events related to usable balance would be:
Fee paid from failed transactionsNo event would be emitted if the transaction was failed. However, the transaction fee is actually paid. Normally, paid fee would emitted in a Fee payerUsually, the first signer is responsible for paying the fees. But there might exceptional case due to // Fee includes the amount of coins paid in fees and the maximum
// gas to be used by the transaction. The ratio yields an effective "gasprice",
// which must be above some miminum to be accepted into the mempool.
type Fee struct {
// amount is the amount of coins to be paid as a fee
Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
// gas_limit is the maximum gas that can be used in transaction processing
// before an out of gas error occurs
GasLimit uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
// if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees.
// the payer must be a tx signer (and thus have signed this field in AuthInfo).
// setting this field does *not* change the ordering of required signers for the transaction.
Payer string `protobuf:"bytes,3,opt,name=payer,proto3" json:"payer,omitempty"`
// if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used
// to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does
// not support fee grants, this will fail
Granter string `protobuf:"bytes,4,opt,name=granter,proto3" json:"granter,omitempty"`
} Fee payer reference: https://github.com/cosmos/cosmos-sdk/blob/master/types/tx/tx.pb.go#L778 |
Thanks @calvinaco pointed out that these coin-related events on existed after cosmos SDK v0.43. Regarding on this, we may need to do via components on outer layer to trace the traffic. Below are trigger points for those coin activities on cosmos SDK
Plus all the IBC activities trigger point on ibc-go |
Should use
GenesisCreated
andAccountTransfer
event to construct the balanceThe text was updated successfully, but these errors were encountered: