Comments (6)
.. unless foundy serial numbers start at 1 for some reason
from iota.go.
another finding. It seems it happens when all tokens in inputs are destroyed.
The following test case fails:
- inputs has 50 of tokens with ID in ExtendedOutput
- inputs has foundry with ID and 100 of circulating supply
- outputs has no tokens with ID
- outputs has foundry with ID and 50 of circulating supply
It is destroying 50 tokens of supply with ID. It fails withchain 08c48c52bbaee81e74514e0e6f7386b369ae94db4e0100000000 (*iotago.FoundryOutput) state transition failed: native token sums are unbalanced: unbalanced circulating supply change -50 of 08c48c52bbaee81e74514e0e6f7386b369ae94db4e0100000000000000000000000000000000: foundry state transition does not balance NativeToken 08c48c52bbaee81e74514e0e6f7386b369ae94db4e0100000000000000000000000000000000
from iota.go.
Case 1:
TIP-0018 specifies that:
When the current state of the foundry with Foundry ID is empty, it must hold true for Serial Number in the next state, that:
Foundry Counter(InputAlias) < Serial Number <= Foundry Counter(OutputAlias)
which means that the Serial Number
of a Foundry can never be 0.
Case 2:
Looking at the numbers you are not actually burning tokens since you are transferring the 50 input tokens (of the extended output) to the foundry output on the output side. The error correctly states that you are short -50 because the tokens of the input side are not burned as you have transferred them to the output side. It would be good if you could show some code just to ensure we are talking about the same thing.
from iota.go.
-
yes, it may be this strange requirement to start serial numbers from 1, it is ok then. However then I propose to rename
startSerial
to something else -
No, it is not true, it is destroying 50 tokens. The foundry output does not contain any tokens . Simply logic does not work when absense of tokens in the outputs means 0.
It is very difficult to point to the code, I would need to spend a lot of time to extract it. It is hidden in the VM's transactio builder. I see that transaction it produces is valid (according to my check), but it fails with validation.
Specifically, this test (among other) fails but it is not very helpful, I guess. https://github.com/iotaledger/wasp/blob/e7b676bef065d640dfdb0527e6b2e021e99da28f/packages/vm/core/testcore_stardust/accounts_test.go#L564
The common diagnosis: if we have N tokens in input and no tokens in outputs (all destroyed by foundry), it fails
In ISC VM foundries never contain any native tokens
from iota.go.
I can not reproduce the issue you've outlined in case 2 (this works):
func TestCirculatingSupplyBurn(t *testing.T) {
_, ident1, ident1AddrKeys := tpkg.RandEd25519Identity()
aliasIdent1 := tpkg.RandAliasAddress()
tokenTag := tpkg.Rand12ByteArray()
inputIDs := tpkg.RandOutputIDs(3)
inputs := iotago.OutputSet{
inputIDs[0]: &iotago.ExtendedOutput{
Address: ident1,
Amount: OneMi,
},
inputIDs[1]: &iotago.AliasOutput{
Amount: OneMi,
NativeTokens: nil,
AliasID: aliasIdent1.AliasID(),
StateController: ident1,
GovernanceController: ident1,
StateIndex: 1,
StateMetadata: nil,
FoundryCounter: 1,
Blocks: nil,
},
inputIDs[2]: &iotago.FoundryOutput{
Address: aliasIdent1,
Amount: OneMi,
NativeTokens: nil,
SerialNumber: 1,
TokenTag: tokenTag,
CirculatingSupply: big.NewInt(50),
MaximumSupply: big.NewInt(50),
TokenScheme: &iotago.SimpleTokenScheme{},
Blocks: nil,
},
}
// set input ExtendedOutput NativeToken to 50 which get burned
foundryNativeTokenID := inputs[inputIDs[2]].(*iotago.FoundryOutput).MustNativeTokenID()
inputs[inputIDs[0]].(*iotago.ExtendedOutput).NativeTokens = iotago.NativeTokens{
{
ID: foundryNativeTokenID,
Amount: new(big.Int).SetInt64(50),
},
}
essence := &iotago.TransactionEssence{
Inputs: inputIDs.UTXOInputs(),
Outputs: iotago.Outputs{
&iotago.AliasOutput{
Amount: OneMi,
NativeTokens: nil,
AliasID: aliasIdent1.AliasID(),
StateController: ident1,
GovernanceController: ident1,
StateIndex: 1,
StateMetadata: nil,
FoundryCounter: 1,
Blocks: nil,
},
&iotago.FoundryOutput{
Address: aliasIdent1,
Amount: 2 * OneMi,
NativeTokens: nil,
SerialNumber: 1,
TokenTag: tokenTag,
// burn supply by -50
CirculatingSupply: big.NewInt(0),
MaximumSupply: big.NewInt(50),
TokenScheme: &iotago.SimpleTokenScheme{},
Blocks: nil,
},
},
}
sigs, err := essence.Sign(ident1AddrKeys)
require.NoError(t, err)
tx := &iotago.Transaction{
Essence: essence,
UnlockBlocks: iotago.UnlockBlocks{
&iotago.SignatureUnlockBlock{Signature: sigs[0]},
&iotago.ReferenceUnlockBlock{Reference: 0},
&iotago.AliasUnlockBlock{Reference: 1},
},
}
require.NoError(t, tx.SemanticallyValidate(&iotago.SemanticValidationContext{
ExtParas: nil,
WorkingSet: nil,
}, inputs))
}
from iota.go.
Case 2 was fixed via 5e2f585
from iota.go.
Related Issues (20)
- Fix decay of the initial rewards
- Change TransactionID to be derived from a merkelized OutputCommitment.
- Order of BlockIssuerFeature's fields
- Mana `TargetReward` assumes epochs start at 1
- V3 protocol params for reward still wrong HOT 1
- Sort Metadata and Allotment Entries lexicographically by key
- Account Output Builder allows setting Immutable Sender Feature
- serix: check registered interfaceObjects rules if the container is a slice of interfaces HOT 1
- Add the special case for ValidationBlock workscore to iota.go
- Fix CalculateAndSetMaxBurnedMana to include the workscore of the complete block
- Fix serix tags for web API
- Signature verification as syntactic check?
- Fix `MinRequiredAllotedMana` to account for the block signatures as well
- Fix `MaxBlockWork` calculation HOT 2
- MultiAddresses in api_common still use the serix validation mode
- Refactor BlockFailureReason
- Update iota.go Event API client to the latest MQTT endpoints
- Integrate feedback for `TransactionFailureReason`
- Make Context Input requirement checks syntactic HOT 1
- Extend the http client in iota.go with binary serix encoding
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iota.go.