Class AccountDiff
Represents a difference between two IAccountStates. This is a partial interpretation of a raw difference obtained by Diff(ITrie) from IAccountState's perspective. Keep in mind of the following properties:
-
Any
value, which is equivalent to non-existent value in the underlying storage, in the source is ignored. That is, even if the value in the target and the value in the source are different while the value in the source is null, this will not be part of the resulting AccountDiff. - Any null value, again, which is equivalent to non-existent value in the underlying storage, in the target for FungibleAssetValue and ValidatorSet is interpreted accordingly. That is, 0 amount of FungibleAssetValue and empty ValidatorSet are used. This is in accordance with how GetBalance(Address, Currency) and GetValidatorSet() would behave.
- Due to the reason mentioned directly above, the size of AccountDiff derived from Diff(ITrie) may not be the same. Moreover, an AccountDiff being empty does not guarantee that the data are the same as IAccountState is not capable of distinguishing between null and 0 FungibleAssetValue and so on and so forth.
- As Currency information is in the domain of an application using this library, only the hash of a Currency is directly stored in the underlying storage. As such, each Currency and FungibleAssetValue are handled as raw values, that is, as hash and Bencodex.Types.Integer, for an AccountDiff.
Inherited Members
Namespace: Libplanet.Action.State
Assembly: Libplanet.Action.dll
Syntax
public class AccountDiff
Properties
| Improve this Doc View SourceFungibleAssetValueDiffs
Represents a difference between two IAccountStates. This is a partial interpretation of a raw difference obtained by Diff(ITrie) from IAccountState's perspective. Keep in mind of the following properties:
-
Any
value, which is equivalent to non-existent value in the underlying storage, in the source is ignored. That is, even if the value in the target and the value in the source are different while the value in the source is null, this will not be part of the resulting AccountDiff. - Any null value, again, which is equivalent to non-existent value in the underlying storage, in the target for FungibleAssetValue and ValidatorSet is interpreted accordingly. That is, 0 amount of FungibleAssetValue and empty ValidatorSet are used. This is in accordance with how GetBalance(Address, Currency) and GetValidatorSet() would behave.
- Due to the reason mentioned directly above, the size of AccountDiff derived from Diff(ITrie) may not be the same. Moreover, an AccountDiff being empty does not guarantee that the data are the same as IAccountState is not capable of distinguishing between null and 0 FungibleAssetValue and so on and so forth.
- As Currency information is in the domain of an application using this library, only the hash of a Currency is directly stored in the underlying storage. As such, each Currency and FungibleAssetValue are handled as raw values, that is, as hash and Bencodex.Types.Integer, for an AccountDiff.
Declaration
public ImmutableDictionary<(Address, HashDigest<SHA1>), (Integer, Integer)> FungibleAssetValueDiffs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.ImmutableDictionary<(T1 Item1, T2 Item2)<Address, HashDigest<SHA1>>, (T1 Item1, T2 Item2)<Bencodex.Types.Integer, Bencodex.Types.Integer>> |
StateDiffs
Represents a difference between two IAccountStates. This is a partial interpretation of a raw difference obtained by Diff(ITrie) from IAccountState's perspective. Keep in mind of the following properties:
-
Any
value, which is equivalent to non-existent value in the underlying storage, in the source is ignored. That is, even if the value in the target and the value in the source are different while the value in the source is null, this will not be part of the resulting AccountDiff. - Any null value, again, which is equivalent to non-existent value in the underlying storage, in the target for FungibleAssetValue and ValidatorSet is interpreted accordingly. That is, 0 amount of FungibleAssetValue and empty ValidatorSet are used. This is in accordance with how GetBalance(Address, Currency) and GetValidatorSet() would behave.
- Due to the reason mentioned directly above, the size of AccountDiff derived from Diff(ITrie) may not be the same. Moreover, an AccountDiff being empty does not guarantee that the data are the same as IAccountState is not capable of distinguishing between null and 0 FungibleAssetValue and so on and so forth.
- As Currency information is in the domain of an application using this library, only the hash of a Currency is directly stored in the underlying storage. As such, each Currency and FungibleAssetValue are handled as raw values, that is, as hash and Bencodex.Types.Integer, for an AccountDiff.
Declaration
public ImmutableDictionary<Address, (IValue, IValue)> StateDiffs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.ImmutableDictionary<Address, (T1 Item1, T2 Item2)<Bencodex.Types.IValue, Bencodex.Types.IValue>> |
TotalSupplyDiffs
Represents a difference between two IAccountStates. This is a partial interpretation of a raw difference obtained by Diff(ITrie) from IAccountState's perspective. Keep in mind of the following properties:
-
Any
value, which is equivalent to non-existent value in the underlying storage, in the source is ignored. That is, even if the value in the target and the value in the source are different while the value in the source is null, this will not be part of the resulting AccountDiff. - Any null value, again, which is equivalent to non-existent value in the underlying storage, in the target for FungibleAssetValue and ValidatorSet is interpreted accordingly. That is, 0 amount of FungibleAssetValue and empty ValidatorSet are used. This is in accordance with how GetBalance(Address, Currency) and GetValidatorSet() would behave.
- Due to the reason mentioned directly above, the size of AccountDiff derived from Diff(ITrie) may not be the same. Moreover, an AccountDiff being empty does not guarantee that the data are the same as IAccountState is not capable of distinguishing between null and 0 FungibleAssetValue and so on and so forth.
- As Currency information is in the domain of an application using this library, only the hash of a Currency is directly stored in the underlying storage. As such, each Currency and FungibleAssetValue are handled as raw values, that is, as hash and Bencodex.Types.Integer, for an AccountDiff.
Declaration
public ImmutableDictionary<HashDigest<SHA1>, (Integer, Integer)> TotalSupplyDiffs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.ImmutableDictionary<HashDigest<SHA1>, (T1 Item1, T2 Item2)<Bencodex.Types.Integer, Bencodex.Types.Integer>> |
ValidatorSetDiff
Represents a difference between two IAccountStates. This is a partial interpretation of a raw difference obtained by Diff(ITrie) from IAccountState's perspective. Keep in mind of the following properties:
-
Any
value, which is equivalent to non-existent value in the underlying storage, in the source is ignored. That is, even if the value in the target and the value in the source are different while the value in the source is null, this will not be part of the resulting AccountDiff. - Any null value, again, which is equivalent to non-existent value in the underlying storage, in the target for FungibleAssetValue and ValidatorSet is interpreted accordingly. That is, 0 amount of FungibleAssetValue and empty ValidatorSet are used. This is in accordance with how GetBalance(Address, Currency) and GetValidatorSet() would behave.
- Due to the reason mentioned directly above, the size of AccountDiff derived from Diff(ITrie) may not be the same. Moreover, an AccountDiff being empty does not guarantee that the data are the same as IAccountState is not capable of distinguishing between null and 0 FungibleAssetValue and so on and so forth.
- As Currency information is in the domain of an application using this library, only the hash of a Currency is directly stored in the underlying storage. As such, each Currency and FungibleAssetValue are handled as raw values, that is, as hash and Bencodex.Types.Integer, for an AccountDiff.
Declaration
public (ValidatorSet, ValidatorSet)? ValidatorSetDiff { get; }
Property Value
Type | Description |
---|---|
Nullable<(T1 Item1, T2 Item2)<ValidatorSet, ValidatorSet>> |
Methods
| Improve this Doc View SourceCreate(IAccountState, IAccountState)
Creates an AccountDiff instance from given parameters.
Declaration
public static AccountDiff Create(IAccountState target, IAccountState source)
Parameters
Type | Name | Description |
---|---|---|
IAccountState | target | The IAccountState to use as the target. |
IAccountState | source | The IAccountState to use as the source. |
Returns
Type | Description |
---|---|
AccountDiff | An AccountDiff created from given parameters. |
Remarks
Note that the ordering of the parameters are flipped compared to Diff(ITrie) for syntactical reasons.
See Also
| Improve this Doc View SourceCreate(ITrie, ITrie)
Creates an AccountDiff instance from given parameters.
Declaration
public static AccountDiff Create(ITrie target, ITrie source)
Parameters
Type | Name | Description |
---|---|---|
ITrie | target | The ITrie to use as the target. |
ITrie | source | The ITrie to use as the source. |
Returns
Type | Description |
---|---|
AccountDiff | An AccountDiff created from given parameters. |
Remarks
Note that the ordering of the parameters are flipped compared to Diff(ITrie) for syntactical reasons.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the diff internally obtained from Diff(ITrie) cannot be properly interpreted. |