You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding the token contract as a dependency in Nargo.toml, without actually importing or using it in the contract, the generated Contract Storage Layout reflects the storage of the token contract instead of the contract being worked on.
In the provided example, the simple counter contract should have the following storage layout in the generated TypeScript artifact:
However, when adding the token contract as a dependency in Nargo.toml, without importing it in the contract, the storage layout that is generated incorrectly maps to the storage slots of the token contract:
public static get storage(): ContractStorageLayout<'admin' | 'minters' | 'balances' | 'total_supply' | 'pending_shields' | 'public_balances' | 'symbol' | 'name' | 'decimals'> {
return {
admin: {
slot: new Fr(1n),
},
minters: {
slot: new Fr(2n),
},
balances: {
slot: new Fr(3n),
},
total_supply: {
slot: new Fr(4n),
},
pending_shields: {
slot: new Fr(5n),
},
public_balances: {
slot: new Fr(6n),
},
symbol: {
slot: new Fr(7n),
},
name: {
slot: new Fr(8n),
},
decimals: {
slot: new Fr(9n),
},
} as ContractStorageLayout<'admin' | 'minters' | 'balances' | 'total_supply' | 'pending_shields' | 'public_balances' | 'symbol' | 'name' | 'decimals'>;
}
Steps to Reproduce
Clone the repo: aztec-artifact-bug.
Check the Nargo.toml file where the token contract is added as a dependency but not imported in the contract.
Observe the incorrect storage layout in the generated TypeScript artifact.
Expected Behavior
The generated storage layout should match the contract being worked on (e.g., the simple counter contract) and not the token contract when it’s merely a dependency in Nargo.toml but not actually imported.
The text was updated successfully, but these errors were encountered:
This is related to aztec macros and we are soon about to migrate them all to meta programming (should be by next week). Once that is in master I will investigate whether this bug pertains.
Closes: AztecProtocol/aztec-packages#8532
Includes the contract name in the exported storage layout, so that the
artifact generator can distinguish between main and dependent contracts.
Bug Report: Incorrect Contract Storage Layout Generated with Token Dependency
Aztec Version: v0.54.0
Repo for Replication: aztec-artifact-bug
Bug Description
When adding the token contract as a dependency in Nargo.toml, without actually importing or using it in the contract, the generated Contract Storage Layout reflects the storage of the token contract instead of the contract being worked on.
In the provided example, the simple counter contract should have the following storage layout in the generated TypeScript artifact:
However, when adding the token contract as a dependency in Nargo.toml, without importing it in the contract, the storage layout that is generated incorrectly maps to the storage slots of the token contract:
Steps to Reproduce
Clone the repo: aztec-artifact-bug.
Check the Nargo.toml file where the token contract is added as a dependency but not imported in the contract.
Compile the contract using:
Observe the incorrect storage layout in the generated TypeScript artifact.
Expected Behavior
The generated storage layout should match the contract being worked on (e.g., the simple counter contract) and not the token contract when it’s merely a dependency in Nargo.toml but not actually imported.
The text was updated successfully, but these errors were encountered: